diff options
author | alekseiplusplus <alekseijeaves@protonmail.com> | 2023-04-28 16:04:35 +1000 |
---|---|---|
committer | alekseiplusplus <alekseijeaves@protonmail.com> | 2023-04-28 16:04:35 +1000 |
commit | 1c30dea63b65c7e117b3fd8ba0140dbf77a0ef73 (patch) | |
tree | 550e05feeace48ff4da53726d306df7b2389d7b7 /docs/interpreter.md | |
parent | eae92c43e1397d05a01050cc6fdb71c000eb22bb (diff) |
changed dirs
Diffstat (limited to 'docs/interpreter.md')
-rw-r--r-- | docs/interpreter.md | 57 |
1 files changed, 57 insertions, 0 deletions
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 |