deduplicated some print character routines

This commit is contained in:
FeralChild64 committed 2019-10-03 22:21:44 +02:00
1 parent c173540fac
commit 2608e1b153
18 files changed
+68 -45

No files matched your search

+1 -1
View File
@@ -3,7 +3,7 @@
SRCDIR_COMMON = c64/aliases SRCDIR_COMMON = c64/aliases
SRCDIR_BASIC_COMMON = $(SRCDIR_COMMON) c64/basic SRCDIR_BASIC_COMMON = $(SRCDIR_COMMON) c64/basic
SRCDIR_KERNAL_COMMON = $(SRCDIR_COMMON) c64/kernal c64/kernal/assets c64/kernal/jumptable c64/kernal/iec c64/kernal/interrupts SRCDIR_KERNAL_COMMON = $(SRCDIR_COMMON) c64/kernal c64/kernal/assets c64/kernal/jumptable c64/kernal/iec c64/kernal/interrupts c64/kernal/print
SRCDIR_BASIC_generic = $(SRCDIR_BASIC_COMMON) c64/basic/,target_generic SRCDIR_BASIC_generic = $(SRCDIR_BASIC_COMMON) c64/basic/,target_generic
SRCDIR_BASIC_mega65 = $(SRCDIR_BASIC_COMMON) c64/basic/,target_mega65 SRCDIR_BASIC_mega65 = $(SRCDIR_BASIC_COMMON) c64/basic/,target_mega65
+1 -2
View File
@@ -65,7 +65,6 @@ Note: vectors at `$0300` are not supported yet - for now only the locations belo
| `($A000)` | | cold start | PARTIAL | | | `($A000)` | | cold start | PARTIAL | |
| `($A002)` | | warm start | PARTIAL | | | `($A002)` | | warm start | PARTIAL | |
<br /> <br />
### Unofficial BASIC routines/locations ### Unofficial BASIC routines/locations
@@ -82,7 +81,7 @@ Not all of them - only these we want to have implemented.
| `$AB1E` | STROUT | DONE | | | `$AB1E` | STROUT | DONE | |
| `$BDCD` | LINPRT | NOT DONE | | | `$BDCD` | LINPRT | NOT DONE | |
| `$E3BF` | INIT | NOT DONE | | | `$E3BF` | INIT | NOT DONE | |
| `$E422` | INITMSG | NOT DONE | | | `$E422` | INITMSG | PARTIAL | banner printed outside |
| `$E453` | RVECT | NOT DONE | | | `$E453` | RVECT | NOT DONE | |
<br /> <br />
+2
View File
@@ -9,3 +9,5 @@
#endif #endif
.label print_hex_byte = KERNAL.print_hex_byte .label print_hex_byte = KERNAL.print_hex_byte
.label print_return = KERNAL.print_return
.label print_space = KERNAL.print_space
+1 -3
View File
@@ -49,10 +49,8 @@ basic_cold_start:
sbc TXTTAB+1 sbc TXTTAB+1
jsr print_integer jsr print_integer
jsr print_space
lda #$20
jsr JCHROUT
// Print the rest of the start up message // Print the rest of the start up message
ldx #34 ldx #34
jsr print_packed_message jsr print_packed_message
+4 -8
View File
@@ -6,8 +6,7 @@ basic_do_error:
pha pha
// Print ? at start // Print ? at start
lda #$0D jsr print_return
jsr JCHROUT
lda #$3F lda #$3F
jsr JCHROUT jsr JCHROUT
@@ -17,8 +16,7 @@ basic_do_error:
jsr print_packed_message jsr print_packed_message
// Print ERROR at end // Print ERROR at end
lda #$20 jsr print_space
jsr JCHROUT
ldx #33 ldx #33
jsr print_packed_message jsr print_packed_message
@@ -26,10 +24,8 @@ basic_do_error:
// XXX print line number if not in direct mode // XXX print line number if not in direct mode
lda #$0D jsr print_return
jsr JCHROUT jsr print_return
lda #$0D // XXX do we need this?
jsr JCHROUT
// Reset stack, and go back to main loop // Reset stack, and go back to main loop
ldx #$FE ldx #$FE
+3 -4
View File
@@ -34,7 +34,7 @@ got_line_of_input:
stx __tokenise_work1 stx __tokenise_work1
// Strip leading spaces from the line // Strip leading spaces from the line
remove_leading_spaces: remove_leading_spaces:
lda $0200 lda $0200
cmp #$20 cmp #$20
bne !+ bne !+
@@ -51,15 +51,14 @@ rsl_l1: lda $0200,x
bne remove_leading_spaces bne remove_leading_spaces
!: !:
// Do printing of the new line // Do printing of the new line
lda #$0d jsr print_return
jsr JCHROUT
// Ignore empty lines // Ignore empty lines
lda __tokenise_work1 lda __tokenise_work1
beq basic_read_next_line beq basic_read_next_line
// Else, tokenise the line // Else, tokenise the line
jsr tokenise_line jsr tokenise_line
// Has the user entered a line of BASIC beginning with a number? // Has the user entered a line of BASIC beginning with a number?
lda $0200 lda $0200
+1 -2
View File
@@ -19,8 +19,7 @@ basic_warm_start:
jsr print_hex_byte jsr print_hex_byte
lda CMP0+0 lda CMP0+0
jsr print_hex_byte jsr print_hex_byte
lda #$0D jsr print_return
jsr JCHROUT
!: !:
jmp basic_main_loop jmp basic_main_loop
+2 -2
View File
@@ -16,7 +16,7 @@ cmd_stop:
jsr print_integer jsr print_integer
!: !:
lda #$0D jsr print_return
jsr JCHROUT
cmd_end: cmd_end:
jmp basic_main_loop jmp basic_main_loop
+4 -6
View File
@@ -60,8 +60,7 @@ list_single_line: // entry point needed by DOS wedge
tax tax
pla pla
jsr print_integer jsr print_integer
lda #$20 jsr print_space
jsr JCHROUT
// Iterate through printing out the line // Iterate through printing out the line
// contents // contents
@@ -69,7 +68,7 @@ list_single_line: // entry point needed by DOS wedge
sta QTSW sta QTSW
ldy #4 ldy #4
list_print_loop: list_print_loop:
#if CONFIG_MEMORY_MODEL_60K #if CONFIG_MEMORY_MODEL_60K
ldx #<OLDTXT ldx #<OLDTXT
@@ -145,7 +144,6 @@ list_end_of_line:
lda #$92 lda #$92
jsr JCHROUT jsr JCHROUT
// Print end of line // Print end of line
lda #$0d jmp print_return
jsr JCHROUT
rts
+5 -9
View File
@@ -125,12 +125,11 @@ do_TO_MANY_FILES_error:
// Error # in X // Error # in X
do_basic_error: do_basic_error:
// "?" // "?"
txa txa
pha pha
lda #$0d jsr print_return
jsr JCHROUT
lda #$3f lda #$3f
jsr JCHROUT jsr JCHROUT
pla pla
@@ -140,8 +139,7 @@ do_basic_error:
jsr print_packed_message jsr print_packed_message
// A space between error name and word error // A space between error name and word error
lda #$20 jsr print_space
jsr $ffd2
// "ERROR" // "ERROR"
ldx #33 ldx #33
@@ -160,12 +158,10 @@ do_basic_error:
jsr print_integer jsr print_integer
!: !:
// New lines // New lines
lda #$0d jsr print_return
jsr $ffd2
lda #$00 lda #$00
jsr $ffd2 jsr JCHROUT
// XXX - Restore stack depth first? // XXX - Restore stack depth first?
jmp basic_main_loop jmp basic_main_loop
+25 -2
View File
@@ -1,5 +1,28 @@
// XXX provide documentation and implementation // XXX provide documentation and finish the implementation
INITMSG: INITMSG:
STUB_IMPLEMENTATION()
// Print PAL/NTSC
ldx #30 // NTSC
lda TVSFLG
beq !+
ldx #31 // PAL
!:
jsr print_packed_message
// Work out free bytes, display them
jsr basic_do_new
lda MEMSIZ+0
sec
sbc TXTTAB+0
tax
lda MEMSIZ+1
sbc TXTTAB+1
jsr print_integer
jsr print_space
// Print the rest of the start up message
ldx #34
jmp print_packed_message
+1 -2
View File
@@ -38,8 +38,7 @@ found_message_in_token_stream:
cmp #$ff cmp #$ff
beq !+ beq !+
jsr print_packed_word jsr print_packed_word
lda #$20 jsr print_space
jsr JCHROUT
pla pla
tay tay
iny iny
+1 -2
View File
@@ -209,8 +209,7 @@ wedge_dos_directory_display:
wedge_dos_clean_exit: wedge_dos_clean_exit:
jsr JCLALL jsr JCLALL
// Print new line // Print new line
lda #$0D jsr print_return
jsr JCHROUT
jmp basic_end_of_line jmp basic_end_of_line
wedge_dos_basic_error: wedge_dos_basic_error:
+1 -2
View File
@@ -132,8 +132,7 @@ lvs_display_done:
jsr print_hex_byte jsr print_hex_byte
lda STAL+0 lda STAL+0
jsr print_hex_byte jsr print_hex_byte
lda #$0D jmp print_return
jmp JCHROUT
lvs_wrap_around_error: lvs_wrap_around_error:
// This error is probably not even detected by C64 Kernal; // This error is probably not even detected by C64 Kernal;
File renamed without changes.
+8
View File
@@ -0,0 +1,8 @@
//
// Print the carriage return
//
print_return:
lda #$0D // carriage return code
jmp JCHROUT
+8
View File
@@ -0,0 +1,8 @@
//
// Print the space character
//
print_space:
lda #$20 // space code
jmp JCHROUT
File renamed without changes.