From d51dd05e0b328d22550353f0cc2cd693048e4d63 Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Sat, 9 Feb 2019 23:17:15 +0000 Subject: [PATCH] v8080: add the compiler helper restarts --- Kernel/platform-v8080/Makefile | 4 +- Kernel/platform-v8080/rst.s | 75 ++++++++++++++++++++++++++++++++++ Kernel/platform-v8080/v8080.s | 5 ++- 3 files changed, 80 insertions(+), 4 deletions(-) create mode 100644 Kernel/platform-v8080/rst.s diff --git a/Kernel/platform-v8080/Makefile b/Kernel/platform-v8080/Makefile index 445cdd26..03641a6b 100644 --- a/Kernel/platform-v8080/Makefile +++ b/Kernel/platform-v8080/Makefile @@ -3,7 +3,7 @@ LIBC=$(LIBPATH)/libc8080.a $(ACK_ROOT)/share/ack/cpm/libem.a CSRCS += devices.c main.c devtty.c devfd.c -ASRCS = crt0.s commonmem.s v8080.s tricks.s end.s +ASRCS = crt0.s commonmem.s v8080.s tricks.s rst.s end.s AOBJS = $(ASRCS:.s=.o) COBJS = $(CSRCS:.c=.o) @@ -30,7 +30,7 @@ bootblock: image: bootblock $(CROSS_LD) -b0:0x0100 -b4:0xE800 -o fuzix.bin crt0.o devices.o main.o \ - commonmem.o tricks.o v8080.o devtty.o \ + commonmem.o tricks.o v8080.o rst.o devtty.o \ ../start.o ../version.o ../lowlevel-8080.o \ ../bankfixed.o ../timer.o ../kdata.o \ ../devio.o ../filesys.o ../process.o ../inode.o ../syscall_fs.o \ diff --git a/Kernel/platform-v8080/rst.s b/Kernel/platform-v8080/rst.s new file mode 100644 index 00000000..28117b28 --- /dev/null +++ b/Kernel/platform-v8080/rst.s @@ -0,0 +1,75 @@ +#include "../kernel-8080.def" + +.sect .common +! +! We need this in common because +! 1. We need to use .rst_init to install the hooks in other banks +! 2. User space also shares these rst handlers (why store them +! repeatedly). That does create an ABI concern but if it becomes a +! problem we just make user apps override +! +.define .rst_init +.rst_init: + mvi a, 0xc3 ! jmp + sta 0x08 + sta 0x10 + sta 0x18 + lxi h, rst1 + shld 0x09 + lxi h, rst2 + shld 0x11 + lxi h, rst3 + shld 0x19 + ret + + ! de = [bc+const1] (remember bc is the frame pointer) +rst1: + pop h + mov a, m + inx h + push h + + mov l, a + ral + sbb a + mov h, a + + dad b + mov e, m + inx h + mov d, m + ret + + ! [bc+const1] = de (remember bc is the frame pointer) +rst2: + pop h + mov a, m + inx h + push h + + mov l, a + ral + sbb a + mov h, a + + dad b + mov m, e + inx h + mov m, d + ret + + ! hl = bc+const1 +rst3: + pop h + mov a, m + inx h + push h + + mov l, a + ral + sbb a + mov h, a + + dad b + ret + \ No newline at end of file diff --git a/Kernel/platform-v8080/v8080.s b/Kernel/platform-v8080/v8080.s index 8b552373..507e544e 100644 --- a/Kernel/platform-v8080/v8080.s +++ b/Kernel/platform-v8080/v8080.s @@ -25,7 +25,8 @@ platform_interrupt_all: .define init_early init_early: - ret + jmp .rst_init + .define init_hardware @@ -72,7 +73,7 @@ _program_vectors_k: shld 0x31 lxi h,nmi_handler shld 0x67 - ret + jmp .rst_init ! ! Memory mapping -- 2.34.1