From 885b74d9b7963514cdf699ea92566ca2496447ca Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Mon, 18 Feb 2019 00:04:20 +0000 Subject: [PATCH] v85: switch to vectored interrupts and use some 8085 optimizations --- Kernel/platform-v85/README | 19 ++++++++ Kernel/platform-v85/config.h | 3 ++ Kernel/platform-v85/kernel.def | 8 ++++ Kernel/platform-v85/tricks.s | 6 ++- Kernel/platform-v85/v85.s | 82 +++++++++++++++++++++++----------- 5 files changed, 89 insertions(+), 29 deletions(-) diff --git a/Kernel/platform-v85/README b/Kernel/platform-v85/README index d366d45f..be6e7cb2 100644 --- a/Kernel/platform-v85/README +++ b/Kernel/platform-v85/README @@ -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 ... diff --git a/Kernel/platform-v85/config.h b/Kernel/platform-v85/config.h index 3c869e5d..791c2938 100644 --- a/Kernel/platform-v85/config.h +++ b/Kernel/platform-v85/config.h @@ -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 diff --git a/Kernel/platform-v85/kernel.def b/Kernel/platform-v85/kernel.def index 4077bba4..91b882e3 100644 --- a/Kernel/platform-v85/kernel.def +++ b/Kernel/platform-v85/kernel.def @@ -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 diff --git a/Kernel/platform-v85/tricks.s b/Kernel/platform-v85/tricks.s index 66623cd0..11f32f1d 100644 --- a/Kernel/platform-v85/tricks.s +++ b/Kernel/platform-v85/tricks.s @@ -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: diff --git a/Kernel/platform-v85/v85.s b/Kernel/platform-v85/v85.s index 3a6b96e2..3d4b5f16 100644 --- a/Kernel/platform-v85/v85.s +++ b/Kernel/platform-v85/v85.s @@ -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 -- 2.34.1