1
0
mirror of https://github.com/dschmenk/PLASMA.git synced 2024-10-18 07:24:16 +00:00

Seriously broken dividing zero by anything

This commit is contained in:
Dave Schmenk 2019-12-17 21:20:09 -08:00
parent ff3d3c0b87
commit 10a98d5392
2 changed files with 5 additions and 4 deletions

View File

@ -81,8 +81,8 @@ def crunch_seq(seq, pass)
fin
if nextop->opcode == SHL_CODE
op->opcode = DUP_CODE
nextop->opcode = ADD_CODE
op->opgroup = STACK_GROUP
nextop->opcode = ADD_CODE
break
fin
if nextop->opcode == MUL_CODE or nextop->opcode == DIV_CODE
@ -270,13 +270,14 @@ def crunch_seq(seq, pass)
is MUL_CODE
if op=>opval == 0
op->opcode = DROP_CODE
op->opgroup = STACK_GROUP
nextop->opcode = CONST_CODE
nextop->opval = 0
nextop->opgroup = CONST_GROUP
nextop=>opval = 0
elsif op=>opval == 2
op->opcode = DUP_CODE
nextop->opcode = ADD_CODE
op->opgroup = STACK_GROUP
nextop->opcode = ADD_CODE
else
for shiftcnt = 2 to 15
if op=>opval == 1 << shiftcnt

View File

@ -638,12 +638,12 @@ _DIV STY IPY
LDY #$11 ; #BITS+1
LDX #$00
LDA NOS+2,S ; WE JSR'ED HERE SO OFFSET ACCORDINGLY
BEQ _DIVEX
BPL +
LDX #$81
EOR #$FFFF
INC
+ STA TMP ; NOS,S
BEQ _DIVEX
LDA TOS+2,S
BPL +
INX