1
0
mirror of https://github.com/dschmenk/PLASMA.git synced 2024-12-25 06:29:21 +00:00

Oops, broke div by 0

This commit is contained in:
David Schmenk 2014-12-01 19:11:44 -08:00
parent aafac44a46
commit c2b795bcb5
3 changed files with 24 additions and 33 deletions

View File

@ -158,6 +158,10 @@ _NEG LDA #$00
STA ESTKH,X
RTS
_DIV STY IPY
LDY #$11 ; #BITS+1
LDA #$00
STA TMPL ; REMNDRL
STA TMPH ; REMNDRH
LDA ESTKH,X
AND #$80
STA DVSIGN
@ -172,18 +176,11 @@ _DIV STY IPY
INC DVSIGN
BNE _DIV1
+ ORA ESTKL+1,X ; DVDNDL
BNE _DIV1
STA TMPL
STA TMPH
RTS
_DIV1 LDY #$11 ; #BITS+1
LDA #$00
STA TMPL ; REMNDRL
STA TMPH ; REMNDRH
- ASL ESTKL+1,X ; DVDNDL
BEQ _DIVEX
_DIV1 ASL ESTKL+1,X ; DVDNDL
ROL ESTKH+1,X ; DVDNDH
DEY
BCC -
BCC _DIV1
_DIVLP ROL TMPL ; REMNDRL
ROL TMPH ; REMNDRH
LDA TMPL ; REMNDRL
@ -200,8 +197,8 @@ _DIVLP ROL TMPL ; REMNDRL
ROL ESTKH+1,X ; DVDNDH
DEY
BNE _DIVLP
_DIVEX INX
LDY IPY
INX
RTS
;*
;* ADD TOS TO TOS-1

View File

@ -481,6 +481,10 @@ _NEG LDA #$00
STA ESTKH,X
RTS
_DIV STY IPY
LDY #$11 ; #BITS+1
LDA #$00
STA TMPL ; REMNDRL
STA TMPH ; REMNDRH
LDA ESTKH,X
AND #$80
STA DVSIGN
@ -495,18 +499,11 @@ _DIV STY IPY
INC DVSIGN
BNE _DIV1
+ ORA ESTKL+1,X ; DVDNDL
BNE _DIV1
STA TMPL
STA TMPH
RTS
_DIV1 LDY #$11 ; #BITS+1
LDA #$00
STA TMPL ; REMNDRL
STA TMPH ; REMNDRH
- ASL ESTKL+1,X ; DVDNDL
BEQ _DIVEX
_DIV1 ASL ESTKL+1,X ; DVDNDL
ROL ESTKH+1,X ; DVDNDH
DEY
BCC -
BCC _DIV1
_DIVLP ROL TMPL ; REMNDRL
ROL TMPH ; REMNDRH
LDA TMPL ; REMNDRL
@ -523,8 +520,8 @@ _DIVLP ROL TMPL ; REMNDRL
ROL ESTKH+1,X ; DVDNDH
DEY
BNE _DIVLP
_DIVEX INX
LDY IPY
INX
RTS
;*
;* NEGATE TOS

View File

@ -148,6 +148,10 @@ _NEG LDA #$00
STA ESTKH,X
RTS
_DIV STY IPY
LDY #$11 ; #BITS+1
LDA #$00
STA TMPL ; REMNDRL
STA TMPH ; REMNDRH
LDA ESTKH,X
AND #$80
STA DVSIGN
@ -162,18 +166,11 @@ _DIV STY IPY
INC DVSIGN
BNE _DIV1
+ ORA ESTKL+1,X ; DVDNDL
BNE _DIV1
STA TMPL
STA TMPH
RTS
_DIV1 LDY #$11 ; #BITS+1
LDA #$00
STA TMPL ; REMNDRL
STA TMPH ; REMNDRH
- ASL ESTKL+1,X ; DVDNDL
BEQ _DIVEX
_DIV1 ASL ESTKL+1,X ; DVDNDL
ROL ESTKH+1,X ; DVDNDH
DEY
BCC -
BCC _DIV1
_DIVLP ROL TMPL ; REMNDRL
ROL TMPH ; REMNDRH
LDA TMPL ; REMNDRL
@ -190,8 +187,8 @@ _DIVLP ROL TMPL ; REMNDRL
ROL ESTKH+1,X ; DVDNDH
DEY
BNE _DIVLP
_DIVEX INX
LDY IPY
INX
RTS
;*
;* OPCODE TABLE