v85: switch to vectored interrupts and use some 8085 optimizations
authorAlan Cox <alan@linux.intel.com>
Mon, 18 Feb 2019 00:04:20 +0000 (00:04 +0000)
committerAlan Cox <alan@linux.intel.com>
Mon, 18 Feb 2019 00:04:20 +0000 (00:04 +0000)
Kernel/platform-v85/README
Kernel/platform-v85/config.h
Kernel/platform-v85/kernel.def
Kernel/platform-v85/tricks.s
Kernel/platform-v85/v85.s

index d366d45..be6e7cb 100644 (file)
@@ -2,3 +2,22 @@ This is an emulated platform driver for the V85 virtual 8085. The main goal is
 to see what can be done to improve 8085 over 8080. It also provides a way to test
 the IDE and modern block layer code with ackcc.
 
+TODO
+
+Review fast bank copiers to see what a slower but saner one might look like
+so we can keep interrupts on
+
+Perhaps repeats of:
+
+               lhlx
+               mov a,b
+               out a
+               shlx
+               mov a,c
+               out a
+               inx
+               inx
+
+               pop b
+               dex b
+               jnk loop ...
index 3c869e5..791c293 100644 (file)
@@ -18,6 +18,9 @@
 #define MAX_MAPS       7
 #define MAP_SIZE       0xC000U
 
+/* We are using the RIM/SIM masking for interrupt control not hard di/ei pairs */
+#define CONFIG_SOFT_IRQ
+
 /* Read processes and big I/O direct into process space */
 #define CONFIG_LARGE_IO_DIRECT(x)      1
 
index 4077bba..91b882e 100644 (file)
@@ -9,3 +9,11 @@ PROGBASE                   = 0x0000
 PROGLOAD                   = 0x0100
 
 CONFIG_SWAP                = 1
+
+#define INT_ENTER      mvi a,0x0a ; sim ; ei
+
+#define INT_EXIT       mvi a,0x08 ; di ; sim
+
+#define DI             mvi a,0x0a ; sim
+
+#define EI             mvi a,0x08 ; sim
index 66623cd..11f32f1 100644 (file)
@@ -8,8 +8,9 @@
 .define bankfork
 
 bankfork:
-       sta patch1+1
-       mov a,c
+       di                      ! This nasty hack requires we really block
+       sta patch1+1            ! interrupts. Might be good to go to a cleaner
+       mov a,c                 ! approach on a faster 8085 ?
        sta patch2+1
        lxi h,0
        dad sp
@@ -40,6 +41,7 @@ copy_stack:
 copy_done:
        lxi h,0
        sphl
+       ei
        ret
 
 copier:
index 3a6b96e..3d4b5f1 100644 (file)
@@ -24,6 +24,41 @@ platform_interrupt_all:
 
 .sect .text
 
+!
+!      Vectored interrupt support. We block only the timer interrupt
+!
+.define _di
+
+_di:
+       lxi h,_int_disabled
+       mvi a,0x0A              ! disable timer not serial
+       sim
+       mov a,m
+       mvi m,1
+       mov e,a
+       ret
+
+.define _ei
+
+_ei:
+       xra a
+       sta _int_disabled
+       mvi a,0x08
+       sim
+       ret
+
+.define _irqrestore
+
+_irqrestore:
+       ldsi 2
+       mov a,m
+       sta _int_disabled
+       ora a
+       rnz
+       mvi a,0x08
+       sim
+       ret
+
 .define init_early
 
 init_early:
@@ -59,10 +94,8 @@ _int_disabled:
 
 _program_vectors:
        di
-       pop d
-       pop h
-       push h
-       push d
+       ldsi 2
+       lhlx
        call map_process
        call _program_vectors_u
        call map_kernel_di
@@ -190,11 +223,8 @@ map_restore:
 .define _probe_bank
 
 _probe_bank:
-       pop d
-       pop h
-       push h
-       push d
-       mov a,l
+       ldsi 2
+       ldax d
        call map_process_a
        lxi d,-1
        lxi h,4
@@ -247,10 +277,11 @@ _ttyready:
 .define _acia_poll
 
 !
-!      Call with interrupts off
+!      Call with interrupts on (we may have some masked)
 !
 _acia_poll:
        lxi h,acia_queue+1
+       di
        mov a,m                 ! read pointer
        mov e,a                 ! save it
        dcx h                   ! queue pointer
@@ -263,9 +294,11 @@ _acia_poll:
        mvi d,0
        dad d                   ! plus offset
        mov e,m                 ! return char in DE
+       ei
        mvi d,0
        ret
 empty:
+       ei
        lxi d,0xffff            ! No luck
        ret
 
@@ -318,11 +351,8 @@ acia_queue:
 .define _devide_writeb
 
 _devide_readb:
-       pop h
-       pop d
-       push d
-       push h
-       mov a,e
+       ldsi 2
+       ldax d
        sta .patch1+1
 .patch1:
        in 0
@@ -331,13 +361,11 @@ _devide_readb:
        ret
 
 _devide_writeb:
-       lxi h,2
-       dad sp
-       mov a,m
+       ldsi 2
+       ldax d
        sta .patch2+1
-       inx h
-       inx h
-       mov a,m
+       ldsi 4
+       ldax d
 .patch2:
        out 0
        ret
@@ -347,10 +375,10 @@ _devide_writeb:
 
 _devide_read_data:
        push b
-       lxi h,_blk_op
-       mov e,m
+       lxi d,_blk_op
+       lhlx                    ! Address in HL
+       xchg                    ! Address in DE, struct back in HL
        inx h
-       mov d,m                 ! Address
        inx h
        mov a,m                 ! Mapping type
        cpi 2
@@ -383,10 +411,10 @@ readloop:
 
 _devide_write_data:
        push b
-       lxi h,_blk_op
-       mov e,m
+       lxi d,_blk_op
+       lhlx
+       xchg
        inx h
-       mov d,m
        inx h
        mov a,m
        cpi 2