; ; Test program 1 ; 31V4 Assignment 2 ; Written by : D Budgeb ; On : 9 March 1989 ; ; This program is largely nonsense code but it does ; perform some of the actions of a routine that controls ; a simple device using program controlled output. ; srce1=4000 dest1=4002 carry=177502 ; .start 1000 ; init: mov #2000,r0 ; set up buffer mov #10,r1 ; and character count jsr pc, print ; call print routine mov #21,@#srce1 ; copy data mov r2 ,@#dest1 ; and again - note additional spaces mov r3, -(sp) ; push register 3 on to stack clr @#carry jsr pc,addsub ; call addsub tst (sp)+ ; clear the stack - result unimportant rts pc ; return control to caller ; ; subroutine print ; print: movb (r0)+ , -(sp) ; pop and push dec r1 jsr pc, writec ; call character writing routine cmp r1,#0 ; have we reached the end? bgt print ; skip back if not rts pc ; else return ; ; subroutine writec - transfer one byte (character) ; writec: tstb status ; is device ready bgt writec ; loop back if not movb (sp)+, buffer ; copy character from stack rts pc ; and return ; ; subroutine addsub ; addsub: add @#srce1, @#dest1 ; add contents of two locations rts pc ; and return ; ; allocate store space by useless intructions ; status: tst r0 ; reserve one word buffer: tst r0 ; reserve another ; .end