.title verify .ident /831202/ ; ;Verifies the contents of a string against a template ; ;Register usage ; R0 scratch ; R1 scratch ; R2 source string ; R3 template string ; verify:: mov sp,r0 mov (r0),r1 mov r3,(r0)+ mov (r0),r3 ;allowable characters mov r2,(r0)+ mov (r0),r2 ;source string mov r1,(r0)+ clr (r0) ;assume o.k. mov r2,-(sp) ; tstb (r3) beq 3$ mov #tabsiz,r1 ;zero template table mov #table,r0 1$: clr (r0)+ sob r1,1$ ; 2$: movb (r3)+,r0 ;set up template beq 3$ jsr pc,addres bis r1,table(r0) br 2$ ; 3$: movb (r2)+,r0 ;check against template beq 4$ ;all passed jsr pc,addres bit r1,table(r0) bne 3$ sub (sp),r2 ;dud found mov r2,10(sp) ;return result ; 4$: tst (sp)+ mov (sp)+,r3 mov (sp)+,r2 rts pc ; addres: mov r0,-(sp) ;find location of bit bic #177400,r0 ash #-4,r0 asl r0 ;word offset bic #177760,(sp) mov #1,r1 ash (sp)+,r1 ;bit in word rts pc ; tabsiz =16. table: .blkw tabsiz .end