ORG 0 ; Position independent .oswrch EQU 4 ; TUBE Character output routine ;.oswrch EQU 225 ; RT11 Character output routine ; 32-bit decimal printout using DIV ; ================================= ; On entry: R0=number b0-b15 ; R1=number b16-b31 ; On exit: R0,R1,R2 corrupted ; Size: 42 bytes ; ; This depends on the side effect of the registers being updated after Overflow. ; Most PDP11s do not update the registers after Overflow, so this routine will ; only work up to &4FFFF. ; .prdec32 CLR -(SP) ; Stack terminator .prdec32lp1 MOV R0,-(SP) ; Save low order 16 bits of dividend CLR R0 ; Divide high order 16 bits of dividend by the divisor DIV #10,R0 ; R0=R0:R1 DIV R2, R1=R0:R1 MOD R2 MOV R0,R2 ; Save high order 16 bits of quotient MOV R1,R0 ; Divide the remainder MOV (SP),R1 ; of the dividend by the divisor DIV #10,R0 ; R0=R0:R1 DIV R2, R1=R0:R1 MOD R2 BIS #ASC"0",R1 ; Convert remainder to ASCII digit MOV R1,(SP) ; Stack it MOV R2,R1 ; R1=result b16-b31, R0=result b0-b15 BIS R0,R2 BNE prdec32lp1 ; Loop until number is zero .prdec32lp2 MOV (SP)+,R0 ; Pop digit off BEQ prdec32done ; Terminator, all done EMT oswrch ; Print digit BR prdec32lp2 ; Loop for another .prdec32done RTS PC ; 16-bit decimal printout using DIV ; ================================= ; On entry: R0=number b0-b15 ; On exit: R0,R1 corrupted ; Size: 30 bytes ; .prdec16 MOV R0,R1 ; R1=number ; Entry here with R1=number .prdec16R1 CLR -(SP) ; Stack terminator .prdec16lp1 CLR R0 DIV #10,R0 ; R0=number DIV 10, R1=number MOD 10 BIS #ASC"0",R1 ; Convert to ascii character MOV R1,-(SP) ; Stack it MOV R0,R1 ; R1=number BNE prdec16lp1 ; Loop until number is zero .prdec16lp2 MOV (SP)+,R0 ; Pop digit off BEQ prdec16done ; Terminator, all done EMT oswrch ; Print digit BR prdec16lp2 ; Loop for another .prdec16done RTS PC