2020-06-08 22:52:53 -04:00
# zybino: LR35902ish racket language
very early days for now.
2020-06-09 00:53:59 -04:00
in the racket repl (comments for reader comprehension, remove before running):
2020-06-08 22:52:53 -04:00
```
2020-06-09 00:53:59 -04:00
(run-vm #x150 #x150 #x16 ; start-address, end-memory-view-addr, number-bytes-view
'(#x3E #x69 ; LD A, $69
#x26 #x01 ; LD H, $01
#x2E #x62 ; LD L, $62
#x77 ; LD (HL), A
#x2E #x5B ; LD L, $5B
#x36 #xE6 ; LD (HL), $E6 ($E6 is the opcode for XOR $xx)
#x10 ; STOP (this instruction @ address $015B)
#xF0 ; (non-instruction, will be arg for previous byte)
#x2E #x63 ; LD L, $63
#x77 ; LD (HL), A
#x10 ; STOP
))
2020-06-08 22:52:53 -04:00
```
will evaluate to:
```
2020-06-09 00:53:59 -04:00
PC: $16, SP: $00, Flags: %00000000
2020-06-08 22:52:53 -04:00
BC: $0000, DE: $0000
2020-06-09 00:53:59 -04:00
HL: $0163, AF: $6000
(HL): $60
$0150 > $3e $69 $26 $01 $2e $62 $77 $2e $5b $36 $e6 $e6 $f0 $2e $63 $77 $10 $00 $69 $60 $00 $00 < $0165
2020-06-08 22:52:53 -04:00
```
2020-06-09 00:53:59 -04:00
here we can see the program loaded starting from address `$0150` , including the `XOR` instruction loaded to `$015B` during execution, and the `$69` we loaded to memory, along with the result of `XOR $F0` we loaded to memory, at `$0162` and `$0163` respectively.
2020-06-08 22:52:53 -04:00
2020-06-09 00:53:59 -04:00
## notes
2020-06-08 22:52:53 -04:00
2020-06-09 00:53:59 -04:00
currently supported instructions are:
* `LD [reg], #imm`
* `LD [reg], [reg]`
* `XOR #imm`
* `AND #imm`
* `OR #imm`
* `STOP`
* `NOP`
2020-06-09 00:56:33 -04:00
2020-06-09 00:53:59 -04:00
all other instructions treated as `NOP`