implemented 'GO' BASIC command, started work on native MEGA65 mode

This commit is contained in:
FeralChild64 committed 2020-08-07 22:03:31 +02:00
1 parent 6eb78f9bb4
commit b235db4cd0
7 files changed
+238 -19

No files matched your search

+31
View File
@@ -0,0 +1,31 @@
// #LAYOUT# M65 * #TAKE
// #LAYOUT# * * #IGNORE
//
// Names of ZP and low memory locations for the native Mega65 mode
//
//
// Page 0 - reused LDTB1
//
// $D9 -- UNUSED --
.label M65_LPNT_BAS1 = $DA // $DA-$DD 4-byte pointer for temporary usage within BASIC
.label M65_LPNT_BAS2 = $DE // $DE-$E1 4-byte pointer for temporary usage within BASIC
.label M65_LPNT_SCR = $E2 // $E2-$E5 4-byte pointer for temporary usage within BASIC and screen editor
// E6 reserved for BASIC error handling routines, also in native mode
.label M65_MAGICSTR = $E7 // $E7-$E9 if equals 'M65' it means we are in native mode
.label M65_LPNT_IRQ = $EA // $EA-$ED 4-byte pointer for temporary usage within interrupts
.label M65_LPNT_KERN = $EE // $EE-$F1 4-byte pointer for temporary usage by KERNAL
// $F2 -- UNUSED --
//
// Pages 4-7 - reused screen memory
//
// $400-$57F -- UNUSED -- reserved for BASIC
// $580-$5FF -- UNUSED -- reserved for KERNAL
.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 --
+8
View File
@@ -51,3 +51,11 @@
#endif
.label filename_any = KERNAL().filename_any
#if ROM_LAYOUT_M65
.label M65_JMODE64 = KERNAL().M65_JMODE64
.label M65_JMODE65 = KERNAL().M65_JMODE65
.label M65_JISMODE65 = KERNAL().M65_JISMODE65
.label M65_JSLOW = KERNAL().M65_JSLOW
.label M65_JFAST = KERNAL().M65_JFAST
#endif
@@ -51,8 +51,6 @@ cmd_tab:
nop
cmd_spc:
nop
cmd_go:
nop
// Unimplemented tokens
@@ -3,6 +3,61 @@
// #LAYOUT# * * #IGNORE
cmd_go:
jsr fetch_character_skip_spaces
cmp #$A4 // 'TO' keyword
beq cmd_goto
#if !ROM_LAYOUT_M65
// FALLTROUGH
cmd_go_syntax_error:
jmp do_SYNTAX_error
#else
dew TXTPTR // unconsume character
// Fetch mode
jsr fetch_uint8
cmp #64
bne !+
// If in native mode - switch to C64 compatibilty
jsr M65_JISMODE65
bne cmd_go_rts
jsr helper_ask_if_sure
bcs cmd_go_rts
jmp M65_JMODE64
!:
cmp #65
bne !+
// If in C64 compatibility mode - switch to native mode
jsr M65_JISMODE65
beq cmd_go_rts
jsr helper_ask_if_sure
bcs cmd_go_rts
jmp M65_JMODE65
!:
jmp do_ILLEGAL_QUANTITY_error
cmd_go_rts:
rts
#endif
cmd_run:
// RUN clears all variables
@@ -27,7 +82,11 @@ cmd_goto:
// GOTO requires line number
jsr fetch_line_number
#if !ROM_LAYOUT_M65
bcs cmd_go_syntax_error
#else
bcs_16 do_SYNTAX_error
#endif
// Check for direct mode
@@ -9,8 +9,18 @@
.const command_01_list = List().add(
#if CONFIG_MB_MEGA_65
M65_JSLOW,
M65_JFAST,
#else
cmd_slow,
cmd_fast,
#endif
cmd_old,
// NOTE! These commands are temporarily placed here, they should be a part of list 02!
+1 -17
View File
@@ -5,23 +5,7 @@
#if CONFIG_MB_MEGA_65
// Command implementation for Mega65
// XXX - I think there are some bit-set instructions in 65CE02...
cmd_slow:
lda #$40
skip_2_bytes_trash_nvz
// FALLTROUGH
cmd_fast:
lda #$41
sta CPU_D6510
rts
// For Mega65 Kernal routines are called directly
#elif CONFIG_MB_ULTIMATE_64
+129
View File
@@ -0,0 +1,129 @@
// #LAYOUT# M65 KERNAL_0 #TAKE
// #LAYOUT# * * #IGNORE
//
// Not this is not an official Kernal API extension (yet)! It is subject to change!
//
M65_JMODE64:
// Disable interrupts, they might interfere
sei
// XXX provide full implementation
// Set the magic string to mark legacy mode
lda #$00
sta M65_MAGICSTR+0
sta M65_MAGICSTR+1
sta M65_MAGICSTR+2
// Reenable interrupts
cli
// Switch CPU speed back to slow and quit
jmp M65_JSLOW
M65_JMODE65:
// Disable interrupts, they might interfere
sei
// Swithc CPU speed to fast
jsr M65_JFAST
// 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
lda #$47
sta VIC_KEY
lda #$53
sta VIC_KEY
// XXX provide proper implementation
// 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 !-
M65_JISMODE65: // checks if mode is native M65 one, BEQ = jump if native mode
pha
lda M65_MAGICSTR+0
cmp #$4D // 'M'
bne !+
lda M65_MAGICSTR+1
cmp #$36 // '6'
bne !+
lda M65_MAGICSTR+2
cmp #$35 // '5'
!:
pla
rts
M65_JSLOW: // set CPU speed to 1 MHz
lda #$40
skip_2_bytes_trash_nvz
// FALLTROUGH
M65_JFAST: // set CPU speed to 40 MHz
lda #$41
sta CPU_D6510
rts