ORG 0 ; Position independent .oswrch EQU 4 ; TUBE Character output routine ;.oswrch EQU 225 ; RT11 Character output routine ; 32-bit decimal printout without using DIV ; ========================================= ; On entry: R0=number b0-b15 ; R1=number b16-b31 ; On exit: R0,R1,R2 corrupted ; Size: 52 bytes ; .prdec32 CLR -(SP) ; Terminator .prdec32lp0 CLR R2 ; Clear accumulator MOV #32,-(SP) ; Shift counter .prdec32lp1 ASL R0 ; Perform the division ROL R1 ROL R2 CMP R2,#10 BLO prdec32lp2 SUB #10,R2 INC R0 .prdec32lp2 DEC (SP) BNE prdec32lp1 ; Not done? BIS #ASC"0",R2 ; Convert digit to ascii MOV R2,(SP) ; Put on stack, overwriting counter MOV R0,R2 ; Test remaining quotient BIS R1,R2 BNE prdec32lp0 ; Quotient not yet zero .prdec32lp3 MOV (SP)+,R0 ; Pop character BEQ prdec32done ; Terminator, all done EMT oswrch ; Write character BR prdec32lp3 ; Loop for next .prdec32done RTS PC ; 16-bit decimal printout without using DIV ; ========================================= ; On entry: R0=number b0-b15 ; On exit: R0,R1 corrupted ; Size: 48 bytes ; .prdec16 CLR -(SP) ; Terminator .prdec16lp0 CLR R2 ; Clear accumulator MOV #16,-(SP) ; Shift counter .prdec16lp1 ASL R0 ; Perform the division ROL R2 CMP R2,#10 BLO prdec16lp2 SUB #10,R2 INC R0 .prdec16lp2 DEC (SP) BNE prdec16lp1 ; Not done? BIS #ASC"0",R2 ; Convert digit to ascii MOV R2,(SP) ; Put on stack, overwriting counter TST R0 ; Test remaining quotient BNE prdec16lp0 ; Quotient not yet zero .prdec16lp3 MOV (SP)+,R0 ; Pop character BEQ prdec16done ; Terminator, all done EMT oswrch ; Write character BR prdec16lp3 ; Loop for next .prdec16done RTS PC