mirror of
https://github.com/cc65/cc65.git
synced 2025-01-10 19:29:45 +00:00
More banking fixes
git-svn-id: svn://svn.cc65.org/cc65/trunk@1090 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
parent
b6476b82c6
commit
b9b144cf52
@ -70,28 +70,32 @@ Head: .word @Next
|
|||||||
; ------------------------------------------------------------------------
|
; ------------------------------------------------------------------------
|
||||||
; Actual code
|
; Actual code
|
||||||
|
|
||||||
ldx #zpspace-1
|
|
||||||
L1: lda sp,x
|
|
||||||
sta zpsave,x ; save the zero page locations we need
|
|
||||||
dex
|
|
||||||
bpl L1
|
|
||||||
|
|
||||||
; Close open files
|
; Close open files
|
||||||
|
|
||||||
jsr CLRCH
|
jsr CLRCH
|
||||||
|
|
||||||
; Switch to second charset
|
; Switch to the second charset
|
||||||
|
|
||||||
lda #14
|
lda #14
|
||||||
jsr BSOUT
|
jsr BSOUT
|
||||||
|
|
||||||
; Get the current MMU setting and save it. Set new memory config.
|
; Before doing anything else, we have to setup our banking configuration.
|
||||||
|
; Otherwise just the lowest 16K are actually RAM. Writing through the ROM
|
||||||
|
; to the underlying RAM works, but it is bad style.
|
||||||
|
|
||||||
lda MMU_CR ; Get current memory configuration...
|
lda MMU_CR ; Get current memory configuration...
|
||||||
pha ; ...and save it for later
|
pha ; ...and save it for later
|
||||||
lda #CC65_MMU_CFG ; Bank0 with kernal ROM
|
lda #CC65_MMU_CFG ; Bank0 with kernal ROM
|
||||||
sta MMU_CR
|
sta MMU_CR
|
||||||
|
|
||||||
|
; Save the zero page locations we need
|
||||||
|
|
||||||
|
ldx #zpspace-1
|
||||||
|
L1: lda sp,x
|
||||||
|
sta zpsave,x
|
||||||
|
dex
|
||||||
|
bpl L1
|
||||||
|
|
||||||
; Clear the BSS data
|
; Clear the BSS data
|
||||||
|
|
||||||
jsr zerobss
|
jsr zerobss
|
||||||
@ -102,7 +106,7 @@ L1: lda sp,x
|
|||||||
sta mmusave
|
sta mmusave
|
||||||
|
|
||||||
tsx
|
tsx
|
||||||
stx spsave ; save system stk ptr
|
stx spsave ; Save the system stack pointer
|
||||||
|
|
||||||
lda #<(__RAM_START__ + __RAM_SIZE__)
|
lda #<(__RAM_START__ + __RAM_SIZE__)
|
||||||
sta sp
|
sta sp
|
||||||
@ -159,12 +163,10 @@ NoIRQ2: jsr donelib
|
|||||||
|
|
||||||
jsr doneconio
|
jsr doneconio
|
||||||
|
|
||||||
; Reset stack and the MMU
|
; Reset the stack
|
||||||
|
|
||||||
ldx spsave
|
ldx spsave
|
||||||
txs
|
txs
|
||||||
lda mmusave
|
|
||||||
sta MMU_CR
|
|
||||||
|
|
||||||
; Copy back the zero page stuff
|
; Copy back the zero page stuff
|
||||||
|
|
||||||
@ -174,7 +176,12 @@ L2: lda zpsave,x
|
|||||||
dex
|
dex
|
||||||
bpl L2
|
bpl L2
|
||||||
|
|
||||||
; Done
|
; Reset the memory configuration
|
||||||
|
|
||||||
|
lda mmusave
|
||||||
|
sta MMU_CR
|
||||||
|
|
||||||
|
; Done, restore kernal vectors in an attempt to cleanup
|
||||||
|
|
||||||
jmp RESTOR
|
jmp RESTOR
|
||||||
|
|
||||||
@ -192,10 +199,10 @@ L2: lda zpsave,x
|
|||||||
; they have to go here.
|
; they have to go here.
|
||||||
|
|
||||||
IRQStub:
|
IRQStub:
|
||||||
cld ; Just to be sure
|
cld ; Just to be sure
|
||||||
lda MMU_CR ; Get old register value
|
lda MMU_CR ; Get old register value
|
||||||
pha ; And save on stack
|
pha ; And save on stack
|
||||||
lda #CC65_MMU_CFG ; Bank 0 with kernal ROM
|
lda #CC65_MMU_CFG ; Bank 0 with kernal ROM
|
||||||
sta MMU_CR
|
sta MMU_CR
|
||||||
ldy #<(__IRQFUNC_COUNT__*2)
|
ldy #<(__IRQFUNC_COUNT__*2)
|
||||||
lda #<__IRQFUNC_TABLE__
|
lda #<__IRQFUNC_TABLE__
|
||||||
|
Loading…
x
Reference in New Issue
Block a user