; ; main routine: establish the stack, then read ; and write. ; lcw r1 stack ; set up stack loa r3 r0 ; get first value loa r2 r0 ; get second value psh r2 ; put second argument on stack lcw r2 max ; call max cal r2 r2 ; sto r3 r0 ; write result, hlt ; and halt max psh r2 ; save the return address loa r2 r1 4 ; get the second argument from the stack bge r3 r2 endif ; go to else if r3 >= r2 add r3 r2 0 ; r3 = r2, i.e. return r2 endif pop r2 ; restore the return address jmp r2 ; return from where we were called ; ; stack area: 50 words ; dat 100 stack