Go to file
n loewen 70c00b4869 Remove "implement CCF and CHP" todo-item 2023-07-25 19:06:20 +01:00
readme.md Remove "implement CCF and CHP" todo-item 2023-07-25 19:06:20 +01:00
simulator-sketch.js After running, print a snapshot of memory as it was before running, as well as a snapshot of the final memory state. Also: refactor `log_memory()` into a more generic `log_table_with_title()` 2023-07-25 19:03:47 +01:00

readme.md

Paper computer simulator experiment

TODO

  • Implement carry flag on SUB
  • Write some more complex test programs
  • Consider adding a way to visualize screen memory
  • Do a proper binary version...

Instruction set

0   END
1   STO lit#   ; store ... mem[lit#] <- A
2   STO addr   ; store ... mem[mem[addr]] <- A
3   LDA lit#   ; load  ... A <- lit#
4   LDA addr   ; load  ... A <- mem[addr]
5   ADD lit#   ; add   ... A <- A + lit#      ... and un/set carry flag
6   ADD addr   ; add   ... A <- A + mem[addr] ... and un/set carry flag
7   SUB lit#   ; sub   ... A <- A - lit#      ... and un/set carry flag
8   SUB addr   ; sub   ... A <- A - mem[addr] ... and un/set carry flag
9   HOP lit#   ; hop   ... skip next instruction if A == lit# ... when true: IP <- PC + 2
A   HOP addr   ; hop   ... skip next instruction if A == addr ... when true: IP <- PC + 2
B   JMP lit#   ; jump  ... IP <- lit#
C   JMP addr   ; jump  ... IP <- addr
D   CCF ————   ; clear Carry Flag ... CF = 0
E   CHP ————   ; carry hop ... skip next instruction if Carry Flag is set ... when true: IP <- PC + 2
F

Nice features that didn't fit

  • hop IF< and hop IF>
  • MUL and DIV
  • rotates and shifts

Registers

  • A - accumulator
  • IP - instruction pointer (aka program counter)

Flags

  • CF - carry flag

Memory-mapped peripherals

  • 4x4 display
  • hex keypad (details TBD)
  • ? bank selector (for bank-switching)

Maybe someday

  • timer (for a version in software/electronic-hardware)

Tentative memory map

00-0F - display
10-1F - keypad? (details TBD)
20    - initial value for IP ?
21-FF - free