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
@@ -30,13 +30,18 @@
|
||||
|
||||
// $580-$5FF - reserved for KERNAL
|
||||
|
||||
.label M65_SCRTXTBASE = $580 // $580-$583 base address of the screen memory for text modes
|
||||
.label M65_SCRGFXBASE = $584 // $584-$587 -- NOT IMPLEMENTED -- base address of the screen memory for graphics modes
|
||||
.label M65_SCRMODE = $588 // 0 = 40x25, 1 = 80x25, 2 = 80x50, (-- NOT IMPLEMENTED -- add $80 for graphics modes)
|
||||
.label M65_TXTWIN_X0 = $589 // text window - top-left X coordinate, starting from 0
|
||||
.label M65_TXTWIN_Y0 = $58A // text window - top-left Y coordinate, starting from 0
|
||||
.label M65_TXTWIN_X1 = $58B // text window - bottom-right X coordinate + 1
|
||||
.label M65_TXTWIN_Y1 = $58C // text window - bottom-right Y coordinate + 1
|
||||
// $58D-$5FF -- UNUSED --
|
||||
.label M65_SCRSEG = $580 // $580-$581 segment address (2 higher bytes) of the screen memory
|
||||
.label M65_SCRBASE = $582 // $582-$583 first byte of screen memory
|
||||
.label M65_SCRGUARD = $584 // $584-$585 last byte of screen memory + 1
|
||||
.label M65_SCRVIEW = $586 // $586-$587 first byte of screen memory viewport
|
||||
.label M65_COLVIEW = $588 // $588-$589 first byte of color memory viewport
|
||||
.label M65_SCRVIEWMAX = $58A // $58A-$58B largest allowed value of M65_SCRVIEW
|
||||
.label M65_SCRMODE = $58C // 0 = 40x25, 1 = 80x25, 2 = 80x50
|
||||
.label M64_SCRWINMODE = $58D // $00 = normal mode, $FF = window enabled
|
||||
.label M65_TXTWIN_X0 = $58E // text window - top-left X coordinate, starting from 0
|
||||
.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_RS232_INBUF = $600 // $600-$6FF -- reserved for RS-232 input buffer --
|
||||
.label M65_RS232_OUTBUF = $700 // $700-$7FF -- reserved for RS-232 output buffer --
|
||||
@@ -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