diff --git a/CONFIG.md b/CONFIG.md index 4b8a320d..8e85748f 100644 --- a/CONFIG.md +++ b/CONFIG.md @@ -94,8 +94,14 @@ On the most widespread CPUs the D flag is not cleared upon entering interrupts. Feature needs 2 bytes in KERNAL segmment (for CPUs needing the patch), but at the same time allows optimizations allowing to gain some more bytes. If unsure - enable. +## Debug options + +Options in this section are for debug purposes only. If unsure - disable. + ### `CONFIG_DBG_STUBS_BRK` -Option just for debugging purposes - replaces `RTS` stubbed routines implementation with one causing a break. +Replaces `RTS` stubbed routines implementation with one causing a break. -If unsure - disable. +### `CONFIG_DBG_PRINTF` + +Makes 'printf' routine available. diff --git a/c64/,,config_generic.s b/c64/,,config_generic.s index 5f5b261f..909a70ed 100644 --- a/c64/,,config_generic.s +++ b/c64/,,config_generic.s @@ -24,4 +24,4 @@ #define CONFIG_BCD_SAFE_INTERRUPTS // #define CONFIG_DBG_STUBS_BRK -#define CONFIG_DBG_PRINTF +// #define CONFIG_DBG_PRINTF diff --git a/c64/,,config_mega65.s b/c64/,,config_mega65.s index 94b3d725..f292a412 100644 --- a/c64/,,config_mega65.s +++ b/c64/,,config_mega65.s @@ -24,4 +24,4 @@ #define CONFIG_BCD_SAFE_INTERRUPTS // #define CONFIG_DBG_STUBS_BRK -#define CONFIG_DBG_PRINTF +// #define CONFIG_DBG_PRINTF diff --git a/c64/,,config_ultimate64.s b/c64/,,config_ultimate64.s index bce0b758..1c075909 100644 --- a/c64/,,config_ultimate64.s +++ b/c64/,,config_ultimate64.s @@ -24,4 +24,4 @@ #define CONFIG_BCD_SAFE_INTERRUPTS // #define CONFIG_DBG_STUBS_BRK -#define CONFIG_DBG_PRINTF +// #define CONFIG_DBG_PRINTF diff --git a/c64/kernal/assets/kernal_messages.s b/c64/kernal/assets/kernal_messages.s new file mode 100644 index 00000000..9bbc3e33 --- /dev/null +++ b/c64/kernal/assets/kernal_messages.s @@ -0,0 +1,44 @@ + +// +// Messages to be prined out by Kernal +// + +// Double underscore prevents labels from being passed to VICE (would confuse monitor) + +.label __MSG_KERNAL_SEARCHING_FOR = __kernal_message_searching_for - __kernal_messages_start +.label __MSG_KERNAL_LOADING = __kernal_message_loading - __kernal_messages_start +.label __MSG_KERNAL_VERIFYING = __kernal_message_verifying - __kernal_messages_start +.label __MSG_KERNAL_SAVING = __kernal_message_saving - __kernal_messages_start +.label __MSG_KERNAL_FROM_HEX = __kernal_message_from_hex - __kernal_messages_start +.label __MSG_KERNAL_TO_HEX = __kernal_message_to_hex - __kernal_messages_start + + +__kernal_messages_start: + +__kernal_message_searching_for: + .byte $0D + .text "SEARCHING FOR " + .byte 0 + +__kernal_message_loading: + .byte $0D + .text "LOADING" + .byte 0 + +__kernal_message_verifying: + .byte $0D + .text "VERIFYING" + .byte 0 + +__kernal_message_saving: + .byte $0D + .text "SAVING" + .byte 0 + +__kernal_message_from_hex: + .text " FROM $" + .byte 0 + +__kernal_message_to_hex: + .text " TO $" + .byte 0 diff --git a/c64/kernal/lvs_helpers.s b/c64/kernal/lvs_helpers.s index bde3f0b7..996fbfa8 100644 --- a/c64/kernal/lvs_helpers.s +++ b/c64/kernal/lvs_helpers.s @@ -71,10 +71,10 @@ lvs_advance_pointer: lvs_display_searching_for: lda MSGFLG bpl lvs_display_end - jsr printf // XXX don't use printf, use packed message - .byte $0D - .text "SEARCHING FOR " - .byte 0 + + ldx #__MSG_KERNAL_SEARCHING_FOR + jsr print_kernal_message + ldy #$00 !: cpy FNLEN @@ -98,24 +98,21 @@ lvs_display_loading_verifying: // Display LOADING / VERIFYING and start address lda MSGFLG bpl lvs_display_end + + ldx #__MSG_KERNAL_LOADING lda VERCKK beq !+ - jsr printf // XXX don't use printf, use packed message - .byte $0D - .text "VERIFYING" - .byte 0 - jmp lvs_display_start_addr + ldx #__MSG_KERNAL_VERIFYING !: - jsr printf // XXX don't use printf, use packed message - .byte $0D - .text "LOADING" - .byte 0 + jsr print_kernal_message + // FALLTHROUGH lvs_display_start_addr: - jsr printf // XXX don't use printf, use packed message - .text " FROM $" - .byte 0 + ldx #__MSG_KERNAL_FROM_HEX +!: + jsr print_kernal_message + lda STAL+1 jsr print_hex_byte lda STAL+0 @@ -125,13 +122,9 @@ lvs_display_done: // Display end address lda MSGFLG bpl lvs_display_end - jsr printf // XXX don't use printf, use packed message - .text " TO $" - .byte 0 - lda STAL+1 - jsr print_hex_byte - lda STAL+0 - jsr print_hex_byte + + ldx #__MSG_KERNAL_TO_HEX + jsr !- jmp print_return lvs_wrap_around_error: diff --git a/c64/kernal/print/print_kernal_message.s b/c64/kernal/print/print_kernal_message.s new file mode 100644 index 00000000..ed2b9f4e --- /dev/null +++ b/c64/kernal/print/print_kernal_message.s @@ -0,0 +1,14 @@ + +// +// Print one of the standard Kernal messages, index in .X +// + +!: + jsr JCHROUT + inx + +print_kernal_message: + + lda __kernal_messages_start, x + bne !- // 0 marks end of string + rts