1
0
mirror of https://github.com/catseye/SixtyPical.git synced 2024-06-26 16:29:28 +00:00

Wow, we have an interrupt handler. Well, a cinv. Good enough!

This commit is contained in:
Cat's Eye Technologies 2014-04-01 22:05:02 +01:00
parent c441f96921
commit cb0fe91a8a
3 changed files with 49 additions and 4 deletions

View File

@ -559,4 +559,28 @@ Installing an interrupt handler (at the Kernal level, i.e. with CINV)
| inc screen
| jmp save_cinv
| }
= story checks out
= .org 0
= .word $0801
= .org $0801
= .byte $10, $08, $c9, $07, $9e, $32, $30, $36, $31, $00, $00, $00
= jmp main
= .alias screen 1024
= .alias cinv 788
= save_cinv: .word 0
= main:
= sei
= lda cinv
= sta save_cinv
= lda cinv+1
= sta save_cinv+1
= lda #<our_cinv
= sta cinv
= lda #>our_cinv
= sta cinv+1
= cli
= rts
=
= our_cinv:
= inc screen
= jmp (save_cinv)
= rts

15
eg/cinv.60pical Normal file
View File

@ -0,0 +1,15 @@
assign byte screen 1024
assign vector cinv 788
reserve vector save_cinv
routine main {
sei {
copy vector cinv to save_cinv
copy routine our_cinv to cinv
}
}
routine our_cinv {
inc screen
jmp save_cinv
}

View File

@ -89,13 +89,19 @@ emitInstr p r (REPEAT iid branch blk) =
emitInstr p r (SEI blk) =
"sei\n" ++
emitInstrs p r blk ++
"cli"
" cli"
emitInstr p r (COPYVECTOR (NamedLocation src) (NamedLocation dst)) =
"COPYVECTOR " ++ src ++ " " ++ dst
"lda " ++ src ++ "\n" ++
" sta " ++ dst ++ "\n" ++
" lda " ++ src ++ "+1\n" ++
" sta " ++ dst ++ "+1"
emitInstr p r (COPYROUTINE src (NamedLocation dst)) =
"COPYROUTINE " ++ src ++ " " ++ dst
"lda #<" ++ src ++ "\n" ++
" sta " ++ dst ++ "\n" ++
" lda #>" ++ src ++ "\n" ++
" sta " ++ dst ++ "+1"
emitInstr p r (JMPVECTOR (NamedLocation dst)) =
"jmp (" ++ dst ++ ")"