1
0
mirror of https://github.com/catseye/SixtyPical.git synced 2024-06-02 18:41:35 +00:00

Emit externals, jsr, eg that uses Kernal.

This commit is contained in:
Cat's Eye Technologies 2014-04-02 13:39:54 +01:00
parent 9d1b0e8309
commit abe2279b46
4 changed files with 16 additions and 31 deletions

9
eg/hi.60pical Normal file
View File

@ -0,0 +1,9 @@
external chrout 65490
routine main {
lda #72
jsr chrout
lda #73
jsr chrout
lda #13
jsr chrout
}

View File

@ -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
}

View File

@ -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 {
}

View File

@ -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) ++ "'")