Quantcast
Channel: Timothy Lottes
Viewing all articles
Browse latest Browse all 434

1536-1 : The Programmer Addiction = Feedback

$
0
0
Continuing on the 1536-byte loader based system. Interpreter finished, under the 1536-byte goal. Second major goal is to get to the instant feedback productivity addiction loop going: modify, get feedback, repeat. Have simple ASCII to custom 64-character set encoding converter, and way to include the converter source text starting at sector 3 in the boot loader. First major test, getting an infinite loop or infinite reboot working. Source without any syntax coloring,

\1536-1 --- BOOTUP INTO SPIN OR REBOOT LOOP\

800000, \PUSH BOOT-UP COMPILE POSITION\
BOOT: \STORE IN BOOT WHICH GETS CALLED TO RUN SYSTEM\
FEEBFEEB,/ \WRITE OPCODE TO JUMP TO SELF\
EAEAEAEA,/ \OR WRITE OPCODE TO CRASH ON INVALID INSTRUCTION\
] \END COMPILE - LOADER WILL THEN JMP TO BOOT WORD\
Loader sets up memory with dictionary at 1MB (2MB chunk with 1MB overflow), copies source to 4MB (4MB chunk maximum), then starts the compile position at 8MB (so 8MB and on is the rest of the memory on the system). Had one major bug getting the interpreter up, forgot that \ in NASM results in a line continuation even when in a comment, removing a line of a lookup table resulting in a crash. Tracking down bugs is very easy, add "JMP $" or "db 0xEA" in NASM to hang or reboot respectively.

Adjustments
Adjusted the character syntax.
- - Negate the 64-bit number, add dash to the string.
. - Lookup word in dictionary, and push 64-bit value from word entry onto data stack.
, - Push 64-bit number on data stack.
: - Lookup word in dictionary, pop 64-bit value from data stack to word entry.
; - Lookup word in dictionary, interpret string starting at address stored in word entry.
[ - Lookup word in dictionary, store pointer to source after the [ in the word entry, skip past next ].
] - When un-matched with ], this ends interpretation via RET.
\ - Ignore text until the next \.
/ - Lookup word in dictionary, call to address stored in dictionary entry.
` - Lookup word in dictionary, push address of word on data stack.

Space and every character above except the - char, clear the working word string and number. So , results in pushing a zero on the data stack. And / results in calling the empty word, which I've setup as a word that pops from the data stack and writes a 32-bit word to the compile position, then advances the compile position. This provides the base mechanics to start to create opcodes via manual hand assembly and build out an assembler, which is the topic of the next post...

Viewing all articles
Browse latest Browse all 434

Trending Articles