started work on setting text mode
This commit is contained in:
1 parent
0b9cc2a9ec
commit
333ecf6eba
18 files changed
+247
-79
No files matched your search
@@ -38,6 +38,7 @@ SRCDIR_KERNAL = $(SRCDIR_COMMON) \
|
||||
src/kernal/assets \
|
||||
src/kernal/board_m65 \
|
||||
src/kernal/board_x16 \
|
||||
src/kernal/extapi_m65 \
|
||||
src/kernal/iec \
|
||||
src/kernal/iec_fast \
|
||||
src/kernal/init \
|
||||
@@ -50,6 +51,7 @@ SRCDIR_KERNAL = $(SRCDIR_COMMON) \
|
||||
src/kernal/rom_revision \
|
||||
src/kernal/rs232 \
|
||||
src/kernal/screen \
|
||||
src/kernal/screen_m65 \
|
||||
src/kernal/tape \
|
||||
src/kernal/time
|
||||
|
||||
|
||||
@@ -261,6 +261,13 @@
|
||||
.byte $22, mod(arg, $100), floor(arg / $100)
|
||||
}
|
||||
|
||||
.pseudocommand jsr_ind_x addr
|
||||
{
|
||||
.var arg = addr.getValue()
|
||||
.byte $23, mod(arg, $100), floor(arg / $100)
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
@@ -70,13 +70,6 @@
|
||||
.label VIC_XSCAN = $D02F // C128 only
|
||||
.label VIC_CLKRATE = $D030 // C128 only
|
||||
|
||||
#endif
|
||||
|
||||
#if CONFIG_MB_MEGA_65
|
||||
|
||||
.label VIC_KEY = $D02F
|
||||
.label VIC_XPOS = $D050
|
||||
|
||||
#endif
|
||||
|
||||
// SID registers
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
|
||||
//
|
||||
// Names of hardware registers
|
||||
//
|
||||
// See https://github.com/MEGA65/mega65-core/blob/master/iomap.txt
|
||||
//
|
||||
|
||||
|
||||
#if CONFIG_MB_MEGA_65
|
||||
|
||||
// VIC-IV registers
|
||||
|
||||
.label VIC_KEY = $D02F
|
||||
|
||||
.label VIC_SCFLAGS = $D031
|
||||
|
||||
.label VIC_XPOS = $D050
|
||||
|
||||
.label VIC_SCRNPTR = $D060 // 4 bytes
|
||||
.label VIC_COLPTR = $D064 // 2 bytes
|
||||
|
||||
.label VIC_CHARPTR = $D068 // 3 bytes
|
||||
|
||||
#endif
|
||||
@@ -24,8 +24,15 @@
|
||||
// Pages 4-7 - reused screen memory
|
||||
//
|
||||
|
||||
// $400-$57F -- UNUSED -- reserved for BASIC
|
||||
// $580-$5FF -- UNUSED -- reserved for KERNAL
|
||||
// $400-$57F - reserved for BASIC
|
||||
|
||||
// $400-$57F -- UNUSED -- reserved for BASIC
|
||||
|
||||
// $580-$5FF - reserved for KERNAL
|
||||
|
||||
.label M65_SCRMODE = $580 // 0 = 40x25, 1 = 80x25, 2 = 80x50, (-- NOT IMPLEMENTED -- add $80 for graphics modes)
|
||||
.label M65_SCRTXTBASE = $581 // $581-$584 base address of the screen memory for text modes
|
||||
.label M65_SCRGFXBASE = $585 // $585-$588 -- NOT IMPLEMENTED -- base address of the screen memory for graphics modes
|
||||
// $589-$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 --
|
||||
@@ -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
|
||||
@@ -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 !-
|
||||
@@ -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
|
||||
@@ -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
|
||||
File renamed without changes.
File renamed without changes.
@@ -1,4 +1,4 @@
|
||||
// #LAYOUT# M65 KERNAL_0 #TAKE
|
||||
// #LAYOUT# M65 KERNAL_1 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
|
||||
|
||||
@@ -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
|
||||
File renamed without changes.
@@ -0,0 +1,9 @@
|
||||
// #LAYOUT# M65 KERNAL_1 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
|
||||
|
||||
M65_CLRSCR:
|
||||
|
||||
// XXX impplement this
|
||||
|
||||
rts
|
||||
@@ -0,0 +1,14 @@
|
||||
// #LAYOUT# M65 KERNAL_1 #TAKE
|
||||
// #LAYOUT# * * #IGNORE
|
||||
|
||||
//
|
||||
// Output:
|
||||
// .A - current screen mode
|
||||
//
|
||||
|
||||
|
||||
M65_SCRMODEGET:
|
||||
|
||||
lda M65_SCRMODE
|
||||
|
||||
rts
|
||||
@@ -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
|
||||
Reference in new issue
Block a user