;
INSTALL:
- sei
ldx #0
stx ptr1
ldx #$80
stx STAVEC
ldy #0
ldx #MMU_CFG_EXT_FROM
+ sei
jsr FETCH
tax
inx
txa
sta tmp1
ldx #MMU_CFG_EXT_FROM
+ sei
jsr STASH
ldx #MMU_CFG_EXT_FROM
jsr FETCH
+ cli
cmp tmp1
beq @ram_present
lda #<EM_ERR_NO_DEVICE
ldx #>EM_ERR_NO_DEVICE
- cli
rts
@ram_present:
stx curpage+1 ; Invalidate the current page
inx
txa ; A = X = EM_ERR_OK
- cli
; rts ; Run into UNINSTALL instead
; ------------------------------------------------------------------------
; by the driver.
;
-MAP: sei
- sta curpage
+MAP: sta curpage
stx curpage+1 ; Remember the new page
clc
lda #<ptr1
sta FETVEC
+ sei
; Transfer one page
; Return the memory window
+ cli
lda #<window
ldx #>window ; Return the window address
- cli
rts
; ------------------------------------------------------------------------
; ------------------------------------------------------------------------
; COMMIT: Commit changes in the memory window to extended storage.
-COMMIT: sei
- lda curpage ; Get the current page
+COMMIT: lda curpage ; Get the current page
ldx curpage+1
bmi done ; Jump if no page mapped
lda #<ptr1
sta STAVEC
+ sei
; Transfer one page. Y must be zero on entry
jsr STASH
iny
bne @L1
+ cli
; Done
-done: cli
- rts
+done: rts
; ------------------------------------------------------------------------
; COPYFROM: Copy from extended into linear memory. A pointer to a structure
;
COPYFROM:
- sei
sta ptr3
stx ptr3+1 ; Save the passed em_copy pointer
; Copy full pages
ldy #$00
+ sei
@L1: ldx #MMU_CFG_EXT_FROM
jsr FETCH
sta (ptr2),y
iny
dec tmp1
bne @L3
-
; Done
@L4: cli
; The function must not return anything.
;
-COPYTO: sei
- sta ptr3
+COPYTO: sta ptr3
stx ptr3+1 ; Save the passed em_copy pointer
ldy #EM_COPY::OFFS
; Copy full pages
+ sei
ldy #$00
@L1: lda (ptr2),y
ldx #MMU_CFG_EXT_FROM
;
-; Extended memory driver for the C128 Internal Function RAM. Driver works
+; Extended memory driver for the C128 External Function RAM. Driver works
; without problems when statically linked.
;
; Marco van den Heuvel, 2015-11-30
; ------------------------------------------------------------------------
; Header. Includes jump table
- module_header _c128_ifnram_emd
+ module_header _c128_efnram_emd
; Driver signature
;
INSTALL:
- sei
ldx #0
stx ptr1
ldx #$80
stx STAVEC
ldy #0
ldx #MMU_CFG_INT_FROM
+ sei
jsr FETCH
tax
inx
txa
sta tmp1
ldx #MMU_CFG_INT_FROM
+ sei
jsr STASH
ldx #MMU_CFG_INT_FROM
jsr FETCH
+ cli
cmp tmp1
beq @ram_present
lda #<EM_ERR_NO_DEVICE
ldx #>EM_ERR_NO_DEVICE
- cli
rts
@ram_present:
stx curpage+1 ; Invalidate the current page
inx
txa ; A = X = EM_ERR_OK
- cli
; rts ; Run into UNINSTALL instead
; ------------------------------------------------------------------------
; by the driver.
;
-MAP: sei
- sta curpage
+MAP: sta curpage
stx curpage+1 ; Remember the new page
clc
lda #<ptr1
sta FETVEC
+ sei
; Transfer one page
; Return the memory window
+ cli
lda #<window
ldx #>window ; Return the window address
- cli
rts
; ------------------------------------------------------------------------
; ------------------------------------------------------------------------
; COMMIT: Commit changes in the memory window to extended storage.
-COMMIT: sei
- lda curpage ; Get the current page
+COMMIT: lda curpage ; Get the current page
ldx curpage+1
bmi done ; Jump if no page mapped
lda #<ptr1
sta STAVEC
+ sei
; Transfer one page. Y must be zero on entry
jsr STASH
iny
bne @L1
+ cli
; Done
-done: cli
- rts
+done: rts
; ------------------------------------------------------------------------
; COPYFROM: Copy from extended into linear memory. A pointer to a structure
;
COPYFROM:
- sei
sta ptr3
stx ptr3+1 ; Save the passed em_copy pointer
; Copy full pages
ldy #$00
+ sei
@L1: ldx #MMU_CFG_INT_FROM
jsr FETCH
sta (ptr2),y
iny
dec tmp1
bne @L3
-
; Done
@L4: cli
; The function must not return anything.
;
-COPYTO: sei
- sta ptr3
+COPYTO: sta ptr3
stx ptr3+1 ; Save the passed em_copy pointer
ldy #EM_COPY::OFFS
; Copy full pages
+ sei
ldy #$00
@L1: lda (ptr2),y
ldx #MMU_CFG_INT_FROM