mirror of
https://github.com/dschmenk/PLASMA.git
synced 2025-04-05 03:37:43 +00:00
65802 VM updates
This commit is contained in:
parent
25599c00c8
commit
3d9c54adbf
@ -938,7 +938,7 @@ SEL INX
|
||||
LDA #$00
|
||||
TAY
|
||||
ADC IPH
|
||||
STA TMPH ; ADD BRANCH OFFSET
|
||||
STA TMPH ; ADD CASEBLOCK OFFSET
|
||||
LDA (TMP),Y
|
||||
;CLC ; BETTER NOT CARRY OUT OF IP+Y
|
||||
ADC TMPL
|
||||
|
@ -231,14 +231,17 @@ VMCORE = *
|
||||
;* *
|
||||
;****************
|
||||
!ALIGN 255,0
|
||||
OPTBL !WORD ZERO,ADD,SUB,MUL,DIV,MOD,INCR,DECR ; 00 02 04 06 08 0A 0C 0E
|
||||
!WORD NEG,COMP,BAND,IOR,XOR,SHL,SHR,IDXW ; 10 12 14 16 18 1A 1C 1E
|
||||
!WORD LNOT,LOR,LAND,LA,LLA,CB,CW,CS ; 20 22 24 26 28 2A 2C 2E
|
||||
!WORD DROP,DUP,NEXTOP,DIVMOD,BRGT,BRLT,BREQ,BRNE ; 30 32 34 36 38 3A 3C 3E
|
||||
!WORD ISEQ,ISNE,ISGT,ISLT,ISGE,ISLE,BRFLS,BRTRU ; 40 42 44 46 48 4A 4C 4E
|
||||
!WORD BRNCH,IBRNCH,CALL,ICAL,ENTER,LEAVE,RET,CFFB ; 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
|
||||
OPTBL !WORD CN,CN,CN,CN,CN,CN,CN,CN ; 00 02 04 06 08 0A 0C 0E
|
||||
!WORD CN,CN,CN,CN,CN,CN,CN,CN ; 10 12 14 16 18 1A 1C 1E
|
||||
!WORD MINUS1,NEXTOP,NEXTOP,LA,LLA,CB,CW,CS ; 20 22 24 26 28 2A 2C 2E
|
||||
!WORD DROP,DROP2,DUP,DIVMOD,ADDI,SUBI,ANDI,ORI ; 30 32 34 36 38 3A 3C 3E
|
||||
!WORD ISEQ,ISNE,ISGT,ISLT,ISGE,ISLE,BRFLS,BRTRU ; 40 42 44 46 48 4A 4C 4E
|
||||
!WORD BRNCH,SEL,CALL,ICAL,ENTER,LEAVE,RET,CFFB ; 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 LNOT,ADD,SUB,MUL,DIV,MOD,INCR,DECR ; 80 82 84 86 88 8A 8C 8E
|
||||
!WORD NEG,COMP,BAND,IOR,XOR,SHL,SHR,IDXW ; 90 92 94 96 98 9A 9C 9E
|
||||
!WORD BRGT,BRLT,INCBRLE,ADDBRLE,DECBRGE,SUBBRGE,BRAND,BROR ; A0 A2 A4 A6 A8 AA AC AE
|
||||
;*
|
||||
;* ENTER INTO BYTECODE INTERPRETER - IMMEDIATELY SWITCH TO NATIVE
|
||||
;*
|
||||
@ -482,14 +485,17 @@ LCDEFCMD = *-28 ; DEFCMD IN LC MEMORY
|
||||
;* *
|
||||
;*****************
|
||||
!ALIGN 255,0
|
||||
OPXTBL !WORD ZERO,ADD,SUB,MUL,DIV,MOD,INCR,DECR ; 00 02 04 06 08 0A 0C 0E
|
||||
!WORD NEG,COMP,BAND,IOR,XOR,SHL,SHR,IDXW ; 10 12 14 16 18 1A 1C 1E
|
||||
!WORD LNOT,LOR,LAND,LA,LLA,CB,CW,CSX ; 20 22 24 26 28 2A 2C 2E
|
||||
!WORD DROP,DUP,NEXTOP,DIVMOD,BRGT,BRLT,BREQ,BRNE ; 30 32 34 36 38 3A 3C 3E
|
||||
!WORD ISEQ,ISNE,ISGT,ISLT,ISGE,ISLE,BRFLS,BRTRU ; 40 42 44 46 48 4A 4C 4E
|
||||
!WORD BRNCH,IBRNCH,CALLX,ICALX,ENTER,LEAVEX,RETX,CFFB ; 50 52 54 56 58 5A 5C 5E
|
||||
!WORD LBX,LWX,LLBX,LLWX,LABX,LAWX,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
|
||||
OPXTBL !WORD CN,CN,CN,CN,CN,CN,CN,CN ; 00 02 04 06 08 0A 0C 0E
|
||||
!WORD CN,CN,CN,CN,CN,CN,CN,CN ; 10 12 14 16 18 1A 1C 1E
|
||||
!WORD MINUS1,NEXTOP,NEXTOP,LA,LLA,CB,CW,CSX ; 20 22 24 26 28 2A 2C 2E
|
||||
!WORD DROP,DROP2,DUP,DIVMOD,ADDI,SUBI,ANDI,ORI ; 30 32 34 36 38 3A 3C 3E
|
||||
!WORD ISEQ,ISNE,ISGT,ISLT,ISGE,ISLE,BRFLS,BRTRU ; 40 42 44 46 48 4A 4C 4E
|
||||
!WORD BRNCH,SEL,CALLX,ICALX,ENTER,LEAVEX,RETX,CFFB ; 50 52 54 56 58 5A 5C 5E
|
||||
!WORD LBX,LWX,LLBX,LLWX,LABX,LAWX,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 LNOT,ADD,SUB,MUL,DIV,MOD,INCR,DECR ; 80 82 84 86 88 8A 8C 8E
|
||||
!WORD NEG,COMP,BAND,IOR,XOR,SHL,SHR,IDXW ; 90 92 94 96 98 9A 9C 9E
|
||||
!WORD BRGT,BRLT,INCBRLE,ADDBRLE,DECBRGE,SUBBRGE,BRAND,BROR ; A0 A2 A4 A6 A8 AA AC AE
|
||||
;*********************************************************************
|
||||
;*
|
||||
;* CODE BELOW HERE DEFAULTS TO NATIVE 16 BIT A/M, 8 BIT X,Y
|
||||
@ -706,25 +712,6 @@ SHR PLA
|
||||
STA TOS,S
|
||||
+ JMP NEXTOP
|
||||
;*
|
||||
;* LOGICAL AND
|
||||
;*
|
||||
LAND PLA
|
||||
BEQ LAND1
|
||||
LDA TOS,S
|
||||
BEQ LAND2
|
||||
LDA #$FFFF
|
||||
LAND1 STA TOS,S
|
||||
LAND2 JMP NEXTOP
|
||||
;*
|
||||
;* LOGICAL OR
|
||||
;*
|
||||
LOR PLA
|
||||
ORA TOS,S
|
||||
BEQ LOR1
|
||||
LDA #$FFFF
|
||||
STA TOS,S
|
||||
LOR1 JMP NEXTOP
|
||||
;*
|
||||
;* DUPLICATE TOS
|
||||
;*
|
||||
DUP LDA TOS,S
|
||||
@ -734,17 +721,57 @@ DUP LDA TOS,S
|
||||
;* LOGICAL NOT
|
||||
;*
|
||||
LNOT PLA
|
||||
BNE ZERO
|
||||
BNE +
|
||||
PEA $FFFF
|
||||
JMP NEXTOP
|
||||
;*
|
||||
;* CONSTANT
|
||||
;*
|
||||
ZERO PEA $0000
|
||||
+ PEA $0000
|
||||
JMP NEXTOP
|
||||
CFFB INY ;+INC_IP
|
||||
;*
|
||||
;* ADD IMMEDIATE TO TOS
|
||||
;*
|
||||
ADDI INY ;+INC_IP
|
||||
LDA (IP),Y
|
||||
ORA #$FF00
|
||||
AND #$00FF
|
||||
CLC
|
||||
ADC TOS,S
|
||||
STA TOS,S
|
||||
JMP NEXTOP
|
||||
;*
|
||||
;* SUB IMMEDIATE FROM TOS
|
||||
;*
|
||||
SUBI INY ;+INC_IP
|
||||
LDA (IP),Y
|
||||
AND #$00FF
|
||||
EOR #$FFFF
|
||||
SEC
|
||||
ADC TOS,S
|
||||
STA TOS,S
|
||||
JMP NEXTOP
|
||||
;*
|
||||
;* AND IMMEDIATE TO TOS
|
||||
;*
|
||||
ANDI INY ;+INC_IP
|
||||
LDA (IP),Y
|
||||
AND #$00FF
|
||||
AND TOS,S
|
||||
STA TOS,S
|
||||
JMP NEXTOP
|
||||
;*
|
||||
;* IOR IMMEDIATE TO TOS
|
||||
;*
|
||||
ORI INY ;+INC_IP
|
||||
LDA (IP),Y
|
||||
AND #$00FF
|
||||
ORA TOS,S
|
||||
STA TOS,S
|
||||
JMP NEXTOP
|
||||
;*
|
||||
;* CONSTANT -1, NYBBLE, BYTE, $FF BYTE, WORD (BELOW)
|
||||
;*
|
||||
MINUS1 PEA $FFFF
|
||||
JMP NEXTOP
|
||||
CN TXA
|
||||
LSR ; A = CONST * 2
|
||||
PHA
|
||||
JMP NEXTOP
|
||||
CB INY ;+INC_IP
|
||||
@ -752,6 +779,11 @@ CB INY ;+INC_IP
|
||||
AND #$00FF
|
||||
PHA
|
||||
JMP NEXTOP
|
||||
CFFB INY ;+INC_IP
|
||||
LDA (IP),Y
|
||||
ORA #$FF00
|
||||
PHA
|
||||
JMP NEXTOP
|
||||
;*
|
||||
;* LOAD ADDRESS & LOAD CONSTANT WORD (SAME THING, WITH OR WITHOUT FIXUP)
|
||||
;*
|
||||
@ -990,7 +1022,10 @@ SW TYX
|
||||
LDA NOS,S
|
||||
STA (TOS,S),Y
|
||||
TXY
|
||||
PLA
|
||||
;*
|
||||
;* DROP TOS, TOS-1
|
||||
;*
|
||||
DROP2 PLA
|
||||
JMP DROP
|
||||
;*
|
||||
;* STORE VALUE TO LOCAL FRAME OFFSET
|
||||
@ -1137,18 +1172,53 @@ ISLT PLA
|
||||
;*
|
||||
;* BRANCHES
|
||||
;*
|
||||
SEL TYA ; FLATTEN IP
|
||||
CLC
|
||||
ADC IP
|
||||
INY ;+INC_IP
|
||||
;CLC ; ADD BRANCH OFFSET (BETTER NOT CARRY OUT OF IP+Y)
|
||||
ADC (IP),Y
|
||||
STA IP
|
||||
LDY #$00
|
||||
LDA (IP),Y
|
||||
TAX ; CASE COUNT
|
||||
BEQ ++
|
||||
INC IP
|
||||
PLA
|
||||
CASELP CMP (IP),Y
|
||||
BEQ +++
|
||||
INY
|
||||
INY
|
||||
INY
|
||||
INY
|
||||
BNE +
|
||||
+ACCMEM8 ; 8 BIT A/M
|
||||
INC IPH
|
||||
+ACCMEM16 ; 16 BIT A/M
|
||||
+ DEX
|
||||
BEQ CASELP
|
||||
FIXNEXT TYA
|
||||
LDY #$00
|
||||
SEC
|
||||
ADC IP
|
||||
STA IP
|
||||
++ JMP NEXTOP
|
||||
+++ INY
|
||||
BRA BRNCH
|
||||
BRAND LDA TOS,S
|
||||
BEQ BRNCH
|
||||
PLA ; DROP LEFT HALF OF AND
|
||||
BNE NOBRNCH
|
||||
BROR LDA TOS,S
|
||||
BNE BRNCH
|
||||
PLA ; DROP LEFT HALF OF OR
|
||||
BNE NOBRNCH
|
||||
BRTRU PLA
|
||||
BNE BRNCH
|
||||
NOBRNCH INY ;+INC_IP
|
||||
INY
|
||||
BMI FIXNEXT
|
||||
JMP NEXTOP
|
||||
FIXNEXT TYA
|
||||
SEC
|
||||
ADC IP
|
||||
STA IP
|
||||
LDY #$00
|
||||
JMP FETCHOP
|
||||
BRFLS PLA
|
||||
BNE NOBRNCH
|
||||
BRNCH TYA ; FLATTEN IP
|
||||
@ -1160,42 +1230,66 @@ BRNCH TYA ; FLATTEN IP
|
||||
STA IP
|
||||
LDY #$01
|
||||
JMP FETCHOP
|
||||
BREQ PLA
|
||||
CMP TOS,S
|
||||
BEQ BRNCH
|
||||
BNE NOBRNCH
|
||||
BRNE PLA
|
||||
CMP TOS,S
|
||||
BNE BRNCH
|
||||
BEQ NOBRNCH
|
||||
BRGT PLA
|
||||
;*
|
||||
;* FOR LOOPS PUT TERMINAL VALUE AT ESTK+1 AND CURRENT COUNT ON ESTK
|
||||
;*
|
||||
BRGT LDA NOS,S
|
||||
SEC
|
||||
SBC TOS,S
|
||||
BVS +
|
||||
BPL NOBRNCH
|
||||
BMI BRNCH
|
||||
+ BMI NOBRNCH
|
||||
BPL BRNCH
|
||||
BRLT PLA
|
||||
SEC
|
||||
SBC TOS,S
|
||||
BVS +
|
||||
BMI NOBRNCH
|
||||
BEQ NOBRNCH
|
||||
BPL BRNCH
|
||||
+ BMI BRNCH
|
||||
BEQ BRNCH
|
||||
BPL NOBRNCH
|
||||
IBRNCH TYA ; FLATTEN IP
|
||||
CLC
|
||||
ADC IP
|
||||
STA IP
|
||||
PLA ; DROP FOR VALUES
|
||||
PLA
|
||||
;CLC ; ADD BRANCH OFFSET (BETTER NOT CARRY OUT OF IP+Y)
|
||||
ADC IP
|
||||
STA IP
|
||||
LDY #$01
|
||||
JMP FETCHOP
|
||||
BRA BRNCH ; BMI BRNCH
|
||||
BRLT LDA TOS,S
|
||||
SEC
|
||||
SBC NOS,S
|
||||
BVS +
|
||||
BPL NOBRNCH
|
||||
PLA ; DROP FOR VALUES
|
||||
PLA
|
||||
BRA BRNCH ; BMI BRNCH
|
||||
+ BMI NOBRNCH
|
||||
PLA ; DROP FOR VALUES
|
||||
PLA
|
||||
BRA BRNCH ; BMI BRNCH
|
||||
DECBRGE LDA TOS,S
|
||||
DEC
|
||||
STA TOS,S
|
||||
_BRGE LDA TOS,S
|
||||
SEC
|
||||
SBC NOS,S
|
||||
BVS +
|
||||
BPL BRNCH
|
||||
PLA ; DROP FOR VALUES
|
||||
PLA
|
||||
BRA NOBRNCH ; BMI NOBRNCH
|
||||
INCBRLE LDA TOS,S
|
||||
INC
|
||||
STA TOS,S
|
||||
_BRLE LDA NOS,S
|
||||
SEC
|
||||
SBC TOS,S
|
||||
BVS +
|
||||
BPL BRNCH
|
||||
PLA ; DROP FOR VALUES
|
||||
PLA
|
||||
BNE NOBRNCH ; BMI NOBRNCH
|
||||
+ BMI BRNCH
|
||||
PLA ; DROP FOR VALUES
|
||||
PLA
|
||||
BRA NOBRNCH ; BMI NOBRNCH
|
||||
SUBBRGE LDA NOS,S
|
||||
SEC
|
||||
SBC TOS,S
|
||||
STA NOS,S
|
||||
PLA
|
||||
BRA _BRGE
|
||||
ADDBRLE PLA
|
||||
CLC
|
||||
ADC TOS,S
|
||||
STA TOS,S
|
||||
BRA _BRLE
|
||||
;*
|
||||
;* INDIRECT CALL TO ADDRESS (NATIVE CODE)
|
||||
;*
|
||||
|
Loading…
x
Reference in New Issue
Block a user