.title getdir ;+ ; subroutine getdir(key, type, buf) ;- ; ; local data ; .psect $r.rod,con,ro,rel,lcl,d devptr: .word st0,st0,st1,st1,st1,st0,st0,st0,st0 uicptr: .word bin,usr,tmp,lpr,msg,man,src,inc,lib ndirs=<.-uicptr>/2 ; number of valid keys st0: .asciz "ST0" st1: .asciz "ST1" bin: .asciz "105,1" usr: .asciz "105,2" tmp: .asciz "105,3" lpr: .asciz "105,4" msg: .asciz "105,5" man: .asciz "105,6" src: .asciz "105,7" inc: .asciz "105,10" lib: .asciz "105,11" .even ; ; ap=%5 key=2 type=4 buf=6 .psect $r.roi,con,ro,rel,lcl,i .enabl lsb getdir:: mov buf(ap),r0 ; destination address mov @key(ap),r3 ; get value of key ble 100$ ; if key <= 0, invalid cmp r3,#ndirs ; too large? bgt 100$ ; YES dec r3 ; key - 1 clc ; rol r3 ; 2 * (key - 1) mov devptr(r3),r1 ; address of device name cmp @type(ap),#path ; desire pathname format? bne 10$ ; NO movb #'/,(r0)+ ; initial slash call copy ; copy device name movb #'/,(r0)+ ; dividing slash mov uicptr(r3),r1 ; address of uic string call copy ; copy uic string movb #'/,(r0)+ ; trailing slash br 100$ ; finish up 10$: call copy ; copy device name movb #':,(r0)+ ; ":[" movb #'[,(r0)+ ; ... mov uicptr(r3),r1 ; address of uic string call copy ; copy uic string movb #'],(r0)+ ; trailing ']' 100$: clrb (r0) ; terminate with EOS return ; ; ; copy subroutine ; ; copy: movb (r1)+,(r0)+ ; copy character bne copy ; if not 0, go again tstb -(r0) ; point at EOS return .end