trs80m1: wire up all the model 3 floppy support (untested)
authorAlan Cox <alan@linux.intel.com>
Sun, 10 Jun 2018 20:11:35 +0000 (21:11 +0100)
committerAlan Cox <alan@linux.intel.com>
Sun, 10 Jun 2018 20:11:35 +0000 (21:11 +0100)
Kernel/platform-trs80m1/Makefile
Kernel/platform-trs80m1/devices.c
Kernel/platform-trs80m1/discard.c
Kernel/platform-trs80m1/fuzix.lnk
Kernel/platform-trs80m1/main.c
Kernel/platform-trs80m1/trs80.s

index eac430f..f851722 100644 (file)
@@ -1,10 +1,10 @@
 
-CSRCS = devlpr.c devtty.c devfd.c devhd.c devgfx.c
+CSRCS = devlpr.c devtty.c devfd.c devfd3.c devhd.c devgfx.c
 CSRCS += devices.c main.c
 DISCARD_CSRCS = discard.c devhd_discard.c
 
 ASRCS = trs80.s trs80-bank.s crt0.s
-ASRCS += tricks.s commonmem.s floppy.s
+ASRCS += tricks.s commonmem.s floppy.s floppy3.s
 
 COBJS = $(CSRCS:.c=.rel)
 AOBJS = $(ASRCS:.s=.rel)
index 0f13813..99ed5bc 100644 (file)
@@ -10,6 +10,8 @@
 #include <vt.h>
 #include <devtty.h>
 #include <devgfx.h>
+#include <devfd3.h>
+#include <trs80.h>
 
 struct devsw dev_tab[] =  /* The device driver switch table */
 {
@@ -35,3 +37,11 @@ bool validdev(uint16_t dev)
         return true;
 }
 
+void floppy_setup(void)
+{
+  if (trs80_model == TRS80_MODEL3) {
+    dev_tab[1].dev_open = fd3_open;
+    dev_tab[1].dev_read = fd3_read;
+    dev_tab[1].dev_write = fd3_write;
+  }
+}
index f4415ce..2861247 100644 (file)
@@ -10,6 +10,7 @@ void device_init(void)
   /* Time of day clock */
   inittod();
 #endif
+  floppy_setup();
   hd_probe();
 }
 
index ecd6538..666b038 100644 (file)
@@ -21,7 +21,9 @@ platform-trs80m1/main.rel
 timer.rel
 kdata.rel
 platform-trs80m1/devfd.rel
+platform-trs80m1/devfd3.rel
 platform-trs80m1/floppy.rel
+platform-trs80m1/floppy3.rel
 platform-trs80m1/devhd.rel
 platform-trs80m1/devhd_discard.rel
 platform-trs80m1/devgfx.rel
index 95877c5..647c1ec 100644 (file)
@@ -3,6 +3,7 @@
 #include <kdata.h>
 #include <printf.h>
 #include <devtty.h>
+#include <trs80.h>
 
 uint16_t ramtop = PROGTOP;
 uint8_t trs80_model;
@@ -43,7 +44,7 @@ __sfr __at 0xEC irqack3;
 void platform_interrupt(void)
 {
   uint8_t dummy;
-  if (trs_model != TRS80_MODEL3) {
+  if (trs80_model != TRS80_MODEL3) {
     uint8_t irq = *((volatile uint8_t *)0x37E0);
 
     tty_interrupt();
@@ -64,7 +65,7 @@ void platform_interrupt(void)
     if (irq & 0x70)
       tty_interrupt();
     /* We don't handle IOBUS */
-    if (irq & 0x04)
+    if (irq & 0x04) {
       kbd_interrupt();
       timer_interrupt();
       dummy = irqack3;
index 6036b0d..e95b6f9 100644 (file)
@@ -47,6 +47,7 @@
             .globl unix_syscall_entry
             .globl outcharhex
            .globl null_handler
+           .globl fd_nmi_handler
 
 
             .include "kernel.def"
@@ -85,7 +86,7 @@ _platform_reboot:
 init_early:
            ld a,(4)
            cp #0x30
-           jr z, not_m3
+           jr nz, not_m3
            ld a,#1
            ld (_trs80_model),a
            ld a,#0x74
@@ -161,6 +162,9 @@ _rom_vectors:
             ld hl, #unix_syscall_entry
             ld (0x4010), hl
 
+           ; Model III only but just writing it does no harm
+           ld hl,#fd_nmi_handler
+           ld (0x4049), hl
            jp map_kernel
            
 ; outchar: Wait for UART TX idle, then print the char in A