VIC-IV screen code optimizations

This commit is contained in:
FeralChild64 committed 2020-08-23 21:44:38 +02:00
1 parent 19b45af197
commit 9e94b9d78c
17 files changed
+109 -85

No files matched your search

+9 -4
View File
@@ -53,12 +53,11 @@ m65_chrout_screen_literal: // entry point for m65_chrout_screen_quote
// Add screen row to the address
ldy M65__TXTROW
clc
lda m65_scrtab_rowoffset_lo,y
lda M65_TXTROW_OFF+0
adc M65_LPNT_SCR+0
sta M65_LPNT_SCR+0
lda m65_scrtab_rowoffset_hi,y
lda M65_TXTROW_OFF+1
adc M65_LPNT_SCR+1
sta M65_LPNT_SCR+1
@@ -113,7 +112,7 @@ m65_chrout_fix_column_row:
// XXX provide implementation
// XXX
jmp_8 m65_chrout_screen_done
jmp_8 m65_chrout_fix_txtrow_off
m65_chrout_fix_column_row_win:
@@ -127,6 +126,12 @@ m65_chrout_fix_column_row_win:
// FALLTROUGH
m65_chrout_fix_txtrow_off:
jsr m65_screen_upd_txtrow_off
// FALLTROUGH
m65_chrout_screen_done:
jsr m65_cursor_show_if_enabled
+2
View File
@@ -118,5 +118,7 @@ m65_clrscr_loop:
lda #$00
sta M65__TXTROW
sta M65__TXTCOL
sta M65_TXTROW_OFF+0
sta M65_TXTROW_OFF+1
rts
+4 -26
View File
@@ -39,16 +39,14 @@ m65_cursor_blink:
sta M65_LPNT_IRQ+0
// Add screen row to the address
ldy M65__TXTROW
clc
lda m65_scrtab_rowoffset_lo,y
lda M65_TXTROW_OFF+0
adc M65_LPNT_IRQ+0
sta M65_LPNT_IRQ+0
lda m65_scrtab_rowoffset_hi,y
lda M65_TXTROW_OFF+1
adc M65_LPNT_IRQ+1
sta M65_LPNT_IRQ+1
// Check if cursor was visible or not, and toggle
lda BLNON
bne m65_cursor_blink_undraw
@@ -68,7 +66,7 @@ m65_cursor_blink_draw:
sta_lp (M65_LPNT_IRQ),z
// Rework pointer to point to screnn memory
jsr m65_cursor_blink_adapt_ptr
jsr m65_cursor_blink_rework_ptr
// Cursor draw - character
lda_lp (M65_LPNT_IRQ),z
@@ -99,30 +97,10 @@ m65_cursor_blink_undraw:
sta_lp (M65_LPNT_IRQ),z
// Rework pointer to point to screnn memory
jsr m65_cursor_blink_adapt_ptr
jsr m65_cursor_blink_rework_ptr
// Cursor undraw - character
lda GDBLN
sta_lp (M65_LPNT_IRQ),z
jmp_8 m65_cursor_blink_timer_reset
m65_cursor_blink_adapt_ptr:
// Adapt pointer to point to screen memory
lda M65_SCRSEG+1
sta M65_LPNT_IRQ+3
lda M65_SCRSEG+0
sta M65_LPNT_IRQ+2
clc
lda M65_SCRBASE+0
adc M65_LPNT_IRQ+0
sta M65_LPNT_IRQ+0
lda M65_SCRBASE+1
adc M65_LPNT_IRQ+1
sta M65_LPNT_IRQ+1
rts
@@ -0,0 +1,22 @@
// #LAYOUT# M65 KERNAL_0 #TAKE
// #LAYOUT# * * #IGNORE
m65_cursor_blink_rework_ptr:
// Adapt pointer to point to screen memory
lda M65_SCRSEG+1
sta M65_LPNT_IRQ+3
lda M65_SCRSEG+0
sta M65_LPNT_IRQ+2
clc
lda M65_SCRBASE+0
adc M65_LPNT_IRQ+0
sta M65_LPNT_IRQ+0
lda M65_SCRBASE+1
adc M65_LPNT_IRQ+1
sta M65_LPNT_IRQ+1
rts
@@ -1,13 +0,0 @@
// #LAYOUT# M65 KERNAL_0 #TAKE
// #LAYOUT# * * #IGNORE
// XXX consider moving this back to extended memory, and just store the offset in RAM
m65_scrtab_rowoffset_hi: // row offsets - high bytes
.byte >(80 * 0), >(80 * 1), >(80 * 2), >(80 * 3), >(80 * 4), >(80 * 5), >(80 * 6), >(80 * 7), >(80 * 8), >(80 * 9)
.byte >(80 * 10), >(80 * 11), >(80 * 12), >(80 * 13), >(80 * 14), >(80 * 15), >(80 * 16), >(80 * 17), >(80 * 18), >(80 * 19)
.byte >(80 * 20), >(80 * 21), >(80 * 22), >(80 * 23), >(80 * 24), >(80 * 25), >(80 * 26), >(80 * 27), >(80 * 28), >(80 * 29)
.byte >(80 * 30), >(80 * 31), >(80 * 32), >(80 * 33), >(80 * 34), >(80 * 35), >(80 * 36), >(80 * 37), >(80 * 38), >(80 * 39)
.byte >(80 * 40), >(80 * 41), >(80 * 42), >(80 * 43), >(80 * 44), >(80 * 45), >(80 * 46), >(80 * 47), >(80 * 48), >(80 * 49)
@@ -1,13 +0,0 @@
// #LAYOUT# M65 KERNAL_0 #TAKE
// #LAYOUT# * * #IGNORE
// XXX consider moving this back to extended memory, and just store the offset in RAM
m65_scrtab_rowoffset_lo: // row offsets - low bytes
.byte <(80 * 0), <(80 * 1), <(80 * 2), <(80 * 3), <(80 * 4), <(80 * 5), <(80 * 6), <(80 * 7), <(80 * 8), <(80 * 9)
.byte <(80 * 10), <(80 * 11), <(80 * 12), <(80 * 13), <(80 * 14), <(80 * 15), <(80 * 16), <(80 * 17), <(80 * 18), <(80 * 19)
.byte <(80 * 20), <(80 * 21), <(80 * 22), <(80 * 23), <(80 * 24), <(80 * 25), <(80 * 26), <(80 * 27), <(80 * 28), <(80 * 29)
.byte <(80 * 30), <(80 * 31), <(80 * 32), <(80 * 33), <(80 * 34), <(80 * 35), <(80 * 36), <(80 * 37), <(80 * 38), <(80 * 39)
.byte <(80 * 40), <(80 * 41), <(80 * 42), <(80 * 43), <(80 * 44), <(80 * 45), <(80 * 46), <(80 * 47), <(80 * 48), <(80 * 49)
@@ -26,6 +26,22 @@ m65_scrtab_scrolx: // values for VIC_SCROLX
.byte $CA
.byte $CA
m65_scrtab_rowoffset_lo: // row offsets - low bytes
.byte <(80 * 0), <(80 * 1), <(80 * 2), <(80 * 3), <(80 * 4), <(80 * 5), <(80 * 6), <(80 * 7), <(80 * 8), <(80 * 9)
.byte <(80 * 10), <(80 * 11), <(80 * 12), <(80 * 13), <(80 * 14), <(80 * 15), <(80 * 16), <(80 * 17), <(80 * 18), <(80 * 19)
.byte <(80 * 20), <(80 * 21), <(80 * 22), <(80 * 23), <(80 * 24), <(80 * 25), <(80 * 26), <(80 * 27), <(80 * 28), <(80 * 29)
.byte <(80 * 30), <(80 * 31), <(80 * 32), <(80 * 33), <(80 * 34), <(80 * 35), <(80 * 36), <(80 * 37), <(80 * 38), <(80 * 39)
.byte <(80 * 40), <(80 * 41), <(80 * 42), <(80 * 43), <(80 * 44), <(80 * 45), <(80 * 46), <(80 * 47), <(80 * 48), <(80 * 49)
m65_scrtab_rowoffset_hi: // row offsets - high bytes
.byte >(80 * 0), >(80 * 1), >(80 * 2), >(80 * 3), >(80 * 4), >(80 * 5), >(80 * 6), >(80 * 7), >(80 * 8), >(80 * 9)
.byte >(80 * 10), >(80 * 11), >(80 * 12), >(80 * 13), >(80 * 14), >(80 * 15), >(80 * 16), >(80 * 17), >(80 * 18), >(80 * 19)
.byte >(80 * 20), >(80 * 21), >(80 * 22), >(80 * 23), >(80 * 24), >(80 * 25), >(80 * 26), >(80 * 27), >(80 * 28), >(80 * 29)
.byte >(80 * 30), >(80 * 31), >(80 * 32), >(80 * 33), >(80 * 34), >(80 * 35), >(80 * 36), >(80 * 37), >(80 * 38), >(80 * 39)
.byte >(80 * 40), >(80 * 41), >(80 * 42), >(80 * 43), >(80 * 44), >(80 * 45), >(80 * 46), >(80 * 47), >(80 * 48), >(80 * 49)
// Jumptable for screen control codes support. To improve performance, should be sorted
// starting from the least probable routine.
@@ -0,0 +1,13 @@
// #LAYOUT# M65 KERNAL_1 #TAKE
// #LAYOUT# * * #IGNORE
m65_screen_upd_txtrow_off:
ldy M65__TXTROW
lda m65_scrtab_rowoffset_lo,y
sta M65_TXTROW_OFF+0
lda m65_scrtab_rowoffset_hi,y
sta M65_TXTROW_OFF+1
rts
+2
View File
@@ -52,5 +52,7 @@ M65_SETWIN_Y:
lda M65_TXTWIN_Y0
sta M65__TXTROW
jsr m65_screen_upd_txtrow_off
pla
rts