1
0
mirror of https://github.com/dschmenk/PLASMA.git synced 2025-01-22 08:31:36 +00:00

Add CFFB opcode

This commit is contained in:
Steven Flintham 2017-07-18 20:37:43 +01:00
parent 1b2a1b5b7a
commit 8610d2f56e
4 changed files with 20 additions and 9 deletions

View File

@ -544,6 +544,8 @@ void emit_const(int cval)
printf("\t%s\t$00\t\t\t; ZERO\n", DB);
else if (cval > 0 && cval < 256)
printf("\t%s\t$2A,$%02X\t\t\t; CB\t%d\n", DB, cval, cval);
else if ((cval&0xFF00) >= 0xFF00)
printf("\t%s\t$80,$%02X\t\t\t; CFFB\t%d\n", DB, cval&0xFF, cval&0xFF);
else
printf("\t%s\t$2C,$%02X,$%02X\t\t; CW\t%d\n", DB, cval&0xFF,(cval>>8)&0xFF, cval);
}

View File

@ -118,6 +118,7 @@ OPTBL !WORD ZERO,ADD,SUB,MUL,DIV,MOD,INCR,DECR ; 00 02 04 06 08 0A 0C 0
!WORD BRNCH,IBRNCH,CALL,ICAL,ENTER,LEAVE,RET,NEXTOP ; 50 52 54 56 58 5A 5C 5E
!WORD LB,LW,LLB,LLW,LAB,LAW,DLB,DLW ; 60 62 64 66 68 6A 6C 6E
!WORD SB,SW,SLB,SLW,SAB,SAW,DAB,DAW ; 70 72 74 76 78 7A 7C 7E
!WORD CFFB ; 80 82 84 86 88 8A 8C 8E
;*
;* DIV TOS-1 BY TOS
;*
@ -399,12 +400,14 @@ ZERO DEX
STA ESTKL,X
STA ESTKH,X
JMP NEXTOP
CB DEX
CFFB LDA #$FF
!BYTE $2C ; BIT $00A9 - effectively skips LDA #$00, no harm in reading this address
CB LDA #$00
DEX
STA ESTKH,X
+INC_IP
LDA (IP),Y
STA ESTKL,X
LDA #$00
STA ESTKH,X
JMP NEXTOP
;*
;* LOAD ADDRESS & LOAD CONSTANT WORD (SAME THING, WITH OR WITHOUT FIXUP)

View File

@ -176,6 +176,7 @@ OPTBL !WORD ZERO,ADD,SUB,MUL,DIV,MOD,INCR,DECR ; 00 02 04 06 08 0A 0C 0E
!WORD BRNCH,IBRNCH,CALL,ICAL,ENTER,LEAVE,RET,NEXTOP ; 50 52 54 56 58 5A 5C 5E
!WORD LB,LW,LLB,LLW,LAB,LAW,DLB,DLW ; 60 62 64 66 68 6A 6C 6E
!WORD SB,SW,SLB,SLW,SAB,SAW,DAB,DAW ; 70 72 74 76 78 7A 7C 7E
!WORD CFFB ; 80 82 84 86 88 8A 8C 8E
;*
;* ENTER INTO BYTECODE INTERPRETER
;*
@ -731,12 +732,14 @@ ZERO DEX
STA ESTKL,X
STA ESTKH,X
JMP NEXTOP
CB DEX
CFFB LDA #$FF
!BYTE $2C ; BIT $00A9 - effectively skips LDA #$00, no harm in reading this address
CB LDA #$00
DEX
STA ESTKH,X
+INC_IP
LDA (IP),Y
STA ESTKL,X
LDA #$00
STA ESTKH,X
JMP NEXTOP
;*
;* LOAD ADDRESS & LOAD CONSTANT WORD (SAME THING, WITH OR WITHOUT FIXUP)

View File

@ -223,6 +223,7 @@ OPTBL !WORD ZERO,ADD,SUB,MUL,DIV,MOD,INCR,DECR ; 00 02 04 06 08
!WORD BRNCH,IBRNCH,CALL,ICAL,ENTER,LEAVE,RET,NEXTOP ; 50 52 54 56 58 5A 5C 5E
!WORD LB,LW,LLB,LLW,LAB,LAW,DLB,DLW ; 60 62 64 66 68 6A 6C 6E
!WORD SB,SW,SLB,SLW,SAB,SAW,DAB,DAW ; 70 72 74 76 78 7A 7C 7E
!WORD CFFB ; 80 82 84 86 88 8A 8C 8E
;*
;* MUL TOS-1 BY TOS
;*
@ -507,12 +508,14 @@ ZERO DEX
STA ESTKL,X
STA ESTKH,X
JMP NEXTOP
CB DEX
CFFB LDA #$FF
!BYTE $2C ; BIT $00A9 - effectively skips LDA #$00, no harm in reading this address
CB LDA #$00
DEX
STA ESTKH,X
+INC_IP
LDA (IP),Y
STA ESTKL,X
LDA #$00
STA ESTKH,X
JMP NEXTOP
;*
;* LOAD ADDRESS & LOAD CONSTANT WORD (SAME THING, WITH OR WITHOUT FIXUP)