Jay West wrote:
It's been decades since I looked at '11
assembler
(Disclaimer: I haven't dealt with '11 assembler since ~1982 either.)
So, why would the branch at location 1016 go back to
the data
at 1002? Obviously there's something I'm missing.
The comment is incorrect. The intent is to go to 1004.
Jim wrote....
> Location Content Op-code comment
> 001000 012700 mov #1,r0 load ro with 1
^ comment should be "r0" not "ro"
> 001002 000001
> 001004 006100 rol rotate r1 left
^ comment should be "rotate r0 left"
> 001006 012701 mov delay r1 load
register r1 with delay
> 001010 007777 delay
> 001012 005301 dec r1 decrement register 1
> 001014 001376 bne -2 continue to decrement r1 until r1=0
-2 = -2
> 001016 000772 br -12 back to
001002 (dec r0)
-6 <> -12 ^
comment should be "001004",
^ comment should be
"rotate r0" not "dec r0"
At 1014 the machine code and assembler instruction are consistent, and correct for word
offsets.
At 1016 the machine code and assembler instruction are NOT consistent, but machine code is
still correct for word offsets.
(And presuming branch offsets are calculated relative to instruction following the branch
(after PC increment).)
There are some inconsistencies between the machine code / mnemonics / comments, but that
doesn't explain why it doesn't work.
I'm sure the '11 experts will chime in here...