added way to detect MEGA65 from the BASIC
This commit is contained in:
1 parent
2338bd8a98
commit
a974b4a763
4 files changed
+121
No files matched your search
@@ -103,3 +103,7 @@ Same as `SYS`, but does not switch to C64 compatibility mode.
|
|||||||
### `GO 64`, `GO 65` (MEGA65)
|
### `GO 64`, `GO 65` (MEGA65)
|
||||||
|
|
||||||
Switches machine to C64 compatibility mode or to MEGA65 native mode. Performs `CLR`
|
Switches machine to C64 compatibility mode or to MEGA65 native mode. Performs `CLR`
|
||||||
|
|
||||||
|
### `IF MEGA65 THEN`, `IF MEGA65 GOTO` (MEGA65)
|
||||||
|
|
||||||
|
Special check for running under MEGA65. The `MEGA65` string is not tokenized, therefore it will be listed properly even under original BASIC V2. `MEGA65` is not a variable here - it is still possible to normally use the `ME` variable.
|
||||||
@@ -5,6 +5,13 @@
|
|||||||
|
|
||||||
cmd_if:
|
cmd_if:
|
||||||
|
|
||||||
|
#if ROM_LAYOUT_M65
|
||||||
|
|
||||||
|
jsr helper_if_mega65
|
||||||
|
bcc cmd_if_true
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
// Calculate expression
|
// Calculate expression
|
||||||
|
|
||||||
jsr FRMEVL
|
jsr FRMEVL
|
||||||
@@ -14,6 +21,10 @@ cmd_if:
|
|||||||
lda FAC1_exponent
|
lda FAC1_exponent
|
||||||
beq_16 cmd_rem
|
beq_16 cmd_rem
|
||||||
|
|
||||||
|
// FALLTROUGH
|
||||||
|
|
||||||
|
cmd_if_true:
|
||||||
|
|
||||||
// Condition fulfilled - look for GOTO or THEN
|
// Condition fulfilled - look for GOTO or THEN
|
||||||
|
|
||||||
jsr fetch_character_skip_spaces
|
jsr fetch_character_skip_spaces
|
||||||
|
|||||||
@@ -0,0 +1,52 @@
|
|||||||
|
// #LAYOUT# M65 BASIC_0 #TAKE
|
||||||
|
// #LAYOUT# * * #IGNORE
|
||||||
|
|
||||||
|
#if CONFIG_MEMORY_MODEL_38K
|
||||||
|
|
||||||
|
helper_if_mega65:
|
||||||
|
|
||||||
|
// Injest all spaces
|
||||||
|
|
||||||
|
ldy #$00
|
||||||
|
!:
|
||||||
|
lda (TXTPTR), Y
|
||||||
|
cmp #$20
|
||||||
|
bne !+
|
||||||
|
inw TXTPTR
|
||||||
|
bra !-
|
||||||
|
!:
|
||||||
|
|
||||||
|
// Check for MEGA65 untokenized keyword
|
||||||
|
|
||||||
|
ldy #$05
|
||||||
|
!:
|
||||||
|
lda (TXTPTR), Y
|
||||||
|
cmp str_mega65, Y
|
||||||
|
bne_16 helper_if_mega65_fail
|
||||||
|
dey
|
||||||
|
bpl !-
|
||||||
|
|
||||||
|
// Increment TXTPTR by 6
|
||||||
|
|
||||||
|
clc
|
||||||
|
lda TXTPTR+0
|
||||||
|
adc #$06
|
||||||
|
sta TXTPTR+0
|
||||||
|
bcc !+
|
||||||
|
inc TXTPTR+1
|
||||||
|
!:
|
||||||
|
// Report successful check
|
||||||
|
|
||||||
|
clc
|
||||||
|
rts
|
||||||
|
|
||||||
|
helper_if_mega65_fail:
|
||||||
|
|
||||||
|
sec
|
||||||
|
rts
|
||||||
|
|
||||||
|
str_mega65:
|
||||||
|
|
||||||
|
.byte $4D, $45, $47, $41, $36, $35
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,54 @@
|
|||||||
|
// #LAYOUT# M65 BASIC_0 #TAKE-HIGH
|
||||||
|
// #LAYOUT# * * #IGNORE
|
||||||
|
|
||||||
|
// This has to go $E000 or above - routine below banks out the main BASIC ROM!
|
||||||
|
|
||||||
|
#if CONFIG_MEMORY_MODEL_46K || CONFIG_MEMORY_MODEL_50K
|
||||||
|
|
||||||
|
helper_if_mega65:
|
||||||
|
|
||||||
|
// Unmap BASIC lower ROM
|
||||||
|
|
||||||
|
lda #$26
|
||||||
|
sta CPU_R6510
|
||||||
|
|
||||||
|
// Injest all spaces
|
||||||
|
|
||||||
|
ldy #$00
|
||||||
|
!:
|
||||||
|
lda (TXTPTR), Y
|
||||||
|
cmp #$20
|
||||||
|
bne !+
|
||||||
|
inw TXTPTR
|
||||||
|
bra !-
|
||||||
|
!:
|
||||||
|
|
||||||
|
// Check for MEGA65 untokenized keyword
|
||||||
|
|
||||||
|
ldy #$05
|
||||||
|
!:
|
||||||
|
lda (TXTPTR), Y
|
||||||
|
cmp str_mega65, Y
|
||||||
|
bne_16 remap_BASIC_sec_rts
|
||||||
|
dey
|
||||||
|
bpl !-
|
||||||
|
|
||||||
|
// Increment TXTPTR by 6
|
||||||
|
|
||||||
|
clc
|
||||||
|
lda TXTPTR+0
|
||||||
|
adc #$06
|
||||||
|
sta TXTPTR+0
|
||||||
|
bcc !+
|
||||||
|
inc TXTPTR+1
|
||||||
|
!:
|
||||||
|
// Report successful check
|
||||||
|
|
||||||
|
jmp remap_BASIC_clc_rts
|
||||||
|
|
||||||
|
str_mega65:
|
||||||
|
|
||||||
|
.byte $4D, $45, $47, $41, $36, $35
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
||||||
Reference in new issue
Block a user