From 7aee439c46bde17aeb2ef4e4b63bd06b725fd157 Mon Sep 17 00:00:00 2001 From: kn0000 Date: Wed, 1 Oct 2025 08:19:41 +0100 Subject: [PATCH] initial commit, not finished, just for backup --- .gitignore | 1 + interpreter | 267 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 268 insertions(+) create mode 100644 .gitignore create mode 100644 interpreter diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..84ead92fb92f8f09800d4c4263f43d4a59c57798 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +*.stt diff --git a/interpreter b/interpreter new file mode 100644 index 0000000000000000000000000000000000000000..94965374e89248c05015cba9624ceec20841ea25 --- /dev/null +++ b/interpreter @@ -0,0 +1,267 @@ +0010000000 imm +0000000000 +0010000000 +0000000000 placeholder addr, will be address of initialisation code +0100000000 jump +0000000000; DENEST +0000000111 seven, addr of next instruction +1110000000 immediate on rs +0010000000 +1110000000 +0000000001 address of lower half of i +1110000101 pop to mem +1110000000 +0010000000 +1110000000 +0000000000 address of upper half of i +1110000101 pop to mem, pop rs to i +0110000000 immediate; NEXT +0010000000 +0110000000 +0000000000 address of upper i +0110000100 push from mem +0110000000 imm +0010000000 +0110000000 +0000000001 low i +0110000100 push; fetch i +0110000111 +0110000111 dup addr +0110000000 imm +0000000010 two +0110001000 clear carry +0010101100 add +0110000000 imm +0010000000 +0110000000 +0000000001 low i +0110000101 pop +0110000000 imm +0000000000 zero +0010101100 add +0110000000 imm +0010000000 +0110000000 +0000000000 high i +0110000101 pop; increment i by two +0110000111 +0110000111 dup addr +0110000000 imm +0000000001 one +0110001000 clc +0010101100 add +0110000011 move stack +0110000000 imm +0000000000 zero +0010101100 add +1110000011 move stack; increment addr +0110000100 push +0110000011 mvstack +0110000100 push +1110000011 mvstack; deref both addrs, fetches wa +0110000000 imm +0010000000 +0110000000 +0010000011 low wa +0110000101 pop +0110000000 imm +0010000000 +0110000000 +0000000010 high wa +0110000101 pop +0110000000 imm; RUN +0010000000 +0110000000 +0000000010 high wa +0110000100 push +0110000000 imm +0010000000 +0110000000 +0000000011 low wa +0110000100 push; fetch wa +0110000111 +0110000111 dup addr +0110000000 imm +0000000010 two +0110001000 clear carry +0010101100 add +0110000011 move stack +0110000000 imm +0000000000 zero +0010101100 add +1110000011 move stack +0110000000 imm +0010000000 +0110000000 +0000000011 low wa +0110000101 pop +0110000000 imm +0010000000 +0110000000 +0000000010 high wa +0110000101 pop; increment wa by two +0110000111 +0110000111 dup addr +0110001000 clear carry +0110000000 imm +0000000001 one +0010101100 add +0110000011 mov stack +0110000000 imm +0000000000 zero +0010101100 add +1110000011 mov stack +0110000100 push +0110000011 mov stack +0110000100 push; deref wa +0100000000 unconditional jump; end of RUN +1110000000 imm; start of NEST +0010000000 +1110000000 +0000000000 high i +1110000100 push +1110000000 imm +0010000000 +1110000000 +0000000001 low i +1110000100 push; push i to return stack +0110000000 imm +0010000000 +0110000000 +0000000010 high wa +0110000100 push +0110000000 imm +0010000000 +0110000000 +0000000000 high i +0110000101 pop +0110000000 imm +0010000000 +0110000000 +0000000011 low wa +0110000100 push +0110000000 imm +0010000000 +0110000000 +0000000001 low i +0110000101 pop; move wa to i +0110000000 imm +0000000000 +0110000000 +0000010001 seventeen, addr of NEXT +0100000000 unconditional jump; end of NEST +0000000111 start of EXECUTE, string +0000001110 E +0000100001 X +0000001110 E +0000001100 C +0000011110 U +0000011101 T +0000001110 E +0000000000 +0000000000 link address; zero to indicate end of dictionary +0000000000 +0010100100 code addr; address of next instruction +0110000000 imm +0010000000 +0110000000 +0000000011 low wa +0110000101 pop +0110000000 imm +0010000000 +0110000000 +0000000010 high wa +0110000101 pop; move address from data stack to wa +0110000000 imm +0000000000 +0110000000 +0001000111 addr of RUN +0100000000 unconditional jump +0110000111 over; start of LONG-DEREF internal subroutine +0110000111 dup addr +0110000000 imm +0000000001 one +0110001000 clr carry +0010101100 add +0110000011 mov stack +0110000000 imm +0000000000 zero +0010101100 add +1110000011 mov stack +0110000100 push +0110000011 mov stack +0110000100 push +1110000011 mov stack +1100000000 jump from return stack; end of LONG-DEREF internal +0000001010 ten; string, start of LONG-DEREF dictionary entry +0000010101 L +0000011000 O +0000010111 N +0000010000 G +0000111101 - +0000001101 D +0000001110 E +0000011011 R +0000001110 E +0000001111 F +0000000000 +0010011000 link addr; links to EXECUTE +0000000000 +0011010010 code addr; next instruction +1110000000 imm +0000000000 +1110000000 +0000010001 addr of NEXT on rs +0110000000 imm +0000000000 +0110000000 +0010110011 addr of LONG-DEREF internal +0100000000 unconditional jump; end of LONG-DEREF +0000001110 fourteen, string; start of REFRESH-SCREEN +0000011011 R +0000001110 E +0000001111 F +0000011011 R +0000001110 E +0000011100 S +0000010001 H +0000111101 - +0000011100 S +0000001100 C +0000011011 R +0000001110 E +0000001110 E +0000010111 N +0000000000 +0011000011 link to LONG-DEREF +0000000000 +0011101110 code address, next instruction +0110000000 imm +0000000001 one +0110000000 imm +0111111111 +0110000000 +1111111111 screen update addr +0110000101 pop; updates screen +0110000000 imm +0000000000 +0110000000 +0000010001 addr of NEXT +0100000000 unconditional jump; end of REFRESH-SCREEN +0000001011 start of MOVE-BUFFER (length from to -- ) +0000010110 M +0000011000 O +0000011111 V +0000001110 E +0000111101 - +0000001011 B +0000011110 U +0000001111 F +0000001111 F +0000001110 E +0000011011 R +0000000000 +0011011011 link to REFRESH-SCREEN +0000000000 +0100001010 code addr +