.TITLE XXSLEN .ENABLE LC .IDENT /090688/ ; ; File:[22,310]XXSLEN.MAC ; Author: Jim Bostwick 9-JUN-1988 ; ; Desc: XXSLEN, XXSMAX ; XXSLEN: Internal Macro-callable routine for string type,length ; XXSMAX: Internal Macro-callable routine for string addx, max length ; ; Last Edit: 23-JUN-1988 21:54:17 ; ; History: JMB 9-JUN-1988 ; 23-JUN-1988 21:21:15 - JMB PA3UTL upgrade. ; ; XXSLEN provides internal (to pasutl) string characterization for ; conformant array parameters. ; ; INPUT: push addx,lo,hi ; jsr pc, xxslen ; ; OUTPUT: pop type, len, addx ; ; Registers: Preserved ; ; Params: ; addx = address of string ( adjusted on return for type-0) ; lo = lo bound (conformant param) ; hi = hi bound (conformant param) ; len = length in bytes ; type = 0 -> type-0, 1 -> type-1 ; XXSLEN:: mov r0, -(sp) mov r1, -(sp) mov r2, -(sp) ; ; symbolic parameter offsets ; ; r2 = 0 ; r1 = 2 ; r2 = 4 ; return = 6 hi = 10 typ = 10 lo = 12 len = 12 addx = 14 mov lo(sp), r0 ; get lnm pointer bne 10$ ; if ne - type-1 string ; ; bump addx, copy length ; movb @addx(sp), r0 ; get length bic #^C377, r0 ; make just a byte mov r0, len(sp) ; put back on stack inc addx(sp) ; bump address clr typ(sp) ; say type-0 br 500$ ; common exit 10$: ; ref label ; get length in use of type-1 string mov addx(sp), r2 ; copy string pointer mov hi(sp), r1 ; get high bound sub r0, r1 ; get max length inc r1 ; ... add r1, r2 ; point past end of string 20$: tstb -(r2) ; scan down past null bytes bne 30$ ; found virtual end sob r1, 20$ ; keep looking 30$: mov r1, len(sp) ; save length mov #1, typ(sp) ; say type-1 ;common return 500$: mov (sp)+, r2 mov (sp)+, r1 mov (sp)+, r0 rts pc ; ; XXSMAX - return 'real' address, max length of a string ; ; Input: ; push addx, lo, hi ; call xxsmax ; Output: ; pop addx, max ; ; Registers: preserved ; XXSMAX:: mov r0, -(sp) mov r1, -(sp) mov r2, -(sp) ; ; symbolic parameter offsets ; ; r2 = 0 ; r1 = 2 ; r2 = 4 ; return = 6 hi = 10 lo = 12 len = 12 addx = 14 mov hi(sp), r1 ; get hi bound mov lo(sp), r0 ; get lo bound bne 10$ ; if ne - type-1 string inc addx(sp) ; bump pointer sub r0, r1 ; compute length br 500$ ; join common return 10$: sub r0, r1 ; compute length inc r1 ; adjust length ;common return 500$: mov r1, len(sp) ; return length mov (sp)+, r2 mov (sp)+, r1 mov (sp)+, r0 mov (sp), 2(sp) ; copy return addx tst (sp)+ ; clean stack rts pc .END