diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..818a25b --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +* +!*.rkt +!old-code +!README.md +!.gitignore diff --git a/README.md b/README.md new file mode 100644 index 0000000..5d66c05 --- /dev/null +++ b/README.md @@ -0,0 +1,51 @@ +# 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