From d5d6581901193bf042beae79b3288ead20b0e167 Mon Sep 17 00:00:00 2001 From: FeralChild64 Date: Mon, 5 Aug 2019 18:08:15 +0200 Subject: [PATCH 01/21] jump table now uses vectors in RAM --- c64/basic/ab1e.print_string.s | 2 +- c64/basic/basic_cold_start.s | 2 +- c64/basic/basic_do_error.s | 10 +++---- c64/basic/basic_main_loop.s | 2 +- c64/basic/cmd_break.s | 2 +- c64/basic/cmd_list.s | 8 +++--- c64/basic/cmd_load.s | 5 ++-- c64/basic/print_integer.s | 2 +- c64/basic/print_packed_message.s | 10 +++---- c64/basic/printf.s | 6 ++--- c64/basic/via_vector.s | 42 ----------------------------- c64/basic/wedge_dos.s | 30 ++++++++++----------- c64/kernal/jumptable/ffc0.jopen.s | 3 ++- c64/kernal/jumptable/ffc3.jclose.s | 3 ++- c64/kernal/jumptable/ffc6.jchkin.s | 3 ++- c64/kernal/jumptable/ffc9.jckout.s | 3 ++- c64/kernal/jumptable/ffcc.jclrchn.s | 3 ++- c64/kernal/jumptable/ffcf.jchrin.s | 3 ++- c64/kernal/jumptable/ffd2.jchrout.s | 3 ++- c64/kernal/jumptable/ffe1.jstop.s | 3 ++- c64/kernal/jumptable/ffe4.jgetin.s | 3 ++- c64/kernal/jumptable/ffe7.jclall.s | 3 ++- c64/kernal/vector.s | 21 --------------- strings/036C1C036C | 3 --- strings/036C1E036C | 3 --- strings/036C20036C | 3 --- strings/036C22036C | 3 --- strings/036C24036C | 3 --- strings/036C2603 | 3 --- strings/036C2A036C | 4 --- strings/036C2C03 | 3 --- strings/6C1A036C | 3 --- 32 files changed, 60 insertions(+), 140 deletions(-) delete mode 100644 c64/basic/via_vector.s delete mode 100644 strings/036C1C036C delete mode 100644 strings/036C1E036C delete mode 100644 strings/036C20036C delete mode 100644 strings/036C22036C delete mode 100644 strings/036C24036C delete mode 100644 strings/036C2603 delete mode 100644 strings/036C2A036C delete mode 100644 strings/036C2C03 delete mode 100644 strings/6C1A036C diff --git a/c64/basic/ab1e.print_string.s b/c64/basic/ab1e.print_string.s index 83f8d366..0ea252a3 100644 --- a/c64/basic/ab1e.print_string.s +++ b/c64/basic/ab1e.print_string.s @@ -20,7 +20,7 @@ print_string_loop: lda (temp_string_ptr),y beq print_string_end - jsr via_IBSOUT + jsr JCHROUT txa tay diff --git a/c64/basic/basic_cold_start.s b/c64/basic/basic_cold_start.s index 325bd1ed..341e0909 100644 --- a/c64/basic/basic_cold_start.s +++ b/c64/basic/basic_cold_start.s @@ -29,7 +29,7 @@ startup_banner: jsr print_integer lda #$20 - jsr via_IBSOUT + jsr JCHROUT ;; Print the rest of the start up message ldx #34 diff --git a/c64/basic/basic_do_error.s b/c64/basic/basic_do_error.s index 92d7e46d..731f99c2 100644 --- a/c64/basic/basic_do_error.s +++ b/c64/basic/basic_do_error.s @@ -7,9 +7,9 @@ basic_do_error: ;; Print ? at start lda #$0d - jsr via_IBSOUT + jsr JCHROUT lda #$3f - jsr via_IBSOUT + jsr JCHROUT ;; Print main part of error message pla @@ -18,7 +18,7 @@ basic_do_error: ;; Print ERROR at end lda #$20 - jsr via_IBSOUT + jsr JCHROUT ldx #33 jsr print_packed_message @@ -27,9 +27,9 @@ basic_do_error: ;; XXX print line number if not in direct mode lda #$0d - jsr via_IBSOUT + jsr JCHROUT lda #$0d - jsr via_IBSOUT + jsr JCHROUT ;; Reset stack, and go back to main loop ldx #$fe diff --git a/c64/basic/basic_main_loop.s b/c64/basic/basic_main_loop.s index 2d7afdd6..69e12c9d 100644 --- a/c64/basic/basic_main_loop.s +++ b/c64/basic/basic_main_loop.s @@ -52,7 +52,7 @@ rsl_l1: lda $0200,x * ;; Do printing of the new line lda #$0d - jsr via_IBSOUT + jsr JCHROUT ;; Ignore empty lines lda tokenise_work1 diff --git a/c64/basic/cmd_break.s b/c64/basic/cmd_break.s index 31194132..36128422 100644 --- a/c64/basic/cmd_break.s +++ b/c64/basic/cmd_break.s @@ -17,7 +17,7 @@ basic_do_break: * lda #$0d - jsr via_IBSOUT + jsr JCHROUT cmd_end: jmp basic_main_loop diff --git a/c64/basic/cmd_list.s b/c64/basic/cmd_list.s index a1be1724..72e9edd9 100644 --- a/c64/basic/cmd_list.s +++ b/c64/basic/cmd_list.s @@ -42,7 +42,7 @@ list_single_line: ; entry point needed by DOS wedge pla jsr print_integer lda #$20 - jsr via_IBSOUT + jsr JCHROUT ;; Iterate through printing out the line ;; contents @@ -111,16 +111,16 @@ list_not_rem: bne list_print_loop list_is_literal: - jsr via_IBSOUT + jsr JCHROUT iny bne list_print_loop list_end_of_line: ;; Clear reverse flag lda #$92 - jsr via_IBSOUT + jsr JCHROUT ;; Print end of line lda #$0d - jsr via_IBSOUT + jsr JCHROUT rts diff --git a/c64/basic/cmd_load.s b/c64/basic/cmd_load.s index dc900c54..ac286c6e 100644 --- a/c64/basic/cmd_load.s +++ b/c64/basic/cmd_load.s @@ -191,6 +191,7 @@ end_of_line_search: pla sta basic_current_line_ptr+0 - - jmp basic_relink_loop + +via_ILOAD: + jmp (ILOAD) diff --git a/c64/basic/print_integer.s b/c64/basic/print_integer.s index 7e897243..f5d93fa7 100644 --- a/c64/basic/print_integer.s +++ b/c64/basic/print_integer.s @@ -115,7 +115,7 @@ found_start_of_number: ;; Print digits * lda $0100,y ora #$30 - jsr via_IBSOUT + jsr JCHROUT iny cpy #5 bne - diff --git a/c64/basic/print_packed_message.s b/c64/basic/print_packed_message.s index 7aac0876..006bf70e 100644 --- a/c64/basic/print_packed_message.s +++ b/c64/basic/print_packed_message.s @@ -38,7 +38,7 @@ found_message_in_token_stream: beq + jsr print_packed_word lda #$20 - jsr via_IBSOUT + jsr JCHROUT pla tay iny @@ -47,7 +47,7 @@ found_message_in_token_stream: pla ;; Rub out space at the end lda #$14 - jsr via_IBSOUT + jsr JCHROUT rts print_packed_word: @@ -144,7 +144,7 @@ next_packed_word_char: ;; X=1-14 = first 14 chars, so subtract one lda packed_message_chars-1,x - jsr via_IBSOUT + jsr JCHROUT ;; See if there is a char in the low nybl to print pla @@ -171,7 +171,7 @@ has_nybl: ;; X=1-14 = first 14 chars, so subtract one lda packed_message_chars-1,x - jsr via_IBSOUT + jsr JCHROUT * pla tay @@ -207,7 +207,7 @@ unpack_literal_char: tya pha lda (temp_string_ptr),y - jsr via_IBSOUT + jsr JCHROUT pla tay rts diff --git a/c64/basic/printf.s b/c64/basic/printf.s index 85fa0cf8..ceb4337b 100644 --- a/c64/basic/printf.s +++ b/c64/basic/printf.s @@ -112,7 +112,7 @@ not_hexword: not_pointer: ;; Print character - jsr via_IBSOUT + jsr JCHROUT printf_nextchar: jsr printf_advance @@ -148,11 +148,11 @@ printf_printhexbyte: cmp #$3A bcc + adc #6 -* jsr via_IBSOUT +* jsr JCHROUT pla and #$0f ora #$30 cmp #$3A bcc + adc #6 -* jmp via_IBSOUT +* jmp JCHROUT diff --git a/c64/basic/via_vector.s b/c64/basic/via_vector.s deleted file mode 100644 index 3cfc7480..00000000 --- a/c64/basic/via_vector.s +++ /dev/null @@ -1,42 +0,0 @@ - -;; -;; Helper routines for jumping via vectors, to be used with JSR -;; -;; Note: they are not in the order of low memory vectors, to avoid -;; similarity with the original ROMs - -via_ISAVE: - jmp (ISAVE) - -via_ILOAD: - jmp (ILOAD) - -via_ICLOSE: - jmp (ICLOSE) - -via_IOPEN: - jmp (IOPEN) - -via_ICHKIN: - jmp (ICHKIN) - -via_IBASIN: - jmp (IBASIN) - -via_IGETIN: - jmp (IGETIN) - -via_ICKOUT: - jmp (ICKOUT) - -via_IBSOUT: - jmp (IBSOUT) - -via_ICLRCH: - jmp (ICLRCH) - -via_ICLALL: - jmp (ICLALL) - -via_ISTOP: - jmp (ISTOP) diff --git a/c64/basic/wedge_dos.s b/c64/basic/wedge_dos.s index e147e9fe..ccfffe4d 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 via_ICLALL + jsr JCLALL ;; Set file parameters, channel 15 is a typical one for commands jsr select_device ; sets X register @@ -41,11 +41,11 @@ wedge_dos_command: jsr wedge_dos_setnam jsr JSETNAM - jsr via_IOPEN + jsr JOPEN bcs wedge_dos_basic_error ;; Retrieve status, print it if not OK - jsr via_ICLALL + jsr JCLALL jsr wedge_dos_status_get lda BUF+0 cmp #$30 ; '0' @@ -82,12 +82,12 @@ wedge_dos_status_get: ;; Set remaining file parameters, open the channel lda #$00 ; empty file name jsr JSETNAM - jsr via_IOPEN + jsr JOPEN bcs wedge_dos_basic_error ;; Set channel for input ldx #$0F - jsr via_ICHKIN + jsr JCHKIN bcs wedge_dos_basic_error ldy #$00 @@ -98,7 +98,7 @@ wedge_dos_status_get: ;; XXX error in case of status != EOF ;; Print out everything retrieved from the drive bne + - jsr via_IBASIN + jsr JCHRIN bcs wedge_dos_basic_error sta BUF, y iny @@ -118,7 +118,7 @@ wedge_dos_status_print: dey bmi + lda BUF, x - jsr via_IBSOUT + jsr JCHROUT inx bne - * @@ -139,18 +139,18 @@ wedge_dos_directory: jsr wedge_dos_setnam ;; Open the file - jsr via_IOPEN + jsr JOPEN bcs wedge_dos_basic_error ;; Set channel for file reading ldx #$00 - jsr via_ICHKIN + jsr JCHKIN bcs wedge_dos_basic_error ;; Ignore start address (2 first bytes) - XXX check for errors - jsr via_IBASIN + jsr JCHRIN bcs wedge_dos_basic_error - jsr via_IBASIN + jsr JCHRIN bcs wedge_dos_basic_error wedge_dos_directory_line: @@ -159,7 +159,7 @@ wedge_dos_directory_line: ldy #$FF * iny - jsr via_IBASIN + jsr JCHRIN bcs wedge_dos_basic_error sta BUF, y cpy #$50 @@ -199,15 +199,15 @@ wedge_dos_directory_display: ;; FALLTROUGH wedge_dos_clean_exit: - jsr via_ICLALL + jsr JCLALL ;; Print new line lda #$0D - jsr via_IBSOUT + jsr JCHROUT jmp basic_end_of_line wedge_dos_basic_error: pha - jsr via_ICLALL + jsr JCLALL pla tax dex diff --git a/c64/kernal/jumptable/ffc0.jopen.s b/c64/kernal/jumptable/ffc0.jopen.s index 58339e6b..7aafbb7e 100644 --- a/c64/kernal/jumptable/ffc0.jopen.s +++ b/c64/kernal/jumptable/ffc0.jopen.s @@ -1,3 +1,4 @@ ; open a logical file ; C64 Programmer's Reference Guide Page 272 - jmp open +; According to Compute's Mapping the Commodore 64 (pages 74/75), this jump is indirect + jmp (IOPEN) diff --git a/c64/kernal/jumptable/ffc3.jclose.s b/c64/kernal/jumptable/ffc3.jclose.s index c4b44418..b59159d3 100644 --- a/c64/kernal/jumptable/ffc3.jclose.s +++ b/c64/kernal/jumptable/ffc3.jclose.s @@ -1,3 +1,4 @@ ; close a specified logical file ; C64 Programmer's Reference Guide Page 272 - jmp close +; According to Compute's Mapping the Commodore 64 (pages 74/75), this jump is indirect + jmp (ICLOSE) diff --git a/c64/kernal/jumptable/ffc6.jchkin.s b/c64/kernal/jumptable/ffc6.jchkin.s index 842faeb9..da8948c7 100644 --- a/c64/kernal/jumptable/ffc6.jchkin.s +++ b/c64/kernal/jumptable/ffc6.jchkin.s @@ -1,3 +1,4 @@ ; Open channel for input ; C64 Programmer's Reference Guide Page 272 - jmp chkin +; According to Compute's Mapping the Commodore 64 (pages 74/75), this jump is indirect + jmp (ICHKIN) diff --git a/c64/kernal/jumptable/ffc9.jckout.s b/c64/kernal/jumptable/ffc9.jckout.s index ccfe9a2f..f394d46d 100644 --- a/c64/kernal/jumptable/ffc9.jckout.s +++ b/c64/kernal/jumptable/ffc9.jckout.s @@ -1,3 +1,4 @@ ; Open channel for output ; C64 Programmer's Reference Guide Page 272 - jmp ckout +; According to Compute's Mapping the Commodore 64 (pages 74/75), this jump is indirect + jmp (ICKOUT) diff --git a/c64/kernal/jumptable/ffcc.jclrchn.s b/c64/kernal/jumptable/ffcc.jclrchn.s index 174f0557..9fb7697c 100644 --- a/c64/kernal/jumptable/ffcc.jclrchn.s +++ b/c64/kernal/jumptable/ffcc.jclrchn.s @@ -1,3 +1,4 @@ ; close input and output channels ; C64 Programmer's Reference Guide Page 272 - jmp clrchn +; According to Compute's Mapping the Commodore 64 (pages 74/75), this jump is indirect + jmp (ICLRCH) diff --git a/c64/kernal/jumptable/ffcf.jchrin.s b/c64/kernal/jumptable/ffcf.jchrin.s index d2952a23..465ac6b8 100644 --- a/c64/kernal/jumptable/ffcf.jchrin.s +++ b/c64/kernal/jumptable/ffcf.jchrin.s @@ -1,3 +1,4 @@ ; Input character from channel ; C64 Programmer's Reference Guide Page 272 - jmp chrin +; According to Compute's Mapping the Commodore 64 (pages 74/75), this jump is indirect + jmp (IBASIN) diff --git a/c64/kernal/jumptable/ffd2.jchrout.s b/c64/kernal/jumptable/ffd2.jchrout.s index 816a6ece..318b26cf 100644 --- a/c64/kernal/jumptable/ffd2.jchrout.s +++ b/c64/kernal/jumptable/ffd2.jchrout.s @@ -1,3 +1,4 @@ ; Output character to channel ; C64 Programmer's Reference Guide Page 272 - jmp chrout +; According to Compute's Mapping the Commodore 64 (pages 74/75), this jump is indirect + jmp (IBSOUT) diff --git a/c64/kernal/jumptable/ffe1.jstop.s b/c64/kernal/jumptable/ffe1.jstop.s index c9c13712..e5b6c4ec 100644 --- a/c64/kernal/jumptable/ffe1.jstop.s +++ b/c64/kernal/jumptable/ffe1.jstop.s @@ -1,3 +1,4 @@ ; Scan stop key ; C64 Programmer's Reference Guide Page 273 - jmp stop +; According to Compute's Mapping the Commodore 64 (pages 74/75), this jump is indirect + jmp (ISTOP) diff --git a/c64/kernal/jumptable/ffe4.jgetin.s b/c64/kernal/jumptable/ffe4.jgetin.s index c1b21dbe..c9f67cf4 100644 --- a/c64/kernal/jumptable/ffe4.jgetin.s +++ b/c64/kernal/jumptable/ffe4.jgetin.s @@ -1,3 +1,4 @@ ; Get character from keyboard queue (keyboard buffer) ; C64 Programmer's Reference Guide Page 272 - jmp getin +; According to Compute's Mapping the Commodore 64 (pages 74/75), this jump is indirect + jmp (IGETIN) diff --git a/c64/kernal/jumptable/ffe7.jclall.s b/c64/kernal/jumptable/ffe7.jclall.s index 03e1725f..f5050a8a 100644 --- a/c64/kernal/jumptable/ffe7.jclall.s +++ b/c64/kernal/jumptable/ffe7.jclall.s @@ -1,3 +1,4 @@ ; $FFE7 - Close all files vector ; (http://codebase64.org/doku.php?id=base:kernalreference) - jmp clall +; According to Compute's Mapping the Commodore 64 (pages 74/75), this jump is indirect + jmp (ICLALL) diff --git a/c64/kernal/vector.s b/c64/kernal/vector.s index 5fb49426..9afc2ef8 100644 --- a/c64/kernal/vector.s +++ b/c64/kernal/vector.s @@ -65,24 +65,3 @@ vector_restore: rts .scend - - ;; XXX below we have quite a lot of data... should we decouple them? - -vector_defaults: - .word default_irq_handler ;; CINV - .word $0000 ;; CBINV XXX implement this - .word $0000 ;; NMINV XXX implement this - - .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 $0000 ;; USRCMD XXX implement this - .word load ;; ILOAD - .word save ;; ISAVE diff --git a/strings/036C1C036C b/strings/036C1C036C deleted file mode 100644 index ebb399e0..00000000 --- a/strings/036C1C036C +++ /dev/null @@ -1,3 +0,0 @@ -$03 (most likely adddress higher byte) + JMP ($031C) (via public, documented vector) + JMP (address does not match) - -Code similarity due to Kernal API usage convention. Since 6510 CPU does not have indirect JSR, the only sane possibility to use Kernal API vectors in RAM ($0314-$0333) is to have JMP ($address) hardcoded somewhere. The jump table has intentionally strange order (to avoid code similarity as much as possible), but some small similarities can't be avoided in any reasonable way. diff --git a/strings/036C1E036C b/strings/036C1E036C deleted file mode 100644 index e6f9e218..00000000 --- a/strings/036C1E036C +++ /dev/null @@ -1,3 +0,0 @@ -$03 (most likely adddress higher byte) + JMP ($031E) (via public, documented vector) + JMP (address does not match) - -Code similarity due to Kernal API usage convention. Since 6510 CPU does not have indirect JSR, the only sane possibility to use Kernal API vectors in RAM ($0314-$0333) is to have JMP ($address) hardcoded somewhere. The jump table has intentionally strange order (to avoid code similarity as much as possible), but some small similarities can't be avoided in any reasonable way. diff --git a/strings/036C20036C b/strings/036C20036C deleted file mode 100644 index ab5ed572..00000000 --- a/strings/036C20036C +++ /dev/null @@ -1,3 +0,0 @@ -$03 (most likely adddress higher byte) + JMP ($0320) (via public, documented vector) + JMP (address does not match) - -Code similarity due to Kernal API usage convention. Since 6510 CPU does not have indirect JSR, the only sane possibility to use Kernal API vectors in RAM ($0314-$0333) is to have JMP ($address) hardcoded somewhere. The jump table has intentionally strange order (to avoid code similarity as much as possible), but some small similarities can't be avoided in any reasonable way. diff --git a/strings/036C22036C b/strings/036C22036C deleted file mode 100644 index f05b4581..00000000 --- a/strings/036C22036C +++ /dev/null @@ -1,3 +0,0 @@ -$03 (most likely adddress higher byte) + JMP ($0322) (via public, documented vector) + JMP (address does not match) - -Code similarity due to Kernal API usage convention. Since 6510 CPU does not have indirect JSR, the only sane possibility to use Kernal API vectors in RAM ($0314-$0333) is to have JMP ($address) hardcoded somewhere. The jump table has intentionally strange order (to avoid code similarity as much as possible), but some small similarities can't be avoided in any reasonable way. diff --git a/strings/036C24036C b/strings/036C24036C deleted file mode 100644 index 4b11242c..00000000 --- a/strings/036C24036C +++ /dev/null @@ -1,3 +0,0 @@ -03 (most likely adddress higher byte) + JMP ($0324) (via public, documented vector) + JMP (address does not match) - -Code similarity due to Kernal API usage convention. Since 6510 CPU does not have indirect JSR, the only sane possibility to use Kernal API vectors in RAM ($0314-$0333) is to have JMP ($address) hardcoded somewhere. The jump table has intentionally strange order (to avoid code similarity as much as possible), but some small similarities can't be avoided in any reasonable way. diff --git a/strings/036C2603 b/strings/036C2603 deleted file mode 100644 index 3271b1af..00000000 --- a/strings/036C2603 +++ /dev/null @@ -1,3 +0,0 @@ -$03 (most likely adddress higher byte) + JMP ($0326) (via public, documented vector) - -Code similarity due to Kernal API usage convention. Since 6510 CPU does not have indirect JSR, the only sane possibility to use Kernal API vectors in RAM ($0314-$0333) is to have JMP ($address) hardcoded somewhere. The jump table has intentionally strange order (to avoid code similarity as much as possible), but some small similarities can't be avoided in any reasonable way. diff --git a/strings/036C2A036C b/strings/036C2A036C deleted file mode 100644 index 552a4b08..00000000 --- a/strings/036C2A036C +++ /dev/null @@ -1,4 +0,0 @@ -$03 (most likely adddress higher byte) + JMP ($032A) (via public, documented vector) + JMP (address does not match) - -Code similarity due to Kernal API usage convention. Since 6510 CPU does not have indirect JSR, the only sane possibility to use Kernal API vectors in RAM ($0314-$0333) is to have JMP ($address) hardcoded somewhere. The jump table has intentionally strange order (to avoid code similarity as much as possible), but some small similarities can't be avoided in any reasonable way. - diff --git a/strings/036C2C03 b/strings/036C2C03 deleted file mode 100644 index 3bf23438..00000000 --- a/strings/036C2C03 +++ /dev/null @@ -1,3 +0,0 @@ -$03 (most likely adddress higher byte) + JMP ($032C) (via public, documented vector) - -Code similarity due to Kernal API usage convention. Since 6510 CPU does not have indirect JSR, the only sane possibility to use Kernal API vectors in RAM ($0314-$0333) is to have JMP ($address) hardcoded somewhere. The jump table has intentionally strange order (to avoid code similarity as much as possible), but some small similarities can't be avoided in any reasonable way. diff --git a/strings/6C1A036C b/strings/6C1A036C deleted file mode 100644 index b2044ce0..00000000 --- a/strings/6C1A036C +++ /dev/null @@ -1,3 +0,0 @@ -JMP ($031A) (via public, documented vector) + JMP (address does not match) - -Code similarity due to Kernal API usage convention. Since 6510 CPU does not have indirect JSR, the only sane possibility to use Kernal API vectors in RAM ($0314-$0333) is to have JMP ($address) hardcoded somewhere. The jump table has intentionally strange order (to avoid code similarity as much as possible), but some small similarities can't be avoided in any reasonable way. From a79564b37410c4aeadc2596c992d6e077214a05d Mon Sep 17 00:00:00 2001 From: FeralChild64 Date: Mon, 5 Aug 2019 18:22:31 +0200 Subject: [PATCH 02/21] drive led is now turned OFF after @$ --- c64/kernal/close.s | 27 ++++++++++++++++++++++++++- c64/kernal/load.s | 13 +------------ 2 files changed, 27 insertions(+), 13 deletions(-) diff --git a/c64/kernal/close.s b/c64/kernal/close.s index fc8e0a8c..40c2f8c1 100644 --- a/c64/kernal/close.s +++ b/c64/kernal/close.s @@ -26,8 +26,13 @@ close: ;; IEC device jsr iec_tx_flush ; make sure no byte is awaiting -* lda SAT, y ; get secondary address + cmp #$60 + bne + + ;; workaround for using CLOSE on reading executable - XXX is this a proper way? + jsr close_load + jmp close_remove_from_table +* ora $E0 ; CLOSE command sta IEC_TMP2 jsr iec_tx_command @@ -57,3 +62,23 @@ close_error_not_found: sec ; report success - not sure if original CLOSE does this, but it's nevertheless a good practice rts + +close_load: ; entry also for LOAD routine + + tax + + ;; Command drive to stop talking and to close the file + jsr untlk + + txa + jsr listen + + lda #$E0 ; CLOSE command + sta IEC_TMP2 + jsr iec_tx_command + jsr iec_tx_command_finalize + + ;; Tell drive to unlisten + jsr unlsn + + rts diff --git a/c64/kernal/load.s b/c64/kernal/load.s index e845b546..ece03816 100644 --- a/c64/kernal/load.s +++ b/c64/kernal/load.s @@ -125,19 +125,8 @@ load_loop: ;; Close file on drive - ;; Command drive to stop talking and to close the file - jsr untlk - lda current_device_number - jsr listen - - lda #$E0 - sta IEC_TMP2 - jsr iec_tx_command - jsr iec_tx_command_finalize - - ;; Tell drive to unlisten - jsr unlsn + jsr close_load ;; Return last address jmp lvs_return_last_address From 3a562447264700e41379d3a99b4c4e15016bd85b Mon Sep 17 00:00:00 2001 From: FeralChild64 Date: Mon, 5 Aug 2019 18:32:55 +0200 Subject: [PATCH 03/21] fix for missing file --- c64/kernal/vector_defaults.s | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 c64/kernal/vector_defaults.s diff --git a/c64/kernal/vector_defaults.s b/c64/kernal/vector_defaults.s new file mode 100644 index 00000000..962cd3c5 --- /dev/null +++ b/c64/kernal/vector_defaults.s @@ -0,0 +1,26 @@ + +;; +;; Default values for Kernal vectors - described in: +;; +;; - [RG64] C64 Programmer's Reference Guide - page 293 (RESTOR), 304 (VECTOR) +;; - [CM64] Compute's Mapping the Commodore 64 - page 237 +;; + +vector_defaults: + .word default_irq_handler ;; CINV + .word $0000 ;; CBINV XXX implement this + .word $0000 ;; NMINV XXX implement this + + .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 $0000 ;; USRCMD XXX implement this + .word load ;; ILOAD + .word save ;; ISAVE From 80dafcee32143ac958a710bfd13e9d9f53e0fe05 Mon Sep 17 00:00:00 2001 From: FeralChild64 Date: Mon, 5 Aug 2019 18:38:01 +0200 Subject: [PATCH 04/21] fix for improper rule in .gitignore --- .gitignore | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index fe4f9202..1d25926a 100644 --- a/.gitignore +++ b/.gitignore @@ -9,8 +9,8 @@ build/* # Input to the similarity tool - copyrighted material, we can't check it in! -basic -kernal +/basic +/kernal # Various IDE project files, temporary files, etc. From 802890ff9cb151d062c630848d56d62235b0a899 Mon Sep 17 00:00:00 2001 From: FeralChild64 Date: Mon, 5 Aug 2019 19:14:38 +0200 Subject: [PATCH 05/21] started working on autostart software support --- STATUS.md | 2 +- c64/kernal/ea31.interop | 8 ++++++++ c64/kernal/{getin.s => f13e.getin.s} | 0 c64/kernal/f13e.interop | 8 ++++++++ c64/kernal/{chrin.s => f157.chrin.s} | 0 c64/kernal/f157.interop | 8 ++++++++ c64/kernal/f1ca.interop | 8 ++++++++ c64/kernal/f20e.interop | 8 ++++++++ c64/kernal/f250.interop | 8 ++++++++ c64/kernal/{close.s => f291.close.s} | 0 c64/kernal/f291.interop | 8 ++++++++ c64/kernal/{clall.s => f32f.clall.s} | 0 c64/kernal/f32f.interop | 8 ++++++++ c64/kernal/f333.interop | 8 ++++++++ c64/kernal/f34a.interop | 8 ++++++++ c64/kernal/{open.s => f34a.open.s} | 0 c64/kernal/f4a5.interop | 8 ++++++++ c64/kernal/{load.s => f4a5.load.s} | 0 c64/kernal/f5ed.interop | 8 ++++++++ c64/kernal/{save.s => f5ed.save.s} | 0 c64/kernal/f6ed.interop | 8 ++++++++ c64/kernal/{stop.s => f6ed.stop.s} | 0 c64/kernal/fe47.interop | 8 ++++++++ c64/kernal/fe66.interop | 8 ++++++++ c64/kernal/vector_defaults.s | 16 ++++++++-------- 25 files changed, 129 insertions(+), 9 deletions(-) create mode 100644 c64/kernal/ea31.interop rename c64/kernal/{getin.s => f13e.getin.s} (100%) create mode 100644 c64/kernal/f13e.interop rename c64/kernal/{chrin.s => f157.chrin.s} (100%) create mode 100644 c64/kernal/f157.interop create mode 100644 c64/kernal/f1ca.interop create mode 100644 c64/kernal/f20e.interop create mode 100644 c64/kernal/f250.interop rename c64/kernal/{close.s => f291.close.s} (100%) create mode 100644 c64/kernal/f291.interop rename c64/kernal/{clall.s => f32f.clall.s} (100%) create mode 100644 c64/kernal/f32f.interop create mode 100644 c64/kernal/f333.interop create mode 100644 c64/kernal/f34a.interop rename c64/kernal/{open.s => f34a.open.s} (100%) create mode 100644 c64/kernal/f4a5.interop rename c64/kernal/{load.s => f4a5.load.s} (100%) create mode 100644 c64/kernal/f5ed.interop rename c64/kernal/{save.s => f5ed.save.s} (100%) create mode 100644 c64/kernal/f6ed.interop rename c64/kernal/{stop.s => f6ed.stop.s} (100%) create mode 100644 c64/kernal/fe47.interop create mode 100644 c64/kernal/fe66.interop diff --git a/STATUS.md b/STATUS.md index 286da229..77ec702d 100644 --- a/STATUS.md +++ b/STATUS.md @@ -30,7 +30,7 @@ The following ROM features are currently missing: Features currently being worked on: -* IEC support needs more testing ang bugfixing; alternative drive ROMs (JiffyDOS, DolphinDOS, etc) usually don't work with current implementation, `@$` leaves the drive led on, most likely other problems can be found +* IEC support needs more work; alternative drive ROMs (JiffyDOS, DolphinDOS, etc) usually don't work with current implementation, SAVE / VERIFY are not implemented, etc. # API status diff --git a/c64/kernal/ea31.interop b/c64/kernal/ea31.interop new file mode 100644 index 00000000..09ebb21a --- /dev/null +++ b/c64/kernal/ea31.interop @@ -0,0 +1,8 @@ +All the Kernal routines, for which there are vectors in $0314-$0333, have to be available at their original addresses. + +Reason: some autostart software (https://codebase64.org/doku.php?id=base:autostarting_disk_files) override these vectors, so that some point +to new locations (custom IRQ routine, custom STOP routine, etc.), while others points the original Kernal routines. Different techniques modify +different vectors (while resetting others to original C64 locations), some don't change the vectors at all, but might still put the original +C64 Kernal addresses there (for example, if the file overrides keyboard input buffer and screeen memory). + +For various cartridges (like IDE64) this just means disabling their extensions; for us that would mean improperly functionning Kernal. diff --git a/c64/kernal/getin.s b/c64/kernal/f13e.getin.s similarity index 100% rename from c64/kernal/getin.s rename to c64/kernal/f13e.getin.s diff --git a/c64/kernal/f13e.interop b/c64/kernal/f13e.interop new file mode 100644 index 00000000..09ebb21a --- /dev/null +++ b/c64/kernal/f13e.interop @@ -0,0 +1,8 @@ +All the Kernal routines, for which there are vectors in $0314-$0333, have to be available at their original addresses. + +Reason: some autostart software (https://codebase64.org/doku.php?id=base:autostarting_disk_files) override these vectors, so that some point +to new locations (custom IRQ routine, custom STOP routine, etc.), while others points the original Kernal routines. Different techniques modify +different vectors (while resetting others to original C64 locations), some don't change the vectors at all, but might still put the original +C64 Kernal addresses there (for example, if the file overrides keyboard input buffer and screeen memory). + +For various cartridges (like IDE64) this just means disabling their extensions; for us that would mean improperly functionning Kernal. diff --git a/c64/kernal/chrin.s b/c64/kernal/f157.chrin.s similarity index 100% rename from c64/kernal/chrin.s rename to c64/kernal/f157.chrin.s diff --git a/c64/kernal/f157.interop b/c64/kernal/f157.interop new file mode 100644 index 00000000..09ebb21a --- /dev/null +++ b/c64/kernal/f157.interop @@ -0,0 +1,8 @@ +All the Kernal routines, for which there are vectors in $0314-$0333, have to be available at their original addresses. + +Reason: some autostart software (https://codebase64.org/doku.php?id=base:autostarting_disk_files) override these vectors, so that some point +to new locations (custom IRQ routine, custom STOP routine, etc.), while others points the original Kernal routines. Different techniques modify +different vectors (while resetting others to original C64 locations), some don't change the vectors at all, but might still put the original +C64 Kernal addresses there (for example, if the file overrides keyboard input buffer and screeen memory). + +For various cartridges (like IDE64) this just means disabling their extensions; for us that would mean improperly functionning Kernal. diff --git a/c64/kernal/f1ca.interop b/c64/kernal/f1ca.interop new file mode 100644 index 00000000..09ebb21a --- /dev/null +++ b/c64/kernal/f1ca.interop @@ -0,0 +1,8 @@ +All the Kernal routines, for which there are vectors in $0314-$0333, have to be available at their original addresses. + +Reason: some autostart software (https://codebase64.org/doku.php?id=base:autostarting_disk_files) override these vectors, so that some point +to new locations (custom IRQ routine, custom STOP routine, etc.), while others points the original Kernal routines. Different techniques modify +different vectors (while resetting others to original C64 locations), some don't change the vectors at all, but might still put the original +C64 Kernal addresses there (for example, if the file overrides keyboard input buffer and screeen memory). + +For various cartridges (like IDE64) this just means disabling their extensions; for us that would mean improperly functionning Kernal. diff --git a/c64/kernal/f20e.interop b/c64/kernal/f20e.interop new file mode 100644 index 00000000..09ebb21a --- /dev/null +++ b/c64/kernal/f20e.interop @@ -0,0 +1,8 @@ +All the Kernal routines, for which there are vectors in $0314-$0333, have to be available at their original addresses. + +Reason: some autostart software (https://codebase64.org/doku.php?id=base:autostarting_disk_files) override these vectors, so that some point +to new locations (custom IRQ routine, custom STOP routine, etc.), while others points the original Kernal routines. Different techniques modify +different vectors (while resetting others to original C64 locations), some don't change the vectors at all, but might still put the original +C64 Kernal addresses there (for example, if the file overrides keyboard input buffer and screeen memory). + +For various cartridges (like IDE64) this just means disabling their extensions; for us that would mean improperly functionning Kernal. diff --git a/c64/kernal/f250.interop b/c64/kernal/f250.interop new file mode 100644 index 00000000..09ebb21a --- /dev/null +++ b/c64/kernal/f250.interop @@ -0,0 +1,8 @@ +All the Kernal routines, for which there are vectors in $0314-$0333, have to be available at their original addresses. + +Reason: some autostart software (https://codebase64.org/doku.php?id=base:autostarting_disk_files) override these vectors, so that some point +to new locations (custom IRQ routine, custom STOP routine, etc.), while others points the original Kernal routines. Different techniques modify +different vectors (while resetting others to original C64 locations), some don't change the vectors at all, but might still put the original +C64 Kernal addresses there (for example, if the file overrides keyboard input buffer and screeen memory). + +For various cartridges (like IDE64) this just means disabling their extensions; for us that would mean improperly functionning Kernal. diff --git a/c64/kernal/close.s b/c64/kernal/f291.close.s similarity index 100% rename from c64/kernal/close.s rename to c64/kernal/f291.close.s diff --git a/c64/kernal/f291.interop b/c64/kernal/f291.interop new file mode 100644 index 00000000..09ebb21a --- /dev/null +++ b/c64/kernal/f291.interop @@ -0,0 +1,8 @@ +All the Kernal routines, for which there are vectors in $0314-$0333, have to be available at their original addresses. + +Reason: some autostart software (https://codebase64.org/doku.php?id=base:autostarting_disk_files) override these vectors, so that some point +to new locations (custom IRQ routine, custom STOP routine, etc.), while others points the original Kernal routines. Different techniques modify +different vectors (while resetting others to original C64 locations), some don't change the vectors at all, but might still put the original +C64 Kernal addresses there (for example, if the file overrides keyboard input buffer and screeen memory). + +For various cartridges (like IDE64) this just means disabling their extensions; for us that would mean improperly functionning Kernal. diff --git a/c64/kernal/clall.s b/c64/kernal/f32f.clall.s similarity index 100% rename from c64/kernal/clall.s rename to c64/kernal/f32f.clall.s diff --git a/c64/kernal/f32f.interop b/c64/kernal/f32f.interop new file mode 100644 index 00000000..09ebb21a --- /dev/null +++ b/c64/kernal/f32f.interop @@ -0,0 +1,8 @@ +All the Kernal routines, for which there are vectors in $0314-$0333, have to be available at their original addresses. + +Reason: some autostart software (https://codebase64.org/doku.php?id=base:autostarting_disk_files) override these vectors, so that some point +to new locations (custom IRQ routine, custom STOP routine, etc.), while others points the original Kernal routines. Different techniques modify +different vectors (while resetting others to original C64 locations), some don't change the vectors at all, but might still put the original +C64 Kernal addresses there (for example, if the file overrides keyboard input buffer and screeen memory). + +For various cartridges (like IDE64) this just means disabling their extensions; for us that would mean improperly functionning Kernal. diff --git a/c64/kernal/f333.interop b/c64/kernal/f333.interop new file mode 100644 index 00000000..09ebb21a --- /dev/null +++ b/c64/kernal/f333.interop @@ -0,0 +1,8 @@ +All the Kernal routines, for which there are vectors in $0314-$0333, have to be available at their original addresses. + +Reason: some autostart software (https://codebase64.org/doku.php?id=base:autostarting_disk_files) override these vectors, so that some point +to new locations (custom IRQ routine, custom STOP routine, etc.), while others points the original Kernal routines. Different techniques modify +different vectors (while resetting others to original C64 locations), some don't change the vectors at all, but might still put the original +C64 Kernal addresses there (for example, if the file overrides keyboard input buffer and screeen memory). + +For various cartridges (like IDE64) this just means disabling their extensions; for us that would mean improperly functionning Kernal. diff --git a/c64/kernal/f34a.interop b/c64/kernal/f34a.interop new file mode 100644 index 00000000..09ebb21a --- /dev/null +++ b/c64/kernal/f34a.interop @@ -0,0 +1,8 @@ +All the Kernal routines, for which there are vectors in $0314-$0333, have to be available at their original addresses. + +Reason: some autostart software (https://codebase64.org/doku.php?id=base:autostarting_disk_files) override these vectors, so that some point +to new locations (custom IRQ routine, custom STOP routine, etc.), while others points the original Kernal routines. Different techniques modify +different vectors (while resetting others to original C64 locations), some don't change the vectors at all, but might still put the original +C64 Kernal addresses there (for example, if the file overrides keyboard input buffer and screeen memory). + +For various cartridges (like IDE64) this just means disabling their extensions; for us that would mean improperly functionning Kernal. diff --git a/c64/kernal/open.s b/c64/kernal/f34a.open.s similarity index 100% rename from c64/kernal/open.s rename to c64/kernal/f34a.open.s diff --git a/c64/kernal/f4a5.interop b/c64/kernal/f4a5.interop new file mode 100644 index 00000000..09ebb21a --- /dev/null +++ b/c64/kernal/f4a5.interop @@ -0,0 +1,8 @@ +All the Kernal routines, for which there are vectors in $0314-$0333, have to be available at their original addresses. + +Reason: some autostart software (https://codebase64.org/doku.php?id=base:autostarting_disk_files) override these vectors, so that some point +to new locations (custom IRQ routine, custom STOP routine, etc.), while others points the original Kernal routines. Different techniques modify +different vectors (while resetting others to original C64 locations), some don't change the vectors at all, but might still put the original +C64 Kernal addresses there (for example, if the file overrides keyboard input buffer and screeen memory). + +For various cartridges (like IDE64) this just means disabling their extensions; for us that would mean improperly functionning Kernal. diff --git a/c64/kernal/load.s b/c64/kernal/f4a5.load.s similarity index 100% rename from c64/kernal/load.s rename to c64/kernal/f4a5.load.s diff --git a/c64/kernal/f5ed.interop b/c64/kernal/f5ed.interop new file mode 100644 index 00000000..09ebb21a --- /dev/null +++ b/c64/kernal/f5ed.interop @@ -0,0 +1,8 @@ +All the Kernal routines, for which there are vectors in $0314-$0333, have to be available at their original addresses. + +Reason: some autostart software (https://codebase64.org/doku.php?id=base:autostarting_disk_files) override these vectors, so that some point +to new locations (custom IRQ routine, custom STOP routine, etc.), while others points the original Kernal routines. Different techniques modify +different vectors (while resetting others to original C64 locations), some don't change the vectors at all, but might still put the original +C64 Kernal addresses there (for example, if the file overrides keyboard input buffer and screeen memory). + +For various cartridges (like IDE64) this just means disabling their extensions; for us that would mean improperly functionning Kernal. diff --git a/c64/kernal/save.s b/c64/kernal/f5ed.save.s similarity index 100% rename from c64/kernal/save.s rename to c64/kernal/f5ed.save.s diff --git a/c64/kernal/f6ed.interop b/c64/kernal/f6ed.interop new file mode 100644 index 00000000..09ebb21a --- /dev/null +++ b/c64/kernal/f6ed.interop @@ -0,0 +1,8 @@ +All the Kernal routines, for which there are vectors in $0314-$0333, have to be available at their original addresses. + +Reason: some autostart software (https://codebase64.org/doku.php?id=base:autostarting_disk_files) override these vectors, so that some point +to new locations (custom IRQ routine, custom STOP routine, etc.), while others points the original Kernal routines. Different techniques modify +different vectors (while resetting others to original C64 locations), some don't change the vectors at all, but might still put the original +C64 Kernal addresses there (for example, if the file overrides keyboard input buffer and screeen memory). + +For various cartridges (like IDE64) this just means disabling their extensions; for us that would mean improperly functionning Kernal. diff --git a/c64/kernal/stop.s b/c64/kernal/f6ed.stop.s similarity index 100% rename from c64/kernal/stop.s rename to c64/kernal/f6ed.stop.s diff --git a/c64/kernal/fe47.interop b/c64/kernal/fe47.interop new file mode 100644 index 00000000..09ebb21a --- /dev/null +++ b/c64/kernal/fe47.interop @@ -0,0 +1,8 @@ +All the Kernal routines, for which there are vectors in $0314-$0333, have to be available at their original addresses. + +Reason: some autostart software (https://codebase64.org/doku.php?id=base:autostarting_disk_files) override these vectors, so that some point +to new locations (custom IRQ routine, custom STOP routine, etc.), while others points the original Kernal routines. Different techniques modify +different vectors (while resetting others to original C64 locations), some don't change the vectors at all, but might still put the original +C64 Kernal addresses there (for example, if the file overrides keyboard input buffer and screeen memory). + +For various cartridges (like IDE64) this just means disabling their extensions; for us that would mean improperly functionning Kernal. diff --git a/c64/kernal/fe66.interop b/c64/kernal/fe66.interop new file mode 100644 index 00000000..09ebb21a --- /dev/null +++ b/c64/kernal/fe66.interop @@ -0,0 +1,8 @@ +All the Kernal routines, for which there are vectors in $0314-$0333, have to be available at their original addresses. + +Reason: some autostart software (https://codebase64.org/doku.php?id=base:autostarting_disk_files) override these vectors, so that some point +to new locations (custom IRQ routine, custom STOP routine, etc.), while others points the original Kernal routines. Different techniques modify +different vectors (while resetting others to original C64 locations), some don't change the vectors at all, but might still put the original +C64 Kernal addresses there (for example, if the file overrides keyboard input buffer and screeen memory). + +For various cartridges (like IDE64) this just means disabling their extensions; for us that would mean improperly functionning Kernal. diff --git a/c64/kernal/vector_defaults.s b/c64/kernal/vector_defaults.s index 962cd3c5..67e7791a 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 - .word $0000 ;; NMINV XXX implement this + .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 open ;; IOPEN .word close ;; ICLOSE - .word chkin ;; ICHKIN - .word ckout ;; ICKOUT - .word clrchn ;; ICLRCH + .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 XXX move routine to $F333 - for autostart support .word chrin ;; IBASIN - .word chrout ;; IBSOUT + .word chrout ;; IBSOUT XXX move routine to $F1CA - for autostart support .word stop ;; ISTOP .word getin ;; IGETIN .word clall ;; ICLALL - .word $0000 ;; USRCMD XXX implement this - .word load ;; ILOAD + .word $0000 ;; USRCMD XXX implement this, has to be $FE66 for autostart support + .word load ;; ILOAD .word save ;; ISAVE From 9187e3e601ba8982706044544080d008f05b7c5f Mon Sep 17 00:00:00 2001 From: FeralChild64 Date: Mon, 5 Aug 2019 22:51:16 +0200 Subject: [PATCH 06/21] more routines placed under compatible addresses --- c64/kernal/{f157.chrin.s => chrin_real.s} | 2 +- c64/kernal/{chrout.s => chrout_real.s} | 2 +- c64/kernal/{f32f.clall.s => clall_real.s} | 4 ++-- c64/kernal/close_load.s | 23 +++++++++++++++++++++++ c64/kernal/{clrchn.s => clrchn_real.s} | 2 +- c64/kernal/f157.chrin.jmp.s | 6 ++++++ c64/kernal/f1ca.chrout.jmp.s | 6 ++++++ c64/kernal/f291.close.s | 22 +--------------------- c64/kernal/f32f.clall.jmp.s | 6 ++++++ c64/kernal/f333.clrchn.jmp.s | 6 ++++++ c64/kernal/vector_defaults.s | 6 +++--- 11 files changed, 56 insertions(+), 29 deletions(-) rename c64/kernal/{f157.chrin.s => chrin_real.s} (99%) rename c64/kernal/{chrout.s => chrout_real.s} (99%) rename c64/kernal/{f32f.clall.s => clall_real.s} (94%) create mode 100644 c64/kernal/close_load.s rename c64/kernal/{clrchn.s => clrchn_real.s} (98%) create mode 100644 c64/kernal/f157.chrin.jmp.s create mode 100644 c64/kernal/f1ca.chrout.jmp.s create mode 100644 c64/kernal/f32f.clall.jmp.s create mode 100644 c64/kernal/f333.clrchn.jmp.s diff --git a/c64/kernal/f157.chrin.s b/c64/kernal/chrin_real.s similarity index 99% rename from c64/kernal/f157.chrin.s rename to c64/kernal/chrin_real.s index 8a84f5d6..b69db61d 100644 --- a/c64/kernal/f157.chrin.s +++ b/c64/kernal/chrin_real.s @@ -14,7 +14,7 @@ ;; If from keyboard, then it gets a whole line of input, and returns the first char. ;; Repeated calls after that read out the successive bytes of the line of input. -chrin: +chrin_real: ;; Determine the device number lda DFLTN diff --git a/c64/kernal/chrout.s b/c64/kernal/chrout_real.s similarity index 99% rename from c64/kernal/chrout.s rename to c64/kernal/chrout_real.s index 6f340a0f..128a7426 100644 --- a/c64/kernal/chrout.s +++ b/c64/kernal/chrout_real.s @@ -9,7 +9,7 @@ ;; -chrout: +chrout_real: sta last_printed_character_ascii diff --git a/c64/kernal/f32f.clall.s b/c64/kernal/clall_real.s similarity index 94% rename from c64/kernal/f32f.clall.s rename to c64/kernal/clall_real.s index ba595c20..33649858 100644 --- a/c64/kernal/f32f.clall.s +++ b/c64/kernal/clall_real.s @@ -9,7 +9,7 @@ ;; -clall: +clall_real: ;; Store .Y register tya @@ -23,7 +23,7 @@ clall: beq + dey lda LAT, y - jsr close ; XXX jump through ICLOSE? + jsr JCLOSE jmp - * ;; Restore .Y register diff --git a/c64/kernal/close_load.s b/c64/kernal/close_load.s new file mode 100644 index 00000000..f594590f --- /dev/null +++ b/c64/kernal/close_load.s @@ -0,0 +1,23 @@ + + +;; Common ppart of CLOSE and LOAD routines + +close_load: + + tax + + ;; Command drive to stop talking and to close the file + jsr untlk + + txa + jsr listen + + lda #$E0 ; CLOSE command + sta IEC_TMP2 + jsr iec_tx_command + jsr iec_tx_command_finalize + + ;; Tell drive to unlisten + jsr unlsn + + rts diff --git a/c64/kernal/clrchn.s b/c64/kernal/clrchn_real.s similarity index 98% rename from c64/kernal/clrchn.s rename to c64/kernal/clrchn_real.s index 3cc53078..2abee15e 100644 --- a/c64/kernal/clrchn.s +++ b/c64/kernal/clrchn_real.s @@ -9,7 +9,7 @@ ;; -clrchn: +clrchn_real: ;; Handle IEC input device lda DFLTN diff --git a/c64/kernal/f157.chrin.jmp.s b/c64/kernal/f157.chrin.jmp.s new file mode 100644 index 00000000..c063c752 --- /dev/null +++ b/c64/kernal/f157.chrin.jmp.s @@ -0,0 +1,6 @@ + +;; Our implementation is longer than the original one, +;; placing it here would cause a collision with CHROUT + +chrin: + jmp chrin_real diff --git a/c64/kernal/f1ca.chrout.jmp.s b/c64/kernal/f1ca.chrout.jmp.s new file mode 100644 index 00000000..02e434ea --- /dev/null +++ b/c64/kernal/f1ca.chrout.jmp.s @@ -0,0 +1,6 @@ + +;; Our implementation is longer than the original one, +;; placing it here would cause a collision with CHKIN + +chrout: + jmp chrout_real diff --git a/c64/kernal/f291.close.s b/c64/kernal/f291.close.s index 40c2f8c1..693362ce 100644 --- a/c64/kernal/f291.close.s +++ b/c64/kernal/f291.close.s @@ -38,7 +38,7 @@ close: jsr iec_tx_command bcs close_remove_from_table jsr iec_tx_command_finalize - + close_remove_from_table: ;; Remove channel from the table iny @@ -62,23 +62,3 @@ close_error_not_found: sec ; report success - not sure if original CLOSE does this, but it's nevertheless a good practice rts - -close_load: ; entry also for LOAD routine - - tax - - ;; Command drive to stop talking and to close the file - jsr untlk - - txa - jsr listen - - lda #$E0 ; CLOSE command - sta IEC_TMP2 - jsr iec_tx_command - jsr iec_tx_command_finalize - - ;; Tell drive to unlisten - jsr unlsn - - rts diff --git a/c64/kernal/f32f.clall.jmp.s b/c64/kernal/f32f.clall.jmp.s new file mode 100644 index 00000000..56567151 --- /dev/null +++ b/c64/kernal/f32f.clall.jmp.s @@ -0,0 +1,6 @@ + +;; Our implementation is longer than the original one, +;; placing it here would cause a collision with CLRCHN + +clall: + jmp clall_real diff --git a/c64/kernal/f333.clrchn.jmp.s b/c64/kernal/f333.clrchn.jmp.s new file mode 100644 index 00000000..ac23dc8e --- /dev/null +++ b/c64/kernal/f333.clrchn.jmp.s @@ -0,0 +1,6 @@ + +;; Our implementation is longer than the original one, +;; placing it here would cause a collision with OPEN + +clrchn: + jmp clrchn_real diff --git a/c64/kernal/vector_defaults.s b/c64/kernal/vector_defaults.s index 67e7791a..9d8c025a 100644 --- a/c64/kernal/vector_defaults.s +++ b/c64/kernal/vector_defaults.s @@ -10,14 +10,14 @@ 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 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 XXX move routine to $F333 - for autostart support + .word clrchn ;; ICLRCH .word chrin ;; IBASIN - .word chrout ;; IBSOUT XXX move routine to $F1CA - for autostart support + .word chrout ;; IBSOUT .word stop ;; ISTOP .word getin ;; IGETIN .word clall ;; ICLALL From 44ca73be40a8c1a5b032c9dd83f6ead334f13c21 Mon Sep 17 00:00:00 2001 From: FeralChild64 Date: Tue, 6 Aug 2019 18:06:47 +0200 Subject: [PATCH 07/21] interrupt cleanup started --- Makefile | 2 +- STATUS.md | 4 +-- c64/kernal/{chkinout.s => chkinout_real.s} | 6 ++-- c64/kernal/f20e.chkin.jmp.s | 6 ++++ c64/kernal/f250.ckout.jmp.s | 6 ++++ .../ea31.default_irq_handler.s | 0 .../interrupts/fe47.default_nmi_handler.s | 8 +++++ .../interrupts/fe66.default_brk_handler.s | 6 ++++ c64/kernal/{ => interrupts}/irq_handler.s | 0 c64/kernal/interrupts/nmi_handler.s | 5 ++++ c64/kernal/nmi_handler.s | 3 -- c64/kernal/vector_defaults.s | 30 +++++++++---------- 12 files changed, 51 insertions(+), 25 deletions(-) rename c64/kernal/{chkinout.s => chkinout_real.s} (98%) create mode 100644 c64/kernal/f20e.chkin.jmp.s create mode 100644 c64/kernal/f250.ckout.jmp.s rename c64/kernal/{ => interrupts}/ea31.default_irq_handler.s (100%) create mode 100644 c64/kernal/interrupts/fe47.default_nmi_handler.s create mode 100644 c64/kernal/interrupts/fe66.default_brk_handler.s rename c64/kernal/{ => interrupts}/irq_handler.s (100%) create mode 100644 c64/kernal/interrupts/nmi_handler.s delete mode 100644 c64/kernal/nmi_handler.s 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 From 03bc8b8e782e4fcf101cf4bea3a651bffab9960d Mon Sep 17 00:00:00 2001 From: FeralChild64 Date: Tue, 6 Aug 2019 20:54:27 +0200 Subject: [PATCH 08/21] implemented BRK handling routine (not yet connected to IRQ) --- c64/aliases/,aliases_hardware.s | 2 +- c64/aliases/,aliases_rom_basic.s | 5 ++++ c64/basic/,target_generic/,hooks_generic.s | 2 +- .../,target_ultimate64/,hooks_ultimate64.s | 2 +- c64/kernal/cint.s | 7 ++++-- c64/kernal/e544.clear_screen.s | 7 +++--- c64/kernal/e5a0.setup_vicii.s | 23 ++++++++++--------- .../interrupts/ea31.default_irq_handler.s | 1 + c64/kernal/{ => interrupts}/ea31.interop | 0 .../ea7e.ack_cia1_return_from_interrupt.s} | 0 .../ea81.return_from_interrupt.s} | 0 .../interrupts/fe47.default_nmi_handler.s | 6 ++++- c64/kernal/{ => interrupts}/fe47.interop | 0 .../interrupts/fe66.default_brk_handler.s | 11 ++++++--- c64/kernal/{ => interrupts}/fe66.interop | 0 c64/kernal/interrupts/irq_handler.s | 12 ++++++---- c64/kernal/interrupts/nmi_handler.s | 2 ++ 17 files changed, 51 insertions(+), 29 deletions(-) rename c64/kernal/{ => interrupts}/ea31.interop (100%) rename c64/kernal/{ea7e.s => interrupts/ea7e.ack_cia1_return_from_interrupt.s} (100%) rename c64/kernal/{ea81.s => interrupts/ea81.return_from_interrupt.s} (100%) rename c64/kernal/{ => interrupts}/fe47.interop (100%) rename c64/kernal/{ => interrupts}/fe66.interop (100%) diff --git a/c64/aliases/,aliases_hardware.s b/c64/aliases/,aliases_hardware.s index ee6ceddb..b9622844 100644 --- a/c64/aliases/,aliases_hardware.s +++ b/c64/aliases/,aliases_hardware.s @@ -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 diff --git a/c64/aliases/,aliases_rom_basic.s b/c64/aliases/,aliases_rom_basic.s index e69de29b..ff6c46dc 100644 --- a/c64/aliases/,aliases_rom_basic.s +++ b/c64/aliases/,aliases_rom_basic.s @@ -0,0 +1,5 @@ + + ;; BASIC startup vector + + .alias IBASIC_COLD_START $A000 + .alias IBASIC_WARM_START $A002 diff --git a/c64/basic/,target_generic/,hooks_generic.s b/c64/basic/,target_generic/,hooks_generic.s index 186b29d0..92860379 100644 --- a/c64/basic/,target_generic/,hooks_generic.s +++ b/c64/basic/,target_generic/,hooks_generic.s @@ -4,6 +4,6 @@ .macro TARGET_HOOK_BANNER - .byte $05, " OPEN ROMS, ", $00 + .byte " OPEN ROMS, ", $00 .macend diff --git a/c64/basic/,target_ultimate64/,hooks_ultimate64.s b/c64/basic/,target_ultimate64/,hooks_ultimate64.s index 519d07e9..9ae05e35 100644 --- a/c64/basic/,target_ultimate64/,hooks_ultimate64.s +++ b/c64/basic/,target_ultimate64/,hooks_ultimate64.s @@ -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 diff --git a/c64/kernal/cint.s b/c64/kernal/cint.s index 973def0d..25c31472 100644 --- a/c64/kernal/cint.s +++ b/c64/kernal/cint.s @@ -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 diff --git a/c64/kernal/e544.clear_screen.s b/c64/kernal/e544.clear_screen.s index 6b1d41fc..431c571e 100644 --- a/c64/kernal/e544.clear_screen.s +++ b/c64/kernal/e544.clear_screen.s @@ -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 diff --git a/c64/kernal/e5a0.setup_vicii.s b/c64/kernal/e5a0.setup_vicii.s index 671bfadf..d2483a45 100644 --- a/c64/kernal/e5a0.setup_vicii.s +++ b/c64/kernal/e5a0.setup_vicii.s @@ -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 diff --git a/c64/kernal/interrupts/ea31.default_irq_handler.s b/c64/kernal/interrupts/ea31.default_irq_handler.s index e37991f1..ab74f1c8 100644 --- a/c64/kernal/interrupts/ea31.default_irq_handler.s +++ b/c64/kernal/interrupts/ea31.default_irq_handler.s @@ -1,3 +1,4 @@ + default_irq_handler: jsr blink_cursor diff --git a/c64/kernal/ea31.interop b/c64/kernal/interrupts/ea31.interop similarity index 100% rename from c64/kernal/ea31.interop rename to c64/kernal/interrupts/ea31.interop diff --git a/c64/kernal/ea7e.s b/c64/kernal/interrupts/ea7e.ack_cia1_return_from_interrupt.s similarity index 100% rename from c64/kernal/ea7e.s rename to c64/kernal/interrupts/ea7e.ack_cia1_return_from_interrupt.s diff --git a/c64/kernal/ea81.s b/c64/kernal/interrupts/ea81.return_from_interrupt.s similarity index 100% rename from c64/kernal/ea81.s rename to c64/kernal/interrupts/ea81.return_from_interrupt.s diff --git a/c64/kernal/interrupts/fe47.default_nmi_handler.s b/c64/kernal/interrupts/fe47.default_nmi_handler.s index be183b26..fac6d0a7 100644 --- a/c64/kernal/interrupts/fe47.default_nmi_handler.s +++ b/c64/kernal/interrupts/fe47.default_nmi_handler.s @@ -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 diff --git a/c64/kernal/fe47.interop b/c64/kernal/interrupts/fe47.interop similarity index 100% rename from c64/kernal/fe47.interop rename to c64/kernal/interrupts/fe47.interop diff --git a/c64/kernal/interrupts/fe66.default_brk_handler.s b/c64/kernal/interrupts/fe66.default_brk_handler.s index 54232eeb..230be89d 100644 --- a/c64/kernal/interrupts/fe66.default_brk_handler.s +++ b/c64/kernal/interrupts/fe66.default_brk_handler.s @@ -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 diff --git a/c64/kernal/fe66.interop b/c64/kernal/interrupts/fe66.interop similarity index 100% rename from c64/kernal/fe66.interop rename to c64/kernal/interrupts/fe66.interop diff --git a/c64/kernal/interrupts/irq_handler.s b/c64/kernal/interrupts/irq_handler.s index 82bbaac7..74d1eb78 100644 --- a/c64/kernal/interrupts/irq_handler.s +++ b/c64/kernal/interrupts/irq_handler.s @@ -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 diff --git a/c64/kernal/interrupts/nmi_handler.s b/c64/kernal/interrupts/nmi_handler.s index 652070f1..220ec401 100644 --- a/c64/kernal/interrupts/nmi_handler.s +++ b/c64/kernal/interrupts/nmi_handler.s @@ -1,5 +1,7 @@ nmi_handler: + ;; XXX provide real implementation + jmp (NMINV) From e4ddf9ec0cbd10e03a8251582930f7bac1626fa4 Mon Sep 17 00:00:00 2001 From: FeralChild64 Date: Tue, 6 Aug 2019 22:00:50 +0200 Subject: [PATCH 09/21] STOP + RESTORE now works (bad news: works even without STOP) --- Makefile | 2 +- STATUS.md | 4 ++-- c64/kernal/cint.s | 4 +--- .../interrupts/ea31.default_irq_handler.s | 3 ++- .../interrupts/fe47.default_nmi_handler.s | 23 +++++++++++++++---- .../interrupts/fe66.default_brk_handler.s | 4 ++++ c64/kernal/interrupts/irq_handler.s | 2 ++ c64/kernal/interrupts/nmi_handler.s | 13 ++++++++++- c64/kernal/jumptable/ff9f.jscnkey.s | 2 +- c64/kernal/jumptable/ffea.judtim.s | 2 +- c64/kernal/{scan_keyboard.s => scnkey.s} | 4 +--- c64/kernal/{update_jiffy_clock.s => udtim.s} | 2 +- 12 files changed, 46 insertions(+), 19 deletions(-) rename c64/kernal/{scan_keyboard.s => scnkey.s} (99%) rename c64/kernal/{update_jiffy_clock.s => udtim.s} (92%) diff --git a/Makefile b/Makefile index 4c852918..739ada5d 100644 --- a/Makefile +++ b/Makefile @@ -147,7 +147,7 @@ test: build/newkern_generic build/newbasic_generic x64 -kernal build/newkern_generic -basic build/newbasic_generic -8 empty.d64 testremote: build/newkern_generic build/newbasic_generic - x64 -kernal build/newkern-generic -basic build/newbasic-generic -remotemonitor + x64 -kernal build/newkern_generic -basic build/newbasic_generic -remotemonitor testm65: build/newc65 m65 -b ../mega65-core/bin/mega65r1.bit -k ../mega65-core/bin/KICKUP.M65 -R build/newc65 -4 diff --git a/STATUS.md b/STATUS.md index 82d800a3..94abe4c2 100644 --- a/STATUS.md +++ b/STATUS.md @@ -102,10 +102,10 @@ NOTE: Even the 'DONE' routines won't support features described as missing in on | `$FFD8` | `SAVE` | NOT DONE | | | `$FFDB` | `SETTIM` | NOT DONE | | | `$FFDE` | `RDTIM` | NOT DONE | | -| `$FFE1` | `STOP` | PARTIAL | no connection with UDTIM | +| `$FFE1` | `STOP` | PARTIAL | | | `$FFE4` | `GETIN` | PARTIAL | only some devices supported | | `$FFE7` | `CLALL` | DONE | | -| `$FFEA` | `UDTIM` | NOT DONE | | +| `$FFEA` | `UDTIM` | NOT DONE | checking for STOP key present in SCNKEY instead | | `$FFED` | `SCREEN` | DONE | | | `$FFF0` | `PLOT` | NOT DONE | | | `$FFF3` | `IOBASE` | DONE | | diff --git a/c64/kernal/cint.s b/c64/kernal/cint.s index 25c31472..243ba5ff 100644 --- a/c64/kernal/cint.s +++ b/c64/kernal/cint.s @@ -48,9 +48,7 @@ cint_brk: ; entry for BRK and STOP+RESTORE - XXX, where should it start? ;; Set default I/O devices (see SCINIT description at http://sta.c64.org/cbm64krnfunc.html) jsr clrchn_reset - + ;; Fallthrough/jump to screen clear routine (Compute's Mapping the 64 p215) jmp clear_screen - rts - diff --git a/c64/kernal/interrupts/ea31.default_irq_handler.s b/c64/kernal/interrupts/ea31.default_irq_handler.s index ab74f1c8..944fe430 100644 --- a/c64/kernal/interrupts/ea31.default_irq_handler.s +++ b/c64/kernal/interrupts/ea31.default_irq_handler.s @@ -2,7 +2,8 @@ default_irq_handler: jsr blink_cursor - jsr scan_keyboard + jsr JSCNKEY + jsr JUDTIM ; update jiffy clock ;; Acknowledge CIA interrupt and return jmp clear_cia1_interrupt_flag_and_return_from_interrupt diff --git a/c64/kernal/interrupts/fe47.default_nmi_handler.s b/c64/kernal/interrupts/fe47.default_nmi_handler.s index fac6d0a7..3be62222 100644 --- a/c64/kernal/interrupts/fe47.default_nmi_handler.s +++ b/c64/kernal/interrupts/fe47.default_nmi_handler.s @@ -1,12 +1,25 @@ default_nmi_handler: - ;; XXX implement according to Compute's Mapping the Commodore 64, page 74 + ;; Implemented according to Compute's Mapping the Commodore 64, page 74 + ;; and to https://www.c64-wiki.com/wiki/Interrupt + + ;; Save registers, sequence according to Compute's Mapping the Commodore 64, page 73 + pha + txa + pha + tya + pha + + ;; XXX: RS-232 support is not implemented - ;; 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 + ;; According to C64 Wiki, if STOP key is pressed, the routine assumes warm start request + + jsr JSTOP + bcs + + jmp return_from_interrupt ; no STOP pressed +* + jmp (CBINV) ; STOP + RESTORE diff --git a/c64/kernal/interrupts/fe66.default_brk_handler.s b/c64/kernal/interrupts/fe66.default_brk_handler.s index 230be89d..6b1f4c73 100644 --- a/c64/kernal/interrupts/fe66.default_brk_handler.s +++ b/c64/kernal/interrupts/fe66.default_brk_handler.s @@ -3,9 +3,13 @@ default_brk_handler: ;; Implemented according to Compute's Mapping the Commodore 64, pages 73-74 + sei ; disable IRQs, to be sure they won't interfere + jsr JRESTOR jsr JIOINIT jsr CINT_BRK + cli + jmp (IBASIC_WARM_START) diff --git a/c64/kernal/interrupts/irq_handler.s b/c64/kernal/interrupts/irq_handler.s index 74d1eb78..0a3634ab 100644 --- a/c64/kernal/interrupts/irq_handler.s +++ b/c64/kernal/interrupts/irq_handler.s @@ -15,6 +15,8 @@ irq_handler: tya pha + ;; XXX check if caused by BRK, react accordingly + ;; Call interrupt routine (only if initialised) lda CINV ora CINV+1 diff --git a/c64/kernal/interrupts/nmi_handler.s b/c64/kernal/interrupts/nmi_handler.s index 220ec401..90c05444 100644 --- a/c64/kernal/interrupts/nmi_handler.s +++ b/c64/kernal/interrupts/nmi_handler.s @@ -1,7 +1,18 @@ nmi_handler: - ;; XXX provide real implementation + sei ;; don't allow IRQ to interfere, see https://www.c64-wiki.com/wiki/Interrupt + ;; Call interrupt routine (only if initialised) + pha + lda NMINV + ora NMINV+1 + bne + + pla jmp (NMINV) +* + ;; Vector not initialized - call default interrupt routine + pla + jmp default_nmi_handler + diff --git a/c64/kernal/jumptable/ff9f.jscnkey.s b/c64/kernal/jumptable/ff9f.jscnkey.s index 6da0b26f..2f445ce4 100644 --- a/c64/kernal/jumptable/ff9f.jscnkey.s +++ b/c64/kernal/jumptable/ff9f.jscnkey.s @@ -1,3 +1,3 @@ ; Scan keyboard ; C64 Programmer's Reference Guide Page 273 - jmp scan_keyboard + jmp SCNKEY diff --git a/c64/kernal/jumptable/ffea.judtim.s b/c64/kernal/jumptable/ffea.judtim.s index d637dff8..5cb58e73 100644 --- a/c64/kernal/jumptable/ffea.judtim.s +++ b/c64/kernal/jumptable/ffea.judtim.s @@ -1,4 +1,4 @@ ; $FFEA - Update jiffy clock vector ; (http://codebase64.org/doku.php?id=base:kernalreference) - jmp update_jiffy_clock + jmp UDTIM diff --git a/c64/kernal/scan_keyboard.s b/c64/kernal/scnkey.s similarity index 99% rename from c64/kernal/scan_keyboard.s rename to c64/kernal/scnkey.s index 8b9de00f..f5dd30cb 100644 --- a/c64/kernal/scan_keyboard.s +++ b/c64/kernal/scnkey.s @@ -69,7 +69,7 @@ ;// Operational Variables .alias MaxKeyRollover 3 -scan_keyboard: +scnkey: lda #$00 sta BufferQuantity @@ -538,5 +538,3 @@ KeyCanRepeat: KeyRepeatWait: pla jmp ConsiderNextKey - - diff --git a/c64/kernal/update_jiffy_clock.s b/c64/kernal/udtim.s similarity index 92% rename from c64/kernal/update_jiffy_clock.s rename to c64/kernal/udtim.s index 7e05883a..b502112f 100644 --- a/c64/kernal/update_jiffy_clock.s +++ b/c64/kernal/udtim.s @@ -8,5 +8,5 @@ ;; CPU registers that has to be preserved (see [RG64]): .Y ;; -update_jiffy_clock: +udtim: rts From 34d60195c2723d6fcb45eed7bc163178560bf60d Mon Sep 17 00:00:00 2001 From: FeralChild64 Date: Tue, 6 Aug 2019 22:28:37 +0200 Subject: [PATCH 10/21] implemented SETTMO routine, some documentation updates --- STATUS.md | 8 ++++---- c64/aliases/,aliases_ram_lowmem.s | 2 ++ c64/kernal/settmo.s | 1 + 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/STATUS.md b/STATUS.md index 94abe4c2..a93e8233 100644 --- a/STATUS.md +++ b/STATUS.md @@ -81,7 +81,7 @@ NOTE: Even the 'DONE' routines won't support features described as missing in on | `$FF99` | `MEMTOP` | DONE | | | `$FF9C` | `MEMBOT` | DONE | | | `$FF9F` | `SCNKEY` | DONE | could be better integrated with ROM (aliases) | -| `$FFA2` | `SETTMO` | NOT DONE | | +| `$FFA2` | `SETTMO` | DONE | | | `$FFA5` | `ACPTR` | DONE | | | `$FFA8` | `CIOUT` | DONE | | | `$FFAB` | `UNTLK` | DONE | | @@ -92,17 +92,17 @@ NOTE: Even the 'DONE' routines won't support features described as missing in on | `$FFBA` | `SETFLS` | DONE | | | `$FFBD` | `SETNAM` | DONE | | | `$FFC0` | `OPEN` | DONE | | -| `$FFC3` | `CLOSE` | PARTIAL | most likely incompleete, @$ doesn't end properly | +| `$FFC3` | `CLOSE` | DONE | | | `$FFC6` | `CHKIN` | DONE | | | `$FFC9` | `CHKOUT` | PARTIAL | | | `$FFCC` | `CLRCHN` | DONE | | | `$FFCF` | `CHRIN` | PARTIAL | | | `$FFD2` | `CHROUT` | PARTIAL | | -| `$FFD5` | `LOAD` | PARTIAL | no VERIFY support yet | +| `$FFD5` | `LOAD` | PARTIAL | no VERIFY support yet, no STOP key support | | `$FFD8` | `SAVE` | NOT DONE | | | `$FFDB` | `SETTIM` | NOT DONE | | | `$FFDE` | `RDTIM` | NOT DONE | | -| `$FFE1` | `STOP` | PARTIAL | | +| `$FFE1` | `STOP` | DONE | | | `$FFE4` | `GETIN` | PARTIAL | only some devices supported | | `$FFE7` | `CLALL` | DONE | | | `$FFEA` | `UDTIM` | NOT DONE | checking for STOP key present in SCNKEY instead | diff --git a/c64/aliases/,aliases_ram_lowmem.s b/c64/aliases/,aliases_ram_lowmem.s index 311fbf87..c9f4ce6d 100644 --- a/c64/aliases/,aliases_ram_lowmem.s +++ b/c64/aliases/,aliases_ram_lowmem.s @@ -60,6 +60,8 @@ .alias MEMSTR $281 .alias MEMSIZ $283 ; NOTE: Mapping the 64 erroniously has the hex as $282, while the DEC is correct + .alias TIMOUT $285 ; IEEE-488 timeout + .alias HIBASE $288 ; high byte of start of screen .alias RSSTAT $297 ; RS-232 status diff --git a/c64/kernal/settmo.s b/c64/kernal/settmo.s index 273fbf43..23cda2b0 100644 --- a/c64/kernal/settmo.s +++ b/c64/kernal/settmo.s @@ -9,4 +9,5 @@ ;; settmo: + sta TIMOUT rts From 7bc76670cdc2a2609a999aba1c97df6d66dd75c5 Mon Sep 17 00:00:00 2001 From: FeralChild64 Date: Wed, 7 Aug 2019 19:14:16 +0200 Subject: [PATCH 11/21] fix for STOP key detection --- c64/kernal/f6ed.stop.s | 3 +-- c64/kernal/scnkey.s | 8 ++++++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/c64/kernal/f6ed.stop.s b/c64/kernal/f6ed.stop.s index 980bd9bf..fd0ce804 100644 --- a/c64/kernal/f6ed.stop.s +++ b/c64/kernal/f6ed.stop.s @@ -14,8 +14,7 @@ stop: ;; BASIC checks carry flag to indicate STOP or not lda STKEY - and #$80 - beq stop_pressed + bpl stop_pressed ;; By trial and error, we know that Z + C = BREAK ;; and that neither should be set otherwise diff --git a/c64/kernal/scnkey.s b/c64/kernal/scnkey.s index f5dd30cb..d5a6bb1b 100644 --- a/c64/kernal/scnkey.s +++ b/c64/kernal/scnkey.s @@ -204,12 +204,16 @@ ReturnNoKeys: NoActivityDetected: + ;; Cancel STKEY status + lda #$FF + sta STKEY ; XXX this variable should be set by UDTIM + ;; So cancel all bucky keys lda key_bucky_state sta key_last_bucky_state lda #$00 sta key_bucky_state - + jmp ReturnNoKeys ;; //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -334,7 +338,7 @@ next_row: ;; so that RUN/STOP etc can be checked easily ;; (Compute's Mapping the 64, p27) lda ScanResult+0 - sta STKEY + sta STKEY ; XXX this variable should be set by UDTIM ;; Store de-bounce data for bucky keys ;; (Compute's Mapping the 64, p58-59) From 1feef6abdb1e5ac80fa8d6d1b9547cc73833b62f Mon Sep 17 00:00:00 2001 From: FeralChild64 Date: Wed, 7 Aug 2019 21:20:05 +0200 Subject: [PATCH 12/21] added PAL/NTSC detection --- STATUS.md | 2 +- c64/basic/basic_cold_start.s | 14 +++++++++++--- c64/kernal/cint.s | 28 ++++++++++++++++++++++++++-- src/compress_text.c | 13 +++++++++---- 4 files changed, 47 insertions(+), 10 deletions(-) diff --git a/STATUS.md b/STATUS.md index a93e8233..e11de2dd 100644 --- a/STATUS.md +++ b/STATUS.md @@ -70,7 +70,7 @@ NOTE: Even the 'DONE' routines won't support features described as missing in on | Address | Name | Status | Remarks | | --------- | :------- | :------: | :------------------------------------------------: | -| `$FF81` | `CINT` | PARTIAL | at least PAL/NTSC detection is missing | +| `$FF81` | `CINT` | DONE | | | `$FF84` | `IOINIT` | PARTIAL | at least SID volume handling is missing | | `$FF87` | `RAMTAS` | DONE | | | `$FF8A` | `RESTOR` | DONE | | diff --git a/c64/basic/basic_cold_start.s b/c64/basic/basic_cold_start.s index 341e0909..b57145c8 100644 --- a/c64/basic/basic_cold_start.s +++ b/c64/basic/basic_cold_start.s @@ -17,6 +17,14 @@ startup_banner: `TARGET_HOOK_BANNER + ;; Print PAL/NTSC + ldx #30 ; NTSC + lda PALNTSC + beq + + ldx #31 ; PAL +* + jsr print_packed_message + ;; Work out free bytes, and display jsr basic_do_new lda basic_top_of_memory_ptr+0 @@ -26,7 +34,7 @@ startup_banner: lda basic_top_of_memory_ptr+1 sbc basic_end_of_text_ptr+1 - jsr print_integer + jsr print_integer lda #$20 jsr JCHROUT @@ -37,8 +45,8 @@ startup_banner: ;; jump into warm start loop jmp basic_warm_start - - + + startup_message: ;; Clear the screen .byte $93 diff --git a/c64/kernal/cint.s b/c64/kernal/cint.s index 243ba5ff..142005c0 100644 --- a/c64/kernal/cint.s +++ b/c64/kernal/cint.s @@ -14,7 +14,32 @@ cint: cint_brk: ; entry for BRK and STOP+RESTORE - XXX, where should it start? jsr setup_vicii - + + ;; Detect video system (PAL/NTSC), use Graham's method, as it's short and reliable + ;; see here: https://codebase64.org/doku.php?id=base:detect_pal_ntsc + +cint_w0: + lda VIC_RASTER +cint_w1: + cmp VIC_RASTER + beq cint_w1 + bmi cint_w0 + + ;; Result in A, if no interrupt happened during the test: + ;; #$37 -> 312 rasterlines, PAL, VIC 6569 + ;; #$06 -> 263 rasterlines, NTSC, VIC 6567R8 + ;; #$05 -> 262 rasterlines, NTSC, VIC 6567R56A + + cmp #$07 + bcs cint_pal +cint_ntsc: + lda #$00 + beq + +cint_pal: + lda #$01 +* + sta PALNTSC + ;; Initialise cursor blink flags (Compute's Mapping the 64 p215) lda #$00 sta cursor_blink_disable @@ -51,4 +76,3 @@ cint_brk: ; entry for BRK and STOP+RESTORE - XXX, where should it start? ;; Fallthrough/jump to screen clear routine (Compute's Mapping the 64 p215) jmp clear_screen - diff --git a/src/compress_text.c b/src/compress_text.c index fd156b19..57c02f19 100644 --- a/src/compress_text.c +++ b/src/compress_text.c @@ -159,15 +159,20 @@ char *error_list[]={ "LOAD", // https://www.discogs.com/Gimmik-Load-Error/release/482462 // Non-error messages "READY.\r", // #29 // https://www.ibm.com/support/knowledgecenter/zosbasics/com.ibm.zos.zconcepts/zconc_whatistsonative.htm https://github.com/stefanhaustein/expressionparser - "LOADING", // #30 // https://community.tibco.com/wiki/how-show-loading-prompt-when-reloading-external-data - "VERIFYING", // https://discussions.apple.com/thread/8087203 - "SAVING", + "NTSC, ", // #30 + "PAL, ", // #31 + "", // unused for now "ERROR", // #33 // Simply the word error that is attached to the other parts of messages https://fjkraan.home.xs4all.nl/comp/apple2faq/app2asoftfaq.html - "BYTES FREE.\r\r", // #34 // https://github.com/stefanhaustein/expressionparser + "BYTES FREE\r\r", // #34 // https://github.com/stefanhaustein/expressionparser "MEMORY CORRUPT", // #35 "NOT IMPLEMENTED", // #36 NULL}; +// XXX: create separate list for Kernal +// "LOADING", // #30 // https://community.tibco.com/wiki/how-show-loading-prompt-when-reloading-external-data +// "VERIFYING", // https://discussions.apple.com/thread/8087203 +// "SAVING", + // Token $FF is end of message, so we can have only 255 unique words #define MAX_WORDS 255 char *words[MAX_WORDS]; From 99a292530656d9d1e57d28ab2c96f70541d02ce8 Mon Sep 17 00:00:00 2001 From: FeralChild64 Date: Wed, 7 Aug 2019 22:13:08 +0200 Subject: [PATCH 13/21] IOINIT now silences SID chips, up to 4 supported --- Makefile | 4 ++ STATUS.md | 3 +- bin/basic_generic.rom | Bin 8192 -> 8192 bytes bin/basic_mega65.rom | Bin 8192 -> 8192 bytes bin/basic_ultimate64.rom | Bin 8192 -> 8192 bytes bin/kernal_generic.rom | Bin 8192 -> 8192 bytes bin/kernal_mega65.rom | Bin 8192 -> 8192 bytes bin/kernal_ultimate64.rom | Bin 8192 -> 8192 bytes c64/aliases/,aliases_hardware.s | 70 +++++++++++++++----------------- c64/kernal/fda3.ioinit.s | 22 ++++++++-- 10 files changed, 56 insertions(+), 43 deletions(-) diff --git a/Makefile b/Makefile index 739ada5d..a6a214d8 100644 --- a/Makefile +++ b/Makefile @@ -23,6 +23,10 @@ TOOL_SIMILARITY = build/tools/similarity TOOLS_LIST = $(TOOL_COLLECT_DATA) $(TOOL_COMPRESS_TEXT) $(TOOL_PNGPREPARE) $(TOOL_PREPROCESS) $(TOOL_SIMILARITY) +# GIT commit + +GIT_COMMIT:= $(shell git log -1 --pretty='%h' | tr '[:lower:]' '[:upper:]') + # Rules - main .PHONY: all clean updatebin diff --git a/STATUS.md b/STATUS.md index e11de2dd..fa58b42e 100644 --- a/STATUS.md +++ b/STATUS.md @@ -6,6 +6,7 @@ Here are the features of the Open ROMs not found in the original ROMs from the 8 * improved keyboard scanning, supports multi-key roll-over and rejection of spurious joystick input * joystick (port 1) can be used to move text cursor * uses RAM under ROM and I/O: 61436 bytes free +* cold/warm start silences 4 SID chips - assumes addresses $D400, $D420, $D440, $D460 * extended `LOAD` command * start/end addresses are displayed, in the Final cartridge style * command with just the file name tries to use the last device if it's number seems sane; otherwise uses 8 @@ -71,7 +72,7 @@ NOTE: Even the 'DONE' routines won't support features described as missing in on | Address | Name | Status | Remarks | | --------- | :------- | :------: | :------------------------------------------------: | | `$FF81` | `CINT` | DONE | | -| `$FF84` | `IOINIT` | PARTIAL | at least SID volume handling is missing | +| `$FF84` | `IOINIT` | DONE | | | `$FF87` | `RAMTAS` | DONE | | | `$FF8A` | `RESTOR` | DONE | | | `$FF8D` | `VECTOR` | DONE | | diff --git a/bin/basic_generic.rom b/bin/basic_generic.rom index 29d891b14b253a4c8bb483069f8d0b857bb2b031..82c768bfabff2a51bd13ec0e3b045336360ec807 100644 GIT binary patch delta 2131 zcmcIlYitx%6uvXtebe2owpc8}qfmBnr0 zW%u6pQ1yXTdt9~F?X_0zfkR7}nFFJbE|^ZB!_)6=+IZ=6 zrhe(n{D-H|s|oaYV#=!i6E(fJ=?X$$zaB>OcX88GOHv<}P|9p|%!Fp>4@?a+O@nL) zGedW=D|Sx`WUrtj)1^0>Y&jR@!~+ornNWEoB=9hc_X_HxLV`!I2dNIdD;4l5qpe3{ zqb)~ccv9eWY*qlW4)kx78pkcer*AM^fRL5}Qk$_i2k9lYrsP>oT<^ToaFB)}Fuopd zqt%XOT?Yl9CjH}At*yGoIjUV$ZTz{x>!qF_4gi0D9+NcB9KBxVKYVpvbMzmC{|DJF z+bzCm;Wsro$OrL=#Um{NMf!C>Uk=16>XB4PZ&c@HwS*alV&6vg4B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3zOKo2xjvw|P4!_cZU~`fHoyZq<%O!Uo`Qv&mGcCihG+g`F7C zkSyReye8sD>Fdfd^^%xZAWLKHkGW0>Q*ud+>|qCx?6R-i;u%CWdUkP%Q)KyVNLT-L2cLxpX|CjOQS+x9;>|lbcr$vV zNuULkw1pIl=cW>ul3GP>kbmmABxN=n=cLqzI!AxIN!cfe89Y zBOGR@PM&oF2OfvK`#4Z$B1{`&!((O=i?T=!EDP_-b2lcX8mv)l zm{D@E#|L|(QbtEc@Ry9BI)U?G(4g3Rj{1E2A5~oN31i4SEpi`X9l$F4k_!S)b+7%0 zL)?YK9BnwnHQ?m6U#JzYW;y4phVscw@t;M_R9_@6j%H;S$)}LS1SO79Fv%B;J%I0{ zaxXrO2_4^YRQ593%!DZdGqMUh#HFw1d@Sg0=6UMqOej|WVW(7zaIrIP!$0+0uI;Jo zrJnBED|J7y>jnG9+cN6;N!sRMBW}x|U?V?4+vZBS6koSuPb;Og(>g~=I>ld@r7V_~ zdaQL8@mlsmTgadntrx8|P!@%=lhE}L3d2wohK(@@7;wvgjRq7OfFHpvG02O-7dlV_ z@ZHKcU{r@L1LnnGVGQn!1AbpeR45z={J Date: Thu, 8 Aug 2019 17:29:50 +0200 Subject: [PATCH 14/21] fixed interrupt vector regression, updated documentation --- STATUS.md | 3 ++- bin/kernal_generic.rom | Bin 8192 -> 8192 bytes bin/kernal_mega65.rom | Bin 8192 -> 8192 bytes bin/kernal_ultimate64.rom | Bin 8192 -> 8192 bytes c64/kernal/interrupts/irq_handler.s | 2 +- c64/kernal/interrupts/nmi_handler.s | 2 +- 6 files changed, 4 insertions(+), 3 deletions(-) diff --git a/STATUS.md b/STATUS.md index fa58b42e..71c5f15f 100644 --- a/STATUS.md +++ b/STATUS.md @@ -26,8 +26,9 @@ The following ROM features are currently missing: * floating point routines * tape support * RS-232 support -* warm start (RUN/STOP + RESTORE) - NMI/BRK handling is not implemented at all +* NMI cartridge handling and BRK handling are not implemented yet * breaking Kernal routines with RUN/STOP key +* PAL/NTSC is detected, but for now only startup banner uses the result Features currently being worked on: diff --git a/bin/kernal_generic.rom b/bin/kernal_generic.rom index 4db3c6affdadb5a4ae78c0bd1cc81b3f529b66ef..bafc66c82bd6122af7002b99c49fe20f529832fe 100644 GIT binary patch delta 30 mcmZp0XmHpND=PSbIY)%q$M98!$65(yUP Date: Thu, 8 Aug 2019 17:58:57 +0200 Subject: [PATCH 15/21] changed VECTOR temporary storage address --- c64/aliases/,aliases_ram_lowmem.s | 1 + c64/kernal/vector.s | 11 +++++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/c64/aliases/,aliases_ram_lowmem.s b/c64/aliases/,aliases_ram_lowmem.s index c9f4ce6d..6108e28e 100644 --- a/c64/aliases/,aliases_ram_lowmem.s +++ b/c64/aliases/,aliases_ram_lowmem.s @@ -45,6 +45,7 @@ .alias FNADDR $BB ; $BB-$BC, current file name pointer .alias STAL $C1 ; $C1-$C2 LOAD/SAVE start address + .alias MEMUS $C3 ; $C3-$C4 temporary address for tape LOAD/SAVE ;; ;; Other low memory addresses diff --git a/c64/kernal/vector.s b/c64/kernal/vector.s index 9afc2ef8..c5ed62ba 100644 --- a/c64/kernal/vector.s +++ b/c64/kernal/vector.s @@ -20,8 +20,10 @@ vector: .scope - ;; Temporary storage location - .alias _caller_arr_ptr CMP0 + ;; Temporary storage location - checked on real C64 that this is the + ;; address originally used; after calling VECTOR and checking zero page + ;; area afterwards, the address could be found there + .alias _caller_arr_ptr MEMUS ;; According to 'Compute's Mapping the Commodore 64' page 237, ;; the CBM implementation does not disable IRQs - yet, the @@ -32,9 +34,10 @@ vector: php cli - ;; Prepare the user data pointer - stx _caller_arr_ptr + 0 + ;; Prepare the user data pointer - strange order to reduce risk + ;; of potential similarity to the original routine sty _caller_arr_ptr + 1 + stx _caller_arr_ptr + 0 ;; Select routine variant - store or restore vectors ldy #$1F From 69ea9abefd4b2b619d42eaa426924a25fdcaf9e6 Mon Sep 17 00:00:00 2001 From: FeralChild64 Date: Thu, 8 Aug 2019 18:28:20 +0200 Subject: [PATCH 16/21] finished IRQ handler, fixed cartridge startup --- STATUS.md | 1 - c64/aliases/,aliases_rom_cart.s | 5 +++++ c64/kernal/cartridge_check.s | 8 ++++---- c64/kernal/cartridge_signature.s | 3 +++ c64/kernal/interrupts/fe47.default_nmi_handler.s | 5 ++++- c64/kernal/interrupts/irq_handler.s | 15 +++++++++++++-- c64/kernal/reset_entry.s | 4 +++- 7 files changed, 32 insertions(+), 9 deletions(-) create mode 100644 c64/aliases/,aliases_rom_cart.s create mode 100644 c64/kernal/cartridge_signature.s diff --git a/STATUS.md b/STATUS.md index 71c5f15f..15d8e3d0 100644 --- a/STATUS.md +++ b/STATUS.md @@ -26,7 +26,6 @@ The following ROM features are currently missing: * floating point routines * tape support * RS-232 support -* NMI cartridge handling and BRK handling are not implemented yet * breaking Kernal routines with RUN/STOP key * PAL/NTSC is detected, but for now only startup banner uses the result diff --git a/c64/aliases/,aliases_rom_cart.s b/c64/aliases/,aliases_rom_cart.s new file mode 100644 index 00000000..c2e25c1e --- /dev/null +++ b/c64/aliases/,aliases_rom_cart.s @@ -0,0 +1,5 @@ + + ;; Cartridge ROM locations + .alias ICART_COLD_START $8000 ; $8000-$8001, cartridge cold start vector + .alias ICART_WARM_START $8002 ; $8002-$8003, cartridge warm start vector (RESTORE key) + .alias CART_SIG $8004 ; 5 bytes, signature for cartridge detection diff --git a/c64/kernal/cartridge_check.s b/c64/kernal/cartridge_check.s index de748d4e..26106ae8 100644 --- a/c64/kernal/cartridge_check.s +++ b/c64/kernal/cartridge_check.s @@ -3,13 +3,13 @@ cartridge_check: ldx #$04 cartridge_check_l1: - lda $8002,x + lda CART_SIG,x cmp cartridge_signature,x bne no_cartridge dex bpl cartridge_check_l1 - jmp ($8000) -cartridge_signature: - .byte $C3,$C2,$CD,$38,$30 + sec + rts no_cartridge: + clc rts diff --git a/c64/kernal/cartridge_signature.s b/c64/kernal/cartridge_signature.s new file mode 100644 index 00000000..2b0c5f90 --- /dev/null +++ b/c64/kernal/cartridge_signature.s @@ -0,0 +1,3 @@ + +cartridge_signature: + .byte $C3,$C2,$CD,$38,$30 diff --git a/c64/kernal/interrupts/fe47.default_nmi_handler.s b/c64/kernal/interrupts/fe47.default_nmi_handler.s index 3be62222..0d0a0ea1 100644 --- a/c64/kernal/interrupts/fe47.default_nmi_handler.s +++ b/c64/kernal/interrupts/fe47.default_nmi_handler.s @@ -13,7 +13,10 @@ default_nmi_handler: ;; XXX: RS-232 support is not implemented - ;; XXX if cartridge present, enter it through warm start vector + jsr cartridge_check + bcc + + jmp (ICART_WARM_START) +* ;; According to C64 Wiki, if STOP key is pressed, the routine assumes warm start request diff --git a/c64/kernal/interrupts/irq_handler.s b/c64/kernal/interrupts/irq_handler.s index 06175ff9..be0b40d3 100644 --- a/c64/kernal/interrupts/irq_handler.s +++ b/c64/kernal/interrupts/irq_handler.s @@ -15,9 +15,14 @@ irq_handler: tya pha - ;; XXX check if caused by BRK, react accordingly + ;; Check if caused by BRK - ;; Call interrupt routine (only if initialised) + tsx + lda $0104, x ; get the pre-interrupt processor state + and #$10 + bne irq_handler_brk + + ;; Not caused by BRK - call interrupt routine (only if initialised) lda CINV ora CINV+1 beq + @@ -25,3 +30,9 @@ irq_handler: * ;; Vector not initialized - call default interrupt routine jmp default_irq_handler + +irq_handler_brk: + + ;; Interrupt caused by BRK + jmp (CBINV) + diff --git a/c64/kernal/reset_entry.s b/c64/kernal/reset_entry.s index 0febf335..fbddb4d3 100644 --- a/c64/kernal/reset_entry.s +++ b/c64/kernal/reset_entry.s @@ -13,7 +13,9 @@ reset_entry: ; C64 PRG p269 jsr cartridge_check - + bcc + + jmp (ICART_COLD_START) +* ; The following routine is based on reading the public KERNAL jumptable routine ; list, and making unimaginative assumptions about what should be done on reset. ; Initialising IO is obviously required. also indicated by c64 prg p269. From 51230784432c9b804e9231456ab1d0ff27bc80b2 Mon Sep 17 00:00:00 2001 From: FeralChild64 Date: Thu, 8 Aug 2019 18:49:22 +0200 Subject: [PATCH 17/21] disabled BRK handling, breaks at least one game --- STATUS.md | 1 + bin/kernal_generic.rom | Bin 8192 -> 8192 bytes bin/kernal_mega65.rom | Bin 8192 -> 8192 bytes bin/kernal_ultimate64.rom | Bin 8192 -> 8192 bytes c64/kernal/interrupts/irq_handler.s | 9 +++++---- 5 files changed, 6 insertions(+), 4 deletions(-) diff --git a/STATUS.md b/STATUS.md index 15d8e3d0..6c7cdc45 100644 --- a/STATUS.md +++ b/STATUS.md @@ -27,6 +27,7 @@ The following ROM features are currently missing: * tape support * RS-232 support * breaking Kernal routines with RUN/STOP key +* BRK handling * PAL/NTSC is detected, but for now only startup banner uses the result Features currently being worked on: diff --git a/bin/kernal_generic.rom b/bin/kernal_generic.rom index bafc66c82bd6122af7002b99c49fe20f529832fe..e78ac9f69bf340a21c9a5ea1bbe20e70fc43f490 100644 GIT binary patch delta 1013 zcmYjPVQ5=b6n@EVmbOsynkDIz>3W1tT8pms*Myc9{m}^b$E*zWhxEdV(s%DBcB|*Tt}u92@?={CrW4BFz-9)Tnt>v7@)5m86zdh0? z3oS4z3R>w^FZA%Z8jZT8v?#1Pr4CsrmyUb&MU9>^AAln)g3rlpE7EyN4Xhh?V8McI z0SRYp)}L3RIGb;)y@7`B8WPv%>V|J!6-SuH`&&=;PXCZx%e1GOOCfT0?X-HglYPCm z5F&0yS1Rzgl_K;FtI2fr7YLoJD#6HRoySzEn!qzBr!3eTfX2l_D>mZdT8 zRc7pi165kC``nB0RdM_bF9kcEn3E|D-jU9Oig%OUd`_a{kl^=&ZJrGt*+16UCsSUH zL7IQCKQrm@fB}K`<`PkT>&9JGMG}glpqlyE7qJWY^N`$oq2pH6X<81EmM}3%JVfZT z)p&$NbMuD(*1Q(eKV}+q+qdTFyEbZTf)8;;{&B(`3=B(MgXX_X=gG^{ZL5&9U}-B? z?%Fm8{j3IoTCR-TE{6_;M+Lf`tL2&Nx|_oZZiQZ)L=$+;0df$#{&IpdfK5b~HPZ4Z zF&koWjl}5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_|I9ZS{Lul)X~ zm}$GaKkDeMFfMhi{9XXML_&$hyi`u=t8OY+*DK`@0_k}TKelFKU&ewH@V-OCA?4)T zNzP%VZQXbRIUBYmOt_VNQ_&ZrCb6ybwy8_1aZ5F&@t?YYUy(mU4*A z>X($K-Ta!K3o$RkqyrL3ZH=agah*X1&jkhi6+|u7BpYGK!!3n2)KCs4( zeGoUXQfu^BHkvekT9nnUS5i(^gFmJFlH=WAH%>XQK}qpU?eK4i$bs|0sFMw79CG6F zfdwGNbMbHDS1Hlw%J&X9V*irgnV*1zrr>JF&?yfuLEezA_*h}iXnH)S#nWGK4MuB^ z=kP+EEH=Yu^fUbBE>CFTYYI^tv70&Gv(qB8l3FEeu((yI^lTdpzpg@CwNN1;E1`qo zaY@aEYLR=0y%^32JM``(ITlsA-n+Et_q`cB=0aQwvDPrNSR%ymb#o%Nq_Nf)nbiMa977*dJ+3g5B*7-?7~Ug#r<3dU`l42zMBes`$>RbnF?H?O)Q7oUp?Uz zhxWexnHncG&5A3;Rl^t5OUl1oY=#Gzg||gtKTHI~g<=_T`*58~a6$e}v*Hh(8 zg{PNOH#0ZHWMpJk36?e^Tl@Td;^E5)_2G`raLPw7o!&H?xF0sSG4;>s6KXksP&Nz7d(ZX+eANTpr$>a6Y@;{kx%Ax=O diff --git a/c64/kernal/interrupts/irq_handler.s b/c64/kernal/interrupts/irq_handler.s index be0b40d3..99733333 100644 --- a/c64/kernal/interrupts/irq_handler.s +++ b/c64/kernal/interrupts/irq_handler.s @@ -17,10 +17,11 @@ irq_handler: ;; Check if caused by BRK - tsx - lda $0104, x ; get the pre-interrupt processor state - and #$10 - bne irq_handler_brk + ;; XXX disabled for now - resets Duotris game, unknown why + ; tsx + ; lda $0104, x ; get the pre-interrupt processor state + ; and #$10 + ; bne irq_handler_brk ;; Not caused by BRK - call interrupt routine (only if initialised) lda CINV From c16b4cb4bca2b9df63bc6a4c80db8e893a891bac Mon Sep 17 00:00:00 2001 From: FeralChild64 Date: Fri, 9 Aug 2019 18:07:14 +0200 Subject: [PATCH 18/21] added Kernal revision byte --- c64/kernal/ff80.interop | 1 + c64/kernal/ff80.kernal_revision.s | 31 +++++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+) create mode 100644 c64/kernal/ff80.interop create mode 100644 c64/kernal/ff80.kernal_revision.s diff --git a/c64/kernal/ff80.interop b/c64/kernal/ff80.interop new file mode 100644 index 00000000..e586be7d --- /dev/null +++ b/c64/kernal/ff80.interop @@ -0,0 +1 @@ +Byte telling Kernal version; we can probably put just about anything here, but we want to be distinct from everyone else! diff --git a/c64/kernal/ff80.kernal_revision.s b/c64/kernal/ff80.kernal_revision.s new file mode 100644 index 00000000..7cadcbec --- /dev/null +++ b/c64/kernal/ff80.kernal_revision.s @@ -0,0 +1,31 @@ + +;; +;; This byte identifies Kernal revision. Sources: +;; - [CM64] Compute's Mapping the Commodore 64 (page 242/243) +;; - [MM] Marko Mäkelä article, http://www.zimmers.net/anonftp/pub/cbm/firmware/computers/c64/revisions.txt +;; - [VICE] Checked with ROMs included in VICE emulator +;; +;; IDEA: put here a value, that is different from any version currently known, as +;; a warning that this is not a Commodore Kernal. Currently known numbers for C64 are: +;; +;; - $00 - [CM64] then current number [MM] 901227-02 [VICE] C64 Revision 2 +;; - $03 - [CM64] (not mentionned) [MM] 901227-02, 901227-03 [VICE] C64 Revision 3 +;; - $43 - [CM64] (not mentionned) [MM] 251104-04 [VICE] SX-64 +;; - $64 - [CM64] PET64 ROM [MM] (not mentionned) [VICE] PET64 +;; - $AA - [CM64] first version of ROM [MM] 901227-01 [VICE] C64 Revision 1 +;; +;; Values from unofficial ROMs: +;; - $03 - SuperCPU ROM 1.40, 2.04, also unofficial 0.7 ROM from [VICE] +;; +;; Values from other Commodore machines: +;; C128: +;; - $01 - see https://www.pagetable.com/?p=1058 +;; - $02 - unreleased updated ROM, see https://www.pagetable.com/?p=1058 +;; +;; XXX check more unofficial C64 ROMs (JiffyDOS, DolphinDOS, etc.) and other machines +;; VIC-20, PET, CBM II, 264 series, C65 prototypes, other sources for C128 ROMs +;; + + +kernal_revision: + .byte $FF From 79c09d9793033fc4c89dc405c8f24e445cf139f3 Mon Sep 17 00:00:00 2001 From: FeralChild64 Date: Fri, 9 Aug 2019 18:40:09 +0200 Subject: [PATCH 19/21] set IRQ frequency depending on video system --- STATUS.md | 5 +- c64/kernal/cint.s | 26 +------- c64/kernal/fda3.ioinit.s | 61 ++++++++++++------- c64/kernal/iec/iec_wait20us.s | 2 +- c64/kernal/iec/iec_wait60us.s | 2 +- .../interrupts/fe47.default_nmi_handler.s | 2 + c64/kernal/setup_pal_ntsc.s | 31 ++++++++++ 7 files changed, 78 insertions(+), 51 deletions(-) create mode 100644 c64/kernal/setup_pal_ntsc.s diff --git a/STATUS.md b/STATUS.md index 6c7cdc45..83831a1f 100644 --- a/STATUS.md +++ b/STATUS.md @@ -27,8 +27,7 @@ The following ROM features are currently missing: * tape support * RS-232 support * breaking Kernal routines with RUN/STOP key -* BRK handling -* PAL/NTSC is detected, but for now only startup banner uses the result +* BRK handling; NMI/IRQ handling is incomplete Features currently being worked on: @@ -73,7 +72,7 @@ NOTE: Even the 'DONE' routines won't support features described as missing in on | Address | Name | Status | Remarks | | --------- | :------- | :------: | :------------------------------------------------: | | `$FF81` | `CINT` | DONE | | -| `$FF84` | `IOINIT` | DONE | | +| `$FF84` | `IOINIT` | PARTIAL | CIA initialization incomplete | | `$FF87` | `RAMTAS` | DONE | | | `$FF8A` | `RESTOR` | DONE | | | `$FF8D` | `VECTOR` | DONE | | diff --git a/c64/kernal/cint.s b/c64/kernal/cint.s index 142005c0..3d2ae602 100644 --- a/c64/kernal/cint.s +++ b/c64/kernal/cint.s @@ -14,31 +14,7 @@ cint: cint_brk: ; entry for BRK and STOP+RESTORE - XXX, where should it start? jsr setup_vicii - - ;; Detect video system (PAL/NTSC), use Graham's method, as it's short and reliable - ;; see here: https://codebase64.org/doku.php?id=base:detect_pal_ntsc - -cint_w0: - lda VIC_RASTER -cint_w1: - cmp VIC_RASTER - beq cint_w1 - bmi cint_w0 - - ;; Result in A, if no interrupt happened during the test: - ;; #$37 -> 312 rasterlines, PAL, VIC 6569 - ;; #$06 -> 263 rasterlines, NTSC, VIC 6567R8 - ;; #$05 -> 262 rasterlines, NTSC, VIC 6567R56A - - cmp #$07 - bcs cint_pal -cint_ntsc: - lda #$00 - beq + -cint_pal: - lda #$01 -* - sta PALNTSC + jsr setup_pal_ntsc ;; Initialise cursor blink flags (Compute's Mapping the 64 p215) lda #$00 diff --git a/c64/kernal/fda3.ioinit.s b/c64/kernal/fda3.ioinit.s index 76ec2ada..fb4a159c 100644 --- a/c64/kernal/fda3.ioinit.s +++ b/c64/kernal/fda3.ioinit.s @@ -34,35 +34,54 @@ ioinit: cpy #$80 ; $20 * amount of chips to silence, $80 to silence 4 chips bne - - ;; Enable CIA1 IRQ and ~50Hz timer - ;; (https://csdb.dk/forums/?roomid=11&topicid=69037) - lda #$7f - sta $DC0D ; First disable all + ;; XXX: calibrate TOD for both CIA's, see here: https://codebase64.org/doku.php?id=base:efficient_tod_initialisation + + ;; Enable CIA1 IRQ and ~50Hz timer (https://csdb.dk/forums/?roomid=11&topicid=69037) + lda #$7F + sta CIA1_ICR ; disable all ;; Set timer interval to ~1/60th of a second - ;; (This value was calculated by running a custom IRQ haandler on a C64 + jsr setup_pal_ntsc + + ;; (This value was calculated by running a custom IRQ handler on a C64 ;; with original KERNAL, and writing the values of $DC04/5 to the screen ;; in the IRQ handler to see roughly what value the timers must be set to) - lda #<16380 - sta $dc04 - lda #>16380 - sta $dc05 + ;; ldy #<16380 + ;; ldx #>16380 + + ;; PAL C64 (https://codebase64.org/doku.php?id=base:cpu_clocking), + ;; is clocked at 0.985248 MHz, so that 1/60s is 16421 CPU cycles + + ldy #<16421 + ldx #>16421 + + lda PALNTSC + bne + + + ;; NTSC C64 (https://codebase64.org/doku.php?id=base:cpu_clocking), + ;; is clocked at 1.022727 MHz, so that 1/60s is 17045 CPU cycles + + ldy #<17045 + ldx #>17045 + + ;; Store the IRQ timing constant to CIA chip +* + sty CIA1_TIMALO + stx CIA1_TIMAHI ;; Enable timer interrupt lda #$81 - sta $dc0d + sta CIA1_ICR - ;; Enable timer A to run continuously - ;; (http://codebase64.org/doku.php?id=base:timerinterrupts) + ;; Enable timer A to run continuously (http://codebase64.org/doku.php?id=base:timerinterrupts) lda #$11 - sta $dc0e - lda $dc0d + sta CIA1_CRA + lda CIA1_ICR ;; Set DDR on CIA2 for IEC bus, VIC-II banking - lda #$3b - sta $dd02 - - ;; Set IEC bus oto its initial idle state - jsr iec_set_idle - - rts + lda #$3B + sta CIA2_DDRA + + ;; Set IEC bus to its initial idle state + jmp iec_set_idle + diff --git a/c64/kernal/iec/iec_wait20us.s b/c64/kernal/iec/iec_wait20us.s index 3ea1349f..819830cc 100644 --- a/c64/kernal/iec/iec_wait20us.s +++ b/c64/kernal/iec/iec_wait20us.s @@ -6,7 +6,7 @@ iec_wait20us: ;; PAL: ;; - CPU frequency 0.985248 MHz, we need to waste at least 20 cycles ;; NTSC: - ;; - CPU frequency 1.022727 MHZ, we need to waste at least 21 cycles + ;; - CPU frequency 1.022727 MHz, we need to waste at least 21 cycles ;; Waste cycles by reading some unimportant memory location ;; in order not to clutter VICE debug logs diff --git a/c64/kernal/iec/iec_wait60us.s b/c64/kernal/iec/iec_wait60us.s index 0f6cd957..90501a5e 100644 --- a/c64/kernal/iec/iec_wait60us.s +++ b/c64/kernal/iec/iec_wait60us.s @@ -6,7 +6,7 @@ iec_wait60us: ;; PAL: ;; - CPU frequency 0.985248 MHz, we need to waste at least 60 cycles ;; NTSC: - ;; - CPU frequency 1.022727 MHZ, we need to waste at least 62 cycles + ;; - CPU frequency 1.022727 MHz, we need to waste at least 62 cycles ;; Waste cycles in a loop diff --git a/c64/kernal/interrupts/fe47.default_nmi_handler.s b/c64/kernal/interrupts/fe47.default_nmi_handler.s index 0d0a0ea1..8814ac2c 100644 --- a/c64/kernal/interrupts/fe47.default_nmi_handler.s +++ b/c64/kernal/interrupts/fe47.default_nmi_handler.s @@ -13,6 +13,8 @@ default_nmi_handler: ;; XXX: RS-232 support is not implemented + ;; XXX confirm NMIs from CIA, or no other NMI will arrive! + jsr cartridge_check bcc + jmp (ICART_WARM_START) diff --git a/c64/kernal/setup_pal_ntsc.s b/c64/kernal/setup_pal_ntsc.s new file mode 100644 index 00000000..f0cdd3a0 --- /dev/null +++ b/c64/kernal/setup_pal_ntsc.s @@ -0,0 +1,31 @@ + +;; +;; Detect video system (PAL/NTSC), use Graham's method, as it's short and reliable +;; see here: https://codebase64.org/doku.php?id=base:detect_pal_ntsc +;; + +setup_pal_ntsc: + + lda VIC_RASTER +setup_pal_ntsc_w1: + cmp VIC_RASTER + beq setup_pal_ntsc_w1 + bmi setup_pal_ntsc + + ;; Result in A, if no interrupt happened during the test: + ;; #$37 -> 312 rasterlines, PAL, VIC 6569 + ;; #$06 -> 263 rasterlines, NTSC, VIC 6567R8 + ;; #$05 -> 262 rasterlines, NTSC, VIC 6567R56A + + cmp #$07 + bcs setup_pal + +setup_ntsc: + lda #$00 + beq + + +setup_pal: + lda #$01 +* + sta PALNTSC + rts From 689e4b46d4d017ba87e5c03d22dacc4c5d3339d5 Mon Sep 17 00:00:00 2001 From: FeralChild64 Date: Fri, 9 Aug 2019 20:12:08 +0200 Subject: [PATCH 20/21] startup fixes --- c64/kernal/cint.s | 5 ++++- c64/kernal/fda3.ioinit.s | 28 +++++++++++++++++++++++++++- c64/kernal/reset_entry.s | 30 ++++++++++++++++++++---------- c64/kernal/setup_pal_ntsc.s | 31 ------------------------------- 4 files changed, 51 insertions(+), 43 deletions(-) delete mode 100644 c64/kernal/setup_pal_ntsc.s diff --git a/c64/kernal/cint.s b/c64/kernal/cint.s index 3d2ae602..1fa22258 100644 --- a/c64/kernal/cint.s +++ b/c64/kernal/cint.s @@ -14,7 +14,10 @@ cint: cint_brk: ; entry for BRK and STOP+RESTORE - XXX, where should it start? jsr setup_vicii - jsr setup_pal_ntsc + + ;; According to [CM64], this routine also checks for PAL/NTSC - this must be a mistake, + ;; it's too late (IOINIT already needs this information), besides - POKE something + ;; to address 678 on a real C64, press STOP+RESTORE - the value won't change ;; Initialise cursor blink flags (Compute's Mapping the 64 p215) lda #$00 diff --git a/c64/kernal/fda3.ioinit.s b/c64/kernal/fda3.ioinit.s index fb4a159c..3f1a3ba9 100644 --- a/c64/kernal/fda3.ioinit.s +++ b/c64/kernal/fda3.ioinit.s @@ -34,6 +34,33 @@ ioinit: cpy #$80 ; $20 * amount of chips to silence, $80 to silence 4 chips bne - + ;; Detect video system (PAL/NTSC), use Graham's method, as it's short and reliable + ;; see here: https://codebase64.org/doku.php?id=base:detect_pal_ntsc + +ioinit_w0: + lda VIC_RASTER +ioinit_w1: + cmp VIC_RASTER + beq ioinit_w1 + bmi ioinit_w0 + + ;; Result in A, if no interrupt happened during the test: + ;; #$37 -> 312 rasterlines, PAL, VIC 6569 + ;; #$06 -> 263 rasterlines, NTSC, VIC 6567R8 + ;; #$05 -> 262 rasterlines, NTSC, VIC 6567R56A + + cmp #$07 + bcs ioinit_pal + +ioinit_ntsc: + lda #$00 + beq + + +ioinit_pal: + lda #$01 +* + sta PALNTSC + ;; XXX: calibrate TOD for both CIA's, see here: https://codebase64.org/doku.php?id=base:efficient_tod_initialisation ;; Enable CIA1 IRQ and ~50Hz timer (https://csdb.dk/forums/?roomid=11&topicid=69037) @@ -41,7 +68,6 @@ ioinit: sta CIA1_ICR ; disable all ;; Set timer interval to ~1/60th of a second - jsr setup_pal_ntsc ;; (This value was calculated by running a custom IRQ handler on a C64 ;; with original KERNAL, and writing the values of $DC04/5 to the screen diff --git a/c64/kernal/reset_entry.s b/c64/kernal/reset_entry.s index fbddb4d3..8a6ccabc 100644 --- a/c64/kernal/reset_entry.s +++ b/c64/kernal/reset_entry.s @@ -11,26 +11,36 @@ reset_entry: txs sei + ; The following routine is based on reading the public KERNAL jumptable routine + ; list, and making unimaginative assumptions about what should be done on reset. + + ; According to example here: https://codebase64.org/doku.php?id=base:assembling_your_own_cart_rom_image + ; the cartridge does not call RAMTAS - despite it's obviously required. So, call RAMTAS + ; before the cartridge check/takeover + + ; Setting up the screen and testing ram is obviously required + ; also affirmed by p269 of c64 prg + jsr RAMTAS + ; C64 PRG p269 jsr cartridge_check bcc + jmp (ICART_COLD_START) * - ; The following routine is based on reading the public KERNAL jumptable routine - ; list, and making unimaginative assumptions about what should be done on reset. - ; Initialising IO is obviously required. also indicated by c64 prg p269. - jsr ioinit - ; Setting up the screen and testing ram is obviously required - ; also affirmed by p269 of c64 prg - jsr ramtas + ; Initialising IO is obviously required. Also indicated by c64 prg p269. + ; Has to be after ther RAMTAS, as it clears memory, including the PAL/NTSC flag, + ; which is set by IOINIT + jsr IOINIT + ; Resetting IO vectors is obviously required, if we want interrupts to run ; also affirmed by c64 prg p269 - jsr restor + jsr RESTOR + ;; "Compute's Mapping the 64" p236 - jsr cint + jsr CINT ; What do we do when finished? A C64 jumps into the BASIC ROM cli ; Allow interrupts to happen ; c64 prg p269 - jmp ($a000) + jmp (IBASIC_COLD_START) diff --git a/c64/kernal/setup_pal_ntsc.s b/c64/kernal/setup_pal_ntsc.s deleted file mode 100644 index f0cdd3a0..00000000 --- a/c64/kernal/setup_pal_ntsc.s +++ /dev/null @@ -1,31 +0,0 @@ - -;; -;; Detect video system (PAL/NTSC), use Graham's method, as it's short and reliable -;; see here: https://codebase64.org/doku.php?id=base:detect_pal_ntsc -;; - -setup_pal_ntsc: - - lda VIC_RASTER -setup_pal_ntsc_w1: - cmp VIC_RASTER - beq setup_pal_ntsc_w1 - bmi setup_pal_ntsc - - ;; Result in A, if no interrupt happened during the test: - ;; #$37 -> 312 rasterlines, PAL, VIC 6569 - ;; #$06 -> 263 rasterlines, NTSC, VIC 6567R8 - ;; #$05 -> 262 rasterlines, NTSC, VIC 6567R56A - - cmp #$07 - bcs setup_pal - -setup_ntsc: - lda #$00 - beq + - -setup_pal: - lda #$01 -* - sta PALNTSC - rts From 1053e13112cd76d5fd403127f73a7f1a2accd676 Mon Sep 17 00:00:00 2001 From: FeralChild64 Date: Fri, 9 Aug 2019 21:55:38 +0200 Subject: [PATCH 21/21] updated ROM binaries, explained all similarities longer than 3 bytes --- bin/kernal_generic.rom | Bin 8192 -> 8192 bytes bin/kernal_mega65.rom | Bin 8192 -> 8192 bytes bin/kernal_ultimate64.rom | Bin 8192 -> 8192 bytes strings/018DA602 | 3 +++ strings/02A9018D | 3 +++ strings/02A97F8D | 3 +++ strings/034C09F4 | 3 +++ strings/036C0080 | 3 +++ strings/036C028020 | 3 +++ strings/036C1403 | 3 +++ strings/08A90020 | 3 +++ strings/20E1FFB0 | 3 +++ ...F250F233F357F1CAF1EDF63EF12FF366FEA5F4EDF5 | 7 +++++++ strings/608D850260 | 5 +++++ strings/60A5BAC902D0 | 4 ++++ strings/60AA20 | 3 +++ strings/{C3C2CD3830 => 60C3C2CD3830} | 4 ++-- ...1A036C1C036C1E036C20036C22036C24036C26034C | 1 + strings/6C28036C2A036C2C034C | 1 + strings/ADA602F0 | 3 +++ strings/B8D0034C | 3 +++ strings/C39914038810 | 3 +++ strings/DD09208D00DD | 5 +++++ strings/DD29DF8D00DD | 5 +++++ strings/DD29DF8D00DD60 | 5 +++++ strings/F64C54F6 | 3 +++ 26 files changed, 77 insertions(+), 2 deletions(-) create mode 100644 strings/018DA602 create mode 100644 strings/02A9018D create mode 100644 strings/02A97F8D create mode 100644 strings/034C09F4 create mode 100644 strings/036C0080 create mode 100644 strings/036C028020 create mode 100644 strings/036C1403 create mode 100644 strings/08A90020 create mode 100644 strings/20E1FFB0 create mode 100644 strings/6031EA66FE47FE4AF391F20EF250F233F357F1CAF1EDF63EF12FF366FEA5F4EDF5 create mode 100644 strings/608D850260 create mode 100644 strings/60A5BAC902D0 create mode 100644 strings/60AA20 rename strings/{C3C2CD3830 => 60C3C2CD3830} (88%) create mode 100644 strings/6C1A036C1C036C1E036C20036C22036C24036C26034C create mode 100644 strings/6C28036C2A036C2C034C create mode 100644 strings/ADA602F0 create mode 100644 strings/B8D0034C create mode 100644 strings/C39914038810 create mode 100644 strings/DD09208D00DD create mode 100644 strings/DD29DF8D00DD create mode 100644 strings/DD29DF8D00DD60 create mode 100644 strings/F64C54F6 diff --git a/bin/kernal_generic.rom b/bin/kernal_generic.rom index e78ac9f69bf340a21c9a5ea1bbe20e70fc43f490..140ad0231fada4d96304d5c3a6f1804c23649b15 100644 GIT binary patch delta 1149 zcmY+CU1%It6vt<0cC%d}$$m7;l-BLBHJWHdAF4!3$VUxb^azFuS_FGbpstbzaVx|J zo0K>ef{_h3RTGgelbyC(y0EbHVFMzGAS94>i#~`X*aut4YSx*}+-W7P@yxCPg<;N_ zbMF1$`Tx!x>ly3G_xe1?c%N_F6Dj=Qd&7HhPE0^jWN&L3Sg~MGK)=J__ut^+Hk7yV zY#GvbxU#z=v}*(oIj|t0%YlMu!`{NjkG!kwYPIpl4cb$vG=A;zMEFGWPfZag-v|RD zuNIHX;O9fZc)V6hiu|Hm+7kKs;-IX}s`#Nf5&tSq+N4U_Nkw1__l9*o`;i8d{hxRSVPWK^bmzx9r-edO@xLuZur^d`R+dhBUe6<*kc zX`AHQ$4muZu}MaSU#kDBVXw_k?2f*KT_!wHO)2<+6)Q|vy9;s4~7r)|EzD%j==SGc*aU8L(&+`J%q~^bd}#6lG3n$ zGv7zf-QD}3-6@`ymsqI*_LgzJ>Z^}{4jAOc@Z&EgosRxG`Pw-MvY3A)rME^2JCvgVN!h0x>Ph}Z2@j@e@o|)k$6s3 z8uuusH!-9t2|W5Y&4cDbD~GK>kCwp|tHy$e#vI~G2>!bQ@NIsn<-opnCwpS&z65O7 zVj$?6a~<-Hme`@4TXh@vR<&;!Gv=4%k~jCI%#4(Ky=vz%YVPDFUg3wMu}53¤K zx*qc{M!%5lrp5eJw4>?!#g)$I(tGqaHmS*M%5$o)5xv#G|A?p^qmzxR=~lfbcZm*5 zU(owL^R9mGTg{%MdNwrKw3?%Mcv4=&m^0<+=SO2t%3bBc`>~*>dmFpTI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A+PW$nB(e}5{JP8OmfI^8Gip2uI@l#2j449 z1wIYHQ)PIECxy+PurA_>3KY2nKb8I$Lx07(+B5;LnRE_UDzL%3(VsfE=S{Jxw}Rhq z6LhNRx@@xzu&I_G_6?Yt3r4vnrC+f_9}Bqyfm&#eYs*%s%hZ}5(!dBK;qbdX_HLJQ0w^wYiy>m34c+EV18w2kkh>M!bj4C+30ZiLk;G z3-wiwtAaAGipqj4<0bva*v`TPJVuBiAq>~BEU)+XL1$SzMsh9a2VulakJ(q{OanYnz@?INOKGy|L+K}3+S~Q?v^gWeyQcM# z@cN>@o;JyM3dR}}@#mDd)-8beNFlX$NOl2qWr;S7!)(!TF@1zLP z9Q*Pii5=b3`zj1^Dshdi+qstc!|f)ff*_FOS<6#;?>Bchgc7h6CR;^Uo2ZMSRuP{l zgxbYGVm8xwXI2U-AIlQ-R_@H=IX2cRofy{tlofXI>kpUVq5<)8VyUN^5%FpfT8fFK zI<@(tDiAdynJB{T?b=LdqZaK%QI%^otDlaSSgG|myU^-;aUzhEMArdPcLYO{7)1X+ zAM!qX%N$azwGq$`$#N?fKMp`|XA!>iLK(t5ze9tU45N zX4MPU))U#6P15{K#J)*V==Lb{cRXy*ms8^%ZrhN6`7&O+hd1-MXy6S4FPqq9VxNhh zb6n&&S-?3H&zN|&f-4+z9OpQWa@=p?8zzpiTb+-4KQi&zTr?XKWI-6=CrhU){{qr1 B3nc&m diff --git a/bin/kernal_ultimate64.rom b/bin/kernal_ultimate64.rom index e78ac9f69bf340a21c9a5ea1bbe20e70fc43f490..140ad0231fada4d96304d5c3a6f1804c23649b15 100644 GIT binary patch delta 1149 zcmY+CU1%It6vt<0cC%d}$$m7;l-BLBHJWHdAF4!3$VUxb^azFuS_FGbpstbzaVx|J zo0K>ef{_h3RTGgelbyC(y0EbHVFMzGAS94>i#~`X*aut4YSx*}+-W7P@yxCPg<;N_ zbMF1$`Tx!x>ly3G_xe1?c%N_F6Dj=Qd&7HhPE0^jWN&L3Sg~MGK)=J__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ZiLk;G z3-wiwtAaAGipqj4<0bva*v`TPJVuBiAq>~BEU)+XL1$SzMsh9a2VulakJ(q{OanYnz@?INOKGy|L+K}3+S~Q?v^gWeyQcM# z@cN>@o;JyM3dR}}@#mDd)-8beNFlX$NOl2qWr;S7!)(!TF@1zLP z9Q*Pii5=b3`zj1^Dshdi+qstc!|f)ff*_FOS<6#;?>Bchgc7h6CR;^Uo2ZMSRuP{l zgxbYGVm8xwXI2U-AIlQ-R_@H=IX2cRofy{tlofXI>kpUVq5<)8VyUN^5%FpfT8fFK zI<@(tDiAdynJB{T?b=LdqZaK%QI%^otDlaSSgG|myU^-;aUzhEMArdPcLYO{7)1X+ zAM!qX%N$azwGq$`$#N?fKMp`|XA!>iLK(t5ze9tU45N zX4MPU))U#6P15{K#J)*V==Lb{cRXy*ms8^%ZrhN6`7&O+hd1-MXy6S4FPqq9VxNhh zb6n&&S-?3H&zN|&f-4+z9OpQWa@=p?8zzpiTb+-4KQi&zTr?XKWI-6=CrhU){{qr1 B3nc&m diff --git a/strings/018DA602 b/strings/018DA602 new file mode 100644 index 00000000..5404e18b --- /dev/null +++ b/strings/018DA602 @@ -0,0 +1,3 @@ +$01 + STA $02A6 (PAL/NTSC flag) + +Instruction and a part (storing data into a decumented variable). Not copyrightable. diff --git a/strings/02A9018D b/strings/02A9018D new file mode 100644 index 00000000..a7822c3a --- /dev/null +++ b/strings/02A9018D @@ -0,0 +1,3 @@ +$02 + LDA #$01 + STA (address does not match) + +Instruction + some parts. Not copyrightable. diff --git a/strings/02A97F8D b/strings/02A97F8D new file mode 100644 index 00000000..dbf4cde4 --- /dev/null +++ b/strings/02A97F8D @@ -0,0 +1,3 @@ +$02 + LDA #$7F + STA (address does not match) + +Instruction + some parts. Not copyrightable. diff --git a/strings/034C09F4 b/strings/034C09F4 new file mode 100644 index 00000000..7a3dbddb --- /dev/null +++ b/strings/034C09F4 @@ -0,0 +1,3 @@ +$03 + JMP $F409 + +Instruction + some part. Not copyrightable. diff --git a/strings/036C0080 b/strings/036C0080 new file mode 100644 index 00000000..87cb7116 --- /dev/null +++ b/strings/036C0080 @@ -0,0 +1,3 @@ +$03 + JMP ($8000) (jump via cartridge vector) + +Instruction (jump via a documented vector) + some part. Not copyrightable. diff --git a/strings/036C028020 b/strings/036C028020 new file mode 100644 index 00000000..2a086842 --- /dev/null +++ b/strings/036C028020 @@ -0,0 +1,3 @@ +$03 + JMP ($8002) (cartridge vector) + JSR (address does not match, part of other branch) + +Instruction and some parts. Not copyrightable. diff --git a/strings/036C1403 b/strings/036C1403 new file mode 100644 index 00000000..d5c29c2b --- /dev/null +++ b/strings/036C1403 @@ -0,0 +1,3 @@ +$03 + JMP ($0314) (jump via CINV) + +Instruction (jump via documented vector) + some part. Not copyrightable. diff --git a/strings/08A90020 b/strings/08A90020 new file mode 100644 index 00000000..8f1e0328 --- /dev/null +++ b/strings/08A90020 @@ -0,0 +1,3 @@ +PHP + LDA #$00 + JSR (address does not match) + +Two very simple instructions (one without argument, second zeroing a register) + a part. Not creative - not copyrightable. diff --git a/strings/20E1FFB0 b/strings/20E1FFB0 new file mode 100644 index 00000000..4489ec2c --- /dev/null +++ b/strings/20E1FFB0 @@ -0,0 +1,3 @@ +JSR $FFE1 (STOP routine jumptable address) + BCS (offset does not match) + +Instruction (call of documented subroutine) and a half - not copyrightable. diff --git a/strings/6031EA66FE47FE4AF391F20EF250F233F357F1CAF1EDF63EF12FF366FEA5F4EDF5 b/strings/6031EA66FE47FE4AF391F20EF250F233F357F1CAF1EDF63EF12FF366FEA5F4EDF5 new file mode 100644 index 00000000..b12c656e --- /dev/null +++ b/strings/6031EA66FE47FE4AF391F20EF250F233F357F1CAF1EDF63EF12FF366FEA5F4EDF5 @@ -0,0 +1,7 @@ +RTS (from previous routine) + a list of vectors to be copied starting from $0314 + +Values of the vectors are already present in many autostart software - as it often overrides them, +sometimes changing one to trigger autostart (one of the possible techniques). We have to use the same +vector values to be compatible (in fact, it even complicates our implementation) - see *.interop files +for more details. + diff --git a/strings/608D850260 b/strings/608D850260 new file mode 100644 index 00000000..bdc30ddc --- /dev/null +++ b/strings/608D850260 @@ -0,0 +1,5 @@ +RTS (from previous routine) + STA $0285 (TIMOUT variable) + RTS + +SETTMO routine (+ RTS from previous one). There really is just one sane way to +implement a subroutine storing accumulator in a fixed memory location. +Not creative - not copyrightable. diff --git a/strings/60A5BAC902D0 b/strings/60A5BAC902D0 new file mode 100644 index 00000000..fc3f35f3 --- /dev/null +++ b/strings/60A5BAC902D0 @@ -0,0 +1,4 @@ +RTS (from previous routine) + LDA $BA (current device number) + CMP $02 + BNE (offset does not match) + +Routine starts by checking whether the device is RS-232 - nothing creative, not copyrightable. + diff --git a/strings/60AA20 b/strings/60AA20 new file mode 100644 index 00000000..0b4517ad --- /dev/null +++ b/strings/60AA20 @@ -0,0 +1,3 @@ +RTS (from previous routine) + TAX + JSR (address does not match) + +Routine starting from TAX + some subroutine jump. Not copyrightable. diff --git a/strings/C3C2CD3830 b/strings/60C3C2CD3830 similarity index 88% rename from strings/C3C2CD3830 rename to strings/60C3C2CD3830 index 395bb154..1190bf40 100644 --- a/strings/C3C2CD3830 +++ b/strings/60C3C2CD3830 @@ -1,6 +1,6 @@ -CBM80 cartridge signature +RTS + CBM80 PETSCII string -This is the string used to compare with the signature block of +CBM80 is the string used to compare with the signature block of a cartridge. It is required for interoperability with C64 cartridges, and the requirement for this string is explicit, and is well documented, including the string itself, in many places, such as: diff --git a/strings/6C1A036C1C036C1E036C20036C22036C24036C26034C b/strings/6C1A036C1C036C1E036C20036C22036C24036C26034C new file mode 100644 index 00000000..fcfe7208 --- /dev/null +++ b/strings/6C1A036C1C036C1E036C20036C22036C24036C26034C @@ -0,0 +1 @@ +This is a part of Kernal jumptable - series of jumps, sometimes to the well known addreses (or through documented vectors). No business logic, part of the Kernal API itself - not copyrightable. diff --git a/strings/6C28036C2A036C2C034C b/strings/6C28036C2A036C2C034C new file mode 100644 index 00000000..fcfe7208 --- /dev/null +++ b/strings/6C28036C2A036C2C034C @@ -0,0 +1 @@ +This is a part of Kernal jumptable - series of jumps, sometimes to the well known addreses (or through documented vectors). No business logic, part of the Kernal API itself - not copyrightable. diff --git a/strings/ADA602F0 b/strings/ADA602F0 new file mode 100644 index 00000000..17bb093a --- /dev/null +++ b/strings/ADA602F0 @@ -0,0 +1,3 @@ +LDA $02A6 (PALNTSC) + BEQ (offset does not match) + +Instruction (read of a documented routine) + a half - not copyrightable. diff --git a/strings/B8D0034C b/strings/B8D0034C new file mode 100644 index 00000000..1e2f4b72 --- /dev/null +++ b/strings/B8D0034C @@ -0,0 +1,3 @@ +$B8 + BNE (offset match) + JMP (address does not match) + +Instruction + some parts. Not copyrightable. diff --git a/strings/C39914038810 b/strings/C39914038810 new file mode 100644 index 00000000..21d8b91f --- /dev/null +++ b/strings/C39914038810 @@ -0,0 +1,3 @@ +$C3 + STA $0314, Y + DEY + BPL (offset does not match) + +Part of the loop processing a documented array, but only two instructions fully match. Nothing creative - not copyrightable. diff --git a/strings/DD09208D00DD b/strings/DD09208D00DD new file mode 100644 index 00000000..56c3d79f --- /dev/null +++ b/strings/DD09208D00DD @@ -0,0 +1,5 @@ +$DD + ORA #$20 + STA $DD00 + +$DD00 is a hardware register, where one typically set/unset/read individual bits. +Having a set of trivial helper subroutines to set/clear individual bits (or groups of bits) is an obvious solution (thus not copyrightable), some similarities are unevitable. +Besides, in this case (since the similarity does not even cover a single subroutine from start to end) it is clear that the similar code actually performs slightly different actions. diff --git a/strings/DD29DF8D00DD b/strings/DD29DF8D00DD new file mode 100644 index 00000000..697075eb --- /dev/null +++ b/strings/DD29DF8D00DD @@ -0,0 +1,5 @@ +$DD + AND #$DF + STA $DD00 + +$DD00 is a hardware register, where one typically set/unset/read individual bits. +Having a set of trivial helper subroutines to set/clear individual bits (or groups of bits) is an obvious solution (thus not copyrightable), some similarities are unevitable. +Besides, in this case (since the similarity does not even cover a single subroutine from start to end) it is clear that the similar code actually performs slightly different actions. diff --git a/strings/DD29DF8D00DD60 b/strings/DD29DF8D00DD60 new file mode 100644 index 00000000..dd4fcd9c --- /dev/null +++ b/strings/DD29DF8D00DD60 @@ -0,0 +1,5 @@ +$DD + AND #$DF + STA $DD00 + RTS + +$DD00 is a hardware register, where one typically set/unset/read individual bits. +Having a set of trivial helper subroutines to set/clear individual bits (or groups of bits) is an obvious solution (thus not copyrightable), some similarities are unevitable. +Besides, in this case (since the similarity does not even cover a single subroutine from start to end) it is clear that the similar code actually performs slightly different actions. diff --git a/strings/F64C54F6 b/strings/F64C54F6 new file mode 100644 index 00000000..8602c5f4 --- /dev/null +++ b/strings/F64C54F6 @@ -0,0 +1,3 @@ +$F6 + JMP $F654 + +Instruction and a part - not copyrightable.