From 6120246a43c18ad456a2c6c9619adb48a5e95d7b Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Thu, 17 May 2018 13:37:05 +0100 Subject: [PATCH] trs80: fix bank94 code With these fixes this code now correctly sizes and manages extended banking --- Kernel/platform-trs80/trs80-bank94.s | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Kernel/platform-trs80/trs80-bank94.s b/Kernel/platform-trs80/trs80-bank94.s index 29f93e85..7fb10a38 100644 --- a/Kernel/platform-trs80/trs80-bank94.s +++ b/Kernel/platform-trs80/trs80-bank94.s @@ -71,7 +71,7 @@ _modout: .db 0x50 ; 80 column, sound enabled, altchars off, detect94: in a,(0x94) cp #0xFF - jr z, nobank94 + jr z, bank94_absent ; ; Seems we have banking extensions present ; @@ -80,6 +80,8 @@ detect94: ; For each bank check the byte selected is A5 and write the bank into ; it. When we see a bank not reporting A5 we have found the wrap. ; + ld a, #0x63 ; map extended memory into low 32K + out (0x84),a ld a, #0xA5 ld bc, #0x1f94 ld hl, #0x80 ; pick somewhere which won't hit us! @@ -97,6 +99,8 @@ scanall: inc b ld (hl), b jr scanall scandone: + ld a,(_opreg) ; restore mapping of kernel + out (0x84),a ld a, b ld (_nbanks), a xor a @@ -109,7 +113,7 @@ scandone: ld l, a ; Report size in HL ld h, b ret -nobank94: +bank94_absent: xor a ld h, a ld l, #128 ; We ought to check/abort on a 64K box ? -- 2.34.1