diff --git a/PLASMA-BLD2.PO b/PLASMA-BLD2.PO index 7b53330..dc22c35 100644 Binary files a/PLASMA-BLD2.PO and b/PLASMA-BLD2.PO differ diff --git a/PLASMA-DEM2.PO b/PLASMA-DEM2.PO index c70d666..a0152dc 100644 Binary files a/PLASMA-DEM2.PO and b/PLASMA-DEM2.PO differ diff --git a/PLASMA-SOS2.PO b/PLASMA-SOS2.PO index 6e64970..15f743e 100644 Binary files a/PLASMA-SOS2.PO and b/PLASMA-SOS2.PO differ diff --git a/PLASMA-SYS2.PO b/PLASMA-SYS2.PO index d1fe04c..8abe2a9 100644 Binary files a/PLASMA-SYS2.PO and b/PLASMA-SYS2.PO differ diff --git a/src/toolsrc/codegen.c b/src/toolsrc/codegen.c index ce18984..630188b 100755 --- a/src/toolsrc/codegen.c +++ b/src/toolsrc/codegen.c @@ -785,6 +785,9 @@ void emit_caseblock(int casecnt, int *caseof, int *casetag) { int i; + if (casecnt < 1 || casecnt > 256) + parse_error("Switch count under/overflow\n"); + emit_pending_seq(); printf("\t%s\t$%02lX\t\t\t; CASEBLOCK\n", DB, casecnt & 0xFF); for (i = 0; i < casecnt; i++) { diff --git a/src/toolsrc/codegen.pla b/src/toolsrc/codegen.pla index 5a7880b..e0c20d8 100644 --- a/src/toolsrc/codegen.pla +++ b/src/toolsrc/codegen.pla @@ -181,6 +181,7 @@ end def emit_caseblock(cnt, oflist, taglist)#0 byte i + if not cnt or cnt > 256; exit_err(ERR_OVER|ERR_STATE); fin emit_pending_seq emit_byte(cnt) for i = 0 to cnt-1 diff --git a/src/toolsrc/parse.c b/src/toolsrc/parse.c index 97305d3..82bc69c 100755 --- a/src/toolsrc/parse.c +++ b/src/toolsrc/parse.c @@ -1061,8 +1061,6 @@ int parse_stmnt(void) caseval[casecnt] = constval; casetag[casecnt] = tag_of; casecnt++; - if (casecnt > 256) - parse_error("CASE clause overflow"); emit_codetag(tag_of); while (parse_stmnt()) next_line(); } diff --git a/src/toolsrc/parse.pla b/src/toolsrc/parse.pla index eadc9d9..831beec 100644 --- a/src/toolsrc/parse.pla +++ b/src/toolsrc/parse.pla @@ -816,7 +816,6 @@ def parse_stmnt caseval=>[casecnt] = caseconst casetag=>[casecnt] = tag_of casecnt++ - if casecnt > 256; exit_err(ERR_OVER|ERR_STATE); fin emit_tag(tag_of) while parse_stmnt nextln diff --git a/src/vmsrc/apple/plvm01.s b/src/vmsrc/apple/plvm01.s index b391d3c..d8dc4b6 100644 --- a/src/vmsrc/apple/plvm01.s +++ b/src/vmsrc/apple/plvm01.s @@ -109,14 +109,17 @@ COMP LDA #$FF ;* OPCODE TABLE ;* !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 ;* ;* DIV TOS-1 BY TOS ;* @@ -325,31 +328,6 @@ SHR STY IPY + LDY IPY JMP DROP ;* -;* LOGICAL AND -;* -LAND LDA ESTKL+1,X - ORA ESTKH+1,X - BEQ ++ - LDA ESTKL,X - ORA ESTKH,X - BEQ + - LDA #$FF -+ STA ESTKL+1,X - STA ESTKH+1,X -++ JMP DROP -;* -;* LOGICAL OR -;* -LOR LDA ESTKL,X - ORA ESTKH,X - ORA ESTKL+1,X - ORA ESTKH+1,X - BEQ + - LDA #$FF - STA ESTKL+1,X - STA ESTKH+1,X -+ JMP DROP -;* ;* DUPLICATE TOS ;* DUP DEX @@ -363,17 +341,64 @@ DUP DEX ;* LNOT LDA ESTKL,X ORA ESTKH,X - BNE + + BEQ + LDA #$FF ++ EOR #$FF STA ESTKL,X STA ESTKH,X JMP NEXTOP ;* -;* CONSTANT +;* ADD IMMEDIATE TO TOS ;* -ZERO DEX -+ LDA #$00 +ADDI INY ;+INC_IP + LDA (IP),Y + CLC + ADC ESTKL,X STA ESTKL,X + BCC + + INC ESTKH,X ++ JMP NEXTOP +;* +;* SUB IMMEDIATE FROM TOS +;* +SUBI INY ;+INC_IP + LDA ESTKL,X + SEC + SBC (IP),Y + STA ESTKL,X + BCS + + DEC ESTKH,X ++ JMP NEXTOP +;* +;* AND IMMEDIATE TO TOS +;* +ANDI INY ;+INC_IP + LDA (IP),Y + AND ESTKL,X + STA ESTKL,X + LDA #$00 + STA ESTKH,X + JMP NEXTOP +;* +;* IOR IMMEDIATE TO TOS +;* +ORI INY ;+INC_IP + LDA (IP),Y + ORA ESTKL,X + STA ESTKL,X + JMP NEXTOP +;* +;* CONSTANT -1, NYBBLE, BYTE, $FF BYTE, WORD (BELOW) +;* +MINUS1 DEX + LDA #$FF + STA ESTKL,X + STA ESTKH,X + JMP NEXTOP +CN DEX + LSR ; A = CONST * 2 + STA ESTKL,X + LDA #$00 STA ESTKH,X JMP NEXTOP CFFB LDA #$FF @@ -552,7 +577,10 @@ SW LDA ESTKL,X JMP DROP + INC ESTKH,X STA (ESTKH-1,X) - INX +;* +;* DROP2 +;* +DROP2 INX JMP DROP ;* ;* STORE VALUE TO LOCAL FRAME OFFSET @@ -738,6 +766,65 @@ ISLT LDA ESTKL+1,X ;* ;* BRANCHES ;* +SEL INX + TYA ; FLATTEN IP + SEC + ADC IPL + STA TMPL + LDA #$00 + TAY + ADC IPH + STA TMPH ; ADD BRANCH OFFSET + LDA (TMP),Y + ;CLC ; BETTER NOT CARRY OUT OF IP+Y + ADC TMPL + STA IPL + INY + LDA (TMP),Y + ADC TMPH + STA IPH + DEY + LDA (IP),Y + STA TMPL ; CASE COUNT + LDA ESTKL-1,X + INC IPL + BNE CASELP + INC IPH +CASELP CMP (IP),Y + BNE + + LDA ESTKH-1,X + INY + CMP (IP),Y + BEQ BRNCH + LDA ESTKL-1,X + DEY ++ INY + INY + INY + DEC TMPL + BEQ FIXNEXT + INY + BNE CASELP + INC IPH + BNE CASELP +FIXNEXT TYA + LDY #$00 + SEC + ADC IPL + STA IPL + BCC + + INC IPH ++ JMP FETCHOP +BRAND LDA ESTKL,X + ORA ESTKH,X + BEQ BRNCH + INX ; DROP LEFT HALF OF AND + BNE NOBRNCH +BROR LDA ESTKL,X + ORA ESTKH,X + BNE BRNCH + INX ; DROP LEFT HALF OF OR + BNE NOBRNCH BRTRU INX LDA ESTKH-1,X ORA ESTKL-1,X @@ -746,14 +833,6 @@ NOBRNCH INY ;+INC_IP INY ;+INC_IP BMI FIXNEXT JMP NEXTOP -FIXNEXT TYA - LDY #$00 - CLC - ADC IPL - STA IPL - BCC + - INC IPH -+ JMP NEXTOP BRFLS INX LDA ESTKH-1,X ORA ESTKL-1,X @@ -776,58 +855,75 @@ BRNCH TYA ; FLATTEN IP STA IPH DEY JMP FETCHOP -BREQ INX - LDA ESTKL-1,X +;* +;* FOR LOOPS PUT TERMINAL VALUE AT ESTK+1 AND CURRENT COUNT ON ESTK +;* +BRGT LDA ESTKL+1,X CMP ESTKL,X - BNE NOBRNCH - LDA ESTKH-1,X - CMP ESTKH,X - BEQ BRNCH - BNE NOBRNCH -BRNE INX - LDA ESTKL-1,X - CMP ESTKL,X - BNE BRNCH - LDA ESTKH-1,X - CMP ESTKH,X - BEQ NOBRNCH - BNE BRNCH -BRGT INX - LDA ESTKL-1,X - CMP ESTKL,X - LDA ESTKH-1,X + LDA ESTKH+1,X SBC ESTKH,X BVS + BPL NOBRNCH - BMI BRNCH -+ BPL BRNCH - BMI NOBRNCH -BRLT INX - LDA ESTKL,X - CMP ESTKL-1,X +- INX ; DROP FOR VALUES + INX + BNE BRNCH ; BMI BRNCH +BRLT LDA ESTKL,X + CMP ESTKL+1,X LDA ESTKH,X - SBC ESTKH-1,X + SBC ESTKH+1,X BVS + BPL NOBRNCH - BMI BRNCH -+ BPL BRNCH - BMI NOBRNCH -IBRNCH TYA ; FLATTEN IP + INX ; DROP FOR VALUES + INX + BNE BRNCH ; BMI BRNCH ++ BMI NOBRNCH + BPL - +DECBRGE DEC ESTKL,X + LDA ESTKL,X + CMP #$FF + BNE + + DEC ESTKH,X +_BRGE LDA ESTKL,X ++ CMP ESTKL+1,X + LDA ESTKH,X + SBC ESTKH+1,X + BVS + + BPL BRNCH +- INX ; DROP FOR VALUES + INX + BNE NOBRNCH ; BMI NOBRNCH +INCBRLE INC ESTKL,X + BNE _BRLE + INC ESTKH,X +_BRLE LDA ESTKL+1,X + CMP ESTKL,X + LDA ESTKH+1,X + SBC ESTKH,X + BVS + + BPL BRNCH + INX ; DROP FOR VALUES + INX + BNE NOBRNCH ; BMI NOBRNCH ++ BMI BRNCH + BPL - +SUBBRGE LDA ESTKL+1,X + SEC + SBC ESTKL,X + STA ESTKL+1,X + LDA ESTKH+1,X + SBC ESTKH,X + STA ESTKH+1,X + INX + BNE _BRGE +ADDBRLE LDA ESTKL,X CLC - ADC IPL - STA TMPL - LDA #$00 - TAY - ADC IPH - STA TMPH ; ADD BRANCH OFFSET - LDA TMPL - ;CLC ; BETTER NOT CARRY OUT OF IP+Y - ADC ESTKL,X - STA IPL - LDA TMPH - ADC ESTKH,X - STA IPH - JMP DROP + ADC ESTKL+1,X + STA ESTKL+1,X + LDA ESTKH,X + ADC ESTKH+1,X + STA ESTKH+1,X + INX + BNE _BRLE ;* ;* INDIRECT CALL TO ADDRESS (NATIVE CODE) ;* diff --git a/src/vmsrc/apple/plvm02.s b/src/vmsrc/apple/plvm02.s index 0875fa8..c4dccd5 100755 --- a/src/vmsrc/apple/plvm02.s +++ b/src/vmsrc/apple/plvm02.s @@ -1307,12 +1307,11 @@ SEL INX STA IPH DEY LDA (IP),Y - BEQ ++ STA TMPL ; CASE COUNT + LDA ESTKL-1,X INC IPL - BNE + + BNE CASELP INC IPH -+ LDA ESTKL-1,X CASELP CMP (IP),Y BNE + LDA ESTKH-1,X @@ -1321,26 +1320,23 @@ CASELP CMP (IP),Y BEQ BRNCH LDA ESTKL-1,X DEY -+ DEC TMPL - BEQ + - INY ++ INY INY INY + DEC TMPL + BEQ FIXNEXT INY BNE CASELP INC IPH BNE CASELP -+ INY - INY - INY FIXNEXT TYA LDY #$00 SEC ADC IPL STA IPL - BCC ++ + BCC + INC IPH -++ JMP FETCHOP ++ JMP FETCHOP BRAND LDA ESTKL,X ORA ESTKH,X BEQ BRNCH diff --git a/src/vmsrc/apple/plvm03.s b/src/vmsrc/apple/plvm03.s index d17fada..c02679a 100755 --- a/src/vmsrc/apple/plvm03.s +++ b/src/vmsrc/apple/plvm03.s @@ -949,12 +949,11 @@ SEL INX STA IPH DEY LDA (IP),Y - BEQ ++ STA TMPL ; CASE COUNT + LDA ESTKL-1,X INC IPL - BNE + + BNE CASELP INC IPH -+ LDA ESTKL-1,X CASELP CMP (IP),Y BNE + LDA ESTKH-1,X @@ -963,26 +962,23 @@ CASELP CMP (IP),Y BEQ BRNCH LDA ESTKL-1,X DEY -+ DEC TMPL - BEQ + - INY ++ INY INY INY + DEC TMPL + BEQ FIXNEXT INY BNE CASELP INC IPH BNE CASELP -+ INY - INY - INY FIXNEXT TYA LDY #$00 SEC ADC IPL STA IPL - BCC ++ + BCC + INC IPH -++ JMP FETCHOP ++ JMP FETCHOP BRAND LDA ESTKL,X ORA ESTKH,X BEQ BRNCH diff --git a/src/vmsrc/apple/plvm802.s b/src/vmsrc/apple/plvm802.s index a7312ce..2e9ca82 100644 --- a/src/vmsrc/apple/plvm802.s +++ b/src/vmsrc/apple/plvm802.s @@ -1183,32 +1183,27 @@ SEL TYA ; FLATTEN IP LDA (IP),Y TAX ; CASE COUNT PLA - CPX #$00 - BEQ ++ INC IP CASELP CMP (IP),Y - BEQ +++ + BEQ ++ + INY + INY + INY DEX - BEQ + - INY - INY - INY + BEQ FIXNEXT INY BNE CASELP +ACCMEM8 ; 8 BIT A/M INC IPH +ACCMEM16 ; 16 BIT A/M BRA CASELP -+ INY - INY - INY FIXNEXT TYA LDY #$00 SEC ADC IP STA IP -++ JMP FETCHOP -+++ INY + JMP FETCHOP +++ INY BRA BRNCH BRAND LDA TOS,S BEQ BRNCH @@ -1227,13 +1222,13 @@ NOBRNCH INY ;+INC_IP BRFLS PLA BNE NOBRNCH BRNCH TYA ; FLATTEN IP - CLC + SEC ADC IP INY ;+INC_IP ;CLC ; ADD BRANCH OFFSET (BETTER NOT CARRY OUT OF IP+Y) ADC (IP),Y STA IP - LDY #$01 + LDY #$00 JMP FETCHOP ;* ;* FOR LOOPS PUT TERMINAL VALUE AT ESTK+1 AND CURRENT COUNT ON ESTK diff --git a/src/vmsrc/c64/plvmc64.s b/src/vmsrc/c64/plvmc64.s index bfaa45c..a225723 100644 --- a/src/vmsrc/c64/plvmc64.s +++ b/src/vmsrc/c64/plvmc64.s @@ -109,14 +109,17 @@ COMP LDA #$FF ;* OPCODE TABLE ;* !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 ;* ;* DIV TOS-1 BY TOS ;* @@ -325,31 +328,6 @@ SHR STY IPY + LDY IPY JMP DROP ;* -;* LOGICAL AND -;* -LAND LDA ESTKL+1,X - ORA ESTKH+1,X - BEQ ++ - LDA ESTKL,X - ORA ESTKH,X - BEQ + - LDA #$FF -+ STA ESTKL+1,X - STA ESTKH+1,X -++ JMP DROP -;* -;* LOGICAL OR -;* -LOR LDA ESTKL,X - ORA ESTKH,X - ORA ESTKL+1,X - ORA ESTKH+1,X - BEQ + - LDA #$FF - STA ESTKL+1,X - STA ESTKH+1,X -+ JMP DROP -;* ;* DUPLICATE TOS ;* DUP DEX @@ -363,17 +341,64 @@ DUP DEX ;* LNOT LDA ESTKL,X ORA ESTKH,X - BNE + + BEQ + LDA #$FF ++ EOR #$FF STA ESTKL,X STA ESTKH,X JMP NEXTOP ;* -;* CONSTANT +;* ADD IMMEDIATE TO TOS ;* -ZERO DEX -+ LDA #$00 +ADDI INY ;+INC_IP + LDA (IP),Y + CLC + ADC ESTKL,X STA ESTKL,X + BCC + + INC ESTKH,X ++ JMP NEXTOP +;* +;* SUB IMMEDIATE FROM TOS +;* +SUBI INY ;+INC_IP + LDA ESTKL,X + SEC + SBC (IP),Y + STA ESTKL,X + BCS + + DEC ESTKH,X ++ JMP NEXTOP +;* +;* AND IMMEDIATE TO TOS +;* +ANDI INY ;+INC_IP + LDA (IP),Y + AND ESTKL,X + STA ESTKL,X + LDA #$00 + STA ESTKH,X + JMP NEXTOP +;* +;* IOR IMMEDIATE TO TOS +;* +ORI INY ;+INC_IP + LDA (IP),Y + ORA ESTKL,X + STA ESTKL,X + JMP NEXTOP +;* +;* CONSTANT -1, NYBBLE, BYTE, $FF BYTE, WORD (BELOW) +;* +MINUS1 DEX + LDA #$FF + STA ESTKL,X + STA ESTKH,X + JMP NEXTOP +CN DEX + LSR ; A = CONST * 2 + STA ESTKL,X + LDA #$00 STA ESTKH,X JMP NEXTOP CFFB LDA #$FF @@ -552,7 +577,10 @@ SW LDA ESTKL,X JMP DROP + INC ESTKH,X STA (ESTKH-1,X) - INX +;* +;* DROP2 +;* +DROP2 INX JMP DROP ;* ;* STORE VALUE TO LOCAL FRAME OFFSET @@ -738,6 +766,65 @@ ISLT LDA ESTKL+1,X ;* ;* BRANCHES ;* +SEL INX + TYA ; FLATTEN IP + SEC + ADC IPL + STA TMPL + LDA #$00 + TAY + ADC IPH + STA TMPH ; ADD BRANCH OFFSET + LDA (TMP),Y + ;CLC ; BETTER NOT CARRY OUT OF IP+Y + ADC TMPL + STA IPL + INY + LDA (TMP),Y + ADC TMPH + STA IPH + DEY + LDA (IP),Y + STA TMPL ; CASE COUNT + LDA ESTKL-1,X + INC IPL + BNE CASELP + INC IPH +CASELP CMP (IP),Y + BNE + + LDA ESTKH-1,X + INY + CMP (IP),Y + BEQ BRNCH + LDA ESTKL-1,X + DEY ++ INY + INY + INY + DEC TMPL + BEQ FIXNEXT + INY + BNE CASELP + INC IPH + BNE CASELP +FIXNEXT TYA + LDY #$00 + SEC + ADC IPL + STA IPL + BCC + + INC IPH ++ JMP FETCHOP +BRAND LDA ESTKL,X + ORA ESTKH,X + BEQ BRNCH + INX ; DROP LEFT HALF OF AND + BNE NOBRNCH +BROR LDA ESTKL,X + ORA ESTKH,X + BNE BRNCH + INX ; DROP LEFT HALF OF OR + BNE NOBRNCH BRTRU INX LDA ESTKH-1,X ORA ESTKL-1,X @@ -746,14 +833,6 @@ NOBRNCH INY ;+INC_IP INY ;+INC_IP BMI FIXNEXT JMP NEXTOP -FIXNEXT TYA - LDY #$00 - CLC - ADC IPL - STA IPL - BCC + - INC IPH -+ JMP NEXTOP BRFLS INX LDA ESTKH-1,X ORA ESTKL-1,X @@ -776,58 +855,75 @@ BRNCH TYA ; FLATTEN IP STA IPH DEY JMP FETCHOP -BREQ INX - LDA ESTKL-1,X +;* +;* FOR LOOPS PUT TERMINAL VALUE AT ESTK+1 AND CURRENT COUNT ON ESTK +;* +BRGT LDA ESTKL+1,X CMP ESTKL,X - BNE NOBRNCH - LDA ESTKH-1,X - CMP ESTKH,X - BEQ BRNCH - BNE NOBRNCH -BRNE INX - LDA ESTKL-1,X - CMP ESTKL,X - BNE BRNCH - LDA ESTKH-1,X - CMP ESTKH,X - BEQ NOBRNCH - BNE BRNCH -BRGT INX - LDA ESTKL-1,X - CMP ESTKL,X - LDA ESTKH-1,X + LDA ESTKH+1,X SBC ESTKH,X BVS + BPL NOBRNCH - BMI BRNCH -+ BPL BRNCH - BMI NOBRNCH -BRLT INX - LDA ESTKL,X - CMP ESTKL-1,X +- INX ; DROP FOR VALUES + INX + BNE BRNCH ; BMI BRNCH +BRLT LDA ESTKL,X + CMP ESTKL+1,X LDA ESTKH,X - SBC ESTKH-1,X + SBC ESTKH+1,X BVS + BPL NOBRNCH - BMI BRNCH -+ BPL BRNCH - BMI NOBRNCH -IBRNCH TYA ; FLATTEN IP + INX ; DROP FOR VALUES + INX + BNE BRNCH ; BMI BRNCH ++ BMI NOBRNCH + BPL - +DECBRGE DEC ESTKL,X + LDA ESTKL,X + CMP #$FF + BNE + + DEC ESTKH,X +_BRGE LDA ESTKL,X ++ CMP ESTKL+1,X + LDA ESTKH,X + SBC ESTKH+1,X + BVS + + BPL BRNCH +- INX ; DROP FOR VALUES + INX + BNE NOBRNCH ; BMI NOBRNCH +INCBRLE INC ESTKL,X + BNE _BRLE + INC ESTKH,X +_BRLE LDA ESTKL+1,X + CMP ESTKL,X + LDA ESTKH+1,X + SBC ESTKH,X + BVS + + BPL BRNCH + INX ; DROP FOR VALUES + INX + BNE NOBRNCH ; BMI NOBRNCH ++ BMI BRNCH + BPL - +SUBBRGE LDA ESTKL+1,X + SEC + SBC ESTKL,X + STA ESTKL+1,X + LDA ESTKH+1,X + SBC ESTKH,X + STA ESTKH+1,X + INX + BNE _BRGE +ADDBRLE LDA ESTKL,X CLC - ADC IPL - STA TMPL - LDA #$00 - TAY - ADC IPH - STA TMPH ; ADD BRANCH OFFSET - LDA TMPL - ;CLC ; BETTER NOT CARRY OUT OF IP+Y - ADC ESTKL,X - STA IPL - LDA TMPH - ADC ESTKH,X - STA IPH - JMP DROP + ADC ESTKL+1,X + STA ESTKL+1,X + LDA ESTKH,X + ADC ESTKH+1,X + STA ESTKH+1,X + INX + BNE _BRLE ;* ;* INDIRECT CALL TO ADDRESS (NATIVE CODE) ;*