More driver cleanup.
git-svn-id: svn://svn.cc65.org/cc65/trunk@4585 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
@@ -38,9 +38,7 @@
|
|||||||
|
|
||||||
BASE = $4000
|
BASE = $4000
|
||||||
PAGES = 3 * 256
|
PAGES = 3 * 256
|
||||||
CHECKC256K = $0200
|
TARGETLOC = $200 ; Target location for copy/check code
|
||||||
TRANSFERC256K = $0200
|
|
||||||
STASHOPCODE = $91
|
|
||||||
pia = $DFC0
|
pia = $DFC0
|
||||||
|
|
||||||
; ------------------------------------------------------------------------
|
; ------------------------------------------------------------------------
|
||||||
@@ -50,11 +48,14 @@ pia = $DFC0
|
|||||||
|
|
||||||
|
|
||||||
; This function is used to copy code from and to the extended memory
|
; This function is used to copy code from and to the extended memory
|
||||||
.proc c256kcopycode
|
.proc copy
|
||||||
.org ::TRANSFERC256K ; Assemble for target location
|
template:
|
||||||
|
.org ::TARGETLOC ; Assemble for target location
|
||||||
|
entry:
|
||||||
stx pia
|
stx pia
|
||||||
::STASHC256K := * ; Location and opcode is patched at runtime
|
stashop = $91 ; 'sta' opcode
|
||||||
::VECC256K := *+1
|
operation := * ; Location and opcode is patched at runtime
|
||||||
|
address := *+1
|
||||||
lda ($00),y
|
lda ($00),y
|
||||||
ldx #$dc
|
ldx #$dc
|
||||||
stx pia
|
stx pia
|
||||||
@@ -63,8 +64,10 @@ pia = $DFC0
|
|||||||
.endproc
|
.endproc
|
||||||
|
|
||||||
; This function is used to check for the existence of the extended memory
|
; This function is used to check for the existence of the extended memory
|
||||||
.proc c256kcheckcode
|
.proc check
|
||||||
.org ::CHECKC256K
|
template:
|
||||||
|
.org ::TARGETLOC
|
||||||
|
entry:
|
||||||
ldy #$00 ; Assume hardware not present
|
ldy #$00 ; Assume hardware not present
|
||||||
|
|
||||||
lda #$fc
|
lda #$fc
|
||||||
@@ -99,7 +102,7 @@ window: .res 256 ; Memory "window"
|
|||||||
|
|
||||||
; Since the functions above are copied to $200, the current contents of this
|
; Since the functions above are copied to $200, the current contents of this
|
||||||
; memory area must be saved into backup storage. Allocate enough space.
|
; memory area must be saved into backup storage. Allocate enough space.
|
||||||
backup: .res .max (.sizeof (c256kcopycode), .sizeof (c256kcheckcode))
|
backup: .res .max (.sizeof (copy), .sizeof (check))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -144,9 +147,9 @@ INSTALL:
|
|||||||
sty pia+3
|
sty pia+3
|
||||||
|
|
||||||
jsr backup_and_setup_check_routine
|
jsr backup_and_setup_check_routine
|
||||||
jsr CHECKC256K
|
jsr check::entry
|
||||||
cli
|
cli
|
||||||
ldx #.sizeof (c256kcheckcode) - 1
|
ldx #.sizeof (check) - 1
|
||||||
jsr restore_data
|
jsr restore_data
|
||||||
cpy #$01
|
cpy #$01
|
||||||
beq @present
|
beq @present
|
||||||
@@ -196,10 +199,10 @@ MAP:
|
|||||||
sty ptr1
|
sty ptr1
|
||||||
jsr backup_and_setup_copy_routine
|
jsr backup_and_setup_copy_routine
|
||||||
ldx #<ptr1
|
ldx #<ptr1
|
||||||
stx VECC256K
|
stx copy::address
|
||||||
@L1:
|
@L1:
|
||||||
ldx curbank
|
ldx curbank
|
||||||
jsr TRANSFERC256K
|
jsr copy::entry
|
||||||
ldx ptr1
|
ldx ptr1
|
||||||
sta window,x
|
sta window,x
|
||||||
inc ptr1
|
inc ptr1
|
||||||
@@ -239,14 +242,14 @@ COMMIT:
|
|||||||
sty ptr1
|
sty ptr1
|
||||||
jsr backup_and_setup_copy_routine
|
jsr backup_and_setup_copy_routine
|
||||||
ldx #<ptr1
|
ldx #<ptr1
|
||||||
stx VECC256K
|
stx copy::address
|
||||||
ldx #<STASHOPCODE
|
ldx #<copy::stashop
|
||||||
stx STASHC256K
|
stx copy::operation
|
||||||
@L1:
|
@L1:
|
||||||
ldx ptr1
|
ldx ptr1
|
||||||
lda window,x
|
lda window,x
|
||||||
ldx curbank
|
ldx curbank
|
||||||
jsr TRANSFERC256K
|
jsr copy::entry
|
||||||
inc ptr1
|
inc ptr1
|
||||||
bne @L1
|
bne @L1
|
||||||
|
|
||||||
@@ -279,13 +282,13 @@ COPYFROM:
|
|||||||
; - tmp2 contains the bank value
|
; - tmp2 contains the bank value
|
||||||
|
|
||||||
lda #<ptr4
|
lda #<ptr4
|
||||||
sta VECC256K
|
sta copy::address
|
||||||
jmp @L3
|
jmp @L3
|
||||||
|
|
||||||
@L1:
|
@L1:
|
||||||
ldx tmp2
|
ldx tmp2
|
||||||
ldy #0
|
ldy #0
|
||||||
jsr TRANSFERC256K
|
jsr copy::entry
|
||||||
ldy tmp1
|
ldy tmp1
|
||||||
sta (ptr2),y
|
sta (ptr2),y
|
||||||
inc tmp1
|
inc tmp1
|
||||||
@@ -342,9 +345,9 @@ COPYTO:
|
|||||||
; - tmp2 contains the bank value
|
; - tmp2 contains the bank value
|
||||||
|
|
||||||
lda #<ptr4
|
lda #<ptr4
|
||||||
sta VECC256K
|
sta copy::address
|
||||||
lda #<STASHOPCODE
|
lda #<copy::stashop
|
||||||
sta STASHC256K
|
sta copy::operation
|
||||||
jmp @L3
|
jmp @L3
|
||||||
|
|
||||||
@L1:
|
@L1:
|
||||||
@@ -352,7 +355,7 @@ COPYTO:
|
|||||||
lda (ptr2),y
|
lda (ptr2),y
|
||||||
ldx tmp2
|
ldx tmp2
|
||||||
ldy #0
|
ldy #0
|
||||||
jsr TRANSFERC256K
|
jsr copy::entry
|
||||||
inc tmp1
|
inc tmp1
|
||||||
bne @L2
|
bne @L2
|
||||||
inc ptr2+1
|
inc ptr2+1
|
||||||
@@ -444,32 +447,32 @@ setup:
|
|||||||
; Helper routines for copying to and from the +256k ram
|
; Helper routines for copying to and from the +256k ram
|
||||||
|
|
||||||
backup_and_setup_copy_routine:
|
backup_and_setup_copy_routine:
|
||||||
ldx #.sizeof (c256kcopycode) - 1
|
ldx #.sizeof (copy) - 1
|
||||||
@L1:
|
@L1:
|
||||||
lda TRANSFERC256K,x
|
lda copy::entry,x
|
||||||
sta backup,x
|
sta backup,x
|
||||||
lda c256kcopycode,x
|
lda copy::template,x
|
||||||
sta TRANSFERC256K,x
|
sta copy::entry,x
|
||||||
dex
|
dex
|
||||||
bpl @L1
|
bpl @L1
|
||||||
rts
|
rts
|
||||||
|
|
||||||
backup_and_setup_check_routine:
|
backup_and_setup_check_routine:
|
||||||
ldx #.sizeof (c256kcheckcode) - 1
|
ldx #.sizeof (check) - 1
|
||||||
@L1:
|
@L1:
|
||||||
lda CHECKC256K,x
|
lda check::entry,x
|
||||||
sta backup,x
|
sta backup,x
|
||||||
lda c256kcheckcode,x
|
lda check::template,x
|
||||||
sta CHECKC256K,x
|
sta check::entry,x
|
||||||
dex
|
dex
|
||||||
bpl @L1
|
bpl @L1
|
||||||
rts
|
rts
|
||||||
|
|
||||||
restore_copy_routine:
|
restore_copy_routine:
|
||||||
ldx #.sizeof (c256kcopycode) - 1
|
ldx #.sizeof (copy) - 1
|
||||||
restore_data:
|
restore_data:
|
||||||
lda backup,x
|
lda backup,x
|
||||||
sta CHECKC256K,x
|
sta TARGETLOC,x
|
||||||
dex
|
dex
|
||||||
bpl restore_data
|
bpl restore_data
|
||||||
rts
|
rts
|
||||||
|
|||||||
Reference in New Issue
Block a user