From cf9e7856cf5895c18f3094ca53889429e6657d7f Mon Sep 17 00:00:00 2001 From: Marco van den Heuvel Date: Sun, 29 Nov 2015 11:35:25 -0800 Subject: [PATCH 1/3] Removed an 'rts'. --- libsrc/c128/emd/c128-ram.s | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libsrc/c128/emd/c128-ram.s b/libsrc/c128/emd/c128-ram.s index bef0a15ee..ab99d7aa3 100644 --- a/libsrc/c128/emd/c128-ram.s +++ b/libsrc/c128/emd/c128-ram.s @@ -70,7 +70,7 @@ INSTALL: stx curpage+1 ; Invalidate the current page inx txa ; A = X = EM_ERR_OK - rts +; rts ; Run into UNINSTALL instead ; ------------------------------------------------------------------------ ; UNINSTALL routine. Is called before the driver is removed from memory. From 18208f4d2e9ebb582803a8fac77ec97e57944ca5 Mon Sep 17 00:00:00 2001 From: Marco van den Heuvel Date: Sun, 29 Nov 2015 23:04:23 -0800 Subject: [PATCH 2/3] Fixed the c128 ram (bank 1) emd. --- libsrc/c128/emd/c128-ram.s | 23 +++++++++++++++-------- testcode/lib/.gitignore | 2 ++ 2 files changed, 17 insertions(+), 8 deletions(-) create mode 100644 testcode/lib/.gitignore diff --git a/libsrc/c128/emd/c128-ram.s b/libsrc/c128/emd/c128-ram.s index ab99d7aa3..8c958a540 100644 --- a/libsrc/c128/emd/c128-ram.s +++ b/libsrc/c128/emd/c128-ram.s @@ -51,7 +51,7 @@ PAGES = (TOPMEM - BASE) / 256 ; Data. .bss -curpage: .res 1 ; Current page number +curpage: .res 2 ; Current page number window: .res 256 ; Memory "window" @@ -96,7 +96,8 @@ PAGECOUNT: ; by the driver. ; -MAP: sta curpage +MAP: sei + sta curpage stx curpage+1 ; Remember the new page clc @@ -120,6 +121,7 @@ MAP: sta curpage lda #window ; Return the window address + cli rts ; ------------------------------------------------------------------------ @@ -134,7 +136,8 @@ USE: sta curpage ; ------------------------------------------------------------------------ ; COMMIT: Commit changes in the memory window to extended storage. -COMMIT: lda curpage ; Get the current page +COMMIT: sei + lda curpage ; Get the current page ldx curpage+1 bmi done ; Jump if no page mapped @@ -157,7 +160,8 @@ COMMIT: lda curpage ; Get the current page ; Done -done: rts +done: cli + rts ; ------------------------------------------------------------------------ ; COPYFROM: Copy from extended into linear memory. A pointer to a structure @@ -166,6 +170,7 @@ done: rts ; COPYFROM: + sei sta ptr3 stx ptr3+1 ; Save the passed em_copy pointer @@ -223,7 +228,8 @@ COPYFROM: ; Done -@L4: rts +@L4: cli + rts ; ------------------------------------------------------------------------ ; COPYTO: Copy from linear into extended memory. A pointer to a structure @@ -231,7 +237,8 @@ COPYFROM: ; The function must not return anything. ; -COPYTO: sta ptr3 +COPYTO: sei + sta ptr3 stx ptr3+1 ; Save the passed em_copy pointer ldy #EM_COPY::OFFS @@ -288,5 +295,5 @@ COPYTO: sta ptr3 ; Done -@L4: rts - +@L4: cli + rts diff --git a/testcode/lib/.gitignore b/testcode/lib/.gitignore new file mode 100644 index 000000000..9bb8eaa3e --- /dev/null +++ b/testcode/lib/.gitignore @@ -0,0 +1,2 @@ +*.o +em-test-* From 7cd80e7450f3eea7e8a7b7851ba63dec6d9f8f24 Mon Sep 17 00:00:00 2001 From: Marco van den Heuvel Date: Wed, 2 Dec 2015 00:21:55 -0800 Subject: [PATCH 3/3] optimized the sei/cli pairing a bit. --- libsrc/c128/emd/c128-ram.s | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/libsrc/c128/emd/c128-ram.s b/libsrc/c128/emd/c128-ram.s index 8c958a540..3fc52c9cc 100644 --- a/libsrc/c128/emd/c128-ram.s +++ b/libsrc/c128/emd/c128-ram.s @@ -96,8 +96,7 @@ PAGECOUNT: ; by the driver. ; -MAP: sei - sta curpage +MAP: sta curpage stx curpage+1 ; Remember the new page clc @@ -108,6 +107,7 @@ MAP: sei lda #window ; Return the window address - cli rts ; ------------------------------------------------------------------------ @@ -136,8 +136,7 @@ USE: sta curpage ; ------------------------------------------------------------------------ ; 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 @@ -149,6 +148,7 @@ COMMIT: sei lda #