1
0
mirror of https://github.com/dschmenk/PLASMA.git synced 2025-01-09 13:33:26 +00:00

No, undo remainder return from div32 so no need to update libs

This commit is contained in:
David Schmenk 2024-07-07 16:46:42 -07:00
parent 3a488a5854
commit 66c2104b76
2 changed files with 25 additions and 25 deletions

View File

@ -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+1,X
STY ESTKH+1,X
STY ESTKL+0,X
STY ESTKH+0,X
STY ESTKL+1,X
STY ESTKH+1,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+1,X ; REMNDR
ROL ESTKH+1,X
ROL ESTKL+0,X
- ROL ESTKL+0,X ; REMNDR
ROL ESTKH+0,X
LDA ESTKL+1,X ; REMNDR
ROL ESTKL+1,X
ROL ESTKH+1,X
LDA ESTKL+0,X ; REMNDR
CMP SRC+0 ; DVSR
LDA ESTKH+1,X ; COMPARE
LDA ESTKH+0,X ; COMPARE
SBC SRC+1
LDA ESTKL+0,X
LDA ESTKL+1,X
SBC SRC+2
LDA ESTKH+0,X
LDA ESTKH+1,X
SBC SRC+3
BCC + ; IS LESS THAN?
STA ESTKH+0,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
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
SBC SRC+2
STA ESTKL+0,X
STA ESTKL+1,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+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
TYA
SBC ESTKL+1,X
STA ESTKL+1,X
TYA
SBC ESTKH+1,X
STA ESTKH+1,X
LDA DVSIGN
+ LSR
BCC +
@ -663,7 +663,7 @@ export def i32tos(i32ptr, strptr)#1
putc('-')
fin
repeat
rem, drop = divi16(10) // Only care about LSW of remainder
drop, rem = divi16(10) // Only care about LSW of remainder
^iptr = rem + '0'
iptr--
until iseqi16(0)

View File

@ -699,7 +699,7 @@ def natv_rem(expr)
num[0], num[1] = eval_num(expr)
load32(@num)
num[0], num[1] = eval_num(expr=>cdr)
num[0], num[1] = div32(@num)
num[1], num[0] = div32(@num)
return new_int(num[0], num[1])
end