diff --git a/Makefile b/Makefile index 7e68ac85..4c852918 100644 --- a/Makefile +++ b/Makefile @@ -3,7 +3,7 @@ SRC_COMMON = $(wildcard c64/aliases/*.s) SRC_BASIC_COMMON = $(SRC_COMMON) $(wildcard c64/basic/*.s) -SRC_KERNAL_COMMON = $(SRC_COMMON) $(wildcard c64/kernal/*.s c64/kernal/jumptable/*.s c64/kernal/iec/*.s) +SRC_KERNAL_COMMON = $(SRC_COMMON) $(wildcard c64/kernal/*.s c64/kernal/jumptable/*.s c64/kernal/iec/*.s c64/kernal/interrupts/*.s) SRC_BASIC_generic = $(SRC_BASIC_COMMON) $(wildcard c64/basic/,target_generic/*.s) SRC_BASIC_mega65 = $(SRC_BASIC_COMMON) $(wildcard c64/basic/,target_mega65/*.s) diff --git a/STATUS.md b/STATUS.md index 77ec702d..82d800a3 100644 --- a/STATUS.md +++ b/STATUS.md @@ -25,7 +25,7 @@ The following ROM features are currently missing: * floating point routines * tape support * RS-232 support -* warm start (RUN/STOP + RESTORE) - NMI is not implemented at all +* warm start (RUN/STOP + RESTORE) - NMI/BRK handling is not implemented at all * breaking Kernal routines with RUN/STOP key Features currently being worked on: @@ -73,7 +73,7 @@ NOTE: Even the 'DONE' routines won't support features described as missing in on | `$FF81` | `CINT` | PARTIAL | at least PAL/NTSC detection is missing | | `$FF84` | `IOINIT` | PARTIAL | at least SID volume handling is missing | | `$FF87` | `RAMTAS` | DONE | | -| `$FF8A` | `RESTOR` | PARTIAL | CBINV, NMINV, and USRCMD missing | +| `$FF8A` | `RESTOR` | DONE | | | `$FF8D` | `VECTOR` | DONE | | | `$FF90` | `SETMSG` | DONE | | | `$FF93` | `SECOND` | DONE | | diff --git a/c64/kernal/chkinout.s b/c64/kernal/chkinout_real.s similarity index 98% rename from c64/kernal/chkinout.s rename to c64/kernal/chkinout_real.s index 1075665c..85d7d622 100644 --- a/c64/kernal/chkinout.s +++ b/c64/kernal/chkinout_real.s @@ -11,7 +11,7 @@ ;; CHKIN implementation -chkin: +chkin_real: ;; Store Y for preservation tya @@ -88,11 +88,9 @@ chkinout_file_not_output: tay jmp kernalerror_FILE_NOT_OUTPUT -chkinout_common: - ;; CKOUT implementation -ckout: +ckout_real: ;; Store Y for preservation tya diff --git a/c64/kernal/f20e.chkin.jmp.s b/c64/kernal/f20e.chkin.jmp.s new file mode 100644 index 00000000..bed06f58 --- /dev/null +++ b/c64/kernal/f20e.chkin.jmp.s @@ -0,0 +1,6 @@ + +;; In our implementation CHKIN and CKOUT are closely tied, +;; placing it here would cause a collision + +chkin: + jmp chkin_real diff --git a/c64/kernal/f250.ckout.jmp.s b/c64/kernal/f250.ckout.jmp.s new file mode 100644 index 00000000..671d44bd --- /dev/null +++ b/c64/kernal/f250.ckout.jmp.s @@ -0,0 +1,6 @@ + +;; In our implementation CHKIN and CKOUT are closely tied, +;; placing it here would cause a collision + +ckout: + jmp ckout_real diff --git a/c64/kernal/ea31.default_irq_handler.s b/c64/kernal/interrupts/ea31.default_irq_handler.s similarity index 100% rename from c64/kernal/ea31.default_irq_handler.s rename to c64/kernal/interrupts/ea31.default_irq_handler.s diff --git a/c64/kernal/interrupts/fe47.default_nmi_handler.s b/c64/kernal/interrupts/fe47.default_nmi_handler.s new file mode 100644 index 00000000..be183b26 --- /dev/null +++ b/c64/kernal/interrupts/fe47.default_nmi_handler.s @@ -0,0 +1,8 @@ + +default_nmi_handler: + + ;; XXX provide real implementation + + inc $D020 + rti + diff --git a/c64/kernal/interrupts/fe66.default_brk_handler.s b/c64/kernal/interrupts/fe66.default_brk_handler.s new file mode 100644 index 00000000..54232eeb --- /dev/null +++ b/c64/kernal/interrupts/fe66.default_brk_handler.s @@ -0,0 +1,6 @@ +default_brk_handler: + + ;; XXX implement this! + + ;; Acknowledge CIA interrupt and return + jmp clear_cia1_interrupt_flag_and_return_from_interrupt diff --git a/c64/kernal/irq_handler.s b/c64/kernal/interrupts/irq_handler.s similarity index 100% rename from c64/kernal/irq_handler.s rename to c64/kernal/interrupts/irq_handler.s diff --git a/c64/kernal/interrupts/nmi_handler.s b/c64/kernal/interrupts/nmi_handler.s new file mode 100644 index 00000000..652070f1 --- /dev/null +++ b/c64/kernal/interrupts/nmi_handler.s @@ -0,0 +1,5 @@ + +nmi_handler: + + jmp (NMINV) + diff --git a/c64/kernal/nmi_handler.s b/c64/kernal/nmi_handler.s deleted file mode 100644 index b9531976..00000000 --- a/c64/kernal/nmi_handler.s +++ /dev/null @@ -1,3 +0,0 @@ -nmi_handler: - inc $D020 - rti diff --git a/c64/kernal/vector_defaults.s b/c64/kernal/vector_defaults.s index 9d8c025a..fc35e4ac 100644 --- a/c64/kernal/vector_defaults.s +++ b/c64/kernal/vector_defaults.s @@ -8,19 +8,19 @@ vector_defaults: .word default_irq_handler ;; CINV - .word $0000 ;; CBINV XXX implement this, has to be $FE66 for autostart support - .word $0000 ;; NMINV XXX implement this, has to be $FE47 for autostart support + .word default_brk_handler ;; CBINV + .word default_nmi_handler ;; NMINV - .word open ;; IOPEN - .word close ;; ICLOSE - .word chkin ;; ICHKIN XXX move routine to $F20E - for autostart support - .word ckout ;; ICKOUT XXX move routine to $F250 - for autostart support - .word clrchn ;; ICLRCH - .word chrin ;; IBASIN - .word chrout ;; IBSOUT - .word stop ;; ISTOP - .word getin ;; IGETIN - .word clall ;; ICLALL - .word $0000 ;; USRCMD XXX implement this, has to be $FE66 for autostart support - .word load ;; ILOAD - .word save ;; ISAVE + .word open ;; IOPEN + .word close ;; ICLOSE + .word chkin ;; ICHKIN + .word ckout ;; ICKOUT + .word clrchn ;; ICLRCH + .word chrin ;; IBASIN + .word chrout ;; IBSOUT + .word stop ;; ISTOP + .word getin ;; IGETIN + .word clall ;; ICLALL + .word default_brk_handler ;; USRCMD + .word load ;; ILOAD + .word save ;; ISAVE