Merge pull request #81 from rikardn/CHRGET

Add MOVCHG, CHRGET and CHRGOT
This commit is contained in:
FeralChild64 authored and GitHub committed 2025-02-10 18:35:13 +01:00
commit 107ecaea81
15 files changed
+133 -3

No files matched your search

+9 -1
View File
@@ -11,7 +11,7 @@ basic_cold_start_internal:
; Setup vectors at $300
ldy #$0B
@1:
@1
lda basic_vector_defaults_1, y
sta IERROR, y
dey
@@ -44,5 +44,13 @@ basic_cold_start_internal:
; Initialize other variables by performing NEW
jsr do_new
!ifdef CONFIG_MEMORY_MODEL_38K {
; Copy CHRGET to the zero page
; This is for maximum C64 compatibility
jsr copy_CHRGET
}
; jump into warm start loop
jmp basic_warm_start
File renamed without changes.
+8 -1
View File
@@ -8,7 +8,13 @@
basic_cold_start:
!ifdef ROM_LAYOUT_STD { ; skip on non-sgtandard ROM layouts - they produce single image nevertheless
!ifdef ROM_LAYOUT_STD { ; skip on non-standard ROM layouts - they produce single image nevertheless
!ifdef CONFIG_MEMORY_MODEL_38K {
; Special version in high memory for the 38K memory layout
jsr revision_check
} else {
; Before doing anything, check if we have a compatible BASIC/KERNAL pair
@@ -23,6 +29,7 @@ basic_cold_start:
@2:
dey
bpl @1
}
}
; Remaining part would not fit here
+39
View File
@@ -0,0 +1,39 @@
;; #LAYOUT# STD * #TAKE
;; #LAYOUT# * BASIC_0 #TAKE
;; #LAYOUT# * * #IGNORE
; init - This is the implementation of the CHARGET and CHARGOT functions
; The basic cold start will copy this into the zero page
; We will only use this for the 38K memory model for maximum C64 compatibility
;
; Input: Nothing
; Output: Nothing
; Clobbers: A, X
;
; See also:
; https://www.c64-wiki.com/wiki/CHRGET
;
!ifdef CONFIG_MEMORY_MODEL_38K {
MOVCHG:
inc TXTPTR
bne @1
inc TXTPTR+1
@1:
lda $0000 ; The address in this instruction will be at TXTPTR in the zero page
beq @2 ; If NULL byte
cmp #$20 ; Is space?
beq MOVCHG
cmp #$30 ; is less than '0'?
bcc @2
cmp #$3A ; '9' + 1 and also ':'
rts
@2:
sec
rts
}
+4
View File
@@ -0,0 +1,4 @@
The MOVCHG function has a well known address and it has been used for different BASIC wedge techniques
https://www.lemon64.com/forum/viewtopic.php?t=47824
https://www.pagetable.com/c64ref/c64mem/
+26
View File
@@ -0,0 +1,26 @@
;; #LAYOUT# STD * #TAKE
;; #LAYOUT# * BASIC_0 #TAKE
;; #LAYOUT# * * #IGNORE
; init - copy CHRGET and CHRGOT from ROM to zero page
; We only use this for the 38K memory model for maximum C64 compatibility
;
; Input: Nothing
; Output: Nothing
; Clobbers: A, Y
;
; See also:
; https://www.c64-wiki.com/wiki/CHRGET
;
!ifdef CONFIG_MEMORY_MODEL_38K {
copy_CHRGET:
ldy #23 ; Last index to copy
@1: lda MOVCHG,Y
sta CHRGET,Y
dey
bpl @1
rts
}
+29
View File
@@ -0,0 +1,29 @@
;; #LAYOUT# STD * #TAKE-HIGH
;; #LAYOUT# * BASIC_0 #TAKE
;; #LAYOUT# * * #IGNORE
;
; A high memory version of the revision check specific to the 38K memory layout
;
!ifdef CONFIG_MEMORY_MODEL_38K {
!ifdef ROM_LAYOUT_STD {
revision_check:
; Before doing anything, check if we have a compatible BASIC/KERNAL pair
ldy #(__rom_revision_basic_end - rom_revision_basic - 1)
@1:
lda rom_revision_basic, y
cmp rom_revision_kernal, y
beq @2
+panic P_ERR_ROM_MISMATCH
@2:
dey
bpl @1
rts
}
}