Commits

Kevin Veroneau committed f58cf10

Adding simple documentation of Op-codes and interrupts to add some explaination to what this does exactly.

Comments (0)

Files changed (2)

+Simple CPU Simulator -- included CPU OP-CODES:
+
+INT:
+  byte-code: 1
+  Next byte should be the interrupt to call.
+  See the sample-interrupts.txt for list of possible interrupts.
+AX:
+  byte-code: 2
+  AX register is set to the next read byte in memory.
+BX:
+  byte-code: 3
+  BX register is set to the next read byte in memory.
+CX:
+  byte-code: 4
+  CX register is set to the next read byte in memory.
+DX:
+  byte-code: 5
+  DX register is set to the next read byte in memory.
+JMP:
+  byte-code: 6
+  Set CPU Memory pointer to the next read byte in memory.
+PUSH:
+  byte-code: 7
+  Store the current CPU Memory pointer for a later use.
+POP:
+  byte-code: 8
+  Restore the previously stored CPU Memory pointer.
+CALL:
+  byte-code: 9
+  PUSHes the next to execute CPU Memory pointer, then performs a JMP using the next read byte.
+CX++:
+  byte-code: 10
+  Increments CX by 1.
+CX--:
+  byte-code: 11
+  Decreases CX by 1.
+ADDCX:
+  byte-code: 12
+  Increments CX by the next read byte.
+SUBCX:
+  byte-code: 13
+  Decreases CX by the next read byte.
+USE:
+  byte-code: 14
+  Sets CX to the byte stored at CPU Memory pointer stored in CX...
+  I know it sounds confusing, and it sort of is.  It's used with the IFs mainly.
+IF=:
+  byte-code: 15
+  If CX equals the value in the next read byte, then set the CPU Memory pointer to DX.
+IF!:
+  byte-code: 16
+  If CX does not equals the value in the next read byte, then set the CPU Memory pointer to DX.

sample-interrupts.txt

+Simple CPU Simulator -- Simple Int table:
+
+INT 1:
+  Terminate current code
+  No Parameters
+INT 2:
+  Screen clearing command
+  Not currently implemented in the Python version.
+INT 3:
+  Print a single character to stdout
+  AX: The Character byte to print.
+INT 4:
+  Screen character coloring command
+  Not currently implemented in the Python version.
+INT 5:
+  CPU Memory copying routine.
+  AX: source
+  BX: destination
+  CX: block size
+INT 6:
+  CPU Memory clearing routine.
+  AX: source
+  CX: size
+INT 7:
+  Persistent storage pointer set.
+  AX: byte position in persistent storage to set read/write pointer to.
+INT 8:
+  Copy bytes from persistent storage into CPU Memory.
+  AX: CPU Memory location to store bytes to.
+  CX: Size of block in bytes.
+INT 9:
+  Copy bytes from CPU Memory into persistent storage.
+  AX: CPU Memory location to read bytes from.
+  CX: Size of block in bytes.
+INT 10:
+  Reads a 0-terminated string of bytes from CPU memory and display it on the screen.
+  AX: source
+INT 11:
+  Reads a single key from the keyboard.
+  Not currently implemented in the Python version.
+INT 12:
+  Read raw input from the keyboard and store it in CPU Memory.
+  AX: CPU Memory location to store text to.
+  Returns CX: Length of string stored.
+
+
+Special INTs to store/retrieve data from shared memory:
+(Unlike CPU memory, executable code cannot run in shared memory)
+
+INT 40:
+  Move bytes from CPU Memory into shared memory.
+  AX: source
+  BX: destination
+  CX: size
+INT 41:
+  Move bytes from shared memory back into CPU memory.
+  AX: source
+  BX: destination
+  CX: size
+INT 42:
+  Save data from shared memory into persistent storage.
+  AX: source
+  CX: size
+INT 43:
+  Load data from persistent storage into shared memory.
+  AX: destination
+  CX: size
+
+
+INT 255:
+  Enter the command/debugger from your running code.
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.