diff --git a/c64/basic/,aliases.s b/c64/basic/,aliases.s index 712e7c35..6b8abe57 100644 --- a/c64/basic/,aliases.s +++ b/c64/basic/,aliases.s @@ -133,6 +133,26 @@ .alias sys_reg_p $30f .alias sys_jmp $310 + ;; Kernal vectors - interrupts + .alias CINV $0314 + .alias CBINV $0316 + .alias NMINV $0318 + + ;; Kernal vectors - routines + .alias IOPEN $031A + .alias ICLOSE $031C + .alias ICHKIN $031E + .alias ICKOUT $0320 + .alias ICLRCH $0322 + .alias IBASIN $0324 + .alias IBASOUT $0326 + .alias ISTOP $0328 + .alias IGETIN $032A + .alias ICLALL $032C + .alias USRCMD $032E + .alias ILOAD $0330 + .alias ISAVE $0331 + ;; BASIC uses some extra bytes for memory access under ROMs located at $2A7 onwards ;; IRQs are disabled when doing such accesses, and a default NMI handler only increments ;; a counter, so that if an NMI occurs, it doesn't crash the machine, but can be captured. diff --git a/c64/basic/wedge_dos.s b/c64/basic/wedge_dos.s index 9616eb6d..f60582e8 100644 --- a/c64/basic/wedge_dos.s +++ b/c64/basic/wedge_dos.s @@ -4,7 +4,7 @@ wedge_dos: ;; Close all the channels, so that wedge has full control - jsr $FFE7 ; XXX jump via ICLALL + jsr (ICLALL) ;; Take last device number, make sure it's a drive ;; If not, set to 8 (first drive number) diff --git a/c64/kernal/,aliases.s b/c64/kernal/,aliases.s index 4dc694f1..47ca4cc8 100644 --- a/c64/kernal/,aliases.s +++ b/c64/kernal/,aliases.s @@ -76,6 +76,26 @@ .alias screen_scroll_disable $0292 .alias pal_or_ntsc $02A6 + ;; Kernal vectors - interrupts + .alias CINV $0314 + .alias CBINV $0316 + .alias NMINV $0318 + + ;; Kernal vectors - routines + .alias IOPEN $031A + .alias ICLOSE $031C + .alias ICHKIN $031E + .alias ICKOUT $0320 + .alias ICLRCH $0322 + .alias IBASIN $0324 + .alias IBASOUT $0326 + .alias ISTOP $0328 + .alias IGETIN $032A + .alias ICLALL $032C + .alias USRCMD $032E + .alias ILOAD $0330 + .alias ISAVE $0331 + ;; Under-ROM routines ;; (BASIC also includes them. XXX - We should de-duplicate them in a safe manner) .alias missed_nmi_flag $2A7 @@ -84,5 +104,3 @@ .alias poke_under_roms tiny_nmi_handler+poke_under_roms_routine-tiny_nmi_handler_routine .alias memmap_allram tiny_nmi_handler+memmap_allram_routine-tiny_nmi_handler_routine .alias memmap_normal tiny_nmi_handler+memmap_normal_routine-tiny_nmi_handler_routine - - diff --git a/c64/kernal/clall.s b/c64/kernal/clall.s new file mode 100644 index 00000000..3a701b3d --- /dev/null +++ b/c64/kernal/clall.s @@ -0,0 +1,2 @@ +clall: + rts diff --git a/c64/kernal/close_all_files.s b/c64/kernal/close_all_files.s deleted file mode 100644 index c0555315..00000000 --- a/c64/kernal/close_all_files.s +++ /dev/null @@ -1,2 +0,0 @@ -close_all_files: - rts diff --git a/c64/kernal/ffe7.s b/c64/kernal/ffe7.s index d333af55..03e1725f 100644 --- a/c64/kernal/ffe7.s +++ b/c64/kernal/ffe7.s @@ -1,3 +1,3 @@ ; $FFE7 - Close all files vector ; (http://codebase64.org/doku.php?id=base:kernalreference) - jmp close_all_files + jmp clall diff --git a/c64/kernal/restor.s b/c64/kernal/restor.s index 0844288b..8b26484a 100644 --- a/c64/kernal/restor.s +++ b/c64/kernal/restor.s @@ -1,3 +1,42 @@ ; Function defined on pp272-273 of C64 Programmers Reference Guide restor: + + ;; According to 'Compute's Mapping the Commodore 64' p237 this resets 15 vectors + ;; placed starting from $0314 + + ;; XXX simplify this implementation when vector is implemented + + ;; Make sure the IRQ is disabled - better safe than sorry + php + cli + + ;; Copy vectors in a loop + ldx #$1F +* + lda restor_def_arr, x + sta CINV, x + dex + bpl - + + ;; Restore status register before return + plp rts + +restor_def_arr: + .word $0000 ;; CINV XXX implement this + .word $0000 ;; CBINV XXX implement this + .word $0000 ;; NMINV XXX implement this + + .word open ;; IOPEN + .word close ;; ICLOSE + .word chkin ;; ICHKIN + .word chkout ;; ICKOUT + .word clrchn ;; ICLRCH + .word chrin ;; IBASIN + .word chrout ;; IBASOUT + .word stop ;; ISTOP + .word getin ;; IGETIN + .word clall ;; ICLALL + .word $0000 ;; USRCMD XXX implement this + .word load ;; ILOAD + .word save ;; ISAVE diff --git a/c64/kernal/vector.s b/c64/kernal/vector.s index 8b296793..cacc606f 100644 --- a/c64/kernal/vector.s +++ b/c64/kernal/vector.s @@ -1,3 +1,6 @@ ; Function defined on pp272-273 of C64 Programmers Reference Guide vector: + + ;; XXX adapt restor when this is implemented + rts