toggling character sets now works in MEGA65 native mode too

This commit is contained in:
FeralChild64 committed 2020-08-31 21:09:54 +02:00
1 parent 1d4c953cee
commit c1b3026976
9 files changed
+123 -31

No files matched your search

+3
View File
@@ -6,6 +6,9 @@
// $10000-$17FFF (32KB) - reserved for DOS
// $18000-$18FFF (4KB) - chargen copied to RAM, to allow character redefinition
.const MEMCONF_CHRBASE = $8000
// $19000-$1B7FF (10KB) - reserved for virtual text screen, 80x128
.const MEMCONF_SCRBASE = $9000
+23 -23
View File
@@ -25,10 +25,10 @@ m65_dmagic_oper_fill:
lda #($03 + $08) // operation: FILL + allow interrupts
sta M65_DMAGIC_LIST+6
// Adapt the addresses, go to common part
// Adapt the addresses, launch the job
jsr m65_dmagic_adapt_dst
jmp_8 m65_dmagic_common
jmp_8 m65_dmagic_launch
m65_dmagic_oper_copy:
@@ -43,7 +43,7 @@ m65_dmagic_oper_copy:
lda #($00 + $08) // operation: COPY + allow interrupts
sta M65_DMAGIC_LIST+6
// Adapt the addresses, go to common part
// Adapt the addresses, launch the job
jsr m65_dmagic_adapt_src
jsr m65_dmagic_adapt_dst
@@ -53,26 +53,6 @@ m65_dmagic_oper_copy:
// FALLTROUGH
m65_dmagic_common:
// Set remaining job parameters
// XXX this should be done during switching to MEGA65 native mode
lda #$0A
sta M65_DMAGIC_LIST+0 // <- $0A = use F018A list format (it is shorter by 1 byte)
lda #$80
sta M65_DMAGIC_LIST+1 // <- $80 = next byte is highest 8 bits of source address
inc_a
sta M65_DMAGIC_LIST+3 // <- $81 = next byte is highest 8 bits of destination address
lda #$00
sta M65_DMAGIC_LIST+5 // <- end of options
sta M65_DMAGIC_LIST+15 // <- set modulo to 0
sta M65_DMAGIC_LIST+16
// FALLTROUGH
m65_dmagic_launch:
// Launch the DMA list
@@ -137,3 +117,23 @@ m65_dmagic_adapt_dst:
sta M65_DMAJOB_DST_2
rts
m65_dmagic_init:
// Set common job parameters
lda #$0A
sta M65_DMAGIC_LIST+0 // <- $0A = use F018A list format (it is shorter by 1 byte)
lda #$80
sta M65_DMAGIC_LIST+1 // <- $80 = next byte is highest 8 bits of source address
inc_a
sta M65_DMAGIC_LIST+3 // <- $81 = next byte is highest 8 bits of destination address
lda #$00
sta M65_DMAGIC_LIST+5 // <- end of options
sta M65_DMAGIC_LIST+15 // <- set modulo to 0
sta M65_DMAGIC_LIST+16
rts
@@ -0,0 +1,42 @@
// #LAYOUT# M65 KERNAL_1 #TAKE
// #LAYOUT# * * #IGNORE
m65_native_meminit:
// Prepare generic DMAgic list
jsr m65_dmagic_init
// Copy MEGA65 charset to target location - set size
lda #$00
sta M65_DMAJOB_SIZE_0
lda #$10
sta M65_DMAJOB_SIZE_1
// Set destination
lda #$00
sta M65_DMAJOB_DST_3
lda #$01
sta M65_DMAJOB_DST_2
lda #>MEMCONF_CHRBASE
sta M65_DMAJOB_DST_1
lda #<MEMCONF_CHRBASE
sta M65_DMAJOB_DST_0
// Set source
lda #$00
sta M65_DMAJOB_SRC_3
lda #$02
sta M65_DMAJOB_SRC_2
lda #$D0
sta M65_DMAJOB_SRC_1
lda #$00
sta M65_DMAJOB_SRC_0
// Launch the DMA job
jmp m65_dmagic_oper_copy
-2
View File
@@ -22,6 +22,4 @@ viciv_init:
lda #%01000000 // enable C65 character set
sta VIC_CTRLA
// XXX enable 48 MHz mode in VIC_CTRLC
rts
+4
View File
@@ -61,6 +61,10 @@ m65_mode65:
jsr vicii_init
jsr viciv_init
// Initialize various memory structures
jsr m65_native_meminit
// Set screen mode to 80x50
lda #$02
+25 -1
View File
@@ -74,12 +74,36 @@ scnkey_toggle_if_needed: // entry for SCNKEY (TWW/CTR version)
lda LSTSHF
and #$03
cmp #$03
beq !+ // alreeady toggled
beq !+ // already toggled
// Toggle char set
#if ROM_LAYOUT_M65
jsr M65_MODEGET
bcc !++
// Toggling charsets for C64 mode
lda VIC_YMCSB
eor #$02
sta VIC_YMCSB
!:
rts
// Toggling charsets for M65 mode
!:
lda VIC_CHARPTR+1
eor #%00001000
sta VIC_CHARPTR+1
rts
#else
lda VIC_YMCSB
eor #$02
sta VIC_YMCSB
!:
rts
#endif
@@ -92,10 +92,5 @@ m65_chrout_screen_TAB_SET_CLR:
m65_chrout_screen_ESC:
nop
m65_chrout_screen_BELL:
nop
m65_chrout_screen_GFX:
nop
m65_chrout_screen_TXT:
nop
jmp m65_chrout_screen_done
@@ -62,6 +62,22 @@ m65_chrout_screen_HOME:
jsr M65_HOME
jmp_8 m65_chrout_screen_ctrl2_end
// Character set switching
m65_chrout_screen_GFX:
lda VIC_CHARPTR+1
ora #%00001000
!:
sta VIC_CHARPTR+1
jmp_8 m65_chrout_screen_ctrl2_end
m65_chrout_screen_TXT:
lda VIC_CHARPTR+1
and #%11110111
jmp_8 !-
// INS key
m65_chrout_screen_INS:
+10
View File
@@ -87,6 +87,16 @@ m65_scrmodeset_internal: // entry point for M65_MODE65
stx VIC_COLPTR+0
stx VIC_COLPTR+1
// Set the following location:
// - VIC_CHARPTR - for character generator location
lda #<MEMCONF_CHRBASE
sta VIC_CHARPTR+0
lda #>MEMCONF_CHRBASE
sta VIC_CHARPTR+1
lda #$01
sta VIC_CHARPTR+2
// Set the following locations:
// - M65_SCRGUARD, M65_COLGUARD - guards for virtual screen end
// - M65_COLVIEWMAX - guard for viewport start