diff --git a/README.markdown b/README.markdown index b3018c9..21571c8 100644 --- a/README.markdown +++ b/README.markdown @@ -198,7 +198,11 @@ No duplicate declarations. | ldy score | tya | } - = .org $c000 + = .org 0 + = .word $0801 + = .org $0801 + = .byte $10, $08, $c9, $07, $9e, $32, $30, $36, $31, $00, $00, $00 + = jmp main = score: .word 0 = .alias screen 4000 = main: diff --git a/eg/sample.60pical b/eg/sample.60pical new file mode 100644 index 0000000..3927ce4 --- /dev/null +++ b/eg/sample.60pical @@ -0,0 +1,12 @@ +reserve word score +assign word screen 4000 +routine main { + lda screen + tax + tay + cmp score + ldx score + txa + ldy score + tya +} diff --git a/loadngo.sh b/loadngo.sh new file mode 100755 index 0000000..413edc4 --- /dev/null +++ b/loadngo.sh @@ -0,0 +1,4 @@ +#!/bin/sh + +bin/sixtypical emit $1 > tmp.oph && ophis tmp.oph -o tmp.prg && x64 tmp.prg +rm -f tmp.oph tmp.prg diff --git a/src/SixtyPical/Emitter.hs b/src/SixtyPical/Emitter.hs index d84d74c..bf2847e 100644 --- a/src/SixtyPical/Emitter.hs +++ b/src/SixtyPical/Emitter.hs @@ -4,8 +4,15 @@ module SixtyPical.Emitter where import SixtyPical.Model +basicHeader = + ".org 0\n" ++ + ".word $0801\n" ++ + ".org $0801\n" ++ + ".byte $10, $08, $c9, $07, $9e, $32, $30, $36, $31, $00, $00, $00\n" ++ + " jmp main\n" + emitProgram p@(Program decls routines) = - ".org $c000\n" ++ + basicHeader ++ emitDecls p decls ++ emitRoutines p routines