Thanks Andrew and rurwin. I've downloaded the library.asm file.
In the mean time, I've been playing with a simple loop program (which uses the C "printf" function: cheating

)
Code: Select all
.section .data
string:
.asciz "Looping: %d\n"
.text
.globl main
main:
mov r5, $10
.loop:
mov r1, r5
ldr r0, =string
bl printf
subs r5, r5, $1
bne .loop
mov r7, $1
swi $0
I found that I had to use a different register from r1 for my counter. I'm not really sure why, but it didn't work when I tried using r1. Anyway, that is why I am using r5 to count down and then moving the count into r1 before printing.
Someone will probably explain it better, but I use "subs" to decrement my counter and set the condition code. That way, I don't need to do "cmp", because "bne" will branch if our counter is not zero. I tried using "bpl" (branch if positive or zero), and that worked nicely too.
mark
By the way, rurwin, where did you use a PDP-11? I'm reading Stephen Levy's "Hackers" at the moment and was very interested by the material about the PDP-1 at MIT.