preparation for up-scrollable console
This commit is contained in:
1 parent
ab22c13fac
commit
0d4898d91c
5 files changed
+214
-51
No files matched your search
@@ -0,0 +1,118 @@
|
||||
// #LAYOUT# M65 KERNAL_1 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
|
||||
|
||||
M65_CLRSCR:
|
||||
|
||||
// Clear additional attributes from the color code
|
||||
|
||||
lda COLOR
|
||||
and #$0F
|
||||
sta COLOR
|
||||
|
||||
// Disable the window mode
|
||||
|
||||
lda #$00
|
||||
sta M64_SCRWINMODE
|
||||
|
||||
// FALLTROUGH
|
||||
|
||||
m65_clrscr_takeover:
|
||||
|
||||
// Set the viewport to the beginning of screen memory - variables:
|
||||
// - M65_SCRVIEW, M65_COLVIEW
|
||||
// To clear the screen, two zeropage long pointers will be used, initialize them too
|
||||
// - M65_LPNT_SCR for screen memory
|
||||
// - M65_LPNT_KERN for colour memory (starts from $FF80000)
|
||||
|
||||
sta M65_COLVIEW+0
|
||||
sta M65_COLVIEW+1
|
||||
|
||||
sta M65_LPNT_KERN+0
|
||||
sta M65_LPNT_KERN+1
|
||||
lda #$F8
|
||||
sta M65_LPNT_KERN+2
|
||||
lda #$0F
|
||||
sta M65_LPNT_KERN+3
|
||||
|
||||
lda M65_SCRSEG+0
|
||||
sta M65_SCRVIEW+0
|
||||
lda M65_SCRSEG+1
|
||||
sta M65_SCRVIEW+1
|
||||
|
||||
lda M65_SCRBASE+0
|
||||
sta M65_LPNT_SCR+0
|
||||
lda M65_SCRBASE+1
|
||||
sta M65_LPNT_SCR+1
|
||||
lda M65_SCRSEG+0
|
||||
sta M65_LPNT_SCR+2
|
||||
lda M65_SCRSEG+1
|
||||
sta M65_LPNT_SCR+3
|
||||
|
||||
// Clear the whole screen+color memory
|
||||
|
||||
phz
|
||||
|
||||
// FALLTROUGH
|
||||
|
||||
m65_clrscr_loop:
|
||||
|
||||
// Clear 80 characters
|
||||
|
||||
ldz #$4F // 80 bytes
|
||||
!:
|
||||
lda #$20
|
||||
sta_lp (M65_LPNT_SCR),z
|
||||
lda COLOR
|
||||
sta_lp (M65_LPNT_KERN),z
|
||||
|
||||
dez
|
||||
bpl !-
|
||||
|
||||
// Move M65_LPNT_SCR and M65_LPNT_KERN 80 characters forward
|
||||
// XXX deduplicate with window clearing
|
||||
|
||||
clc
|
||||
lda M65_LPNT_SCR+0
|
||||
adc #$50
|
||||
sta M65_LPNT_SCR+0
|
||||
bcc !+
|
||||
inc M65_LPNT_SCR+1
|
||||
!:
|
||||
clc
|
||||
lda M65_LPNT_KERN+0
|
||||
adc #$50
|
||||
sta M65_LPNT_KERN+0
|
||||
bcc !+
|
||||
inc M65_LPNT_KERN+1
|
||||
!:
|
||||
// Check if we have more rows to clear
|
||||
|
||||
lda M65_LPNT_SCR+1
|
||||
cmp M65_SCRGUARD+1
|
||||
bne m65_clrscr_loop
|
||||
lda M65_LPNT_SCR+0
|
||||
cmp M65_SCRGUARD+0
|
||||
bne m65_clrscr_loop
|
||||
|
||||
// Restore .Z register
|
||||
|
||||
plz
|
||||
|
||||
// Set screen+color base address in VIC IV
|
||||
// XXX deduplicate with mode setting routine
|
||||
|
||||
lda #$00
|
||||
sta VIC_COLPTR+0
|
||||
sta VIC_COLPTR+1
|
||||
|
||||
lda M65_SCRBASE+0
|
||||
sta VIC_SCRNPTR+0
|
||||
lda M65_SCRBASE+1
|
||||
sta VIC_SCRNPTR+1
|
||||
|
||||
// Set screen variables
|
||||
|
||||
// XXX implement this, together with HOME
|
||||
|
||||
rts
|
||||
+29
-30
@@ -2,49 +2,48 @@
|
||||
// #LAYOUT# * * #IGNORE
|
||||
|
||||
|
||||
M65_CLRSCR:
|
||||
|
||||
// Set the text window to whole screen area
|
||||
|
||||
lda #$00
|
||||
sta M65_TXTWIN_X0
|
||||
sta M65_TXTWIN_Y0
|
||||
|
||||
ldx M65_SCRMODE
|
||||
|
||||
lda m65_scrtab_txtwidth, X
|
||||
sta M65_TXTWIN_X1
|
||||
lda m65_scrtab_txtheight, X
|
||||
sta M65_TXTWIN_Y1
|
||||
|
||||
// FALLTROUGH
|
||||
|
||||
M65_CLRWIN:
|
||||
|
||||
// Clear additional attributes from the color code
|
||||
// XXX deduplicate with M65_CLRSCR
|
||||
|
||||
lda COLOR
|
||||
and #$0F
|
||||
sta COLOR
|
||||
|
||||
// Check if windowed mode; if not, go to M65_CLRSCR
|
||||
|
||||
lda M64_SCRWINMODE
|
||||
bpl_16 m65_clrscr_takeover
|
||||
|
||||
// To clear the window, two zeropage long pointers will be used:
|
||||
// - M65_LPNT_SCR for screen memory
|
||||
// - M65_LPNT_KERN for colour memory (starts from $FF80000)
|
||||
|
||||
// First initialize both pointers
|
||||
|
||||
ldx #$03
|
||||
!:
|
||||
lda M65_SCRTXTBASE,x
|
||||
sta M65_LPNT_SCR,x
|
||||
lda #$00
|
||||
sta M65_LPNT_KERN,x
|
||||
dex
|
||||
bpl !-
|
||||
lda M65_SCRVIEW+0
|
||||
sta M65_LPNT_SCR+0
|
||||
lda M65_SCRVIEW+1
|
||||
sta M65_LPNT_SCR+1
|
||||
lda M65_SCRSEG+0
|
||||
sta M65_LPNT_SCR+2
|
||||
lda M65_SCRSEG+1
|
||||
sta M65_LPNT_SCR+3
|
||||
|
||||
lda #$0F
|
||||
sta M65_LPNT_KERN+3
|
||||
lda #$F8
|
||||
sta M65_LPNT_KERN+2
|
||||
lda M65_COLVIEW+0
|
||||
sta M65_LPNT_KERN+0
|
||||
lda M65_COLVIEW+1
|
||||
sta M65_LPNT_KERN+1
|
||||
// XXX deduplicate part below with M65_CLRSCR
|
||||
lda #$F8
|
||||
sta M65_LPNT_KERN+2
|
||||
lda #$0F
|
||||
sta M65_LPNT_KERN+3
|
||||
|
||||
// Go trough all the rows
|
||||
|
||||
phz
|
||||
ldx M65_SCRMODE
|
||||
ldy #$00
|
||||
|
||||
// FALLTROUGH
|
||||
@@ -20,6 +20,18 @@ m65_scrtab_txtheight: // height of the text screen
|
||||
.byte 25
|
||||
.byte 50
|
||||
|
||||
m65_scrtab_viewmax_lo: // maximum allowed viewport start - low byte
|
||||
|
||||
.byte $B0
|
||||
.byte $B0
|
||||
.byte $E0
|
||||
|
||||
m65_scrtab_viewmax_hi: // maximum allowed viewport start - high byte
|
||||
|
||||
.byte $96
|
||||
.byte $96
|
||||
.byte $8E
|
||||
|
||||
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)
|
||||
|
||||
@@ -56,21 +56,50 @@ m65_scrmodeset_internal: // entry point for M65_MODE65
|
||||
ldx #$00
|
||||
stx VIC_CHARSTEP+1
|
||||
|
||||
// Set the base screen addresses:
|
||||
// - in VIC_SCRNPTR and M65_SCRTXTBASE to $16000
|
||||
// - in VIC_COLPTR to $0000
|
||||
// Set the following locations:
|
||||
// - M64_SCRWINMODE - for scroll-console mode
|
||||
// - M65_SCRSEG, VIC_SCRNPTR+2/+3 - for screen in $0001xxxx area
|
||||
|
||||
stx M64_SCRWINMODE // .X = 0
|
||||
stx M65_SCRSEG+1
|
||||
stx VIC_SCRNPTR+3
|
||||
inx
|
||||
stx M65_SCRSEG+0
|
||||
stx VIC_SCRNPTR+2
|
||||
|
||||
// Set the following locations:
|
||||
// - M65_SCRBASE - for screen starting from $xxxx6000
|
||||
// - M65_SCRVIEW, VIC_SCRNPTR+0/+1 - for screen viewport starting from the same address
|
||||
// - M65_COLVIEW, VIC_COLPTR - for using color memory from the start
|
||||
|
||||
ldx #$60
|
||||
stx M65_SCRBASE+1
|
||||
stx M65_SCRVIEW+1
|
||||
stx VIC_SCRNPTR+1
|
||||
|
||||
ldx #$00
|
||||
stx M65_SCRBASE+0
|
||||
stx M65_SCRVIEW+0
|
||||
stx VIC_SCRNPTR+0
|
||||
|
||||
stx M65_COLVIEW+0
|
||||
stx M65_COLVIEW+1
|
||||
stx VIC_COLPTR+0
|
||||
stx VIC_COLPTR+1
|
||||
stx VIC_SCRNPTR+0
|
||||
stx M65_SCRTXTBASE+0
|
||||
stx VIC_SCRNPTR+3
|
||||
stx M65_SCRTXTBASE+3
|
||||
inx
|
||||
stx VIC_SCRNPTR+2
|
||||
stx M65_SCRTXTBASE+2
|
||||
ldx #$60
|
||||
stx VIC_SCRNPTR+1
|
||||
stx M65_SCRTXTBASE+1
|
||||
|
||||
// Set the following locations:
|
||||
// - M65_SCREND - for max 200 lines of virtual screen
|
||||
// - M65_SCRVIEWMAX - as above, but depending on the mode
|
||||
|
||||
ldx #$80
|
||||
stx M65_SCRGUARD+0
|
||||
ldx #$9E
|
||||
stx M65_SCRGUARD+1
|
||||
|
||||
ldx M65_SCRMODE
|
||||
lda m65_scrtab_viewmax_lo, x
|
||||
sta M65_SCRVIEWMAX+0
|
||||
lda m65_scrtab_viewmax_hi, x
|
||||
sta M65_SCRVIEWMAX+1
|
||||
|
||||
rts
|
||||
Reference in new issue
Block a user