From 65a60e63db8a215c0d470af7ffcc680d89c4e106 Mon Sep 17 00:00:00 2001 From: David Schmenk Date: Fri, 13 Apr 2018 21:43:25 -0700 Subject: [PATCH] Updated PLASMA Byte Codes (markdown) --- PLASMA-Byte-Codes.md | 164 +++++++++++++++++++++---------------------- 1 file changed, 82 insertions(+), 82 deletions(-) diff --git a/PLASMA-Byte-Codes.md b/PLASMA-Byte-Codes.md index b64895a..76dac30 100644 --- a/PLASMA-Byte-Codes.md +++ b/PLASMA-Byte-Codes.md @@ -7,85 +7,85 @@ NOS: Next On Stack value (TOS-1) | OPCODE | Name | Description | Operation |:-------:|:---------:|-----------------------------------------|--------------------- -| $00-$1F | CN | CONSTANT NYBBLE | OPCODE/2 ==> TOS -| $20 | MINUS_ONE | CONSTANT -1 | -1 ==> TOS -| $22 | BREQ | BRANCH EQUAL | NOS == TOS ?? IP = IP + OFFSET -| $24 | BRNE | BRACH NOT EQUAL | NOS <> TOS ?? IP = IP + OFFSET -| $26 | LA | LOAD ADDRESS | ABSOLUTE ADDR ==> TOS -| $28 | LLA | LOAD LOCAL ADDRESS | LOCAL ADDR ==> TOS -| $2A | CB | CONSTANT BYTE | CONSTANT BYTE ==> TOS -| $2C | CB | CONSTANT WORD | CONSTANT WORD ==> TOS -| $2E | CS | CONSTANT STRING | STRING ADDR ==> TOS -| $30 | DROP | DROP TOP VALUE | TOS ==> -| $32 | DROP2 | DROP TOP 2 VALUES | NOS, TOS ==> -| $34 | DUP | DUPLICATE TOP VALUE | TOS ==> TOS -| $36 | DIVMOD | DIVIDE & MOD TOS,NOS | NOS / TOS ==> TOS, NOS % TOS ==> NOS -| $38 | ADDI | ADD IMMEDIATE BYE | TOS + IMM8 ==> TOS -| $3A | SUBI | SUB IMMEDIATE BYE | TOS - IMM8 ==> TOS -| $3C | ANDI | AND IMMEDIATE BYE | TOS & IMM8 ==> TOS -| $3E | ORI | OR IMMEDIATE BYE | TOS | IMM8 ==> TOS -| $40 | ISEQ | IS NOS EQUAL TOS | NOS == TOS ==> TOS -| $42 | ISNE | IS NOS NOT EQUAL TOS | NOS <> TOS ==> TOS -| $44 | ISGT | IS NOS GREATER THAN TOS | NOS > TOS ==> TOS -| $46 | ISLT | IS NOS LESS THAN TOS | NOS < TOS ==> TOS -| $48 | ISGE | IS NOS GREATER OR EQUAL THAN TOS | NOS >= TOS ==> TOS -| $4A | ISLE | IS NOS LESS OR EQUAL THAN TOS | NOS <= TOS ==> TOS -| $4C | BRFLS | BRANCH FALSE | TOS == 0 ?? IP = IP + OFFSET -| $4E | BRTRU | BRANCH TRUE | TOS <> 0 ?? IP = IP + OFFSET -| $50 | BRNCH | BRANCH | IP = IP + OFFSET -| $52 | SEL | SELECT | TOS == CASE ?? IP = IP + OFFSET (FOR ALL CASES) -| $54 | CALL | CALL ADDRESS | PUSH(IP+2), IP = ADDRESS -| $56 | ICAL | INDIRECT CALL | PUSH(IP+2), IP = TOS -| $58 | ENTER | ENTER FRAME SIZE, PARAM COUNT | FP = FP - FRAME SIZE, PARAMS ==> LOCALS -| $5A | LEAVE | LEAVE FRAME SIZE | FP = FP + FRAME SIZE, IP = PULL() -| $5C | RET | RETURN | IP = PULL() -| $5E | CFFB | CONSTANT $FF BYTE | CONSTANT BYTE + $FF00 ==> TOS -| $60 | LB | LOAD BYTE | (TOS) ==> TOS -| $62 | LW | LOAD WORD | (TOS) ==> TOS -| $64 | LLB | LOAD LOCAL BYTE | FP[LOCAL] ==> TOS -| $66 | LLW | LOAD LOCAL WORD | FP[LOCAL] ==> TOS -| $68 | LAB | LOAD ABSOLUTE BYTE | MEM[ADDR] ==> TOS -| $6A | LAW | LOAD ABSOLUTE WORD | MEM[ADDR] ==> TOS -| $6C | DLB | DUPLICATE TO LOCAL BYTE | TOS ==> FP[LOCAL], TOS ==> TOS -| $6E | DLW | DUPLICATE TO LOCAL WORD | TOS ==> FP[LOCAL], TOS ==> TOS -| $70 | SB | STORE BYTE | NOS ==> (TOS) -| $72 | SW | STORE WORD | NOS ==> (TOS) -| $74 | SLB | STORE LOCAL BYTE | TOS ==> FP[LOCAL] -| $76 | SLW | STORE LOCAL WORD | TOS ==> FP[LOCAL] -| $78 | SAB | STORE ABSOLUTE BYTE | TOS ==> MEM[ADDR] -| $7A | SAW | STORE ABSOLUTE WORD | TOS ==> MEM[ADDR] -| $7C | DAB | DUPLICATE TO ABSOLUTE BYTE | TOS ==> MEM[ADDR], TOS ==> TOS -| $7E | DAW | DUPLICATE TO ABSOLUTE WORD | TOS ==> MEM[ADDR], TOS ==> TOS -| $80 | NOT | LOGICAL NOT | !TOS ==> TOS -| $82 | ADD | ADD NOS TO TOS | NOS + TOS ==> TOS -| $84 | SUB | SUBTRACT TOS FROM NOS | NOS - TOS ==> TOS -| $86 | MUL | MULTIPLY NOS TIMES TOS | NOS * TOS ==> TOS -| $88 | DIV | DIVIDE NOS BY TOS | NOS / TOS ==> TOS -| $8A | MOD | MODULO NOS BY TOS | NOS % TOS ==> TOS -| $8C | INCR | INCREMENT TOS | TOS + 1 ==> TOS -| $8E | DECR | DECREMENT TOS | TOS - 1 ==> TOS -| $90 | NEG | NEGATE TOS | -TOS ==> TOS -| $92 | COMP | COMPLIMENT TOS | ~TOS ==> TOS -| $94 | AND | BITWISE AND | NOS & TOS ==> TOS -| $96 | IOR | BITWISE INCLUSIVE OR | NOS | TOS ==> TOS -| $98 | XOR | BITWISE EXCLUSIVE OR | NOS ^ TOS ==> TOS -| $9A | SHL | SHIFT LEFT | NOS << TOS ==> TOS -| $9C | SHR | SHIFT RIGHT | NOS >> TOS ==> TOS -| $9E | IDXW | INDEX WORD | TOS * 2 + NOS ==> TOS -| $A0 | BRGT | BRANCH GREATER THAN (FOR/NEXT) | TOS > NOS ?? IP = IP + OFFSET -| $A2 | BRLT | BRANCH LESS THAN (FOR/NEXT) | TOS < NOS ?? IP = IP + OFFSET -| $A4 | INCBRLE | INCREMENT, BRANCH LESS EQUAL (FOR/NEXT) | TOS + 1 ==> TOS, TOS <= NOS ?? IP = IP + OFFSET -| $A6 | ADDBRLE | ADD, BRANCH LESS EQUAL (FOR/NEXT) | NOS + TOS ==> TOS, TOS <= NOS ?? IP = IP + OFFSET -| $A8 | DECBRGE | DECREMENT, BRANCH GREATER EQUAL (FOR/NEXT)| TOS - 1 ==> TOS, TOS >= NOS ?? IP = IP + OFFSET -| $AA | SUBBRGE | SUBTRACT, BRANCH GREATER EQUAL (FOR/NEXT) | NOS = TOS ==> TOS, TOS >= NOS :: IP = IP + OFFSET -| $AC | BRAND | BRANCH AND (SHORT CIRCUIT) | TOS == 0 ?? IP = IP + OFFSET :: TOS ==> TOS -| $AE | BROR | BRANCH OR (SHORT CIRCUIT) | TOS <> 0 ?? IP = IP + OFFSET :: TOS ==> TOS -| $B0 | ADDLB | ADD LOCAL BYTE | TOS + FP[LOCAL] ==> TOS -| $B2 | ADDLW | ADD LOCAL WORD | TOS + FP[LOCAL] ==> TOS -| $B4 | ADDAB | ADD ABSOLUTE BYTE | TOS + MEM[ADDR] ==> TOS -| $B6 | ADDAW | ADD ABSOLUTE WORD | TOS + MEM[ADDR] ==> TOS -| $B8 | IDXLB | INDEX WORD BY LOCAL BYTE | TOS + FP[LOCAL] * 2 ==> TOS -| $BA | IDXLW | INDEX WORD BY LOCAL WORD | TOS + FP[LOCAL] * 2 ==> TOS -| $BC | IDXAB | INDEX WORD BY ABSOLUTE BYTE | TOS + MEM[ADDR] * 2 ==> TOS -| $BE | IDXAW | INDEX WORD BY ABSOLUTE WORD | TOS + MEM[ADDR] * 2 ==> TOS -| $C0 | NATV | BACK TO IN-LINE NATIVE CODE | JUMP (IP) +| $00-$1F | CN | Constant Nybble | OPCODE/2 ==> TOS +| $20 | MINUS_ONE | constant -1 | -1 ==> TOS +| $22 | BREQ | Branch EQual | NOS == TOS ?? IP = IP + OFFSET +| $24 | BRNE | Branch Not Equal | NOS <> TOS ?? IP = IP + OFFSET +| $26 | LA | Load Address | ABSOLUTE ADDR ==> TOS +| $28 | LLA | Load Local Address | LOCAL ADDR ==> TOS +| $2A | CB | Constant Byte | CONSTANT BYTE ==> TOS +| $2C | CB | Constant Word | CONSTANT WORD ==> TOS +| $2E | CS | Constant String | STRING ADDR ==> TOS +| $30 | DROP | DROP top value | TOS ==> +| $32 | DROP2 | DROP top 2 values | NOS, TOS ==> +| $34 | DUP | DUPlicate top value | TOS ==> TOS +| $36 | DIVMOD | DIVide & MOD tos,nos | NOS / TOS ==> TOS, NOS % TOS ==> NOS +| $38 | ADDI | ADD Immediate byte | TOS + IMM8 ==> TOS +| $3A | SUBI | SUB Immediate byte | TOS - IMM8 ==> TOS +| $3C | ANDI | AND Immediate byte | TOS & IMM8 ==> TOS +| $3E | ORI | OR Immediate byte | TOS | IMM8 ==> TOS +| $40 | ISEQ | IS nos EQual tos | NOS == TOS ==> TOS +| $42 | ISNE | IS nos Not Equal to tos | NOS <> TOS ==> TOS +| $44 | ISGT | IS nos Greater Than tos | NOS > TOS ==> TOS +| $46 | ISLT | IS nos Less Than tos | NOS < TOS ==> TOS +| $48 | ISGE | IS nos Greater or Equal to tos | NOS >= TOS ==> TOS +| $4A | ISLE | IS nos Less or Equal to tos | NOS <= TOS ==> TOS +| $4C | BRFLS | BRanch FaLSe | TOS == 0 ?? IP = IP + OFFSET +| $4E | BRTRU | BRanch TRUe | TOS <> 0 ?? IP = IP + OFFSET +| $50 | BRNCH | BRaNCH | IP = IP + OFFSET +| $52 | SEL | SELect cases | TOS == CASE ?? IP = IP + OFFSET (FOR ALL CASES) +| $54 | CALL | CALL address | PUSH(IP+2), IP = ADDRESS +| $56 | ICAL | Indirect CALl | PUSH(IP+2), IP = TOS +| $58 | ENTER | ENTER frame size, param count | FP = FP - FRAME SIZE, PARAMS ==> LOCALS +| $5A | LEAVE | LEAVE frame size | FP = FP + FRAME SIZE, IP = PULL() +| $5C | RET | RETurn | IP = PULL() +| $5E | CFFB | Constant $FF Byte | CONSTANT BYTE + $FF00 ==> TOS +| $60 | LB | Load Byte | (TOS) ==> TOS +| $62 | LW | Load Word | (TOS) ==> TOS +| $64 | LLB | Load Local Byte | FP[LOCAL] ==> TOS +| $66 | LLW | Load Local Word | FP[LOCAL] ==> TOS +| $68 | LAB | Load Absolute Byte | MEM[ADDR] ==> TOS +| $6A | LAW | Load Absolute Word | MEM[ADDR] ==> TOS +| $6C | DLB | Duplicate to Local Byte | TOS ==> FP[LOCAL], TOS ==> TOS +| $6E | DLW | Duplicate to Local Word | TOS ==> FP[LOCAL], TOS ==> TOS +| $70 | SB | Store Byte | NOS ==> (TOS) +| $72 | SW | Store Word | NOS ==> (TOS) +| $74 | SLB | Store Local Byte | TOS ==> FP[LOCAL] +| $76 | SLW | Store Local Word | TOS ==> FP[LOCAL] +| $78 | SAB | Store Absolute Byte | TOS ==> MEM[ADDR] +| $7A | SAW | Store Absolute Word | TOS ==> MEM[ADDR] +| $7C | DAB | Duplicate to Absolute Byte | TOS ==> MEM[ADDR], TOS ==> TOS +| $7E | DAW | Duplicate to Absolute Word | TOS ==> MEM[ADDR], TOS ==> TOS +| $80 | NOT | logical NOT | !TOS ==> TOS +| $82 | ADD | ADD nos to tos | NOS + TOS ==> TOS +| $84 | SUB | SUBtract tos from nos | NOS - TOS ==> TOS +| $86 | MUL | MULtiply nos times tos | NOS * TOS ==> TOS +| $88 | DIV | DIVide nos by tos | NOS / TOS ==> TOS +| $8A | MOD | MODulo nos by tos | NOS % TOS ==> TOS +| $8C | INCR | INCRement tos | TOS + 1 ==> TOS +| $8E | DECR | DECRement tos | TOS - 1 ==> TOS +| $90 | NEG | NEGate tos | -TOS ==> TOS +| $92 | COMP | COMPliment tos | ~TOS ==> TOS +| $94 | AND | bitwise AND | NOS & TOS ==> TOS +| $96 | IOR | bitwise Inclusive OR | NOS | TOS ==> TOS +| $98 | XOR | bitwise eXclusive OR | NOS ^ TOS ==> TOS +| $9A | SHL | SHift Left | NOS << TOS ==> TOS +| $9C | SHR | SHift Right | NOS >> TOS ==> TOS +| $9E | IDXW | InDeX Word | TOS * 2 + NOS ==> TOS +| $A0 | BRGT | BRanch GReater than (FOR/NEXT) | TOS > NOS ?? IP = IP + OFFSET +| $A2 | BRLT | BRanch Less Than (FOR/NEXT) | TOS < NOS ?? IP = IP + OFFSET +| $A4 | INCBRLE | INCrement, BRanch Less Equal (FOR/NEXT) | TOS + 1 ==> TOS, TOS <= NOS ?? IP = IP + OFFSET +| $A6 | ADDBRLE | ADD, BRanch Less Equal (FOR/NEXT) | NOS + TOS ==> TOS, TOS <= NOS ?? IP = IP + OFFSET +| $A8 | DECBRGE | DECrement, BRanch Greater Equal (FOR/NEXT)| TOS - 1 ==> TOS, TOS >= NOS ?? IP = IP + OFFSET +| $AA | SUBBRGE | SUBtract, BRanch GReater Equal (FOR/NEXT) | NOS = TOS ==> TOS, TOS >= NOS :: IP = IP + OFFSET +| $AC | BRAND | BRanch AND (SHORT CIRCUIT) | TOS == 0 ?? IP = IP + OFFSET :: TOS ==> TOS +| $AE | BROR | BRanch OR (SHORT CIRCUIT) | TOS <> 0 ?? IP = IP + OFFSET :: TOS ==> TOS +| $B0 | ADDLB | ADD Local Byte | TOS + FP[LOCAL] ==> TOS +| $B2 | ADDLW | ADD Local Word | TOS + FP[LOCAL] ==> TOS +| $B4 | ADDAB | ADD Absolute Byte | TOS + MEM[ADDR] ==> TOS +| $B6 | ADDAW | ADD Absolute Word | TOS + MEM[ADDR] ==> TOS +| $B8 | IDXLB | INDeX word by Local Byte | TOS + FP[LOCAL] * 2 ==> TOS +| $BA | IDXLW | INDeX word by Local Word | TOS + FP[LOCAL] * 2 ==> TOS +| $BC | IDXAB | INDeX word by Absolute Byte | TOS + MEM[ADDR] * 2 ==> TOS +| $BE | IDXAW | INDeX word by Absolute Word | TOS + MEM[ADDR] * 2 ==> TOS +| $C0 | NATV | back to in-line NATiVe code | JUMP (IP) \ No newline at end of file