Add MOVCHG (CHRGET + CHRGOT) and call from cold start
This commit is contained in:
1 parent
47a7a1c47a
commit
1cb54b58c4
13 files changed
+133
-3
No files matched your search
@@ -299,6 +299,7 @@ Not all of them - only these we want to have implemented.
|
||||
| `$AB1E` | `STROUT` | DONE | |
|
||||
| `$AD9E` | `FRMEVL` | PARTIAL | |
|
||||
| `$BDCD` | `LINPRT` | DONE | temporary implementation |
|
||||
| `$E3A2` | `MOVCHG` | DONE | memory model 38K only |
|
||||
| `$E3BF` | `INIT` | NOT DONE | |
|
||||
| `$E422` | `INITMSG` | DONE | |
|
||||
| `$E453` | `RVECT` | NOT DONE | |
|
||||
|
||||
@@ -74,7 +74,8 @@
|
||||
!addr ARISGN = $6F ; -- NOT IMPLEMENTED --
|
||||
!addr FACOV = $70 ; FAC1 low order mantissa
|
||||
!addr FBUFPT = $71 ; $71-$72 -- NOT IMPLEMENTED --
|
||||
!addr CHRGET = $73 ; $73-$8A -- NOT IMPLEMENTED --
|
||||
!addr CHRGET = $73 ; $73-$8A copied from $E3A2 during cold start
|
||||
!addr CHRGOT = $79 ; same area as CHRGET
|
||||
!addr TXTPTR = $7A ; $7A-$7B current BASIC statement pointer
|
||||
!addr RNDX = $8B ; $8B-$8F random number seed
|
||||
|
||||
|
||||
@@ -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
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
}
|
||||
@@ -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/
|
||||
@@ -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
|
||||
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fragment + BNE 03 + JMP fragment
|
||||
|
||||
Fragments of a long conditional jump - trivial
|
||||
@@ -0,0 +1,3 @@
|
||||
$7A + BNE 2 + INC $7B + LDA(abs)
|
||||
|
||||
Fragment of common code to increment a 16-bit pointer, trivial and non-copyrightable
|
||||
@@ -0,0 +1,3 @@
|
||||
$E394 + $E37B Address of basic cold start and address of basic warm start
|
||||
|
||||
Addresses to well known functions. Trivial.
|
||||
@@ -0,0 +1,3 @@
|
||||
LDY #0 + BCC $14 + RTS
|
||||
|
||||
Fragment of special case termination of subroutine. Trivial
|
||||
@@ -0,0 +1,3 @@
|
||||
DEX + BPL back + RTS
|
||||
|
||||
Loop fragment. Not copyrightable.
|
||||
Reference in new issue
Block a user