Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Assembly code need explanation

Assembly code need explanation

Assembly code need explanation


I have a hw assignment below and I don't know what the three lines doing, can someone kindly explain to me?


Assume the following lines of HC11 code run on your HC11 system (MC68HC11E1 chip, program loaded into RAM during bootstrap)

PORTA= 0x1000

ldaa #3
staa PORTA
ldaa PORTA

What will be the value in the A accumulator after these lines of code have executed?

RE: Assembly code need explanation

Hey Tracy,

Well... I have not worked with Motorola assembler since my Commodore Vic 20 back in the 80s. However, this is what I can tell you:

LDAA means load immediate value to accumulator
STAA means store immediate value to accumulator
The #3 means the immediate value 3 -not the value of another register...

PORTA = 0x1000 refers to a hardware hexadecimal address. 0x1000 equals to the binary value 0001.0000.0000.0000

LDAA #3 loads the dicimal value 3 into the accumulator
STAA PORTA sends the accumulator value (3) to PORTA (0x1000)
LDAA PORTA reads from value from PORTA (0x1000) to the accumulator.

What does the accumulator hold then? Well, that depends what is at address 0x1000. If a buffer or latch is placed on that address, you should read back the same value, hence 3!

Hope this can guide you in the right direction!!

Good luck with your assignment  ยง;O)


PS. You should have a Motorola Instruction set reference manual at hand.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close