more label conflicts fixed

This commit is contained in:
FeralChild64 committed 2019-09-27 23:29:33 +02:00
1 parent c6350cc86b
commit 0597988a59
21 files changed
+279 -352

No files matched your search

+3 -3
View File
@@ -99,7 +99,7 @@
.label RIDDATA = $AA // -- NOT IMPLEMENTED -- .label RIDDATA = $AA // -- NOT IMPLEMENTED --
.label RIPRTY = $AB // -- NOT IMPLEMENTED -- .label RIPRTY = $AB // -- NOT IMPLEMENTED --
.label SAL = $AC // $AC-$AD -- NOT IMPLEMENTED -- (implemented screen part) .label SAL = $AC // $AC-$AD -- NOT IMPLEMENTED -- (implemented screen part)
.label EAL = $AE // $AE-$AF -- NOT IMPLEMENTED -- [!] used also byy screen editor .label EAL = $AE // $AE-$AF -- NOT IMPLEMENTED -- [!] used also by screen editor, for temporary color storage when scrolling
.label CMP0 = $B0 // $B0-$B1 temporary tape storage, [!] here used for BRK instruction address .label CMP0 = $B0 // $B0-$B1 temporary tape storage, [!] here used for BRK instruction address
.label TAPE1 = $B2 // $B2-$B3 tape buffer pointer .label TAPE1 = $B2 // $B2-$B3 tape buffer pointer
.label BITTS = $B4 // -- NOT IMPLEMENTED -- .label BITTS = $B4 // -- NOT IMPLEMENTED --
@@ -124,7 +124,7 @@
.label SFDX = $CB // -- NOT IMPLEMENTED -- .label SFDX = $CB // -- NOT IMPLEMENTED --
.label BLNSW = $CC // cursor blink disable flag .label BLNSW = $CC // cursor blink disable flag
.label BLNCT = $CD // cursor blink countdown .label BLNCT = $CD // cursor blink countdown
.label GDBLN = $CE // cursorb saved character .label GDBLN = $CE // cursor saved character
.label BLNON = $CF // cursor visibilityy flag .label BLNON = $CF // cursor visibilityy flag
.label CRSW = $D0 // whether to input from screen or keyboard .label CRSW = $D0 // whether to input from screen or keyboard
.label PNT = $D1 // $D1-$D2 pointer to the current screen line .label PNT = $D1 // $D1-$D2 pointer to the current screen line
@@ -134,7 +134,7 @@
.label TBLX = $D6 // current screen Y position .label TBLX = $D6 // current screen Y position
.label SCHAR = $D7 // ASCII value of the last printed character .label SCHAR = $D7 // ASCII value of the last printed character
.label INSRT = $D8 // insert mode flag/counter .label INSRT = $D8 // insert mode flag/counter
.label LDTB1 = $D9 // $D9-$F2 screen line link table, [!] our usage is different XXX give more details .label LDTBL = $D9 // $D9-$F2 screen line link table, [!] our usage is different XXX give more details
.label USER = $F3 // $F3-$F4 pointer to current color RAM location .label USER = $F3 // $F3-$F4 pointer to current color RAM location
.label KEYTAB = $F5 // $F5-$F6 -- NOT IMPLEMENTED -- .label KEYTAB = $F5 // $F5-$F6 -- NOT IMPLEMENTED --
.label RIBUF = $F7 // $F7-$F8 -- NOT IMPLEMENTED -- .label RIBUF = $F7 // $F7-$F8 -- NOT IMPLEMENTED --
-35
View File
@@ -54,41 +54,6 @@
.label memmove_dst = $6b .label memmove_dst = $6b
.label memmove_size = $6d .label memmove_size = $6d
.label current_file_num = $98
.label cassette_buffer_bytes_used = $A6
.label load_or_scroll_temp_pointer = $AC
// We also use the following for temp colour pointer when scrolling
.label load_save_verify_end_address = $AE
.label current_logical_filenum = $B8
.label current_secondary_address = $B9
.label current_device_number = $BA
.label current_filename_ptr = $BB
.label load_save_start_ptr = $C1
.label load_save_end_ptr = $C3
.label last_key_matrix_position = $C5
.label keys_in_key_buffer = $C6
.label reverse_video_flag = $C7
.label end_of_input_line = $C8
.label start_of_keyboard_input = $C9
.label current_key_index_entry = $CB
.label cursor_blink_disable = $CC
.label cursor_blink_countdown = $CD
.label cursor_saved_character = $CE
.label cursor_is_visible = $CF
.label keyboard_input_ready = $D0
.label current_screen_line_ptr = $D1
.label current_screen_x = $D3
.label logical_line_length = $D5
.label current_screen_y = $D6
.label last_printed_character_ascii = $D7
.label insert_mode = $D8
// Bits 0 -3 = bits 8-11 of screen line address
// Bit 7 = line spans multiple physical lines
.label screen_line_link_table = $D9
.label current_screen_line_colour_ptr = $F3
.label keyboard_decoding_table_ptr = $F5
#if CONFIG_MEMORY_MODEL_60K #if CONFIG_MEMORY_MODEL_60K
// BASIC uses some extra bytes for memory access under ROMs located at $2A7 onwards // BASIC uses some extra bytes for memory access under ROMs located at $2A7 onwards
+6 -6
View File
@@ -37,9 +37,9 @@ cmd_load:
!: !:
// Filename starts here so set pointer // Filename starts here so set pointer
lda basic_current_statement_ptr+0 lda basic_current_statement_ptr+0
sta current_filename_ptr+0 sta FNADDR+0
lda basic_current_statement_ptr+1 lda basic_current_statement_ptr+1
sta current_filename_ptr+1 sta FNADDR+1
// Now search for end of line or closing quote // Now search for end of line or closing quote
// so that we know the length of the filename // so that we know the length of the filename
@@ -60,7 +60,7 @@ got_filename:
// Now fetch the file number, start from the default one // Now fetch the file number, start from the default one
jsr select_device jsr select_device
stx current_device_number stx FA
jsr injest_comma jsr injest_comma
bcs got_devicenumber bcs got_devicenumber
@@ -70,20 +70,20 @@ got_filename:
jmp do_ILLEGAL_QUANTITY_error jmp do_ILLEGAL_QUANTITY_error
!: !:
lda basic_line_number+0 lda basic_line_number+0
sta current_device_number sta FA
got_devicenumber: got_devicenumber:
// Now fetch the secondary address // Now fetch the secondary address
lda #$00 lda #$00
sta current_secondary_address sta SA
jsr injest_comma jsr injest_comma
bcs got_secondaryaddress bcs got_secondaryaddress
jsr basic_parse_line_number jsr basic_parse_line_number
lda basic_line_number+1 lda basic_line_number+1
bne !+ bne !+
lda basic_line_number+0 lda basic_line_number+0
sta current_secondary_address sta SA
jmp got_secondaryaddress jmp got_secondaryaddress
!: !:
// Second parameter is above 255, this can't be a secondary address // Second parameter is above 255, this can't be a secondary address
+1 -1
View File
@@ -11,7 +11,7 @@ select_device:
// Note: if tape support is introduced here, make sure DOS wedge won't get broken // Note: if tape support is introduced here, make sure DOS wedge won't get broken
ldx current_device_number ldx FA
cpx #$08 cpx #$08
bcs !+ bcs !+
ldx #$08 ldx #$08
+2 -2
View File
@@ -74,7 +74,7 @@ wedge_dos_change_drive:
bcs !+ bcs !+
jmp do_ILLEGAL_DEVICE_NUMBER_error jmp do_ILLEGAL_DEVICE_NUMBER_error
!: !:
sta current_device_number sta FA
jmp basic_end_of_line jmp basic_end_of_line
wedge_dos_status_get: wedge_dos_status_get:
@@ -139,7 +139,7 @@ wedge_dos_directory:
// First change the secondary address to the one suitable for // First change the secondary address to the one suitable for
// directory loading // directory loading
lda #$00 // logical device number lda #$00 // logical device number
ldx current_device_number ldx FA
ldy #$60 ldy #$60
jsr JSETFLS jsr JSETFLS
+1 -39
View File
@@ -1,43 +1,5 @@
// Names of ZP and low memory locations
// (Only those of relevance for the KERNAL)
// (And only those for now that we feel the need to implement initially)
// (https://www.c64-wiki.com/wiki/Zeropage)
// XXX get rid of this file, use ,aliases_ram_lowmem.s instead // XXX get rid of this file
.label current_file_num = $98
.label input_device_number = DFLTN
.label cassette_buffer_bytes_used = $A6
.label load_or_scroll_temp_pointer = $AC
// We also use the following for temp colour pointer when scrolling
.label load_save_verify_end_address = $AE
.label current_logical_filenum = $B8
.label current_secondary_address = $B9
.label current_device_number = $BA
.label current_filename_ptr = $BB
.label load_save_end_ptr = $C3
.label last_key_matrix_position = $C5
.label keys_in_key_buffer = $C6
.label reverse_video_flag = $C7
.label end_of_input_line = $C8
.label start_of_keyboard_input = $C9
.label current_key_index_entry = $CB
.label cursor_blink_disable = $CC
.label cursor_blink_countdown = $CD
.label cursor_saved_character = $CE
.label cursor_is_visible = $CF
.label keyboard_input_ready = $D0
.label current_screen_line_ptr = $D1
.label current_screen_x = $D3
.label logical_line_length = $D5
.label current_screen_y = $D6
.label last_printed_character_ascii = $D7
.label insert_mode = $D8
// Bits 0 -3 = bits 8-11 of screen line address
// Bit 7 = line spans multiple physical lines
.label screen_line_link_table = $D9
.label current_screen_line_colour_ptr = $F3
.label keyboard_decoding_table_ptr = $F5
#if CONFIG_MEMORY_MODEL_60K #if CONFIG_MEMORY_MODEL_60K
+31 -28
View File
@@ -1,15 +1,18 @@
// We have the following variables: // We have the following variables:
// cursor_blink_disable // BLNSW (cursor blink switch)
// cursor_blink_countdown // BLNCT (cursor blink countdown)
// cursor_saved_character // GDBLN (cursor saved character)
// cursor_is_visible // BLNON (if cursor is visible)
// GDCOL (colour under cursor) // GDCOL (colour under cursor)
// USER (current screen line colour pointer)
// PNT (current screen line pointer)
// PNTR (current screen x position)
show_cursor_if_enabled: show_cursor_if_enabled:
lda cursor_blink_disable lda BLNSW
beq !+ beq !+
rts rts
!: lda cursor_is_visible !: lda BLNON
beq show_cursor beq show_cursor
rts rts
@@ -17,77 +20,77 @@ show_cursor:
// Set cursor as though it had just finished the off phase, // Set cursor as though it had just finished the off phase,
// so that the call to blink_cursor paints it // so that the call to blink_cursor paints it
lda #$00 lda #$00
sta cursor_blink_countdown sta BLNCT
sta cursor_is_visible sta BLNON
jsr blink_cursor jsr blink_cursor
// Then set the timeout to 1 frame, so that the cursor // Then set the timeout to 1 frame, so that the cursor
// blinks under key repeat conditions, like on the original KERNAL // blinks under key repeat conditions, like on the original KERNAL
lda #$01 lda #$01
sta cursor_blink_countdown sta BLNCT
rts rts
blink_cursor: blink_cursor:
// Is the cursor enabled? // Is the cursor enabled?
lda cursor_blink_disable lda BLNSW
bne no_blink_cursor bne no_blink_cursor
// Do we need to redraw things? // Do we need to redraw things?
dec cursor_blink_countdown dec BLNCT
bpl no_blink_cursor bpl no_blink_cursor
// Check if cursor was visible or not, and toggle // Check if cursor was visible or not, and toggle
lda cursor_is_visible lda BLNON
bne undraw_cursor bne undraw_cursor
draw_cursor: draw_cursor:
jsr calculate_screen_line_pointer jsr calculate_screen_line_pointer
ldy current_screen_x ldy PNTR
lda (current_screen_line_ptr),y lda (PNT),y
sta cursor_saved_character sta GDBLN
eor #$80 eor #$80
sta (current_screen_line_ptr),y sta (PNT),y
// Also set cursor colour // Also set cursor colour
lda (current_screen_line_colour_ptr),y lda (USER),y
sta GDCOL sta GDCOL
lda COLOR lda COLOR
sta (current_screen_line_colour_ptr),y sta (USER),y
lda #1 lda #1
sta cursor_is_visible sta BLNON
jmp reset_blink_timer jmp reset_blink_timer
undraw_cursor: undraw_cursor:
jsr calculate_screen_line_pointer jsr calculate_screen_line_pointer
lda cursor_saved_character lda GDBLN
ldy current_screen_x ldy PNTR
sta (current_screen_line_ptr),y sta (PNT),y
lda GDCOL lda GDCOL
sta (current_screen_line_colour_ptr),y sta (USER),y
lda #0 lda #0
sta cursor_is_visible sta BLNON
// Fall through // Fall through
reset_blink_timer: reset_blink_timer:
// Rest blink counter // Rest blink counter
// (Compute's Mapping the 64, p39-40) // (Compute's Mapping the 64, p39-40)
lda #20 lda #20
sta cursor_blink_countdown sta BLNCT
no_blink_cursor: no_blink_cursor:
rts rts
disable_cursor: disable_cursor:
lda #$80 lda #$80
sta cursor_blink_disable sta BLNSW
// FALL THROUGH // FALL THROUGH
hide_cursor_if_visible: hide_cursor_if_visible:
lda cursor_is_visible lda BLNON
bne undraw_cursor bne undraw_cursor
rts rts
enable_cursor: enable_cursor:
lda #$00 lda #$00
sta cursor_blink_disable sta BLNSW
rts rts
+17 -17
View File
@@ -52,18 +52,18 @@ chrin_repeat:
// If so, return the next byte, and clear the flag when we reach the end. // If so, return the next byte, and clear the flag when we reach the end.
// Do we have a line of input waiting? // Do we have a line of input waiting?
lda keyboard_input_ready lda CRSW
beq read_from_keyboard beq read_from_keyboard
// Yes, we have input waiting at (start_of_keyboard_input)+keyboard_input_ready // Yes, we have input waiting at (LXSP)+CRSW
// When keyboard_input_ready = end_of_input_line, then we return a carriage return // When CRSW = INDX, then we return a carriage return
// and clear the flag // and clear the flag
cmp end_of_input_line cmp INDX
bne not_end_of_input bne not_end_of_input
// Return carriage return and clear pending input flag // Return carriage return and clear pending input flag
lda #$00 lda #$00
sta keyboard_input_ready sta CRSW
pla pla
tax tax
clc clc
@@ -75,9 +75,9 @@ not_end_of_input:
tay tay
pla pla
tax tax
lda (start_of_keyboard_input),y lda (LXSP),y
jsr screen_code_to_petscii jsr screen_code_to_petscii
inc keyboard_input_ready inc CRSW
clc clc
rts rts
@@ -87,7 +87,7 @@ read_from_keyboard:
jsr enable_cursor jsr enable_cursor
// Wait for a key // Wait for a key
lda keys_in_key_buffer lda NDX
beq chrin_repeat beq chrin_repeat
lda KEYD lda KEYD
@@ -106,10 +106,10 @@ read_from_keyboard:
// (Compute's Mapping the 64, p96) // (Compute's Mapping the 64, p96)
// Set pointer to line of input // Set pointer to line of input
lda current_screen_line_ptr+0 lda PNT+0
sta start_of_keyboard_input+0 sta LXSP+0
lda current_screen_line_ptr+1 lda PNT+1
sta start_of_keyboard_input+1 sta LXSP+1
// Calculate length // Calculate length
jsr get_current_line_logical_length jsr get_current_line_logical_length
@@ -117,18 +117,18 @@ read_from_keyboard:
iny iny
!: dey !: dey
bmi empty_line bmi empty_line
lda (current_screen_line_ptr),y lda (PNT),y
cmp #$20 cmp #$20
beq !- beq !-
iny iny
sty end_of_input_line sty INDX
lda #$01 lda #$01
sta keyboard_input_ready sta CRSW
// Return first char of line // Return first char of line
ldy #$00 ldy #$00
pla pla
tax tax
lda (start_of_keyboard_input),y lda (LXSP),y
jsr screen_code_to_petscii jsr screen_code_to_petscii
clc clc
rts rts
@@ -166,7 +166,7 @@ pop_keyboard_buffer:
iny iny
cpy XMAX cpy XMAX
bne !- bne !-
dec keys_in_key_buffer dec NDX
cli cli
rts rts
+166 -167
View File
@@ -11,7 +11,7 @@
chrout_real: chrout_real:
sta last_printed_character_ascii sta SCHAR
// Save X and Y values // Save X and Y values
// (Confirmed by writing a test program that X and Y // (Confirmed by writing a test program that X and Y
@@ -34,7 +34,7 @@ chrout_real:
chrout_iec: chrout_iec:
lda last_printed_character_ascii lda SCHAR
jsr JCIOUT jsr JCIOUT
bcc chrout_done bcc chrout_done
@@ -77,7 +77,7 @@ chrout_done:
tay tay
pla pla
tax tax
lda last_printed_character_ascii lda SCHAR
clc // indicate success clc // indicate success
rts rts
@@ -88,7 +88,7 @@ chrout_screen:
jsr hide_cursor_if_visible jsr hide_cursor_if_visible
lda last_printed_character_ascii lda SCHAR
tax tax
// Check for special characters // Check for special characters
@@ -111,7 +111,7 @@ not_0a:
// RETURN clears quote and insert modes // RETURN clears quote and insert modes
lda #$00 lda #$00
sta QTSW sta QTSW
sta insert_mode sta INSRT
jmp screen_advance_to_next_line jmp screen_advance_to_next_line
not_0d: not_0d:
@@ -125,7 +125,7 @@ not_0d:
cmp #79 cmp #79
bne definitely_not_too_long bne definitely_not_too_long
tay tay
lda (current_screen_line_ptr),y lda (PNT),y
cmp #$20 cmp #$20
beq definitely_not_too_long beq definitely_not_too_long
@@ -135,7 +135,7 @@ not_0d:
definitely_not_too_long: definitely_not_too_long:
// Work out if line needs to be expanded, and if so expand it // Work out if line needs to be expanded, and if so expand it
ldy #39 ldy #39
lda (current_screen_line_ptr),y lda (PNT),y
cmp #$20 cmp #$20
beq no_need_to_extend beq no_need_to_extend
@@ -155,89 +155,89 @@ no_need_to_extend:
// though we really don't believe that the routine can be copyrighted // though we really don't believe that the routine can be copyrighted
// due to the lack of creativity. // due to the lack of creativity.
dey dey
lda (current_screen_line_colour_ptr),y lda (USER),y
iny iny
sta (current_screen_line_colour_ptr),y sta (USER),y
dey dey
lda (current_screen_line_ptr),y lda (PNT),y
iny iny
sta (current_screen_line_ptr),y sta (PNT),y
dey dey
cpy current_screen_x cpy PNTR
bne !- bne !-
// Increase insert mode count (which causes quote-mode like behaviour) // Increase insert mode count (which causes quote-mode like behaviour)
inc insert_mode inc INSRT
// Put space in the inserted gap // Put space in the inserted gap
lda #$20 lda #$20
sta (current_screen_line_ptr),y sta (PNT),y
jmp chrout_done jmp chrout_done
not_94: not_94:
// DELETE in insert mode embeds control character // DELETE in insert mode embeds control character
ldx insert_mode ldx INSRT
bne not_14 bne not_14
cmp #$14 cmp #$14
bne not_14 bne not_14
// Delete // Delete
ldx current_screen_x ldx PNTR
bne delete_non_zero_column bne delete_non_zero_column
delete_at_column_0: delete_at_column_0:
ldy current_screen_y ldy TBLX
bne not_row_0 bne not_row_0
// delete from row 0, col 0 does nothing // delete from row 0, col 0 does nothing
jmp chrout_done jmp chrout_done
not_row_0: not_row_0:
// Column 0 delete just moves us to the end of the // Column 0 delete just moves us to the end of the
// previous line, without actually deleting anything // previous line, without actually deleting anything
dec current_screen_y dec TBLX
jsr get_current_line_logical_length jsr get_current_line_logical_length
lda logical_line_length lda LNMX
sta current_screen_x sta PNTR
jsr calculate_screen_line_pointer jsr calculate_screen_line_pointer
jmp chrout_done jmp chrout_done
delete_non_zero_column: delete_non_zero_column:
// Copy rest of line down // Copy rest of line down
jsr get_current_line_logical_length jsr get_current_line_logical_length
ldy current_screen_x ldy PNTR
cpy logical_line_length cpy LNMX
beq done_delete beq done_delete
dey dey
!: !:
iny iny
lda (current_screen_line_ptr),y lda (PNT),y
dey dey
sta (current_screen_line_ptr),y sta (PNT),y
iny iny
lda (current_screen_line_colour_ptr),y lda (USER),y
dey dey
sta (current_screen_line_colour_ptr),y sta (USER),y
iny iny
cpy logical_line_length cpy LNMX
bne !- bne !-
// Clear char at end of line // Clear char at end of line
jsr get_current_line_logical_length jsr get_current_line_logical_length
tay tay
lda #$20 lda #$20
sta (current_screen_line_ptr),y sta (PNT),y
done_delete: done_delete:
dec current_screen_x dec PNTR
jmp chrout_done jmp chrout_done
not_14: not_14:
// Check for quote mode // Check for quote mode
ldx QTSW ldx QTSW
bne is_quote_mode bne is_quote_mode
ldx insert_mode ldx INSRT
bne is_quote_mode bne is_quote_mode
jmp not_quote_mode jmp not_quote_mode
@@ -283,24 +283,24 @@ colour_check_loop:
cmp #$12 cmp #$12
bne not_12 bne not_12
lda #$80 lda #$80
sta reverse_video_flag sta RVS
jmp chrout_done jmp chrout_done
not_12: not_12:
// Compute's Mapping the 64 p 38 // Compute's Mapping the 64 p 38
cmp #$92 cmp #$92
bne not_92 bne not_92
lda #$00 lda #$00
sta reverse_video_flag sta RVS
jmp chrout_done jmp chrout_done
not_92: not_92:
// Check for cursor movement keys // Check for cursor movement keys
cmp #$11 cmp #$11
bne not_11 bne not_11
lda current_screen_x lda PNTR
clc clc
adc #40 adc #40
sta current_screen_x sta PNTR
// We need to advance the pointer manually, as normalising // We need to advance the pointer manually, as normalising
// now will break things. The pointer update is required // now will break things. The pointer update is required
// so that we can tell if we really are on the bottom phys // so that we can tell if we really are on the bottom phys
@@ -311,22 +311,22 @@ not_92:
not_11: not_11:
cmp #$1d cmp #$1d
bne not_1d bne not_1d
inc current_screen_x inc PNTR
jsr calculate_screen_line_pointer jsr calculate_screen_line_pointer
jmp chrout_done jmp chrout_done
not_1d: not_1d:
cmp #$91 cmp #$91
bne not_91 bne not_91
lda current_screen_x lda PNTR
sec sec
sbc #40 sbc #40
sta current_screen_x sta PNTR
jsr calculate_screen_line_pointer jsr calculate_screen_line_pointer
jmp chrout_done jmp chrout_done
not_91: not_91:
cmp #$9d cmp #$9d
bne not_9d bne not_9d
dec current_screen_x dec PNTR
jsr calculate_screen_line_pointer jsr calculate_screen_line_pointer
jmp chrout_done jmp chrout_done
not_9d: not_9d:
@@ -335,8 +335,8 @@ not_9d:
cmp #$13 cmp #$13
bne not_13 bne not_13
lda #0 lda #0
sta current_screen_x sta PNTR
sta current_screen_y sta TBLX
jsr calculate_screen_line_pointer jsr calculate_screen_line_pointer
jmp chrout_done jmp chrout_done
not_13: not_13:
@@ -401,14 +401,14 @@ output_literal_char:
pha pha
ldy current_screen_x ldy PNTR
ora reverse_video_flag // Compute's Mapping the 64 p38 ora RVS // Compute's Mapping the 64 p38
sta (current_screen_line_ptr),y sta (PNT),y
// Decrement number of chars waiting to be inserted // Decrement number of chars waiting to be inserted
lda insert_mode lda INSRT
beq !+ beq !+
dec insert_mode dec INSRT
!: !:
pla pla
cmp #$22 cmp #$22
@@ -423,36 +423,36 @@ not_quote:
// Set colour // Set colour
lda COLOR lda COLOR
sta (current_screen_line_colour_ptr),y sta (USER),y
// Advance the column, and scroll screen down if we need // Advance the column, and scroll screen down if we need
// to insert a 2nd line in this logical line. // to insert a 2nd line in this logical line.
// (eg Compute's Mapping the 64 p41) // (eg Compute's Mapping the 64 p41)
ldx current_screen_y ldx TBLX
iny iny
sty current_screen_x sty PNTR
cpy #40 cpy #40
bne !+ bne !+
jsr screen_grow_logical_line jsr screen_grow_logical_line
ldy current_screen_x ldy PNTR
!: !:
cpy #80 cpy #80
bcc no_screen_advance_to_next_line bcc no_screen_advance_to_next_line
lda #0 lda #0
sta current_screen_x sta PNTR
jmp screen_advance_to_next_line jmp screen_advance_to_next_line
no_screen_advance_to_next_line: no_screen_advance_to_next_line:
jmp chrout_done jmp chrout_done
screen_grow_logical_line: screen_grow_logical_line:
ldy current_screen_y ldy TBLX
// Don't grow line if it is already grown // Don't grow line if it is already grown
lda screen_line_link_table,y lda LDTBL,y
bpl !+ bpl !+
jmp done_grow_line jmp done_grow_line
!: !:
lda #$80 lda #$80
sta screen_line_link_table,y sta LDTBL,y
// Now make space for the extra line added. // Now make space for the extra line added.
// If we are on the last physical line of the screen, // If we are on the last physical line of the screen,
@@ -471,11 +471,11 @@ screen_grow_logical_line:
ldy #0 ldy #0
count_rows_loop: count_rows_loop:
dex dex
lda screen_line_link_table,y lda LDTBL,y
bpl !+ bpl !+
dex dex
!: iny !: iny
cpy current_screen_y cpy TBLX
bne count_rows_loop bne count_rows_loop
cpx #0 cpx #0
@@ -493,28 +493,28 @@ count_rows_loop:
lda HIBASE lda HIBASE
clc clc
adc #3 adc #3
sta current_screen_line_ptr+1 sta PNT+1
sta load_or_scroll_temp_pointer+1 sta SAL+1
lda #>$DBC0 lda #>$DBC0
sta load_save_verify_end_address+1 sta EAL+1
sta current_screen_line_colour_ptr+1 sta USER+1
lda #<$03C0 lda #<$03C0
sta current_screen_line_ptr+0 sta PNT+0
sta current_screen_line_colour_ptr+0 sta USER+0
// souce address is line above // souce address is line above
sec sec
sbc #40 sbc #40
sta load_or_scroll_temp_pointer+0 sta SAL+0
sta load_save_verify_end_address+0 sta EAL+0
copy_line_down_loop: copy_line_down_loop:
ldy #39 ldy #39
cl_inner: cl_inner:
lda (load_save_verify_end_address),y lda (EAL),y
sta (current_screen_line_colour_ptr),y sta (USER),y
lda (load_or_scroll_temp_pointer),y lda (SAL),y
sta (current_screen_line_ptr),y sta (PNT),y
dey dey
bpl cl_inner bpl cl_inner
@@ -523,29 +523,29 @@ cl_inner:
// Old source is new destination // Old source is new destination
// Use different registers to minimise byte similarity with C64 KERNAl // Use different registers to minimise byte similarity with C64 KERNAl
ldy load_or_scroll_temp_pointer+1 ldy SAL+1
sty current_screen_line_ptr+1 sty PNT+1
lda load_save_verify_end_address+1 lda EAL+1
ldy load_or_scroll_temp_pointer+0 ldy SAL+0
sta current_screen_line_colour_ptr+1 sta USER+1
sty current_screen_line_ptr+0 sty PNT+0
sty current_screen_line_colour_ptr+0 sty USER+0
// Decrementing source pointers // Decrementing source pointers
lda load_or_scroll_temp_pointer+0 lda SAL+0
sec sec
sbc #<40 sbc #<40
sta load_or_scroll_temp_pointer+0 sta SAL+0
sta load_save_verify_end_address+0 sta EAL+0
lda load_or_scroll_temp_pointer+1 lda SAL+1
sbc #>40 sbc #>40
sta load_or_scroll_temp_pointer+1 sta SAL+1
// convert to screen equivalent // convert to screen equivalent
sec sec
sbc HIBASE sbc HIBASE
clc clc
adc #>$D800 adc #>$D800
sta load_save_verify_end_address+1 sta EAL+1
dex dex
bne copy_line_down_loop bne copy_line_down_loop
@@ -557,9 +557,9 @@ no_copy_down:
ldy #79 ldy #79
!: !:
lda COLOR lda COLOR
sta (current_screen_line_colour_ptr),y sta (USER),y
lda #$20 lda #$20
sta (current_screen_line_ptr),y sta (PNT),y
dey dey
cpy #40 cpy #40
bne !- bne !-
@@ -575,23 +575,23 @@ scroll_up_if_on_last_line:
// Colour RAM is always in fixed place, so is easiest // Colour RAM is always in fixed place, so is easiest
// to use to check if we are on the last line. // to use to check if we are on the last line.
// The last line is at $D800 + 24*40 = $DBC0 // The last line is at $D800 + 24*40 = $DBC0
lda current_screen_line_colour_ptr+1 lda USER+1
cmp #>$DBC0 cmp #>$DBC0
bne not_last_line bne not_last_line
lda current_screen_line_colour_ptr+0 lda USER+0
cmp #<$DBC0 cmp #<$DBC0
beq is_last_line beq is_last_line
jsr get_current_line_logical_length jsr get_current_line_logical_length
clc clc
adc current_screen_line_colour_ptr+0 adc USER+0
cmp #<$DBE7-1 cmp #<$DBE7-1
bcc not_last_line bcc not_last_line
is_last_line: is_last_line:
dec current_screen_y dec TBLX
// FALL THROUGH // FALL THROUGH
@@ -601,68 +601,68 @@ scroll_screen_up:
// Get pointers to start of screen + colour RAM // Get pointers to start of screen + colour RAM
lda HIBASE lda HIBASE
sta current_screen_line_ptr+1 sta PNT+1
sta load_or_scroll_temp_pointer+1 sta SAL+1
lda #>$D800 lda #>$D800
sta current_screen_line_colour_ptr+1 sta USER+1
sta load_save_verify_end_address+1 sta EAL+1
lda #$00 lda #$00
sta current_screen_line_ptr+0 sta PNT+0
sta current_screen_line_colour_ptr+0 sta USER+0
// Get pointers to screen/colour RAM source // Get pointers to screen/colour RAM source
lda screen_line_link_table+0 lda LDTBL+0
bmi !+ bmi !+
lda #40 lda #40
.byte $2C // BIT $nnnn to skip next instruction .byte $2C // BIT $nnnn to skip next instruction
!: !:
lda #80 lda #80
sta load_or_scroll_temp_pointer+0 sta SAL+0
sta load_save_verify_end_address+0 sta EAL+0
// Copy first three pages // Copy first three pages
ldy #$00 ldy #$00
ldx #3 ldx #3
scroll_copy_loop: scroll_copy_loop:
lda (load_save_verify_end_address),y lda (EAL),y
sta (current_screen_line_colour_ptr),y sta (USER),y
lda (load_or_scroll_temp_pointer),y lda (SAL),y
sta (current_screen_line_ptr),y sta (PNT),y
iny iny
bne scroll_copy_loop bne scroll_copy_loop
inc load_or_scroll_temp_pointer+1 inc SAL+1
inc current_screen_line_ptr+1 inc PNT+1
inc load_save_verify_end_address+1 inc EAL+1
inc current_screen_line_colour_ptr+1 inc USER+1
dex dex
bne scroll_copy_loop bne scroll_copy_loop
// Copy last partial page // Copy last partial page
// We need to copy 1000-(3*256)-line length // We need to copy 1000-(3*256)-line length
// = 232 - line length // = 232 - line length
lda load_or_scroll_temp_pointer+0 lda SAL+0
lda #232 lda #232
sec sec
sbc load_or_scroll_temp_pointer+0 sbc SAL+0
tax tax
scroll_copy_loop2: scroll_copy_loop2:
lda (load_save_verify_end_address),y lda (EAL),y
sta (current_screen_line_colour_ptr),y sta (USER),y
lda (load_or_scroll_temp_pointer),y lda (SAL),y
sta (current_screen_line_ptr),y sta (PNT),y
iny iny
dex dex
bne scroll_copy_loop2 bne scroll_copy_loop2
// Fill in scrolled up area // Fill in scrolled up area
ldx load_or_scroll_temp_pointer+0 ldx SAL+0
scroll_copy_loop3: scroll_copy_loop3:
lda COLOR lda COLOR
sta (current_screen_line_colour_ptr),y sta (USER),y
lda #$20 lda #$20
sta (current_screen_line_ptr),y sta (PNT),y
iny iny
dex dex
bne scroll_copy_loop3 bne scroll_copy_loop3
@@ -671,13 +671,13 @@ scroll_copy_loop3:
ldy #0 ldy #0
ldx #24 ldx #24
link_copy: link_copy:
lda screen_line_link_table+1,y lda LDTBL+1,y
sta screen_line_link_table+0,y sta LDTBL+0,y
iny iny
dex dex
bne link_copy bne link_copy
// Clear line link flag of last line // Clear line link flag of last line
stx screen_line_link_table+24 stx LDTBL+24
// Restore correct line pointers // Restore correct line pointers
jsr calculate_screen_line_pointer jsr calculate_screen_line_pointer
@@ -685,14 +685,14 @@ link_copy:
rts rts
get_current_line_logical_length: get_current_line_logical_length:
ldy current_screen_y ldy TBLX
lda screen_line_link_table,y lda LDTBL,y
bpl line_not_linked_del bpl line_not_linked_del
lda #79 lda #79
.byte $2c // BIT absolute mode, which we use to skip the next two instruction bytes .byte $2c // BIT absolute mode, which we use to skip the next two instruction bytes
line_not_linked_del: line_not_linked_del:
lda #39 lda #39
sta logical_line_length sta LNMX
rts rts
screen_advance_to_next_line: screen_advance_to_next_line:
@@ -701,37 +701,37 @@ screen_advance_to_next_line:
// Go to start of line // Go to start of line
lda #0 lda #0
sta current_screen_x sta PNTR
// Advance line number // Advance line number
ldy current_screen_y ldy TBLX
// Do quick fix to line pointer to work out if it is off // Do quick fix to line pointer to work out if it is off
// the bottom of the screen. // the bottom of the screen.
ldx #40 ldx #40
lda screen_line_link_table,y lda LDTBL,y
bmi !+ bmi !+
.byte $2c .byte $2c
!: ldx #80 !: ldx #80
txa txa
clc clc
adc current_screen_line_ptr+0 adc PNT+0
sta current_screen_line_ptr+0 sta PNT+0
lda current_screen_line_ptr+1 lda PNT+1
adc #0 adc #0
sta current_screen_line_ptr+1 sta PNT+1
inc current_screen_y inc TBLX
// Check if it will trigger scrolling // Check if it will trigger scrolling
// Work out if we have gone off the bottom of the screen? // Work out if we have gone off the bottom of the screen?
// 1040 > 1024, so if high byte of screen pointer is >= (HIBASE+4), // 1040 > 1024, so if high byte of screen pointer is >= (HIBASE+4),
// then we are off the bottom of the screen // then we are off the bottom of the screen
lda current_screen_line_ptr+1 lda PNT+1
sec sec
sbc HIBASE sbc HIBASE
cmp #3 cmp #3
bcc !+ bcc !+
lda current_screen_line_ptr+0 lda PNT+0
cmp #$e7 cmp #$e7
bcc !+ bcc !+
@@ -744,83 +744,82 @@ screen_advance_to_next_line:
jmp chrout_done jmp chrout_done
add_40_to_screen_x: add_40_to_screen_x:
lda current_screen_x lda PNTR
clc clc
adc #40 adc #40
sta current_screen_x sta PNTR
rts rts
normalise_screen_x_y: normalise_screen_x_y:
// Normalise X and Y values // Normalise X and Y values
// If X < 0, then make X = X + 40 (or 80, if previous line is linked) // If X < 0, then make X = X + 40 (or 80, if previous line is linked)
!: lda current_screen_x !: lda PNTR
bpl x_not_negative bpl x_not_negative
dec current_screen_y dec TBLX
// Check that we didn't go backwards off the top of the screen // Check that we didn't go backwards off the top of the screen
bpl !+ bpl !+
lda #0 lda #0
sta current_screen_y sta TBLX
!: jsr add_40_to_screen_x !: jsr add_40_to_screen_x
// Check if line is linked, if so, add 40 again // Check if line is linked, if so, add 40 again
ldy current_screen_y ldy TBLX
lda screen_line_link_table,y lda LDTBL,y
bpl !+ bpl !+
jsr add_40_to_screen_x jsr add_40_to_screen_x
!: !:
x_not_negative: x_not_negative:
// Work out if X is too big // Work out if X is too big
ldy current_screen_y ldy TBLX
lda screen_line_link_table,y lda LDTBL,y
bpl !+ bpl !+
lda #79 lda #79
.byte $2C // BIT $nnnn, used to skip next instruction .byte $2C // BIT $nnnn, used to skip next instruction
!: lda #39 !: lda #39
cmp current_screen_x cmp PNTR
bcs x_not_too_big bcs x_not_too_big
// X value is too big, so subtract 40 and increment Y // X value is too big, so subtract 40 and increment Y
lda current_screen_x lda PNTR
sec sec
sbc #40 sbc #40
sta current_screen_x sta PNTR
inc current_screen_y inc TBLX
x_not_too_big: x_not_too_big:
// Make sure Y isn't negative // Make sure Y isn't negative
lda current_screen_y lda TBLX
bpl !+ bpl !+
lda #0 lda #0
sta current_screen_y sta TBLX
!: !:
// Make sure Y isn't too large for absolute size of // Make sure Y isn't too large for absolute size of
// screen // screen
cmp #24 cmp #24
bcc !+ bcc !+
lda #24 lda #24
sta current_screen_y sta TBLX
!: !:
// Make sure Y isn't too much for the screen, taking // Make sure Y isn't too much for the screen, taking
// into account the line link table // into account the line link table
ldy #24 // max allowable line ldy #24 // max allowable line
ldx #0 ldx #0
link_count_loop: link_count_loop:
lda screen_line_link_table,x lda LDTBL,x
bpl !+ bpl !+
dey dey
!: inx !: inx
cpx #25 cpx #25
bne link_count_loop bne link_count_loop
tya tya
cmp current_screen_y cmp TBLX
bcs y_ok bcs y_ok
sta current_screen_y sta TBLX
y_ok: y_ok:
rts rts
calculate_screen_line_pointer: calculate_screen_line_pointer:
@@ -828,12 +827,12 @@ calculate_screen_line_pointer:
// Reset pointer to start of screen // Reset pointer to start of screen
lda HIBASE lda HIBASE
sta current_screen_line_ptr+1 sta PNT+1
lda #0 lda #0
sta current_screen_line_ptr+0 sta PNT+0
// Add 40 for every line, or 80 if the lines are linked // Add 40 for every line, or 80 if the lines are linked
ldx current_screen_y ldx TBLX
!: !:
// Stop if we have counted enough lines // Stop if we have counted enough lines
@@ -844,18 +843,18 @@ calculate_screen_line_pointer:
ldy #40 ldy #40
// -1 offset is because we count down from N to 1, not // -1 offset is because we count down from N to 1, not
// N-1 to 0. // N-1 to 0.
lda screen_line_link_table-1,x lda LDTBL-1,x
bpl cslp_l1 bpl cslp_l1
ldy #80 ldy #80
cslp_l1: cslp_l1:
// Add computed line length to pointer value // Add computed line length to pointer value
tya tya
clc clc
adc current_screen_line_ptr+0 adc PNT+0
sta current_screen_line_ptr+0 sta PNT+0
lda current_screen_line_ptr+1 lda PNT+1
adc #0 adc #0
sta current_screen_line_ptr+1 sta PNT+1
// Loop back to next line // Loop back to next line
dex dex
@@ -866,36 +865,36 @@ cslp_l1:
update_colour_line_pointer: update_colour_line_pointer:
// Now setup pointer to colour RAM // Now setup pointer to colour RAM
lda current_screen_line_ptr+0 lda PNT+0
sta current_screen_line_colour_ptr+0 sta USER+0
lda current_screen_line_ptr+1 lda PNT+1
sec sec
sbc HIBASE sbc HIBASE
clc clc
adc #>$d800 adc #>$d800
sta current_screen_line_colour_ptr+1 sta USER+1
rts rts
advance_screen_pointer_40_bytes: advance_screen_pointer_40_bytes:
lda current_screen_line_ptr+0 lda PNT+0
clc clc
adc #<40 adc #<40
sta current_screen_line_ptr+0 sta PNT+0
sta current_screen_line_colour_ptr+0 sta USER+0
lda current_screen_line_ptr+1 lda PNT+1
adc #>40 adc #>40
sta current_screen_line_ptr+1 sta PNT+1
sec sec
sbc HIBASE sbc HIBASE
clc clc
adc #>$D800 adc #>$D800
sta current_screen_line_colour_ptr+1 sta USER+1
jmp update_colour_line_pointer jmp update_colour_line_pointer
colour_codes: colour_codes: // consider moving them to separate location
// CHR$ codes for the 16 colours // CHR$ codes for the 16 colours
.byte 144,5,28,159,156,30,31,158 .byte 144,5,28,159,156,30,31,158
.byte 129,149,150,151,152,153,154,155 .byte 129,149,150,151,152,153,154,155
+1 -1
View File
@@ -69,7 +69,7 @@ cint_brk: // entry for BRK and STOP+RESTORE - XXX, where should it start?
// Initialise cursor blink flags (Compute's Mapping the 64 p215) // Initialise cursor blink flags (Compute's Mapping the 64 p215)
lda #$00 lda #$00
sta cursor_blink_disable sta BLNSW
// Set keyboard decode vector (Compute's Mapping the 64 p215) // Set keyboard decode vector (Compute's Mapping the 64 p215)
+9 -9
View File
@@ -9,7 +9,7 @@ clear_screen:
lda #$00 lda #$00
ldy #24 ldy #24
clearscreen_l1: clearscreen_l1:
sta screen_line_link_table,y sta LDTBL,y
dey dey
bpl clearscreen_l1 bpl clearscreen_l1
@@ -19,28 +19,28 @@ clearscreen_l1:
// We should do this at HIBASE, which annoyingly // We should do this at HIBASE, which annoyingly
// is no ZP, so we need to make a vector // is no ZP, so we need to make a vector
// (Compute's Mapping the 64 p216) // (Compute's Mapping the 64 p216)
// Get pointer to the screen into current_screen_line_ptr // Get pointer to the screen into PNT
// as it is the first appropriate place for it found when // as it is the first appropriate place for it found when
// searching through the ZP allocations listed in // searching through the ZP allocations listed in
// Compute's Mapping the 64 // Compute's Mapping the 64
sta current_screen_line_ptr+0 sta PNT+0
lda HIBASE lda HIBASE
sta current_screen_line_ptr+1 sta PNT+1
ldx #$03 // countdown for pages to update ldx #$03 // countdown for pages to update
iny // Y now = #$00 iny // Y now = #$00
lda #$20 // space character lda #$20 // space character
clearscreen_l2: clearscreen_l2:
sta (current_screen_line_ptr),y sta (PNT),y
iny iny
bne clearscreen_l2 bne clearscreen_l2
// To draw only 1000 bytes, add 250 to address each time // To draw only 1000 bytes, add 250 to address each time
lda current_screen_line_ptr lda PNT
clc clc
adc #<250 adc #<250
sta current_screen_line_ptr sta PNT
lda current_screen_line_ptr+1 lda PNT+1
adc #>250 adc #>250
sta current_screen_line_ptr+1 sta PNT+1
lda #$20 // get space character again lda #$20 // get space character again
dex dex
bpl clearscreen_l2 bpl clearscreen_l2
+1 -1
View File
@@ -13,7 +13,7 @@
GETIN: GETIN:
// Wait for a key // Wait for a key
lda keys_in_key_buffer lda NDX
bne !+ bne !+
// Nothing in keyboard buffer to read // Nothing in keyboard buffer to read
+6 -6
View File
@@ -20,7 +20,7 @@ OPEN:
beq !+ beq !+
dey dey
lda LAT, y lda LAT, y
cmp current_logical_filenum cmp LA
bne open_not_yet_open bne open_not_yet_open
jmp kernalerror_FILE_ALREADY_OPEN jmp kernalerror_FILE_ALREADY_OPEN
open_not_yet_open: open_not_yet_open:
@@ -43,11 +43,11 @@ open_has_space:
// LAT / FAT / SAT support implemented according to // LAT / FAT / SAT support implemented according to
// 'Compute's Mapping the Commodore 64', page 52 // 'Compute's Mapping the Commodore 64', page 52
lda current_logical_filenum lda LA
sta LAT, y sta LAT, y
lda current_device_number lda FA
sta FAT, y sta FAT, y
lda current_secondary_address lda SA
sta SAT, y sta SAT, y
iny iny
@@ -58,7 +58,7 @@ open_has_space:
beq open_done_success beq open_done_success
// Check for IEC device // Check for IEC device
lda current_device_number lda FA
jsr iec_check_devnum jsr iec_check_devnum
bcc open_iec bcc open_iec
@@ -75,7 +75,7 @@ open_iec:
bcc !+ bcc !+
jmp kernalerror_DEVICE_NOT_FOUND jmp kernalerror_DEVICE_NOT_FOUND
!: !:
lda current_secondary_address lda SA
jsr iec_cmd_open jsr iec_cmd_open
bcc !+ bcc !+
jmp kernalerror_DEVICE_NOT_FOUND jmp kernalerror_DEVICE_NOT_FOUND
+6 -6
View File
@@ -40,7 +40,7 @@ LOAD:
TARGET_HOOK_LOAD() TARGET_HOOK_LOAD()
// Check whether we support the requested device // Check whether we support the requested device
lda current_device_number lda FA
and #$FC and #$FC
bne !+ bne !+
jmp lvs_illegal_device_number // device number below 4, not an IEC device jmp lvs_illegal_device_number // device number below 4, not an IEC device
@@ -60,7 +60,7 @@ LOAD:
// in the C64, only in the drive. // in the C64, only in the drive.
// Call device to LISTEN (p16) // Call device to LISTEN (p16)
lda current_device_number lda FA
jsr LISTEN jsr LISTEN
bcc !+ bcc !+
jmp lvs_device_not_found_error // XXX deduplicate with other jumps in this routine jmp lvs_device_not_found_error // XXX deduplicate with other jumps in this routine
@@ -77,7 +77,7 @@ LOAD:
jmp lvs_load_verify_error // XXX deduplicate with other jumps in this routine jmp lvs_load_verify_error // XXX deduplicate with other jumps in this routine
!: !:
// Now command device to talk (p16) // Now command device to talk (p16)
lda current_device_number lda FA
jsr TALK jsr TALK
bcc !+ bcc !+
jmp lvs_load_verify_error // XXX deduplicate with other jumps in this routine jmp lvs_load_verify_error // XXX deduplicate with other jumps in this routine
@@ -99,7 +99,7 @@ LOAD:
bcc !+ bcc !+
jmp lvs_file_not_found_error // XXX deduplicate with other jumps in this routine jmp lvs_file_not_found_error // XXX deduplicate with other jumps in this routine
!: !:
ldx current_secondary_address ldx SA
beq !+ beq !+
sta STAL+0 sta STAL+0
!: !:
@@ -107,7 +107,7 @@ LOAD:
bcc !+ bcc !+
jmp lvs_file_not_found_error // XXX deduplicate with other jumps in this routine jmp lvs_file_not_found_error // XXX deduplicate with other jumps in this routine
!: !:
ldx current_secondary_address ldx SA
beq !+ beq !+
sta STAL+1 sta STAL+1
!: !:
@@ -140,7 +140,7 @@ load_loop:
// Close file on drive // Close file on drive
lda current_device_number lda FA
jsr close_load jsr close_load
// Return last address // Return last address
+2 -2
View File
@@ -4,7 +4,7 @@
home_cursor: home_cursor:
lda #$00 lda #$00
sta current_screen_x sta PNTR // x position
sta current_screen_y sta TBLX // y position
jmp set_pointer_to_current_screen_line jmp set_pointer_to_current_screen_line
+4 -4
View File
@@ -10,10 +10,10 @@ lvs_send_file_name_loop:
beq lvs_send_file_name_done beq lvs_send_file_name_done
#if CONFIG_MEMORY_MODEL_60K #if CONFIG_MEMORY_MODEL_60K
ldx #<current_filename_ptr+0 ldx #<FNADDR+0
jsr peek_under_roms jsr peek_under_roms
#else // CONFIG_MEMORY_MODEL_38K #else // CONFIG_MEMORY_MODEL_38K
lda (current_filename_ptr),y lda (FNADDR),y
#endif #endif
iny iny
@@ -81,10 +81,10 @@ lvs_display_searching_for:
beq lvs_display_end beq lvs_display_end
#if CONFIG_MEMORY_MODEL_60K #if CONFIG_MEMORY_MODEL_60K
ldx #<current_filename_ptr+0 ldx #<FNADDR+0
jsr peek_under_roms jsr peek_under_roms
#else // CONFIG_MEMORY_MODEL_38K #else // CONFIG_MEMORY_MODEL_38K
lda (current_filename_ptr),y lda (FNADDR),y
#endif #endif
jsr JCHROUT jsr JCHROUT
+4 -4
View File
@@ -12,15 +12,15 @@ PLOT:
bcs plot_get bcs plot_get
plot_set: plot_set:
sty current_screen_y sty TBLX
stx current_screen_x stx PNTR
// XXX handle cursor blink // XXX handle cursor blink
// FALLTROUGH to save one byte on RTS // FALLTROUGH to save one byte on RTS
plot_get: plot_get:
ldy current_screen_y ldy TBLX
ldx current_screen_x ldx PNTR
rts rts
+1 -1
View File
@@ -12,7 +12,7 @@ READST:
// Check the current device number // Check the current device number
lda current_device_number lda FA
cmp #$02 cmp #$02
bne !+ bne !+
+7 -9
View File
@@ -122,17 +122,16 @@ accept_key:
beq sk_nokey beq sk_nokey
// Stash key into keyboard buffer // Stash key into keyboard buffer
ldx keys_in_key_buffer ldx NDX
cpx XMAX cpx XMAX
beq sk_nokey beq sk_nokey
sta KEYD,x sta KEYD,x
inc keys_in_key_buffer inc NDX
sk_nokey: sk_nokey:
rts rts
// //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// // Routine for Scanning a Matrix Row // // Routine for Scanning a Matrix Row
@@ -181,13 +180,12 @@ OverFlow:
pla pla
// Don't manipulate last legal buffer as the routine will fix itself once it gets valid input again. // Don't manipulate last legal buffer as the routine will fix itself once it gets valid input again.
TooManyNewKeys:
ReturnNoKeys: ReturnNoKeys:
sec sec
lda #$00 lda #$00
sta BufferQuantity sta BufferQuantity
lda #$FF lda #$FF
sta last_key_matrix_position sta LSTX
ldx #MaxKeyRollover-1 ldx #MaxKeyRollover-1
!: !:
sta Buffer,x sta Buffer,x
@@ -463,7 +461,7 @@ RecordKeypress:
ldy BufferQuantity ldy BufferQuantity
cpy #MaxKeyRollover cpy #MaxKeyRollover
bcc !+ bcc !+
jmp TooManyNewKeys jmp ReturnNoKeys // too many new keys
!: !:
AcceptKeyEvent: AcceptKeyEvent:
sta Buffer,y sta Buffer,y
@@ -488,7 +486,7 @@ ConsiderNextKey:
KeyHeld: KeyHeld:
// The key in A is still held down. // The key in A is still held down.
// compare with key in last_key_matrix_position // compare with key in LSTX
// (Compute's Mapping the 64 p36-37) // (Compute's Mapping the 64 p36-37)
// if different, reset repeat count down. // if different, reset repeat count down.
@@ -503,11 +501,11 @@ KeyHeld:
cmp #61 cmp #61
beq BuckyHeld beq BuckyHeld
cmp last_key_matrix_position cmp LSTX
beq SameKeyHeld beq SameKeyHeld
// Different key held // Different key held
sta last_key_matrix_position sta LSTX
pha pha
lda DELAY lda DELAY
sta KOUNT sta KOUNT
@@ -1,32 +1,32 @@
// Put the address of the screen current line // Put the address of the screen current line
// into the pointer at $D1 (current_screen_line_ptr). // into the pointer at $D1 (PNT).
// It must take into account the screen line link table // It must take into account the screen line link table
// (Compute's Mapping the 64 p216) // (Compute's Mapping the 64 p216)
set_pointer_to_current_screen_line: set_pointer_to_current_screen_line:
// Get pointer to start of the screen // Get pointer to start of the screen
lda HIBASE lda HIBASE
sta current_screen_line_ptr+1 sta PNT+1
lda #$00 lda #$00
sta current_screen_line_ptr+0 sta PNT+0
// Now advance for the number of lines // Now advance for the number of lines
ldx current_screen_y ldx TBLX
sptcsl_l2: sptcsl_l2:
// XXX - Should we read the columns per line from // XXX - Should we read the columns per line from
// somewhere? // somewhere?
ldy #<40 ldy #<40
// Double line length if line is linked // Double line length if line is linked
lda screen_line_link_table,x lda LDTBL,x
bpl sptcsl_l1 bpl sptcsl_l1
ldy #<80 ldy #<80
sptcsl_l1: sptcsl_l1:
tya tya
clc clc
adc current_screen_line_ptr+0 adc PNT+0
lda current_screen_line_ptr+1 lda PNT+1
adc #>40 adc #>40
sta current_screen_line_ptr+1 sta PNT+1
dex dex
bpl sptcsl_l2 bpl sptcsl_l2
+3 -3
View File
@@ -13,8 +13,8 @@ SETFLS:
// There are 6 sane ways to implement this routine, // There are 6 sane ways to implement this routine,
// I hope this one won't cause similarity to CBM code // I hope this one won't cause similarity to CBM code
sta current_logical_filenum sta LA
sty current_secondary_address sty SA
stx current_device_number stx FA
rts rts