started separating 'printf' as debug-only routine
This commit is contained in:
1 parent
c3cbfcebfb
commit
c173540fac
13 files changed
+86
-74
No files matched your search
@@ -94,7 +94,7 @@ 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.
|
||||
|
||||
### `CONFIG_STUBS_BRK`
|
||||
### `CONFIG_DBG_STUBS_BRK`
|
||||
|
||||
Option just for debugging purposes - replaces `RTS` stubbed routines implementation with one causing a break.
|
||||
|
||||
|
||||
@@ -23,4 +23,5 @@
|
||||
#define CONFIG_DOS_WEDGE
|
||||
#define CONFIG_BCD_SAFE_INTERRUPTS
|
||||
|
||||
// #define CONFIG_STUBS_BRK
|
||||
// #define CONFIG_DBG_STUBS_BRK
|
||||
#define CONFIG_DBG_PRINTF
|
||||
@@ -23,4 +23,5 @@
|
||||
#define CONFIG_DOS_WEDGE
|
||||
#define CONFIG_BCD_SAFE_INTERRUPTS
|
||||
|
||||
// #define CONFIG_STUBS_BRK
|
||||
// #define CONFIG_DBG_STUBS_BRK
|
||||
#define CONFIG_DBG_PRINTF
|
||||
@@ -23,4 +23,5 @@
|
||||
#define CONFIG_DOS_WEDGE
|
||||
#define CONFIG_BCD_SAFE_INTERRUPTS
|
||||
|
||||
// #define CONFIG_STUBS_BRK
|
||||
// #define CONFIG_DBG_STUBS_BRK
|
||||
#define CONFIG_DBG_PRINTF
|
||||
@@ -75,7 +75,7 @@
|
||||
|
||||
.macro STUB_IMPLEMENTATION()
|
||||
{
|
||||
#if CONFIG_STUBS_BRK
|
||||
#if CONFIG_DBG_STUBS_BRK
|
||||
STUB_IMPLEMENTATION_BRK()
|
||||
#else
|
||||
STUB_IMPLEMENTATION_RTS()
|
||||
|
||||
@@ -3,5 +3,9 @@
|
||||
|
||||
#import "KERNAL_combined.sym"
|
||||
|
||||
|
||||
#if CONFIG_DBG_PRINTF
|
||||
.label printf = KERNAL.printf
|
||||
.label printf_printhexbyte = KERNAL.printf_printhexbyte
|
||||
#endif
|
||||
|
||||
.label print_hex_byte = KERNAL.print_hex_byte
|
||||
@@ -16,12 +16,11 @@ basic_warm_start:
|
||||
jsr print_packed_message
|
||||
|
||||
lda CMP0+1
|
||||
jsr printf_printhexbyte
|
||||
jsr print_hex_byte
|
||||
lda CMP0+0
|
||||
jsr printf_printhexbyte
|
||||
jsr print_hex_byte
|
||||
lda #$0D
|
||||
jsr JCHROUT
|
||||
|
||||
!:
|
||||
jmp basic_main_loop
|
||||
|
||||
@@ -1,17 +1,16 @@
|
||||
cmd_stop:
|
||||
jsr printf // XXX don't use printf, use packed messages!
|
||||
.text "BREAK"
|
||||
.byte 0
|
||||
ldx #38 // "BREAK"
|
||||
jsr print_packed_message
|
||||
|
||||
// Check for direct mode
|
||||
// Are we in direct mode
|
||||
lda CURLIN+1
|
||||
cmp #$FF
|
||||
beq !+
|
||||
|
||||
// Not direct mode
|
||||
jsr printf // XXX don't use printf, use packed messages!
|
||||
.text " IN "
|
||||
.byte 0
|
||||
ldx #37
|
||||
jsr print_packed_message
|
||||
|
||||
lda CURLIN+1
|
||||
ldx CURLIN+0
|
||||
jsr print_integer
|
||||
|
||||
@@ -152,9 +152,8 @@ do_basic_error:
|
||||
beq !+
|
||||
|
||||
// We were in a program, so show IN <line>
|
||||
jsr printf // XXX don't use printf, use packed messages
|
||||
.text " IN "
|
||||
.byte 0
|
||||
ldx #37
|
||||
jsr print_packed_message
|
||||
|
||||
lda CURLIN+1
|
||||
ldx CURLIN+0
|
||||
|
||||
@@ -117,9 +117,9 @@ lvs_display_start_addr:
|
||||
.text " FROM $"
|
||||
.byte 0
|
||||
lda STAL+1
|
||||
jsr printf_printhexbyte
|
||||
jsr print_hex_byte
|
||||
lda STAL+0
|
||||
jmp printf_printhexbyte
|
||||
jmp print_hex_byte
|
||||
|
||||
lvs_display_done:
|
||||
// Display end address
|
||||
@@ -129,9 +129,9 @@ lvs_display_done:
|
||||
.text " TO $"
|
||||
.byte 0
|
||||
lda STAL+1
|
||||
jsr printf_printhexbyte
|
||||
jsr print_hex_byte
|
||||
lda STAL+0
|
||||
jsr printf_printhexbyte
|
||||
jsr print_hex_byte
|
||||
lda #$0D
|
||||
jmp JCHROUT
|
||||
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
|
||||
//
|
||||
// Print the hex value in .A as two digits
|
||||
//
|
||||
|
||||
print_hex_byte:
|
||||
|
||||
#if HAS_BCD_SAFE_INTERRUPTS
|
||||
|
||||
// Idea by Haubitze
|
||||
|
||||
sed
|
||||
pha
|
||||
lsr
|
||||
lsr
|
||||
lsr
|
||||
lsr
|
||||
cmp #$0A
|
||||
adc #$30
|
||||
jsr JCHROUT
|
||||
pla
|
||||
and #$0F
|
||||
cmp #$0A
|
||||
adc #$30
|
||||
cld
|
||||
jmp JCHROUT
|
||||
|
||||
#else
|
||||
|
||||
pha
|
||||
lsr
|
||||
lsr
|
||||
lsr
|
||||
lsr
|
||||
ora #$30
|
||||
cmp #$3A
|
||||
bcc !+
|
||||
adc #6
|
||||
!: jsr JCHROUT
|
||||
pla
|
||||
and #$0f
|
||||
ora #$30
|
||||
cmp #$3A
|
||||
bcc !+
|
||||
adc #6
|
||||
!: jmp JCHROUT
|
||||
|
||||
#endif
|
||||
+7
-49
@@ -9,6 +9,8 @@
|
||||
// .byte 2,$low,$hi = display word as hex
|
||||
// .byte $f0+n,$low,$hi = display byte at $hi$lo+n as hex
|
||||
|
||||
#if CONFIG_DBG_PRINTF
|
||||
|
||||
printf:
|
||||
// Temporary storage is between end of screen at $0400
|
||||
// and the sprite pointers at $7f8
|
||||
@@ -63,7 +65,7 @@ printf_continues:
|
||||
// Read the low byte
|
||||
jsr $7f4
|
||||
// Print as hex
|
||||
jsr printf_printhexbyte
|
||||
jsr print_hex_byte
|
||||
jmp printf_nextchar
|
||||
|
||||
not_hexbyte:
|
||||
@@ -77,13 +79,13 @@ not_hexbyte:
|
||||
// Read the high byte
|
||||
jsr $7f4
|
||||
// Print as hex
|
||||
jsr printf_printhexbyte
|
||||
jsr print_hex_byte
|
||||
// Skip the token
|
||||
jsr printf_retreat
|
||||
// Read the low byte
|
||||
jsr $7f4
|
||||
// Print as hex
|
||||
jsr printf_printhexbyte
|
||||
jsr print_hex_byte
|
||||
jsr printf_advance
|
||||
jmp printf_nextchar
|
||||
|
||||
@@ -107,7 +109,7 @@ not_hexword:
|
||||
sta $fe
|
||||
|
||||
lda ($fd),y
|
||||
jsr printf_printhexbyte
|
||||
jsr print_hex_byte
|
||||
jmp printf_nextchar
|
||||
|
||||
not_pointer:
|
||||
@@ -118,7 +120,6 @@ printf_nextchar:
|
||||
jsr printf_advance
|
||||
jmp printf_loop
|
||||
|
||||
|
||||
printf_advance:
|
||||
// Advance pointer to next character
|
||||
inc $7f5
|
||||
@@ -138,48 +139,5 @@ printf_retreat:
|
||||
sta $7f6
|
||||
rts
|
||||
|
||||
printf_printhexbyte:
|
||||
#endif // CONFIG_DBG_PRINTF
|
||||
|
||||
// Print the hex value in .A as two digits
|
||||
|
||||
#if HAS_BCD_SAFE_INTERRUPTS
|
||||
|
||||
// Idea by Haubitze
|
||||
|
||||
sed
|
||||
pha
|
||||
lsr
|
||||
lsr
|
||||
lsr
|
||||
lsr
|
||||
cmp #$0A
|
||||
adc #$30
|
||||
jsr JCHROUT
|
||||
pla
|
||||
and #$0F
|
||||
cmp #$0A
|
||||
adc #$30
|
||||
cld
|
||||
jmp JCHROUT
|
||||
|
||||
#else
|
||||
|
||||
pha
|
||||
lsr
|
||||
lsr
|
||||
lsr
|
||||
lsr
|
||||
ora #$30
|
||||
cmp #$3A
|
||||
bcc !+
|
||||
adc #6
|
||||
!: jsr JCHROUT
|
||||
pla
|
||||
and #$0f
|
||||
ora #$30
|
||||
cmp #$3A
|
||||
bcc !+
|
||||
adc #6
|
||||
!: jmp JCHROUT
|
||||
|
||||
#endif
|
||||
+4
-2
@@ -24,7 +24,7 @@
|
||||
LOAD and SAVE. Indeed, that this is so is highlighted by the fact that it was used in the
|
||||
C64 ROM. Therefore there is no exercise of creativity here, and a reasonable person would
|
||||
likely select this name independently. Also, single words cannot be copyright.
|
||||
|
||||
|
||||
Further, the list is a list of facts, and thus not copyrightable.
|
||||
|
||||
We sourced the list from a public source, https://www.c64-wiki.com/wiki/BASIC, which has
|
||||
@@ -161,11 +161,13 @@ char *error_list[]={
|
||||
"READY.\r", // #29 // https://www.ibm.com/support/knowledgecenter/zosbasics/com.ibm.zos.zconcepts/zconc_whatistsonative.htm https://github.com/stefanhaustein/expressionparser
|
||||
"NTSC, ", // #30
|
||||
"PAL, ", // #31
|
||||
"BRK AT $", // #32
|
||||
"BREAK AT $", // #32
|
||||
"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
|
||||
"MEMORY CORRUPT", // #35
|
||||
"NOT IMPLEMENTED", // #36
|
||||
" IN ", // #37
|
||||
"BREAK", // #38
|
||||
NULL};
|
||||
|
||||
// XXX: create separate list for Kernal
|
||||
|
||||
Reference in new issue
Block a user