implemented BRK handling routine (not yet connected to IRQ)

This commit is contained in:
FeralChild64 committed 2019-08-06 20:54:27 +02:00
1 parent 44ca73be40
commit 03bc8b8e78
17 files changed
+51 -29

No files matched your search

+1 -1
View File
@@ -28,7 +28,7 @@
.alias VIC_SP7Y $D00F
.alias VIC_MSIGX $D010
.alias VIC_SCROLLY $D011
.alias VIC_SCROLY $D011
.alias VIC_RASTER $D012
.alias VIC_LPENX $D013
.alias VIC_LPENY $D014
+5
View File
@@ -0,0 +1,5 @@
;; BASIC startup vector
.alias IBASIC_COLD_START $A000
.alias IBASIC_WARM_START $A002
+1 -1
View File
@@ -4,6 +4,6 @@
.macro TARGET_HOOK_BANNER
.byte $05, " OPEN ROMS, ", $00
.byte " OPEN ROMS, ", $00
.macend
@@ -4,6 +4,6 @@
.macro TARGET_HOOK_BANNER
.byte $05, " OPEN ROMS FOR ULTIMATE 64", $0D, $0D, " ", $00
.byte " OPEN ROMS FOR ULTIMATE 64", $0D, $0D, " ", $00
.macend
+5 -2
View File
@@ -10,6 +10,9 @@
cint:
cint_brk: ; entry for BRK and STOP+RESTORE - XXX, where should it start?
jsr setup_vicii
;; Initialise cursor blink flags (Compute's Mapping the 64 p215)
@@ -34,8 +37,8 @@ cint:
stx key_first_repeat_delay
;; Set current colour for text (Compute's Mapping the 64 p215)
ldx #$0e ; light blue by default
stx $0286
ldx #$01 ; default is light blue ($0E), but we use a different one
stx text_colour
;; Set maximum keyboard buffer size (Compute's Mapping the 64 p215)
ldx #10
+3 -4
View File
@@ -1,21 +1,20 @@
;; Clear screen and initialise line link table
;; (Compute's Mapping the 64 p215-216)
clear_screen:
clear_screen:
;; Clear line link table
;; (Compute's Mapping the 64 p215)
lda #$00
ldy #24
clearscreen_l1:
clearscreen_l1:
sta screen_line_link_table,y
dey
bpl clearscreen_l1
;; Y now = #$FF
;; Clear screen RAM.
;; We should do this at HIBASE, which annoyingly
;; is no ZP, so we need to make a vector
+12 -11
View File
@@ -1,19 +1,20 @@
setup_vicii:
setup_vicii:
;; Set up default IO values (Compute's Mapping the 64 p215)
lda #$1b ; Enable text mode
sta $d011
lda #$c8 ; 40 column etc
sta $d016
lda #$1B ; Enable text mode
sta VIC_SCROLY
lda #$C8 ; 40 column etc
sta VIC_SCROLX
;; Compute's Mapping the 64, p156
;; We use a different colour scheme of white text on all blue
lda #$06
sta $D020
sta $D021
sta VIC_EXTCOL
sta VIC_BGCOL0
;; Turn off sprites
;; (observed hanging around after running programs and resetting)
;; Turn off sprites (observed hanging around after running programs and resetting)
lda #$00
sta $D015
sta VIC_SPENA
;;FALLTROUGH
@@ -1,3 +1,4 @@
default_irq_handler:
jsr blink_cursor
File renamed without changes.
File renamed without changes.
@@ -1,7 +1,11 @@
default_nmi_handler:
;; XXX provide real implementation
;; XXX implement according to Compute's Mapping the Commodore 64, page 74
;; XXX check if the source was RESTORE key, quit if it wasn't (no RS-232 support)
;; XXX if cartridge present, enter it through warm start vector
;; XXX if stop pressed, go to default_brk_handler
inc $D020
rti
File renamed without changes.
@@ -1,6 +1,11 @@
default_brk_handler:
;; XXX implement this!
;; Implemented according to Compute's Mapping the Commodore 64, pages 73-74
jsr JRESTOR
jsr JIOINIT
jsr CINT_BRK
jmp (IBASIC_WARM_START)
;; Acknowledge CIA interrupt and return
jmp clear_cia1_interrupt_flag_and_return_from_interrupt
File renamed without changes.
+7 -5
View File
@@ -1,3 +1,4 @@
irq_handler:
;; The IRQ is a commonly messed with thing on the C64,
;; so we need to handle entry points that are commonly
@@ -7,17 +8,18 @@ irq_handler:
;; $EA81 - https://www.lemon64.com/forum/viewtopic.php?t=2112&sid=6ea01982b26da69783120a7923ca46fb
;; Also the $0314 vector is widely used (e.g., https://www.lemon64.com/forum/viewtopic.php?t=2112&sid=6ea01982b26da69783120a7923ca46fb)
;; Save registers
;; Sequence according to Compute's Mapping the 64 p73
;; Save registers, sequence according to Compute's Mapping the Commodore 64, page 73
pha
txa
pha
tya
pha
;; Call interrupt routine
;; (but only if initialised)
;; Call interrupt routine (only if initialised)
lda CINV
ora CINV+1
beq default_irq_handler
bne +
jmp (CINV)
*
;; Vector not initialized - call default interrupt routine
jmp default_irq_handler
+2
View File
@@ -1,5 +1,7 @@
nmi_handler:
;; XXX provide real implementation
jmp (NMINV)