Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7170559
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T15:14:14+00:00 2026-05-28T15:14:14+00:00

My teacher wants us to have a basic understanding of assembly, because later down

  • 0

My teacher wants us to have a basic understanding of assembly, because later down the road, that might be helpful. I’m fine with that, but my college provides zero documentation on the subject, apart from 4 small examples. I’m trying to figure out what is happening in this one:

.DEVICE ATmega32

.CSEG
main:

ldi    ZL,low(varclist<<1)
ldi    ZH,high(varclist<<1)

.CSEG
varclist:
.db    1, 2
.db    3, 4
.db    5, 6
.db    7, 8
.db    9, 0

I’m am working in AVR studio 5, and looking at the ‘processor’ tab. I can’t seem to find any relation between the values in ‘varclist’, and the hexadecimal values the registers are showing. How do i look at this?

I would expect the Z register to contain 0x0100 as i would imagine the ‘most-significant’ bit to be the first one declared, and the least significant the last declared. I’m seeing 0x0070, however. I’m not sure what the shifting does, though.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T15:14:15+00:00Added an answer on May 28, 2026 at 3:14 pm

    To answer your wondering about the shifting, what it does is shift all the bits by one to the left adding a zero as first bit. In other words it multiplies by 2 the high (resp. low) value of the variable varclist.

    varclist here in your program is the address of the array of bytes [ 0x01, 0x02, … 0x00 ] in memory => varclist is a pointer to the first byte of this array. To obtain the original address, we just need to divide by 2 (reverse operation of the multiply) and we obtain

    0x0070 >> 1 = 0000 0000 0111 0000 >> 1 = 0000 0000 0011 1000 = 0x0038
    

    So the varclist address was 0x0038. I don’t know how you thought this was 0x0100 but I hope you now understand the code.

    I think this address is multiplied by 2 because addresses to the program storage space are expressed in word offset, in which case you’ll need to multiply by 2 to get the address in a byte offset. Later you can load that byte (the first byte of your array) into r0thanks to the LPM assembly instruction.

    I would recommend you read the chapter 5.2 of this pdf and possibly the other chapters as well. The AVR Assembler User Guide is also probably a good bet.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an assignment for school, and I'm not sure how the teacher wants
My teacher wants me to evaluate the theorical value of Mpixel/second that a specific
I have an in-memory table that might looks something like this: Favorite# Name Profession
This IS NOT homework, but it is a practice that the teacher gave us
This might not be completely relevant to stackoverflow but I have no better site
I have implemented some algorithms from graph theory in C++. My teacher wants us
I have a Teacher/Student django app. When a Teacher is logged in, and wants
I have 2 models - Teacher and Subject . A want to connect them
I have a Student and a Teacher model in my app. I want a
My teacher asked me to do a program using execlp that will do the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.