From 1c30dea63b65c7e117b3fd8ba0140dbf77a0ef73 Mon Sep 17 00:00:00 2001 From: alekseiplusplus Date: Fri, 28 Apr 2023 16:04:35 +1000 Subject: changed dirs --- docs/interpreter.md | 57 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 docs/interpreter.md (limited to 'docs/interpreter.md') diff --git a/docs/interpreter.md b/docs/interpreter.md new file mode 100644 index 0000000..54a6c2a --- /dev/null +++ b/docs/interpreter.md @@ -0,0 +1,57 @@ +# interpreter + +This is a small program intended to help with testing the 6502 CPU, or running programs on it. + +The expected input is machine code written in plaintext. + +The program assumes you will write statements correctly so it doesn't waste time checking that you put four digits in instead of three. If you are using this I assume you know what you are doing. + +The program accepts stdin, so it can be used in two ways. +- Typing instructions inline. +- Piping a file in with cat. + +## Instructions + +To express the syntax of instructions, here are some valid examples to express LDA $01: + + a901 + A901 + A9 01 + +If you downloaded my project on Github, I have included a PDF called `opcodes_reference.pdf` which has a table with every legal opcode in it. + +Statements can be seperated or on a single line. For instance, + + a901 + p + q + +Can be written as + + a901pq + +The only case in which this should be avoided is after an M/m command. + +## Debug Commands + +The interpreter comes with multiple statements for the purpose of debugging the emulator. + +`Q/q` Quits the program. +Will cause segfault at end of file if not used. + +`R/r` Resets the virtual computer. + +`P/p` Dumps processor state. + +`M/m` Prints out memory. +There are two forms which memory can be printed. +The first is `sXX` where `XX` is a memory page. The whole page of memory is printed onto the screen. +The second is `sXXXX` where `XXXX` is a specific address. This prints out the value of the 1 byte requested. +Be aware that unallocated memory will be dumped if it happens to be accessed with this command. Also be aware that there should be a newline directly after this command. + +`S/s` Directly set a piece of memory. +Syntax is strictly of form `sXXXX.xx` where `XXXX` is the address and `xx` is the value. + +`/` Prints until newline. + +`#` Ignores until newline. \ No newline at end of file -- cgit v1.2.3