trs80m1: further selector work
authorAlan Cox <alan@linux.intel.com>
Fri, 6 Jul 2018 00:15:28 +0000 (01:15 +0100)
committerAlan Cox <alan@linux.intel.com>
Fri, 6 Jul 2018 00:15:28 +0000 (01:15 +0100)
Generalize the fork code

Kernel/platform-trs80m1/tricks.s
Kernel/platform-trs80m1/trs80-bank.s

index ecf26e3..4925f25 100644 (file)
@@ -8,6 +8,12 @@
 
        .globl bankfork         ; for debugging
 
+       .globl bankpatch1       ; so the mapping code can patch us
+       .globl bankpatch2
+
+
+       .area _COMMONMEM
+
 ;
 ;      This is related so we will keep it here. Copy the process memory
 ;      for a fork. a is the page base of the parent, c of the child
@@ -16,7 +22,7 @@
 ;      really matters on a 1.77Mhz processor !
 ;
 ;      Interrupts are off so I guess the stack pointer is spare (Watch
-;      out for NMI if we do model 3 this way!)
+;      out for NMI as we do model 3 this way!)
 ;
 bankfork:
        ld (cpatch0 + 1),a      ; patch parent into loop
@@ -38,6 +44,7 @@ copyloop:
        ex af,af'       ; Save A as we need an A for ioports
 cpatch0:
        ld a,#0         ; parent bank (patched in for speed)
+bankpatch1:
        out (0x43),a
        pop bc          ; copy 16 bytes out of parent
        pop de
@@ -51,6 +58,7 @@ cpatch0:
        ld (sp_patch+1),sp
 cpatch1:
        ld a,#0         ; child bank (also patched in for speed)
+bankpatch2:
        out (0x43),a
        push iy         ; and put them back into the child
        push ix
index ad3a10e..542615b 100644 (file)
@@ -26,6 +26,9 @@
            .globl vtbufinit
            .globl _trs80_mapper
 
+           .globl bankpatch1
+           .globl bankpatch2
+
            .globl s__COMMONMEM
            .globl l__COMMONMEM
 
@@ -138,7 +141,12 @@ mapper_init:
            ld (map_bank1),hl
            inc h
            ld (map_bank2),hl
+           ret
 mapper_selector:
+           ; Patch the fast copier for our port numbering
+           ld a,#0x1f
+           ld (bankpatch1 + 1),a
+           ld (bankpatch2 + 1),a
            ret
 
 ;------------------------------------------------------------------------------