more label conflicts fixed
This commit is contained in:
1 parent
c6350cc86b
commit
0597988a59
21 files changed
+311
-384
No files matched your search
+187
-188
@@ -11,7 +11,7 @@
|
||||
|
||||
chrout_real:
|
||||
|
||||
sta last_printed_character_ascii
|
||||
sta SCHAR
|
||||
|
||||
// Save X and Y values
|
||||
// (Confirmed by writing a test program that X and Y
|
||||
@@ -34,7 +34,7 @@ chrout_real:
|
||||
|
||||
chrout_iec:
|
||||
|
||||
lda last_printed_character_ascii
|
||||
lda SCHAR
|
||||
jsr JCIOUT
|
||||
bcc chrout_done
|
||||
|
||||
@@ -77,7 +77,7 @@ chrout_done:
|
||||
tay
|
||||
pla
|
||||
tax
|
||||
lda last_printed_character_ascii
|
||||
lda SCHAR
|
||||
clc // indicate success
|
||||
rts
|
||||
|
||||
@@ -88,7 +88,7 @@ chrout_screen:
|
||||
|
||||
jsr hide_cursor_if_visible
|
||||
|
||||
lda last_printed_character_ascii
|
||||
lda SCHAR
|
||||
tax
|
||||
|
||||
// Check for special characters
|
||||
@@ -111,7 +111,7 @@ not_0a:
|
||||
// RETURN clears quote and insert modes
|
||||
lda #$00
|
||||
sta QTSW
|
||||
sta insert_mode
|
||||
sta INSRT
|
||||
jmp screen_advance_to_next_line
|
||||
not_0d:
|
||||
|
||||
@@ -125,7 +125,7 @@ not_0d:
|
||||
cmp #79
|
||||
bne definitely_not_too_long
|
||||
tay
|
||||
lda (current_screen_line_ptr),y
|
||||
lda (PNT),y
|
||||
cmp #$20
|
||||
beq definitely_not_too_long
|
||||
|
||||
@@ -135,7 +135,7 @@ not_0d:
|
||||
definitely_not_too_long:
|
||||
// Work out if line needs to be expanded, and if so expand it
|
||||
ldy #39
|
||||
lda (current_screen_line_ptr),y
|
||||
lda (PNT),y
|
||||
cmp #$20
|
||||
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
|
||||
// due to the lack of creativity.
|
||||
dey
|
||||
lda (current_screen_line_colour_ptr),y
|
||||
lda (USER),y
|
||||
iny
|
||||
sta (current_screen_line_colour_ptr),y
|
||||
sta (USER),y
|
||||
dey
|
||||
lda (current_screen_line_ptr),y
|
||||
lda (PNT),y
|
||||
iny
|
||||
sta (current_screen_line_ptr),y
|
||||
sta (PNT),y
|
||||
|
||||
dey
|
||||
cpy current_screen_x
|
||||
cpy PNTR
|
||||
bne !-
|
||||
|
||||
// Increase insert mode count (which causes quote-mode like behaviour)
|
||||
inc insert_mode
|
||||
|
||||
inc INSRT
|
||||
|
||||
// Put space in the inserted gap
|
||||
lda #$20
|
||||
sta (current_screen_line_ptr),y
|
||||
sta (PNT),y
|
||||
|
||||
jmp chrout_done
|
||||
not_94:
|
||||
|
||||
// DELETE in insert mode embeds control character
|
||||
ldx insert_mode
|
||||
ldx INSRT
|
||||
bne not_14
|
||||
|
||||
cmp #$14
|
||||
bne not_14
|
||||
|
||||
// Delete
|
||||
ldx current_screen_x
|
||||
ldx PNTR
|
||||
bne delete_non_zero_column
|
||||
delete_at_column_0:
|
||||
ldy current_screen_y
|
||||
ldy TBLX
|
||||
bne not_row_0
|
||||
// delete from row 0, col 0 does nothing
|
||||
jmp chrout_done
|
||||
not_row_0:
|
||||
// Column 0 delete just moves us to the end of the
|
||||
// previous line, without actually deleting anything
|
||||
dec current_screen_y
|
||||
dec TBLX
|
||||
jsr get_current_line_logical_length
|
||||
lda logical_line_length
|
||||
|
||||
sta current_screen_x
|
||||
lda LNMX
|
||||
|
||||
sta PNTR
|
||||
jsr calculate_screen_line_pointer
|
||||
jmp chrout_done
|
||||
|
||||
delete_non_zero_column:
|
||||
// Copy rest of line down
|
||||
jsr get_current_line_logical_length
|
||||
ldy current_screen_x
|
||||
cpy logical_line_length
|
||||
ldy PNTR
|
||||
cpy LNMX
|
||||
beq done_delete
|
||||
dey
|
||||
!:
|
||||
iny
|
||||
lda (current_screen_line_ptr),y
|
||||
lda (PNT),y
|
||||
dey
|
||||
sta (current_screen_line_ptr),y
|
||||
sta (PNT),y
|
||||
iny
|
||||
lda (current_screen_line_colour_ptr),y
|
||||
lda (USER),y
|
||||
dey
|
||||
sta (current_screen_line_colour_ptr),y
|
||||
sta (USER),y
|
||||
iny
|
||||
cpy logical_line_length
|
||||
cpy LNMX
|
||||
bne !-
|
||||
|
||||
// Clear char at end of line
|
||||
jsr get_current_line_logical_length
|
||||
tay
|
||||
lda #$20
|
||||
sta (current_screen_line_ptr),y
|
||||
sta (PNT),y
|
||||
|
||||
done_delete:
|
||||
dec current_screen_x
|
||||
jmp chrout_done
|
||||
dec PNTR
|
||||
jmp chrout_done
|
||||
not_14:
|
||||
|
||||
// Check for quote mode
|
||||
ldx QTSW
|
||||
bne is_quote_mode
|
||||
ldx insert_mode
|
||||
ldx INSRT
|
||||
bne is_quote_mode
|
||||
jmp not_quote_mode
|
||||
|
||||
@@ -283,24 +283,24 @@ colour_check_loop:
|
||||
cmp #$12
|
||||
bne not_12
|
||||
lda #$80
|
||||
sta reverse_video_flag
|
||||
sta RVS
|
||||
jmp chrout_done
|
||||
not_12:
|
||||
// Compute's Mapping the 64 p 38
|
||||
cmp #$92
|
||||
bne not_92
|
||||
lda #$00
|
||||
sta reverse_video_flag
|
||||
sta RVS
|
||||
jmp chrout_done
|
||||
not_92:
|
||||
|
||||
// Check for cursor movement keys
|
||||
cmp #$11
|
||||
bne not_11
|
||||
lda current_screen_x
|
||||
lda PNTR
|
||||
clc
|
||||
adc #40
|
||||
sta current_screen_x
|
||||
sta PNTR
|
||||
// We need to advance the pointer manually, as normalising
|
||||
// now will break things. The pointer update is required
|
||||
// so that we can tell if we really are on the bottom phys
|
||||
@@ -311,22 +311,22 @@ not_92:
|
||||
not_11:
|
||||
cmp #$1d
|
||||
bne not_1d
|
||||
inc current_screen_x
|
||||
inc PNTR
|
||||
jsr calculate_screen_line_pointer
|
||||
jmp chrout_done
|
||||
not_1d:
|
||||
cmp #$91
|
||||
bne not_91
|
||||
lda current_screen_x
|
||||
lda PNTR
|
||||
sec
|
||||
sbc #40
|
||||
sta current_screen_x
|
||||
sta PNTR
|
||||
jsr calculate_screen_line_pointer
|
||||
jmp chrout_done
|
||||
not_91:
|
||||
cmp #$9d
|
||||
bne not_9d
|
||||
dec current_screen_x
|
||||
dec PNTR
|
||||
jsr calculate_screen_line_pointer
|
||||
jmp chrout_done
|
||||
not_9d:
|
||||
@@ -335,8 +335,8 @@ not_9d:
|
||||
cmp #$13
|
||||
bne not_13
|
||||
lda #0
|
||||
sta current_screen_x
|
||||
sta current_screen_y
|
||||
sta PNTR
|
||||
sta TBLX
|
||||
jsr calculate_screen_line_pointer
|
||||
jmp chrout_done
|
||||
not_13:
|
||||
@@ -401,14 +401,14 @@ output_literal_char:
|
||||
|
||||
pha
|
||||
|
||||
ldy current_screen_x
|
||||
ora reverse_video_flag // Compute's Mapping the 64 p38
|
||||
sta (current_screen_line_ptr),y
|
||||
ldy PNTR
|
||||
ora RVS // Compute's Mapping the 64 p38
|
||||
sta (PNT),y
|
||||
|
||||
// Decrement number of chars waiting to be inserted
|
||||
lda insert_mode
|
||||
lda INSRT
|
||||
beq !+
|
||||
dec insert_mode
|
||||
dec INSRT
|
||||
!:
|
||||
pla
|
||||
cmp #$22
|
||||
@@ -423,36 +423,36 @@ not_quote:
|
||||
|
||||
// Set colour
|
||||
lda COLOR
|
||||
sta (current_screen_line_colour_ptr),y
|
||||
sta (USER),y
|
||||
|
||||
// Advance the column, and scroll screen down if we need
|
||||
// to insert a 2nd line in this logical line.
|
||||
// (eg Compute's Mapping the 64 p41)
|
||||
ldx current_screen_y
|
||||
ldx TBLX
|
||||
iny
|
||||
sty current_screen_x
|
||||
sty PNTR
|
||||
cpy #40
|
||||
bne !+
|
||||
jsr screen_grow_logical_line
|
||||
ldy current_screen_x
|
||||
ldy PNTR
|
||||
!:
|
||||
cpy #80
|
||||
bcc no_screen_advance_to_next_line
|
||||
lda #0
|
||||
sta current_screen_x
|
||||
sta PNTR
|
||||
jmp screen_advance_to_next_line
|
||||
no_screen_advance_to_next_line:
|
||||
jmp chrout_done
|
||||
|
||||
screen_grow_logical_line:
|
||||
ldy current_screen_y
|
||||
ldy TBLX
|
||||
// Don't grow line if it is already grown
|
||||
lda screen_line_link_table,y
|
||||
lda LDTBL,y
|
||||
bpl !+
|
||||
jmp done_grow_line
|
||||
!:
|
||||
lda #$80
|
||||
sta screen_line_link_table,y
|
||||
sta LDTBL,y
|
||||
|
||||
// Now make space for the extra line added.
|
||||
// If we are on the last physical line of the screen,
|
||||
@@ -471,11 +471,11 @@ screen_grow_logical_line:
|
||||
ldy #0
|
||||
count_rows_loop:
|
||||
dex
|
||||
lda screen_line_link_table,y
|
||||
lda LDTBL,y
|
||||
bpl !+
|
||||
dex
|
||||
!: iny
|
||||
cpy current_screen_y
|
||||
cpy TBLX
|
||||
bne count_rows_loop
|
||||
|
||||
cpx #0
|
||||
@@ -493,28 +493,28 @@ count_rows_loop:
|
||||
lda HIBASE
|
||||
clc
|
||||
adc #3
|
||||
sta current_screen_line_ptr+1
|
||||
sta load_or_scroll_temp_pointer+1
|
||||
sta PNT+1
|
||||
sta SAL+1
|
||||
lda #>$DBC0
|
||||
sta load_save_verify_end_address+1
|
||||
sta current_screen_line_colour_ptr+1
|
||||
sta EAL+1
|
||||
sta USER+1
|
||||
|
||||
lda #<$03C0
|
||||
sta current_screen_line_ptr+0
|
||||
sta current_screen_line_colour_ptr+0
|
||||
sta PNT+0
|
||||
sta USER+0
|
||||
// souce address is line above
|
||||
sec
|
||||
sbc #40
|
||||
sta load_or_scroll_temp_pointer+0
|
||||
sta load_save_verify_end_address+0
|
||||
sta SAL+0
|
||||
sta EAL+0
|
||||
|
||||
copy_line_down_loop:
|
||||
ldy #39
|
||||
cl_inner:
|
||||
lda (load_save_verify_end_address),y
|
||||
sta (current_screen_line_colour_ptr),y
|
||||
lda (load_or_scroll_temp_pointer),y
|
||||
sta (current_screen_line_ptr),y
|
||||
lda (EAL),y
|
||||
sta (USER),y
|
||||
lda (SAL),y
|
||||
sta (PNT),y
|
||||
dey
|
||||
bpl cl_inner
|
||||
|
||||
@@ -523,29 +523,29 @@ cl_inner:
|
||||
|
||||
// Old source is new destination
|
||||
// Use different registers to minimise byte similarity with C64 KERNAl
|
||||
ldy load_or_scroll_temp_pointer+1
|
||||
sty current_screen_line_ptr+1
|
||||
lda load_save_verify_end_address+1
|
||||
ldy load_or_scroll_temp_pointer+0
|
||||
sta current_screen_line_colour_ptr+1
|
||||
sty current_screen_line_ptr+0
|
||||
sty current_screen_line_colour_ptr+0
|
||||
ldy SAL+1
|
||||
sty PNT+1
|
||||
lda EAL+1
|
||||
ldy SAL+0
|
||||
sta USER+1
|
||||
sty PNT+0
|
||||
sty USER+0
|
||||
|
||||
// Decrementing source pointers
|
||||
lda load_or_scroll_temp_pointer+0
|
||||
lda SAL+0
|
||||
sec
|
||||
sbc #<40
|
||||
sta load_or_scroll_temp_pointer+0
|
||||
sta load_save_verify_end_address+0
|
||||
lda load_or_scroll_temp_pointer+1
|
||||
sta SAL+0
|
||||
sta EAL+0
|
||||
lda SAL+1
|
||||
sbc #>40
|
||||
sta load_or_scroll_temp_pointer+1
|
||||
sta SAL+1
|
||||
// convert to screen equivalent
|
||||
sec
|
||||
sbc HIBASE
|
||||
clc
|
||||
adc #>$D800
|
||||
sta load_save_verify_end_address+1
|
||||
sta EAL+1
|
||||
|
||||
dex
|
||||
bne copy_line_down_loop
|
||||
@@ -557,9 +557,9 @@ no_copy_down:
|
||||
ldy #79
|
||||
!:
|
||||
lda COLOR
|
||||
sta (current_screen_line_colour_ptr),y
|
||||
sta (USER),y
|
||||
lda #$20
|
||||
sta (current_screen_line_ptr),y
|
||||
sta (PNT),y
|
||||
dey
|
||||
cpy #40
|
||||
bne !-
|
||||
@@ -575,163 +575,163 @@ scroll_up_if_on_last_line:
|
||||
// Colour RAM is always in fixed place, so is easiest
|
||||
// to use to check if we are on the last line.
|
||||
// The last line is at $D800 + 24*40 = $DBC0
|
||||
lda current_screen_line_colour_ptr+1
|
||||
lda USER+1
|
||||
cmp #>$DBC0
|
||||
bne not_last_line
|
||||
|
||||
lda current_screen_line_colour_ptr+0
|
||||
lda USER+0
|
||||
cmp #<$DBC0
|
||||
beq is_last_line
|
||||
|
||||
|
||||
jsr get_current_line_logical_length
|
||||
clc
|
||||
adc current_screen_line_colour_ptr+0
|
||||
adc USER+0
|
||||
cmp #<$DBE7-1
|
||||
bcc not_last_line
|
||||
bcc not_last_line
|
||||
|
||||
is_last_line:
|
||||
|
||||
dec current_screen_y
|
||||
is_last_line:
|
||||
|
||||
dec TBLX
|
||||
|
||||
// FALL THROUGH
|
||||
|
||||
scroll_screen_up:
|
||||
scroll_screen_up:
|
||||
// Now scroll the whole screen up either one or two lines
|
||||
// based on whether the first screen line is linked or not.
|
||||
|
||||
|
||||
// Get pointers to start of screen + colour RAM
|
||||
lda HIBASE
|
||||
sta current_screen_line_ptr+1
|
||||
sta load_or_scroll_temp_pointer+1
|
||||
sta PNT+1
|
||||
sta SAL+1
|
||||
lda #>$D800
|
||||
sta current_screen_line_colour_ptr+1
|
||||
sta load_save_verify_end_address+1
|
||||
sta USER+1
|
||||
sta EAL+1
|
||||
lda #$00
|
||||
sta current_screen_line_ptr+0
|
||||
sta current_screen_line_colour_ptr+0
|
||||
sta PNT+0
|
||||
sta USER+0
|
||||
|
||||
// Get pointers to screen/colour RAM source
|
||||
lda screen_line_link_table+0
|
||||
lda LDTBL+0
|
||||
bmi !+
|
||||
lda #40
|
||||
.byte $2C // BIT $nnnn to skip next instruction
|
||||
!:
|
||||
lda #80
|
||||
sta load_or_scroll_temp_pointer+0
|
||||
sta load_save_verify_end_address+0
|
||||
sta SAL+0
|
||||
sta EAL+0
|
||||
|
||||
// Copy first three pages
|
||||
ldy #$00
|
||||
ldx #3
|
||||
scroll_copy_loop:
|
||||
lda (load_save_verify_end_address),y
|
||||
sta (current_screen_line_colour_ptr),y
|
||||
lda (load_or_scroll_temp_pointer),y
|
||||
sta (current_screen_line_ptr),y
|
||||
lda (EAL),y
|
||||
sta (USER),y
|
||||
lda (SAL),y
|
||||
sta (PNT),y
|
||||
|
||||
iny
|
||||
bne scroll_copy_loop
|
||||
|
||||
inc load_or_scroll_temp_pointer+1
|
||||
inc current_screen_line_ptr+1
|
||||
inc load_save_verify_end_address+1
|
||||
inc current_screen_line_colour_ptr+1
|
||||
inc SAL+1
|
||||
inc PNT+1
|
||||
inc EAL+1
|
||||
inc USER+1
|
||||
dex
|
||||
bne scroll_copy_loop
|
||||
|
||||
// Copy last partial page
|
||||
// We need to copy 1000-(3*256)-line length
|
||||
// = 232 - line length
|
||||
lda load_or_scroll_temp_pointer+0
|
||||
lda SAL+0
|
||||
lda #232
|
||||
sec
|
||||
sbc load_or_scroll_temp_pointer+0
|
||||
sbc SAL+0
|
||||
tax
|
||||
scroll_copy_loop2:
|
||||
lda (load_save_verify_end_address),y
|
||||
sta (current_screen_line_colour_ptr),y
|
||||
lda (load_or_scroll_temp_pointer),y
|
||||
sta (current_screen_line_ptr),y
|
||||
scroll_copy_loop2:
|
||||
lda (EAL),y
|
||||
sta (USER),y
|
||||
lda (SAL),y
|
||||
sta (PNT),y
|
||||
iny
|
||||
dex
|
||||
bne scroll_copy_loop2
|
||||
|
||||
// Fill in scrolled up area
|
||||
ldx load_or_scroll_temp_pointer+0
|
||||
ldx SAL+0
|
||||
scroll_copy_loop3:
|
||||
lda COLOR
|
||||
sta (current_screen_line_colour_ptr),y
|
||||
sta (USER),y
|
||||
lda #$20
|
||||
sta (current_screen_line_ptr),y
|
||||
sta (PNT),y
|
||||
iny
|
||||
dex
|
||||
bne scroll_copy_loop3
|
||||
|
||||
|
||||
// Shift line linkage list
|
||||
ldy #0
|
||||
ldx #24
|
||||
link_copy:
|
||||
lda screen_line_link_table+1,y
|
||||
sta screen_line_link_table+0,y
|
||||
lda LDTBL+1,y
|
||||
sta LDTBL+0,y
|
||||
iny
|
||||
dex
|
||||
bne link_copy
|
||||
// Clear line link flag of last line
|
||||
stx screen_line_link_table+24
|
||||
stx LDTBL+24
|
||||
|
||||
// Restore correct line pointers
|
||||
jsr calculate_screen_line_pointer
|
||||
|
||||
rts
|
||||
|
||||
|
||||
get_current_line_logical_length:
|
||||
ldy current_screen_y
|
||||
lda screen_line_link_table,y
|
||||
ldy TBLX
|
||||
lda LDTBL,y
|
||||
bpl line_not_linked_del
|
||||
lda #79
|
||||
.byte $2c // BIT absolute mode, which we use to skip the next two instruction bytes
|
||||
line_not_linked_del:
|
||||
lda #39
|
||||
sta logical_line_length
|
||||
sta LNMX
|
||||
rts
|
||||
|
||||
|
||||
screen_advance_to_next_line:
|
||||
|
||||
// jsr hide_cursor_if_visible
|
||||
|
||||
// Go to start of line
|
||||
lda #0
|
||||
sta current_screen_x
|
||||
sta PNTR
|
||||
// Advance line number
|
||||
ldy current_screen_y
|
||||
ldy TBLX
|
||||
|
||||
// Do quick fix to line pointer to work out if it is off
|
||||
// the bottom of the screen.
|
||||
ldx #40
|
||||
lda screen_line_link_table,y
|
||||
lda LDTBL,y
|
||||
bmi !+
|
||||
.byte $2c
|
||||
!: ldx #80
|
||||
txa
|
||||
clc
|
||||
adc current_screen_line_ptr+0
|
||||
sta current_screen_line_ptr+0
|
||||
lda current_screen_line_ptr+1
|
||||
adc PNT+0
|
||||
sta PNT+0
|
||||
lda PNT+1
|
||||
adc #0
|
||||
sta current_screen_line_ptr+1
|
||||
|
||||
inc current_screen_y
|
||||
|
||||
sta PNT+1
|
||||
|
||||
inc TBLX
|
||||
|
||||
// Check if it will trigger scrolling
|
||||
// Work out if we have gone off the bottom of the screen?
|
||||
// 1040 > 1024, so if high byte of screen pointer is >= (HIBASE+4),
|
||||
// then we are off the bottom of the screen
|
||||
lda current_screen_line_ptr+1
|
||||
lda PNT+1
|
||||
sec
|
||||
sbc HIBASE
|
||||
cmp #3
|
||||
bcc !+
|
||||
lda current_screen_line_ptr+0
|
||||
lda PNT+0
|
||||
cmp #$e7
|
||||
bcc !+
|
||||
|
||||
@@ -744,83 +744,82 @@ screen_advance_to_next_line:
|
||||
jmp chrout_done
|
||||
|
||||
add_40_to_screen_x:
|
||||
lda current_screen_x
|
||||
lda PNTR
|
||||
clc
|
||||
adc #40
|
||||
sta current_screen_x
|
||||
sta PNTR
|
||||
rts
|
||||
|
||||
normalise_screen_x_y:
|
||||
// Normalise X and Y values
|
||||
|
||||
// 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
|
||||
dec current_screen_y
|
||||
dec TBLX
|
||||
// Check that we didn't go backwards off the top of the screen
|
||||
bpl !+
|
||||
lda #0
|
||||
sta current_screen_y
|
||||
sta TBLX
|
||||
|
||||
!: jsr add_40_to_screen_x
|
||||
|
||||
// Check if line is linked, if so, add 40 again
|
||||
ldy current_screen_y
|
||||
lda screen_line_link_table,y
|
||||
ldy TBLX
|
||||
lda LDTBL,y
|
||||
bpl !+
|
||||
jsr add_40_to_screen_x
|
||||
!:
|
||||
|
||||
x_not_negative:
|
||||
// Work out if X is too big
|
||||
ldy current_screen_y
|
||||
lda screen_line_link_table,y
|
||||
ldy TBLX
|
||||
lda LDTBL,y
|
||||
bpl !+
|
||||
lda #79
|
||||
.byte $2C // BIT $nnnn, used to skip next instruction
|
||||
!: lda #39
|
||||
cmp current_screen_x
|
||||
cmp PNTR
|
||||
bcs x_not_too_big
|
||||
|
||||
// X value is too big, so subtract 40 and increment Y
|
||||
lda current_screen_x
|
||||
lda PNTR
|
||||
sec
|
||||
sbc #40
|
||||
sta current_screen_x
|
||||
inc current_screen_y
|
||||
sta PNTR
|
||||
inc TBLX
|
||||
|
||||
x_not_too_big:
|
||||
|
||||
// Make sure Y isn't negative
|
||||
lda current_screen_y
|
||||
lda TBLX
|
||||
bpl !+
|
||||
lda #0
|
||||
sta current_screen_y
|
||||
sta TBLX
|
||||
!:
|
||||
// Make sure Y isn't too large for absolute size of
|
||||
// screen
|
||||
cmp #24
|
||||
bcc !+
|
||||
lda #24
|
||||
sta current_screen_y
|
||||
sta TBLX
|
||||
!:
|
||||
// Make sure Y isn't too much for the screen, taking
|
||||
// into account the line link table
|
||||
ldy #24 // max allowable line
|
||||
ldx #0
|
||||
link_count_loop:
|
||||
lda screen_line_link_table,x
|
||||
lda LDTBL,x
|
||||
bpl !+
|
||||
dey
|
||||
!: inx
|
||||
cpx #25
|
||||
bne link_count_loop
|
||||
tya
|
||||
cmp current_screen_y
|
||||
cmp TBLX
|
||||
bcs y_ok
|
||||
sta current_screen_y
|
||||
y_ok:
|
||||
|
||||
sta TBLX
|
||||
y_ok:
|
||||
rts
|
||||
|
||||
calculate_screen_line_pointer:
|
||||
@@ -828,12 +827,12 @@ calculate_screen_line_pointer:
|
||||
|
||||
// Reset pointer to start of screen
|
||||
lda HIBASE
|
||||
sta current_screen_line_ptr+1
|
||||
sta PNT+1
|
||||
lda #0
|
||||
sta current_screen_line_ptr+0
|
||||
sta PNT+0
|
||||
|
||||
// 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
|
||||
@@ -844,18 +843,18 @@ calculate_screen_line_pointer:
|
||||
ldy #40
|
||||
// -1 offset is because we count down from N to 1, not
|
||||
// N-1 to 0.
|
||||
lda screen_line_link_table-1,x
|
||||
lda LDTBL-1,x
|
||||
bpl cslp_l1
|
||||
ldy #80
|
||||
cslp_l1:
|
||||
// Add computed line length to pointer value
|
||||
tya
|
||||
clc
|
||||
adc current_screen_line_ptr+0
|
||||
sta current_screen_line_ptr+0
|
||||
lda current_screen_line_ptr+1
|
||||
adc PNT+0
|
||||
sta PNT+0
|
||||
lda PNT+1
|
||||
adc #0
|
||||
sta current_screen_line_ptr+1
|
||||
sta PNT+1
|
||||
|
||||
// Loop back to next line
|
||||
dex
|
||||
@@ -864,38 +863,38 @@ cslp_l1:
|
||||
|
||||
// FALL THROUGH
|
||||
|
||||
update_colour_line_pointer:
|
||||
update_colour_line_pointer:
|
||||
// Now setup pointer to colour RAM
|
||||
lda current_screen_line_ptr+0
|
||||
sta current_screen_line_colour_ptr+0
|
||||
lda current_screen_line_ptr+1
|
||||
lda PNT+0
|
||||
sta USER+0
|
||||
lda PNT+1
|
||||
sec
|
||||
sbc HIBASE
|
||||
clc
|
||||
adc #>$d800
|
||||
sta current_screen_line_colour_ptr+1
|
||||
|
||||
sta USER+1
|
||||
|
||||
rts
|
||||
|
||||
|
||||
|
||||
|
||||
advance_screen_pointer_40_bytes:
|
||||
lda current_screen_line_ptr+0
|
||||
lda PNT+0
|
||||
clc
|
||||
adc #<40
|
||||
sta current_screen_line_ptr+0
|
||||
sta current_screen_line_colour_ptr+0
|
||||
lda current_screen_line_ptr+1
|
||||
sta PNT+0
|
||||
sta USER+0
|
||||
lda PNT+1
|
||||
adc #>40
|
||||
sta current_screen_line_ptr+1
|
||||
sta PNT+1
|
||||
sec
|
||||
sbc HIBASE
|
||||
clc
|
||||
adc #>$D800
|
||||
sta current_screen_line_colour_ptr+1
|
||||
sta USER+1
|
||||
|
||||
jmp update_colour_line_pointer
|
||||
|
||||
colour_codes:
|
||||
|
||||
colour_codes: // consider moving them to separate location
|
||||
// CHR$ codes for the 16 colours
|
||||
.byte 144,5,28,159,156,30,31,158
|
||||
.byte 129,149,150,151,152,153,154,155
|
||||
Reference in new issue
Block a user