git @ Cat's Eye Technologies SixtyPical / cb0fe91
Wow, we have an interrupt handler. Well, a cinv. Good enough! Cat's Eye Technologies 8 years ago
3 changed file(s) with 49 addition(s) and 4 deletion(s). Raw diff Collapse all Expand all
558558 | inc screen
559559 | jmp save_cinv
560560 | }
561 = story checks out
561 = .org 0
562 = .word $0801
563 = .org $0801
564 = .byte $10, $08, $c9, $07, $9e, $32, $30, $36, $31, $00, $00, $00
565 = jmp main
566 = .alias screen 1024
567 = .alias cinv 788
568 = save_cinv: .word 0
569 = main:
570 = sei
571 = lda cinv
572 = sta save_cinv
573 = lda cinv+1
574 = sta save_cinv+1
575 = lda #<our_cinv
576 = sta cinv
577 = lda #>our_cinv
578 = sta cinv+1
579 = cli
580 = rts
581 =
582 = our_cinv:
583 = inc screen
584 = jmp (save_cinv)
585 = rts
0 assign byte screen 1024
1 assign vector cinv 788
2 reserve vector save_cinv
3
4 routine main {
5 sei {
6 copy vector cinv to save_cinv
7 copy routine our_cinv to cinv
8 }
9 }
10
11 routine our_cinv {
12 inc screen
13 jmp save_cinv
14 }
8888 emitInstr p r (SEI blk) =
8989 "sei\n" ++
9090 emitInstrs p r blk ++
91 "cli"
91 " cli"
9292
9393 emitInstr p r (COPYVECTOR (NamedLocation src) (NamedLocation dst)) =
94 "COPYVECTOR " ++ src ++ " " ++ dst
94 "lda " ++ src ++ "\n" ++
95 " sta " ++ dst ++ "\n" ++
96 " lda " ++ src ++ "+1\n" ++
97 " sta " ++ dst ++ "+1"
9598
9699 emitInstr p r (COPYROUTINE src (NamedLocation dst)) =
97 "COPYROUTINE " ++ src ++ " " ++ dst
100 "lda #<" ++ src ++ "\n" ++
101 " sta " ++ dst ++ "\n" ++
102 " lda #>" ++ src ++ "\n" ++
103 " sta " ++ dst ++ "+1"
98104
99105 emitInstr p r (JMPVECTOR (NamedLocation dst)) =
100106 "jmp (" ++ dst ++ ")"