From 2b6dfe97a29c333da01319899ab6f77892dd02c3 Mon Sep 17 00:00:00 2001 From: neauoire Date: Thu, 9 Nov 2023 20:17:29 -0800 Subject: [PATCH] Created defined for BCB trits --- src/gyoasm.c | 8 ++++---- src/tern.c | 6 +++--- src/tern.h | 4 ++++ 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/gyoasm.c b/src/gyoasm.c index a555ebc..6c2d026 100644 --- a/src/gyoasm.c +++ b/src/gyoasm.c @@ -83,15 +83,15 @@ asmtoken(char *token) Label *l; uc15 opc; /* word */ - if((l = findlabel(token))) return (intuc15(l->addr) << 4) | 0x1; + if((l = findlabel(token))) return (intuc15(l->addr) << 4) | 0x0 | 0x1; /* jump */ switch(token[0]) { case '#': /* LIT */ return (hepuc15(token) << 2) | 0x2; - case '>': /* JMP */ return (l = findlabel(token + 1)) ? (intuc15(l->addr) << 4) | 0x9 : error("Missing label", token); - case '?': /* JCN */ return (l = findlabel(token + 1)) ? (intuc15(l->addr) << 4) | 0x5 : error("Missing label", token); + case '>': /* JMP */ return (l = findlabel(token + 1)) ? (intuc15(l->addr) << 4) | 0x8 | 0x1 : error("Missing label", token); + case '?': /* JCN */ return (l = findlabel(token + 1)) ? (intuc15(l->addr) << 4) | 0x4 | 0x1 : error("Missing label", token); } /* opcode */ - opc = hepuc15("00MIL"); // blank OPC with signed flags + opc = hepuc15("00MIL") | 0x0; // 00 00 00 00 00 00 01 01 01 01 00 00 01 01 00 while((c = *token++)) { switch(c) { case ';': opc &= ~(3 << 12); /* fall-through */ diff --git a/src/tern.c b/src/tern.c index 761a6cf..108952b 100644 --- a/src/tern.c +++ b/src/tern.c @@ -51,9 +51,9 @@ bc3 tribc1(char c) { switch(c) { - case '+': return 0x1; - case '0': return 0x0; - case '-': return 0x3; + case '+': return BCP; + case '0': return BCZ; + case '-': return BCM; } return 0x2; } diff --git a/src/tern.h b/src/tern.h index 8efad3f..f42fa7e 100644 --- a/src/tern.h +++ b/src/tern.h @@ -11,6 +11,10 @@ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE. */ +#define BCP 0x1 +#define BCZ 0x0 +#define BCM 0x3 + typedef uint32_t bc15; typedef uint32_t uc15; typedef uint_fast8_t bc3; -- 2.45.2