MEGA65 native screen fixes

This commit is contained in:
FeralChild64 committed 2020-08-26 22:25:56 +02:00
1 parent ecafb43807
commit c32650f7f5
10 files changed
+88 -86

No files matched your search

+5
View File
@@ -7,6 +7,11 @@
// $10000-$17FFF (32KB) - reserved for DOS
// $18000-$18FFF (4KB) - chargen copied to RAM, to allow character redefinition
// $19000-$1B7FF (10KB) - reserved for virtual text screenk, 80x128
.const MEMCONF_SCRBASE = $9000
.const MEMCONF_SCRROWS = 128
// $1B800-$1DFFF (10KB) - reserved for a color RAM backup when switchin between text/graphics modes
// (4KB) - reserved for sprites
// (2KB) - reserved for future use
@@ -1,11 +0,0 @@
// #LAYOUT# M65 KERNAL_1 #TAKE
// #LAYOUT# * * #IGNORE
m65_clear_attributes:
lda COLOR
and #$0F
sta COLOR
rts
+4 -4
View File
@@ -7,7 +7,7 @@ M65_CLRSCR:
// Clear additional attributes from the color code
jsr m65_clear_attributes
jsr m65_screen_clear_colorattr
// Disable the window mode
@@ -79,10 +79,10 @@ m65_clrscr_loop:
// Check if we are allowed to progress further
lda M65_COLVIEW+1
cmp M65_COLVIEWMAX+1
cmp M65_COLGUARD+1
bne m65_clrscr_loop
lda M65_COLVIEW+0
cmp M65_COLVIEWMAX+0
cmp M65_COLGUARD+0
bne m65_clrscr_loop
m65_clrscr_loop_done:
@@ -111,7 +111,7 @@ m65_clrscr_loop_done:
// FALLTROUGH
M65_HOME:
m65_home: // XXX reuse
// XXX provide proper implementation
+1 -1
View File
@@ -8,7 +8,7 @@ M65_CLRWIN:
// Clear additional attributes from the color code
jsr m65_clear_attributes
jsr m65_screen_clear_colorattr
// Check if windowed mode; if not, go to M65_CLRSCR
+10 -41
View File
@@ -2,52 +2,21 @@
// #LAYOUT# * * #IGNORE
m65_helper_scrlpnt_color:
m65_screen_clear_colorattr:
// Set .Z to the current column
ldz M65__TXTCOL
// Setting M65_LPNT_SCR to point to colour memory (starts from $FF80000)
lda #$0F
sta M65_LPNT_SCR+3
lda #$F8
sta M65_LPNT_SCR+2
lda M65_COLVIEW+1
sta M65_LPNT_SCR+1
lda M65_COLVIEW+0
sta M65_LPNT_SCR+0
// Add screen row to the address
clc
lda M65_TXTROW_OFF+0
adc M65_LPNT_SCR+0
sta M65_LPNT_SCR+0
lda M65_TXTROW_OFF+1
adc M65_LPNT_SCR+1
sta M65_LPNT_SCR+1
lda COLOR
and #$0F
sta COLOR
rts
m65_helper_scrlpnt_to_screen:
m65_screen_upd_txtrow_off:
// Change M65_LPNT_SCR to point to screen memory (when it points to color memory)
lda M65_SCRSEG+1
sta M65_LPNT_SCR+3
lda M65_SCRSEG+0
sta M65_LPNT_SCR+2
clc
lda M65_SCRBASE+0
adc M65_LPNT_SCR+0
sta M65_LPNT_SCR+0
lda M65_SCRBASE+1
adc M65_LPNT_SCR+1
sta M65_LPNT_SCR+1
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
@@ -0,0 +1,53 @@
// #LAYOUT# M65 KERNAL_1 #TAKE
// #LAYOUT# * * #IGNORE
m65_helper_scrlpnt_color:
// Set .Z to the current column
ldz M65__TXTCOL
// Setting M65_LPNT_SCR to point to colour memory (starts from $FF80000)
lda #$0F
sta M65_LPNT_SCR+3
lda #$F8
sta M65_LPNT_SCR+2
lda M65_COLVIEW+1
sta M65_LPNT_SCR+1
lda M65_COLVIEW+0
sta M65_LPNT_SCR+0
// Add screen row to the address
clc
lda M65_TXTROW_OFF+0
adc M65_LPNT_SCR+0
sta M65_LPNT_SCR+0
lda M65_TXTROW_OFF+1
adc M65_LPNT_SCR+1
sta M65_LPNT_SCR+1
rts
m65_helper_scrlpnt_to_screen:
// Change M65_LPNT_SCR to point to screen memory (when it points to color memory)
lda M65_SCRSEG+1
sta M65_LPNT_SCR+3
lda M65_SCRSEG+0
sta M65_LPNT_SCR+2
clc
lda M65_SCRBASE+0
adc M65_LPNT_SCR+0
sta M65_LPNT_SCR+0
lda M65_SCRBASE+1
adc M65_LPNT_SCR+1
sta M65_LPNT_SCR+1
rts
@@ -10,15 +10,15 @@ m65_scrtab_vic_ctrlb: // parameters for VIC control register B
m65_scrtab_colviewmax_lo: // maximum allowed color viewport start - low byte
.byte <((128-25)*80)
.byte <((128-25)*80)
.byte <((128-50)*80)
.byte <((MEMCONF_SCRROWS - 25) * 80)
.byte <((MEMCONF_SCRROWS - 25) * 80)
.byte <((MEMCONF_SCRROWS - 50) * 80)
m65_scrtab_colviewmax_hi: // maximum allowed color viewport start - high byte
.byte >((128-25)*80)
.byte >((128-25)*80)
.byte >((128-50)*80)
.byte >((MEMCONF_SCRROWS - 25) * 80)
.byte >((MEMCONF_SCRROWS - 25) * 80)
.byte >((MEMCONF_SCRROWS - 50) * 80)
m65_scrtab_scrolx: // values for VIC_SCROLX
@@ -1,13 +0,0 @@
// #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
+9 -10
View File
@@ -54,9 +54,9 @@ m65_scrmodeset_internal: // entry point for M65_MODE65
// Set the logical row length to 80
ldx #$50
// stx VIC_CHARSTEP+0
stx VIC_CHARSTEP+0
ldx #$00
// stx VIC_CHARSTEP+1
stx VIC_CHARSTEP+1
// Set the following locations:
// - M64_SCRWINMODE - for scroll-console mode
@@ -74,13 +74,12 @@ m65_scrmodeset_internal: // entry point for M65_MODE65
// - VIC_SCRNPTR+0/+1 - for screen viewport start
// - M65_COLVIEW, VIC_COLPTR - for using color memory from the start
ldx #>($9000)
ldx #>MEMCONF_SCRBASE
stx M65_SCRBASE+1
stx VIC_SCRNPTR+1
ldx #<($9000)
ldx #<MEMCONF_SCRBASE
stx M65_SCRBASE+0
stx VIC_SCRNPTR+0
stx M65_COLVIEW+0
@@ -89,17 +88,17 @@ m65_scrmodeset_internal: // entry point for M65_MODE65
stx VIC_COLPTR+1
// Set the following locations:
// - M65_SCRGUARD, M65_COLGUARD - for max 128 lines of virtual screen
// - M65_SCRGUARD, M65_COLGUARD - for max lines of virtual screen
// - M65_COLVIEWMAX - as above, but depending on the mode
ldx #<($9000 + 80 * 128)
ldx #<(MEMCONF_SCRBASE + 80 * MEMCONF_SCRROWS)
stx M65_SCRGUARD+0
ldx #>($9000 + 80 * 128)
ldx #>(MEMCONF_SCRBASE + 80 * MEMCONF_SCRROWS)
stx M65_SCRGUARD+1
ldx #<(80 * 128)
ldx #<(80 * MEMCONF_SCRROWS)
stx M65_COLGUARD+0
ldx #>(80 * 128)
ldx #>(80 * MEMCONF_SCRROWS)
stx M65_COLGUARD+1
ldx M65_SCRMODE