lr35902ish racket
Go to file
2020-06-09 14:52:53 +12:00
old-code first commit 2020-06-09 14:50:42 +12:00
.gitignore unignored readme 2020-06-09 14:52:53 +12:00
README.md unignored readme 2020-06-09 14:52:53 +12:00
vm.rkt first commit 2020-06-09 14:50:42 +12:00

zybino: LR35902ish racket language

very early days for now.

in the racket repl:

 (run-lines (list
  (8b-ld-reg-imm 4 #x01)
  (8b-ld-reg-imm 5 #x50)
  (8b-ld-reg-imm 7 #x69)
  (8b-ld-reg-reg 6 7)
  (8b-ld-reg-reg 7 4)
  (8b-ld-reg-imm 5 #x51)
  (8b-ld-reg-reg 6 7)))

will evaluate to:

PC: $07, SP: $00, Flags: %00000000
BC: $0000, DE: $0000
HL: $0151, AF: $0100
(HL): $01
$0150 > $69 $01 $00 $00 $00 $00 $00 $00 $00 $00 $00 $00 $00 $00 $00 $00 < $0160

which is the equivilent of:

LD H, $01
LD L, $50
LD A, $69
LD (HL), A
LD A, H
LD L, $51
LD (HL), A

notes

register numbering is following how the LR35902 decodes instructions, as such:

  • 0: B
  • 1: C
  • 2: D
  • 3: E
  • 4: H
  • 5: L
  • 6: (HL)
  • 7: A