diff --git a/README.markdown b/README.markdown index 4dd0fc6..05816cb 100644 --- a/README.markdown +++ b/README.markdown @@ -268,7 +268,6 @@ TODO * Work out the analyses again and document them * `repeat jmp` * Addressing modes; rename instructions to match -* Put data at end, no need for jmp main Tests ----- @@ -483,9 +482,6 @@ We cannot absolute-indexed a word. | ora #8 | ora screen | } - = jmp main - = score: .word 0 - = .alias screen 1024 = main: = lda #4 = ldx #0 @@ -530,6 +526,9 @@ We cannot absolute-indexed a word. = ora #8 = ora screen = rts + = + = score: .word 0 + = .alias screen 1024 | assign word screen 1024 | routine main { @@ -542,8 +541,6 @@ We cannot absolute-indexed a word. | } | sta screen | } - = jmp main - = .alias screen 1024 = main: = lda screen = cmp screen @@ -555,6 +552,8 @@ We cannot absolute-indexed a word. = _past_1: = sta screen = rts + = + = .alias screen 1024 | assign byte screen 1024 | reserve byte zero @@ -567,9 +566,6 @@ We cannot absolute-indexed a word. | } | sty screen | } - = jmp main - = .alias screen 1024 - = zero: .byte 0 = main: = ldy zero = @@ -580,6 +576,9 @@ We cannot absolute-indexed a word. = BNE _repeat_1 = sty screen = rts + = + = .alias screen 1024 + = zero: .byte 0 Nested ifs. @@ -598,7 +597,6 @@ Nested ifs. | lda #3 | } | } - = jmp main = main: = BEQ _label_3 = lda #3 @@ -635,10 +633,6 @@ Installing an interrupt handler (at the Kernal level, i.e. with CINV) | inc screen | jmp save_cinv | } - = jmp main - = .alias screen 1024 - = .alias cinv 788 - = save_cinv: .word 0 = main: = sei = lda cinv @@ -656,3 +650,7 @@ Installing an interrupt handler (at the Kernal level, i.e. with CINV) = inc screen = jmp (save_cinv) = rts + = + = .alias screen 1024 + = .alias cinv 788 + = save_cinv: .word 0 diff --git a/loadngo.sh b/loadngo.sh index 223b2c1..0ab05d1 100755 --- a/loadngo.sh +++ b/loadngo.sh @@ -1,7 +1,7 @@ #!/bin/sh bin/sixtypical emit $1 > tmp.oph || exit 1 -cat lib/basic_head.oph tmp.oph > tmp2.oph +cat lib/basic_header.oph tmp.oph > tmp2.oph || exit 1 ophis tmp2.oph -o tmp.prg || exit 1 x64 tmp.prg rm -f tmp.oph tmp2.oph tmp.prg diff --git a/src/SixtyPical/Emitter.hs b/src/SixtyPical/Emitter.hs index e364b8a..bfaa00d 100644 --- a/src/SixtyPical/Emitter.hs +++ b/src/SixtyPical/Emitter.hs @@ -5,9 +5,8 @@ module SixtyPical.Emitter where import SixtyPical.Model emitProgram p@(Program decls routines) = - " jmp main\n" ++ - emitDecls p decls ++ - emitRoutines p routines + emitRoutines p routines ++ + emitDecls p decls emitDecls _ [] = "" emitDecls p (decl:decls) =