added ZP shadowing for monitor and Z80 CPU emulator
This commit is contained in:
1 parent
6c5a6f6327
commit
18c5bbbafb
7 files changed
+98
-7
No files matched your search
@@ -153,7 +153,7 @@
|
||||
!addr KEYTAB = $F5 ; $F5-$F6 pointer to keyboard lookup table
|
||||
!addr RIBUF = $F7 ; $F7-$F8 -- WIP -- RS-232 receive buffer pointer
|
||||
!addr ROBUF = $F9 ; $F9-$FA -- WIP -- RS-232 send buffer pointer
|
||||
; $FB $FB-$FE -- UNUSED -- free for user software
|
||||
; $FB $FB-$FE -- UNUSED -- free for user software
|
||||
!addr BASZPT = $FF ; -- NOT IMPLEMENTED --
|
||||
|
||||
;
|
||||
|
||||
@@ -20,5 +20,12 @@
|
||||
; (2KB) - color RAM mirror, not useable
|
||||
; $20000-$2FFFF (64KB) - ROM, the essential part
|
||||
; $30000-$4FFFF (64KB) - ROM, additions
|
||||
; $50000-$57FFF (32KB) - reserved for graphics screen
|
||||
; $50000-$57F71 (32KB) - reserved for graphics screen
|
||||
; $57F72-$57FFF - shadow location for BASIC zeropage
|
||||
|
||||
!set MEMCONF_SHADOW_BZP_0 = $72
|
||||
!set MEMCONF_SHADOW_BZP_1 = $7F
|
||||
!set MEMCONF_SHADOW_BZP_2 = $05
|
||||
!set MEMCONF_SHADOW_BZP_3 = $00
|
||||
|
||||
; $58000-... - extended BASIC variables, RAM disk, etc.
|
||||
@@ -26,6 +26,7 @@
|
||||
!addr VK1__M65_CLRSCR = $4000 + 2 * 12
|
||||
!addr VK1__M65_CLRWIN = $4000 + 2 * 13
|
||||
!addr VK1__m65_screen_upd_txtrow_off = $4000 + 2 * 14
|
||||
!addr VK1__m65_shadow_BZP = $4000 + 2 * 15
|
||||
|
||||
} else {
|
||||
|
||||
@@ -60,4 +61,5 @@
|
||||
!word M65_CLRSCR
|
||||
!word M65_CLRWIN
|
||||
!word m65_screen_upd_txtrow_off
|
||||
!word m65_shadow_BZP
|
||||
}
|
||||
@@ -4,7 +4,8 @@
|
||||
|
||||
MONITOR:
|
||||
|
||||
jsr m65_shadow_BZP
|
||||
jsr map_MON_1
|
||||
jmp ($4000)
|
||||
|
||||
; Monitor knows, that it should exit via map_NORMAL
|
||||
; Monitor knows, that it should exit via m65_shadow_BZP
|
||||
@@ -0,0 +1,80 @@
|
||||
;; #LAYOUT# M65 KERNAL_0 #TAKE
|
||||
;; #LAYOUT# M65 KERNAL_1 #TAKE
|
||||
;; #LAYOUT# * * #IGNORE
|
||||
|
||||
; Exchanges BASIC part of the zero page with it's shadow location; tries to destroy as little memory as possible
|
||||
|
||||
|
||||
m65_shadow_BZP:
|
||||
|
||||
!ifdef SEGMENT_M65_KERNAL_0 {
|
||||
|
||||
jsr map_KERNAL_1
|
||||
jsr (VK1__m65_shadow_BZP)
|
||||
jmp map_NORMAL
|
||||
|
||||
} else {
|
||||
|
||||
|
||||
; Preserve CPU status and registers
|
||||
|
||||
php
|
||||
phz
|
||||
pha
|
||||
phx
|
||||
|
||||
; We need a 4-byte pointer on the zero page; let's use the ones starting from FNLEN
|
||||
|
||||
ldx #$03
|
||||
@1:
|
||||
lda FNLEN,x
|
||||
pha
|
||||
dex
|
||||
bpl @1
|
||||
|
||||
; Store the address of the ZP shadow location
|
||||
|
||||
lda #MEMCONF_SHADOW_BZP_0
|
||||
sta FNLEN+0
|
||||
lda #MEMCONF_SHADOW_BZP_1
|
||||
sta FNLEN+1
|
||||
lda #MEMCONF_SHADOW_BZP_2
|
||||
sta FNLEN+2
|
||||
lda #MEMCONF_SHADOW_BZP_3
|
||||
sta FNLEN+3
|
||||
|
||||
; Exchange the ZP content
|
||||
|
||||
ldz #$00
|
||||
ldx #$00
|
||||
@2:
|
||||
lda [FNLEN],z
|
||||
pha
|
||||
lda $02,x
|
||||
sta [FNLEN],z
|
||||
pla
|
||||
sta $02,x
|
||||
inz
|
||||
inx
|
||||
cpx #$8E
|
||||
bne @2
|
||||
|
||||
; Restore FNLEN and further bytes
|
||||
|
||||
ldx #$00
|
||||
@3:
|
||||
pla
|
||||
sta FNLEN,x
|
||||
inx
|
||||
cpx #$04
|
||||
bne @3
|
||||
|
||||
; Restore registers and quit
|
||||
|
||||
plx
|
||||
pla
|
||||
plz
|
||||
plp
|
||||
|
||||
rts
|
||||
}
|
||||
@@ -9,6 +9,7 @@
|
||||
|
||||
;; #ALIAS# map_NORMAL = KERNAL_0.map_NORMAL
|
||||
;; #ALIAS# map_MON_1 = KERNAL_0.map_MON_1
|
||||
;; #ALIAS# m65_shadow_BZP = KERNAL_0.m65_shadow_BZP
|
||||
|
||||
;; #ALIAS# CHRIN = KERNAL_0.proxy_M1_CHRIN
|
||||
;; #ALIAS# CHROUT = KERNAL_0.proxy_M1_CHROUT
|
||||
|
||||
+4
-4
@@ -60,8 +60,8 @@
|
||||
|
||||
!addr MODE_80 = $d7 ; 80 column / 40 volumn flag ; XXX add routine to detect this
|
||||
|
||||
!addr Disk_Status = $40A ; BCD value of status
|
||||
!addr Disk_Msg = $410 ; 40 bytes, disk status as text message ; XXX get rid of this buffer
|
||||
!addr Disk_Status = $40A ; BCD value of status
|
||||
!addr Disk_Msg = $410 ; 40 bytes, disk status as text message ; XXX get rid of this buffer
|
||||
|
||||
|
||||
; *******
|
||||
@@ -109,8 +109,8 @@ Mon_Call
|
||||
|
||||
; set default PC to monitor exit point
|
||||
|
||||
LDA #<map_NORMAL
|
||||
LDX #>map_NORMAL
|
||||
LDA #<m65_shadow_BZP
|
||||
LDX #>m65_shadow_BZP
|
||||
STA PCL
|
||||
STA MON_XVEC
|
||||
STX PCH
|
||||
|
||||
Reference in new issue
Block a user