separate functions for EAL/SAL preservation during screen routines
This commit is contained in:
1 parent
309cfe3eb0
commit
27792a78ea
5 files changed
+92
-60
No files matched your search
@@ -10,7 +10,38 @@ screen_scroll_up:
|
||||
|
||||
// First handle CTRL and NO_SCRL keys
|
||||
|
||||
jsr screen_scroll_delay
|
||||
#if CONFIG_KEYBOARD_C128 || CONFIG_KEYBOARD_C65
|
||||
|
||||
// Do not scroll if NO_SCRL is pressed and interrupts are enabled
|
||||
!:
|
||||
php
|
||||
pla
|
||||
and #%00000010
|
||||
bne !+ // branch if IRQs disabled, we cannot detect NO_SCRL status
|
||||
|
||||
lda SHFLAG
|
||||
and #KEY_FLAG_NO_SCRL
|
||||
bne !-
|
||||
!:
|
||||
|
||||
#endif
|
||||
|
||||
// Check if CTRL key pressed - if so, perform a delay
|
||||
|
||||
lda SHFLAG
|
||||
and #KEY_FLAG_CTRL
|
||||
beq screen_scroll_up_delay_done
|
||||
|
||||
ldy #$09
|
||||
!:
|
||||
ldx #$FF
|
||||
jsr wait_x_bars
|
||||
dey
|
||||
bne !-
|
||||
|
||||
// FALLTROUGH
|
||||
|
||||
screen_scroll_up_delay_done:
|
||||
|
||||
// Scroll the LDTBL (line link table)
|
||||
|
||||
@@ -27,14 +58,7 @@ screen_scroll_up:
|
||||
|
||||
// Preserve SAL and EAL
|
||||
|
||||
lda SAL+0
|
||||
pha
|
||||
lda SAL+1
|
||||
pha
|
||||
lda EAL+0
|
||||
pha
|
||||
lda EAL+1
|
||||
pha
|
||||
jsr screen_preserve_sal_eal
|
||||
|
||||
// Now, we need to scroll both screen memory and color memory; first create start/end pointers
|
||||
|
||||
@@ -86,15 +110,8 @@ screen_scroll_up_loop:
|
||||
screen_scroll_up_loop_done:
|
||||
|
||||
// Restore SAL and EAL
|
||||
|
||||
pla
|
||||
sta EAL+1
|
||||
pla
|
||||
sta EAL+0
|
||||
pla
|
||||
sta SAL+1
|
||||
pla
|
||||
sta SAL+0
|
||||
|
||||
jsr screen_restore_sal_eal
|
||||
|
||||
// Clear the newly introduced line
|
||||
|
||||
|
||||
@@ -8,7 +8,6 @@ screen_grow_logical_line_done:
|
||||
screen_grow_logical_line:
|
||||
|
||||
// Do not grow line if previus one is grown
|
||||
|
||||
ldy TBLX
|
||||
lda LDTBL,y
|
||||
bpl screen_grow_logical_line_done
|
||||
@@ -28,12 +27,27 @@ screen_grow_logical_line:
|
||||
lda #$00
|
||||
sta LDTBL,y
|
||||
|
||||
// Preserve SAL and EAL
|
||||
jsr screen_preserve_sal_eal
|
||||
|
||||
// Now we have to scroll lines downwards to make space
|
||||
|
||||
|
||||
// YYY implement here
|
||||
|
||||
.break
|
||||
rts
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// Restore SAL and EAL
|
||||
jsr screen_restore_sal_eal
|
||||
|
||||
// Recalculate PNT and USER YYY is it needed?
|
||||
jmp screen_calculate_PNT_USER
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
|
||||
|
||||
screen_preserve_sal_eal:
|
||||
|
||||
plx_trash_a
|
||||
ply_trash_a
|
||||
|
||||
lda SAL+0
|
||||
pha
|
||||
lda SAL+1
|
||||
pha
|
||||
lda EAL+0
|
||||
pha
|
||||
lda EAL+1
|
||||
pha
|
||||
|
||||
// FALLTROUGH
|
||||
|
||||
screen_common_sal_eal:
|
||||
|
||||
phy_trash_a
|
||||
phx_trash_a
|
||||
rts
|
||||
@@ -0,0 +1,18 @@
|
||||
|
||||
|
||||
screen_restore_sal_eal:
|
||||
|
||||
plx_trash_a
|
||||
ply_trash_a
|
||||
|
||||
pla
|
||||
sta EAL+1
|
||||
pla
|
||||
sta EAL+0
|
||||
pla
|
||||
sta SAL+1
|
||||
pla
|
||||
sta SAL+0
|
||||
|
||||
jmp screen_common_sal_eal
|
||||
|
||||
@@ -1,40 +0,0 @@
|
||||
|
||||
//
|
||||
// Handles CTRL and NO_SCRL during screen scroll
|
||||
//
|
||||
|
||||
|
||||
screen_scroll_delay:
|
||||
|
||||
#if CONFIG_KEYBOARD_C128 || CONFIG_KEYBOARD_C65
|
||||
|
||||
// Do not scroll if NO_SCRL is pressed and interrupts are enabled
|
||||
!:
|
||||
php
|
||||
pla
|
||||
and #%00000010
|
||||
bne !+ // branch if IRQs disabled, we cannot detect NO_SCRL status
|
||||
|
||||
lda SHFLAG
|
||||
and #KEY_FLAG_NO_SCRL
|
||||
bne !-
|
||||
!:
|
||||
|
||||
#endif
|
||||
|
||||
// Check if CTRL key pressed - if so, perform a delay
|
||||
|
||||
lda SHFLAG
|
||||
and #KEY_FLAG_CTRL
|
||||
beq screen_scroll_delay_done
|
||||
|
||||
ldy #$09
|
||||
!:
|
||||
ldx #$FF
|
||||
jsr wait_x_bars
|
||||
dey
|
||||
bne !-
|
||||
|
||||
screen_scroll_delay_done:
|
||||
|
||||
rts
|
||||
Reference in new issue
Block a user