On May 22 2005, 20:49, Jay West wrote:
Jim wrote....
> Location Content Op-code comment
> 001000 012700 mov #1,r0 load ro with 1
> 001002 000001
> 001004 006100 rol rotate r1 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
001016 000772 br -12 back to 001002 (dec r0)
This runs on my /45, but produces a steady light display, not a cylon
or
"blinking" effect.
I'm not much of a Unibus expert but I seem to remember there's
something odd about what's displayed in the lights, and how you get it
to change.
It's been decades since I looked at '11
assembler. I'm
confused about something in the listing above. If the 012700 at
location
1000 is a load r0 with 1, I'm guessing the next
word (1002) is the
constant
to be loaded? So, why would the branch at location
1016 go back to
the data
at 1002? Obviously there's something I'm
missing.
The code is correct, the comments are correct, but the mnemonic
instructions are wrong :-)
Remember that what's counted in a BR instruction are words, not bytes,
but that when the instruction is interpreted, the PC has already been
incremented. So 777 is a "branch to self", and 776 is "branch back to
the previous instruction". 1376 is "branch back to the previous
instruction if Z is set", as at 1014. 772 does indeed branch back to
the ROL instruction, because it's "branch back 6". Looks like Jim
remembered that "branch back to the previous" is "br -2", thought
"two
bytes", and just doubled the six to twelve -- except that what he wrote
was octal 12 (there's no decimal point after it), or ten decimal :-)
Actually, if I'm being really picky, it should be "br .-2".
--
Pete Peter Turnbull
Network Manager
University of York