diff --git a/eg/hi.60pical b/eg/hi.60pical new file mode 100644 index 0000000..6071538 --- /dev/null +++ b/eg/hi.60pical @@ -0,0 +1,9 @@ +external chrout 65490 +routine main { + lda #72 + jsr chrout + lda #73 + jsr chrout + lda #13 + jsr chrout +} diff --git a/eg/sample.60pical b/eg/sample.60pical deleted file mode 100644 index 3927ce4..0000000 --- a/eg/sample.60pical +++ /dev/null @@ -1,12 +0,0 @@ -reserve word score -assign word screen 4000 -routine main { - lda screen - tax - tay - cmp score - ldx score - txa - ldy score - tya -} diff --git a/eg/simple.60pical b/eg/simple.60pical deleted file mode 100644 index 6b9eebf..0000000 --- a/eg/simple.60pical +++ /dev/null @@ -1,19 +0,0 @@ -assign word fnord 4000 -assign byte blerf 4002 - -reserve byte foo -reserve word bar - -routine hello { - lda fnord - cmp blerf - lda foo -} - -routine bye { - lda fnord - cmp bar -} - -routine byee { -} diff --git a/src/SixtyPical/Emitter.hs b/src/SixtyPical/Emitter.hs index 6d13386..6cb9115 100644 --- a/src/SixtyPical/Emitter.hs +++ b/src/SixtyPical/Emitter.hs @@ -24,6 +24,10 @@ emitDecl p (Assign name _ addr) = ".alias " ++ name ++ " " ++ (show addr) emitDecl p (Reserve name Byte) = name ++ ": .byte 0" emitDecl p (Reserve name Word) = name ++ ": .word 0" emitDecl p (Reserve name Vector) = name ++ ": .word 0" +emitDecl p (External name addr) = ".alias " ++ name ++ " " ++ (show addr) +emitDecl p d = error ( + "Internal error: sixtypical doesn't know how to " ++ + "emit assembler code for '" ++ (show d) ++ "'") emitRoutines _ [] = "" emitRoutines p (rout:routs) = @@ -124,6 +128,9 @@ emitInstr p r (COPYROUTINE src (NamedLocation dst)) = emitInstr p r (JMPVECTOR (NamedLocation dst)) = "jmp (" ++ dst ++ ")" +emitInstr p r (JSR routineName) = + "jsr " ++ routineName + emitInstr p r i = error ( "Internal error: sixtypical doesn't know how to " ++ "emit assembler code for '" ++ (show i) ++ "'")