.title option Parse option string .ident "V02.00" ;+ ; Index Parse option string and set option bits ; ; Description ; ; Parse a user supplied option string and set the proper ; bits for the option qiow parameter. ; ; Usage ; ; Internal ; ; mov options,r0 /* Users string of options */ ; mov #optable,r1 /* Option table for routine */ ; call option ; ; r0 is 1 if successful and 0 on error (illegal option). r1 is ; set to the inclusive-or of the options. ; ;- ; Edit History ; V02.00 18-Oct-82 TTC Rework of old CS library ; .psect c$code option:: mov r2,-(sp) ; Save r2 mov r3,-(sp) ; Save r3 mov r1,r3 ; Temporarily save option table clr r2 ; r2 = inclusive-or of options 10$: tstb (r0) ; More options? beq 40$ ; (No) bisb #040,(r0) ; Convert to lower case 20$: cmpb (r0),@(r1)+ ; check user option against table beq 30$ ; Found option tst (r1)+ ; No, point to next one tst (r1) ; End of table? bne 20$ ; (No) br 50$ ; Invalid option 30$: bis (r1),r2 ; r2 = inclusive-or of options tstb (r0)+ ; Get next option character mov r3,r1 ; Start at beginning of table br 10$ ; and check next option. 40$: mov r2,r1 ; r1 = inclusive-or of options mov #1,r0 ; Everything is ok br 60$ 50$: clr r0 ; r0 = 0 on error 60$: mov (sp)+,r3 ; Restore registers mov (sp)+,r2 return .end