;+ ; ; Routine to convert a word from .rad50 to .ascii using a variation ; of the BCD method used by the TSS/8 System Interpreter to convert ; decimal numbers on the PDP-8 (with no DIV instruction). ; ; This is a big win on machines without DIV, since we loop only 12. ; times instead of 32. for two 16-bit divisions. On machines with ; EIS it's a loss since you can do it with 2 DIV's and no loop. ; ; Takes number in r5. ; ; 04-Nov-90 JMBW Created. ; 13-Apr-91 JMBW Converted for rad50. ; ;- .mcall .ttyout ; rad$: mov #bittab,r3 ;pt at table br 40$ ;jump into loop 10$: ; next digit clr r0 ;clear it mov #6,r2 ;bit count (each .rad50 dig is 5.625 bits) 20$: asl r0 ;*2 cmp r1,r5 ;OK? bhi 30$ ;no (C=0) sub r1,r5 ;remove the bit (C=0) inc r0 ;count it 30$: ror r1 ;/2 (C=0 either way above) sob r2,20$ ;loop movb r50(r0),r0 ;convert .ttyout ;display 40$: mov (r3)+,r1 ;get next value bne 10$ ;loop if non-zero movb r50(r5),r0 ;convert last .ttyout ;display rts pc ; bittab: .word 40*50*50,40*50,0 r50: .ascii / ABCDEFGHIJKLMNOPQRSTUVWXYZ$.%0123456789/ ; .end