52 lines
755 B
Markdown
52 lines
755 B
Markdown
|
# 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
|