1 ; 2 ; Test program 1 3 ; 31V4 Assignment 2 4 ; Written by : D Budgen 5 ; On : 9 March 1989 6 ; 7 ; This program is largely nonsense code but it does 8 ; perform some of the actions of a routine that controls 9 ; a simple device using program controlled output. 10 ; 11 004000 srce1=4000 12 004002 dest1=4002 13 177502 carry=177502 14 ; 15 .start 1000 16 ; 17 01000 012700 init: mov #2000,r0 ; set up buffer address 002000 18 01004 012701 mov #10,r1 ; and character count 000010 19 01010 004767 jsr pc, print ; call print routine 000030 20 01014 012737 mov #21,@#srce1 ; copy data 000021 004000 21 01022 010237 mov r2 ,@#dest1 ; and again - note additional spaces 004002 22 01026 010346 mov r3, -(sp) ; push register 3 on to stack 23 01030 005037 clr @#carry 177502 24 01034 004767 jsr pc,addsub ; call addsub 000040 25 01040 005726 tst (sp)+ ; clear the stack - result unimportant 26 01042 000207 rts pc ; return control to caller 27 ; 28 ; subroutine print 29 ; 30 01044 112046 print: movb (r0)+ , -(sp) ; pop and push 31 01046 005301 dec r1 32 01050 004767 jsr pc, writec ; call character writing routine 000010 33 01054 020127 cmp r1,#0 ; have we reached the end? 000000 34 01060 003371 bgt print ; skip back if not 35 01062 000207 rts pc ; else return 36 37 ; 38 ; subroutine writec - transfer one byte (character) 39 ; 40 01064 105767 writec: tstb status ; is device ready 000020 41 01070 003375 bgt writec ; loop back if not 42 01072 112667 movb (sp)+, buffer ; copy character from stack 000014 43 01076 000207 rts pc ; and return 44 ; 45 ; subroutine addsub 46 ; 47 01100 063737 addsub: add @#srce1, @#dest1 ; add contents of two locations 004000 004000 48 01106 000207 rts pc ; and return 49 ; 50 ; allocate store space by useless intructions 51 ; 52 01110 005700 status: tst r0 ; reserve one word 53 01112 005700 buffer: tst r0 ; reserve another 54 ; 55 .end Symbol table: ADDSUB 001100 BUFFER 001112 CARRY 177502 DEST1 004002 INIT 001000 PRINT 001044 DRCE1 004000 STATUS 001110 WRITEC 001064