From ab22c13fac5957322035ebe346eae37b19426f7c Mon Sep 17 00:00:00 2001 From: FeralChild64 Date: Sun, 9 Aug 2020 13:11:15 +0200 Subject: [PATCH] more work towards Mega65 console --- src/aliases/,aliases_hardware_m65.s | 8 +++++--- src/kernal/screen_m65/mega65_clrscr_clrwin.s | 6 +++--- src/kernal/screen_m65/mega65_screen_tables.s | 18 +++++++++++++++++- src/kernal/screen_m65/mega65_scrmodeset.s | 8 +++++++- 4 files changed, 32 insertions(+), 8 deletions(-) diff --git a/src/aliases/,aliases_hardware_m65.s b/src/aliases/,aliases_hardware_m65.s index 9830338e..14e33cc4 100644 --- a/src/aliases/,aliases_hardware_m65.s +++ b/src/aliases/,aliases_hardware_m65.s @@ -16,10 +16,12 @@ .label VIC_XPOS = $D050 - .label VIC_SCRNPTR = $D060 // 4 bytes - .label VIC_COLPTR = $D064 // 2 bytes + .label VIC_CHARSTEP = $D058 // 2 bytes - logical characters per line - .label VIC_CHARPTR = $D068 // 3 bytes + .label VIC_SCRNPTR = $D060 // 4 bytes - pointer to start of screen memory + .label VIC_COLPTR = $D064 // 2 bytes - pointer to start of color memory + + .label VIC_CHARPTR = $D068 // 3 bytes - pointer to start of character generator // MISC registers diff --git a/src/kernal/screen_m65/mega65_clrscr_clrwin.s b/src/kernal/screen_m65/mega65_clrscr_clrwin.s index 5d363ed6..d29ae967 100644 --- a/src/kernal/screen_m65/mega65_clrscr_clrwin.s +++ b/src/kernal/screen_m65/mega65_clrscr_clrwin.s @@ -72,17 +72,17 @@ m65_clrwin_loop: m65_clrwin_loop_next: - // Increment M65_LPNT_SCR and M65_LPNT_KERN by the row length + // Increment M65_LPNT_SCR and M65_LPNT_KERN by the logical row length (always 80 = $50) clc - lda m65_scrtab_txtwidth, x + lda #$50 adc M65_LPNT_SCR+0 sta M65_LPNT_SCR+0 bcc !+ inc M65_LPNT_SCR+1 !: clc - lda m65_scrtab_txtwidth, x + lda #$50 adc M65_LPNT_KERN+0 sta M65_LPNT_KERN+0 bcc !+ diff --git a/src/kernal/screen_m65/mega65_screen_tables.s b/src/kernal/screen_m65/mega65_screen_tables.s index 3a071a2b..2a00a5ce 100644 --- a/src/kernal/screen_m65/mega65_screen_tables.s +++ b/src/kernal/screen_m65/mega65_screen_tables.s @@ -8,7 +8,7 @@ m65_scrtab_vic_ctrlb: // parameters for VIC control register B .byte %10100000 // 80x25 + extended attributes .byte %10100100 // 80x50 + extended attributes -m65_scrtab_txtwidth: // width of the text screen +m65_scrtab_txtwidth: // width of the text screen (logical width is always set to 80) .byte 40 .byte 80 @@ -19,3 +19,19 @@ m65_scrtab_txtheight: // height of the text screen .byte 25 .byte 25 .byte 50 + +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) \ No newline at end of file diff --git a/src/kernal/screen_m65/mega65_scrmodeset.s b/src/kernal/screen_m65/mega65_scrmodeset.s index c7e070e5..56994e77 100644 --- a/src/kernal/screen_m65/mega65_scrmodeset.s +++ b/src/kernal/screen_m65/mega65_scrmodeset.s @@ -49,11 +49,17 @@ m65_scrmodeset_internal: // entry point for M65_MODE65 lda m65_scrtab_vic_ctrlb,x sta VIC_CTRLB + // Set the logical row length to 80 + + ldx #$50 + stx VIC_CHARSTEP+0 + ldx #$00 + stx VIC_CHARSTEP+1 + // Set the base screen addresses: // - in VIC_SCRNPTR and M65_SCRTXTBASE to $16000 // - in VIC_COLPTR to $0000 - ldx #$00 stx VIC_COLPTR+0 stx VIC_COLPTR+1 stx VIC_SCRNPTR+0