started work on setting text mode

This commit is contained in:
FeralChild64 committed 2020-08-08 15:12:46 +02:00
1 parent 0b9cc2a9ec
commit 333ecf6eba
18 files changed
+247 -79

No files matched your search

@@ -18,6 +18,10 @@
.label VK1__load_tape_turbo = $4000 + 2 * 4
.label VK1__load_tape_auto = $4000 + 2 * 5
.label VK1__tape_head_align = $4000 + 2 * 6
.label VK1__M65_MODE64 = $4000 + 2 * 7
.label VK1__M65_MODE65 = $4000 + 2 * 8
.label VK1__M65_SCRMODEGET = $4000 + 2 * 9
.label VK1__M65_SCRMODESET = $4000 + 2 * 10
#else
@@ -51,4 +55,9 @@
.word $0000
#endif
.word M65_MODE64
.word M65_MODE65
.word M65_SCRMODEGET
.word M65_SCRMODESET
#endif
-63
View File
@@ -1,63 +0,0 @@
// #LAYOUT# M65 KERNAL_0 #TAKE
// #LAYOUT# * * #IGNORE
M65_MODE65:
// Disable interrupts, they might interfere
sei
// Switch CPU speed to fast
jsr M65_FAST
// Set the magic string to mark native mode
lda #$4D // 'M'
sta M65_MAGICSTR+0
lda #$36 // '6'
sta M65_MAGICSTR+1
lda #$35 // '5'
sta M65_MAGICSTR+2
// XXX provide full implementation
// Switch VIC to VIC-IV mode
jsr viciv_unhide
// XXX provide proper implementation below
// Set screen mode to 80 columns
lda $D031
ora #$80
sta $D031
// Set screen RAM base to $15000
lda #$00
sta $D060
sta LDTB1+0
sta $D063
sta LDTB1+3
lda #$50
sta $D061
sta LDTB1+1
lda #$01
sta $D062
sta LDTB1+2
// Set something in screen memory
lda #$01
// STA [],Z
nop
.byte $92
.byte LDTB1
!:
nop
jmp !-
+4 -2
View File
@@ -9,6 +9,9 @@
.label STOP = KERNAL_0.STOP
.label M65_SLOW = KERNAL_0.M65_SLOW
.label M65_FAST = KERNAL_0.M65_FAST
.label hw_entry_reset = KERNAL_0.hw_entry_reset
.label return_from_interrupt = KERNAL_0.return_from_interrupt
@@ -17,7 +20,7 @@
.label setup_irq_timer = KERNAL_0.setup_irq_timer
.label wait_x_bars = KERNAL_0.wait_x_bars
.label viciv_unhide = KERNAL_0.viciv_unhide
#if CONFIG_IEC
@@ -28,7 +31,6 @@
#if CONFIG_TAPE_NORMAL || CONFIG_TAPE_TURBO
.label viciv_unhide = KERNAL_0.viciv_unhide
.label tape_motor_on = KERNAL_0.tape_motor_on
.label tape_motor_off = KERNAL_0.tape_motor_off
@@ -0,0 +1,30 @@
// #LAYOUT# M65 KERNAL_0 #TAKE
// #LAYOUT# * * #IGNORE
//
// ROM routine call redirect for Mega65 API routines
//
M65_MODE64:
jsr map_KERNAL_1
jsr_ind VK1__M65_MODE64
jmp map_NORMAL
M65_MODE65:
jsr map_KERNAL_1
jsr_ind VK1__M65_MODE65
jmp map_NORMAL
M65_SCRMODEGET:
jsr map_KERNAL_1
jsr_ind VK1__M65_SCRMODEGET
jmp map_NORMAL
M65_SCRMODESET:
jsr map_KERNAL_1
jsr_ind VK1__M65_SCRMODESET
jmp map_NORMAL
+4 -4
View File
@@ -8,17 +8,17 @@
//
#if ROM_LAYOUT_M65 || CONFIG_KEYBOARD_C65 || (CONFIG_MB_MEGA_65 && (CONFIG_TAPE_NORMAL || CONFIG_TAPE_TURBO))
#if ROM_LAYOUT_M65 || CONFIG_KEYBOARD_C65
// XXX viciii_unhide for non-Mega65 build?
viciv_unhide:
lda #$A5
lda #$47
sta VIC_KEY
lda #$96
lda #$53
sta VIC_KEY
rts
#endif
@@ -1,4 +1,4 @@
// #LAYOUT# M65 KERNAL_0 #TAKE
// #LAYOUT# M65 KERNAL_1 #TAKE
// #LAYOUT# * * #IGNORE
+35
View File
@@ -0,0 +1,35 @@
// #LAYOUT# M65 KERNAL_1 #TAKE
// #LAYOUT# * * #IGNORE
M65_MODE65:
// Disable interrupts, they might interfere
sei
// Switch CPU speed to fast
jsr M65_FAST
// Set the magic string to mark native mode
lda #$4D // 'M'
sta M65_MAGICSTR+0
lda #$36 // '6'
sta M65_MAGICSTR+1
lda #$35 // '5'
sta M65_MAGICSTR+2
// Switch VIC to VIC-IV mode
jsr viciv_unhide
// Set screen mode to 80x25
lda #$01
jsr m65_scrmodeset_internal
// Clear the screen
jmp M65_CLRSCR
+9
View File
@@ -0,0 +1,9 @@
// #LAYOUT# M65 KERNAL_1 #TAKE
// #LAYOUT# * * #IGNORE
M65_CLRSCR:
// XXX impplement this
rts
+14
View File
@@ -0,0 +1,14 @@
// #LAYOUT# M65 KERNAL_1 #TAKE
// #LAYOUT# * * #IGNORE
//
// Output:
// .A - current screen mode
//
M65_SCRMODEGET:
lda M65_SCRMODE
rts
+99
View File
@@ -0,0 +1,99 @@
// #LAYOUT# M65 KERNAL_1 #TAKE
// #LAYOUT# * * #IGNORE
//
// Input:
// - .A - desired screen mode
//
// Output:
// - Carry set = unsupported screen mode
// - Carry clear = screen mode switched correctly
//
M65_SCRMODESET:
cmp #$03
bcs m65_scrmodeset_rts // branch if unsupported screen mode
// Preserve .X, move desired mode to .X, disable interrupts
phx
sei
// Perform the switch
jsr m65_scrmodeset_internal
// Re-enable interrupts, restore .X
cli
plx
// FALLTROUGH
m65_scrmodeset_rts:
rts
m65_scrmodeset_internal: // entry point for M65_MODE65
// Store desired screen mode
sta M65_SCRMODE
// 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
stx M65_SCRTXTBASE+0
stx VIC_SCRNPTR+3
stx M65_SCRTXTBASE+3
inx
stx VIC_SCRNPTR+2
stx M65_SCRTXTBASE+2
ldx #$06
stx VIC_SCRNPTR+1
stx M65_SCRTXTBASE+1
// Set flags for 40/80 columns and 25/50 rows
asl
tax
lda VIC_SCFLAGS
jsr_ind_x m65_scrmodeset_flagtab
rts
m65_scrmodeset_flagtab:
.word m65_scrmodeset_40x25
.word m65_scrmodeset_80x25
.word m65_scrmodeset_80x50
m65_scrmodeset_40x25:
and #$77
bra !+
m65_scrmodeset_80x25:
and #$F7
ora #$80
skip_2_bytes_trash_nvz
// FALLTROUGH
m65_scrmodeset_80x50:
ora #$88
!:
sta VIC_SCFLAGS
rts