diff --git a/src/libsrc/int32.pla b/src/libsrc/int32.pla index 921c3e3..b1d0f74 100644 --- a/src/libsrc/int32.pla +++ b/src/libsrc/int32.pla @@ -342,10 +342,10 @@ export asm divi16(imm16)#2 _DIV STY DVSIGN ; LSB = SIGN OF DVSR DEX ; REMNDR = ESTK..ESTK+1 LDY #$00 - STY ESTKL+0,X - STY ESTKH+0,X STY ESTKL+1,X STY ESTKH+1,X + STY ESTKL+0,X + STY ESTKH+0,X LDA SRC+0 ; DIVIDE BY 0? ORA SRC+1 ORA SRC+2 @@ -387,29 +387,29 @@ _DIV STY DVSIGN ; LSB = SIGN OF DVSR ROL ACCUM32+3 DEY BCC - -- ROL ESTKL+0,X ; REMNDR - ROL ESTKH+0,X - ROL ESTKL+1,X +- ROL ESTKL+1,X ; REMNDR ROL ESTKH+1,X - LDA ESTKL+0,X ; REMNDR + ROL ESTKL+0,X + ROL ESTKH+0,X + LDA ESTKL+1,X ; REMNDR CMP SRC+0 ; DVSR - LDA ESTKH+0,X ; COMPARE + LDA ESTKH+1,X ; COMPARE SBC SRC+1 - LDA ESTKL+1,X + LDA ESTKL+0,X SBC SRC+2 - LDA ESTKH+1,X + LDA ESTKH+0,X SBC SRC+3 BCC + ; IS LESS THAN? - STA ESTKH+1,X - LDA ESTKL+0,X ; REMNDR - SBC SRC+0 ; DVSR - STA ESTKL+0,X ; SUBTRACT - LDA ESTKH+0,X - SBC SRC+1 STA ESTKH+0,X - LDA ESTKL+1,X + LDA ESTKL+1,X ; REMNDR + SBC SRC+0 ; DVSR + STA ESTKL+1,X ; SUBTRACT + LDA ESTKH+1,X + SBC SRC+1 + STA ESTKH+1,X + LDA ESTKL+0,X SBC SRC+2 - STA ESTKL+1,X + STA ESTKL+0,X SEC + ROL ACCUM32+0 ; DVDND ROL ACCUM32+1 ; ROTATE IN RESULT @@ -421,17 +421,17 @@ _DIV STY DVSIGN ; LSB = SIGN OF DVSR BPL + TYA SEC - SBC ESTKL+0,X - STA ESTKL+0,X - TYA - SBC ESTKH+0,X - STA ESTKH+0,X - TYA SBC ESTKL+1,X STA ESTKL+1,X TYA SBC ESTKH+1,X STA ESTKH+1,X + TYA + SBC ESTKL+0,X + STA ESTKL+0,X + TYA + SBC ESTKH+0,X + STA ESTKH+0,X LDA DVSIGN + LSR BCC + @@ -663,7 +663,7 @@ export def i32tos(i32ptr, strptr)#1 putc('-') fin repeat - drop, rem = divi16(10) // Only care about LSW of remainder + rem, drop = divi16(10) // Only care about LSW of remainder ^iptr = rem + '0' iptr-- until iseqi16(0)