.title getdir ;+ ; subroutine getdir(key, type, buf) ;- ; ; local data ; .psect $r.rod,con,ro,rel,lcl,d ptr: .word bin,usr,tmp,lpr,mal,man bin: .asciz "ST0:[105,1]" usr: .asciz "ST0:[105,2]" tmp: .asciz "ST1:[105,3]" lpr: .asciz "ST1:[105,4]" mal: .asciz "ST0:[105,5]" man: .asciz "ST0:[105,6]" .even ; ; ap=%5 key=2 type=4 buf=6 .psect $r.roi,con,ro,rel,lcl,i .enabl lsb getdir:: clrb @buf(ap) ; assume invalid key mov @key(ap),r0 ; get value of key blt 100$ ; if key < 0, invalid cmp r0,#6 ; too large? bgt 100$ ; YES dec r0 ; key - 1 clc ; rol r0 ; 2 * (key - 1) mov ptr(r0),r0 ; source address mov buf(ap),r1 ; destination address 10$: movb (r0)+,(r1)+ ; copy character bne 10$ ; if not EOS, do again 100$: return .end