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

+2 -1
View File
@@ -49,6 +49,7 @@
.label M65_TXTWIN_Y0 = $58F // text window - top-left Y coordinate, starting from 0
.label M65_TXTWIN_X1 = $590 // text window - bottom-right X coordinate + 1
.label M65_TXTWIN_Y1 = $591 // text window - bottom-right Y coordinate + 1
// $592-$5FF -- UNUSED --
.label M65_TXTROW_OFF = $592 // $592-$594 offset to the current text row
// $594-$5FF -- UNUSED --
.label M65_RS232_INBUF = $600 // $600-$6FF -- reserved for RS-232 input buffer --
.label M65_RS232_OUTBUF = $700 // $700-$7FF -- reserved for RS-232 output buffer --
+1
View File
@@ -36,6 +36,7 @@
.label hw_entry_reset = KERNAL().hw_entry_reset
.label clear_screen = KERNAL().clear_screen
.label M65_SETWIN_Y = KERNAL().M65_SETWIN_Y
#if CONFIG_DBG_PRINTF
.label printf = KERNAL().printf
+2 -2
View File
@@ -12,6 +12,7 @@
.label poke_via_OLDTXT = BASIC_0.proxy_B1_poke_via_OLDTXT
.label JCHROUT = BASIC_0.proxy_B1_JCHROUT
.label JCLALL = BASIC_0.proxy_B1_JCLALL
.label plot_set = BASIC_0.proxy_B1_plot_set
#if CONFIG_DOS_WEDGE
.label JCLOSE = BASIC_0.proxy_B1_JCLOSE
.label JOPEN = BASIC_0.proxy_B1_JOPEN
@@ -28,9 +29,8 @@
.label M65_ISMODE65 = KERNAL_0.M65_ISMODE65
.label M65_SETWIN_XY = KERNAL_0.M65_SETWIN_XY
.label M65_SETWIN_WH = KERNAL_0.M65_SETWIN_WH
.label M65_SETWIN_Y = KERNAL_0.M65_SETWIN_Y
.label M65_SETWIN_Y = BASIC_0.proxy_B1_M65_SETWIN_Y
.label M65_SETWIN_N = KERNAL_0.M65_SETWIN_N
.label plot_set = KERNAL_0.plot_set
.label init_oldtxt = BASIC_0.init_oldtxt
.label tmpstr_free_all_reset = BASIC_0.tmpstr_free_all_reset
.label rom_revision_basic_string = BASIC_0.rom_revision_basic_string
+7 -7
View File
@@ -29,7 +29,6 @@ proxy_B1_poke_via_OLDTXT:
#endif
jmp map_BASIC_1
proxy_B1_JCLALL:
jsr map_NORMAL
@@ -85,16 +84,17 @@ proxy_B1_print_space:
jsr print_space
jmp map_BASIC_1
#if CONFIG_SHOW_FEATURES
proxy_B1_print_features:
proxy_B1_plot_set:
jsr map_NORMAL
jsr print_features
jsr plot_set
jmp map_BASIC_1
#endif
proxy_B1_M65_SETWIN_Y:
jsr map_NORMAL
jsr M65_SETWIN_Y
jmp map_BASIC_1
#if CONFIG_DOS_WEDGE
@@ -11,20 +11,21 @@
// Label definitions
.label VK1__IOINIT = $4000 + 2 * 0
.label VK1__RAMTAS = $4000 + 2 * 1
.label VK1__setup_vicii = $4000 + 2 * 2
.label VK1__load_tape_normal = $4000 + 2 * 3
.label VK1__load_tape_turbo = $4000 + 2 * 4
.label VK1__load_tape_auto = $4000 + 2 * 5
.label VK1__tape_head_align = $4000 + 2 * 6
.label VK1__m65_chrout_screen = $4000 + 2 * 7
.label VK1__M65_MODE64 = $4000 + 2 * 8
.label VK1__M65_MODE65 = $4000 + 2 * 9
.label VK1__M65_SCRMODEGET = $4000 + 2 * 10
.label VK1__M65_SCRMODESET = $4000 + 2 * 11
.label VK1__M65_CLRSCR = $4000 + 2 * 12
.label VK1__M65_CLRWIN = $4000 + 2 * 13
.label VK1__IOINIT = $4000 + 2 * 0
.label VK1__RAMTAS = $4000 + 2 * 1
.label VK1__setup_vicii = $4000 + 2 * 2
.label VK1__load_tape_normal = $4000 + 2 * 3
.label VK1__load_tape_turbo = $4000 + 2 * 4
.label VK1__load_tape_auto = $4000 + 2 * 5
.label VK1__tape_head_align = $4000 + 2 * 6
.label VK1__m65_chrout_screen = $4000 + 2 * 7
.label VK1__M65_MODE64 = $4000 + 2 * 8
.label VK1__M65_MODE65 = $4000 + 2 * 9
.label VK1__M65_SCRMODEGET = $4000 + 2 * 10
.label VK1__M65_SCRMODESET = $4000 + 2 * 11
.label VK1__M65_CLRSCR = $4000 + 2 * 12
.label VK1__M65_CLRWIN = $4000 + 2 * 13
.label VK1__m65_screen_upd_txtrow_off = $4000 + 2 * 14
#else
@@ -65,6 +66,7 @@
.word M65_SCRMODEGET
.word M65_SCRMODESET
.word M65_CLRSCR
.word M65_CLRWIN
.word M65_CLRWIN
.word m65_screen_upd_txtrow_off
#endif
-2
View File
@@ -34,8 +34,6 @@
.label wait_x_bars = KERNAL_0.wait_x_bars
.label viciv_unhide = KERNAL_0.viciv_unhide
.label m65_scrtab_rowoffset_lo = KERNAL_0.m65_scrtab_rowoffset_lo
.label m65_scrtab_rowoffset_hi = KERNAL_0.m65_scrtab_rowoffset_hi
.label m65_scrtab_txtwidth = KERNAL_0.m65_scrtab_txtwidth
.label m65_scrtab_txtheight = KERNAL_0.m65_scrtab_txtheight
@@ -2,7 +2,7 @@
// #LAYOUT# * * #IGNORE
//
// ROM routine call redirect for Mega65 screen routines
// ROM routine call redirect for MEGA65 screen routines
//
@@ -11,4 +11,10 @@ m65_chrout_screen:
jsr map_KERNAL_1
jsr_ind VK1__m65_chrout_screen
jsr map_NORMAL
jmp chrout_done_success
jmp chrout_done_success
m65_screen_upd_txtrow_off:
jsr map_KERNAL_1
jsr_ind VK1__m65_screen_upd_txtrow_off
jmp map_NORMAL
@@ -15,5 +15,9 @@
screen_calculate_pointers:
jsr M65_ISMODE65
bcs !+
jmp m65_screen_upd_txtrow_off
!:
jsr screen_calculate_PNT_USER
jmp screen_calculate_PNTR_LNMX
+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