From 19c6e94a13ce5f138aa529f3e62de002f2bfaf7f Mon Sep 17 00:00:00 2001 From: Neal Andrew Crook Date: Sat, 11 Jun 2016 19:39:57 +0100 Subject: [PATCH] Bring drivewire.s changes across from coco3. Comment out drivewire poll call here because I've not made any of the other changes needed for drivewire support yet. Corrections to some code comments. --- Kernel/platform-multicomp09/devtty.c | 2 +- Kernel/platform-multicomp09/drivewire.s | 16 ++++++++++------ Kernel/platform-multicomp09/multicomp09.s | 20 ++++++++++---------- Kernel/platform-multicomp09/tricks.s | 2 +- 4 files changed, 22 insertions(+), 18 deletions(-) diff --git a/Kernel/platform-multicomp09/devtty.c b/Kernel/platform-multicomp09/devtty.c index 73ee51b7..a0d3a075 100644 --- a/Kernel/platform-multicomp09/devtty.c +++ b/Kernel/platform-multicomp09/devtty.c @@ -188,7 +188,7 @@ void platform_interrupt(void) timer_interrupt(); } - dw_vpoll(); + // dw_vpoll(); } diff --git a/Kernel/platform-multicomp09/drivewire.s b/Kernel/platform-multicomp09/drivewire.s index 8582fc76..214d4686 100644 --- a/Kernel/platform-multicomp09/drivewire.s +++ b/Kernel/platform-multicomp09/drivewire.s @@ -53,9 +53,11 @@ _dw_reset: _dw_operation: pshs y + ldd 6,x ; test for kernel/usr mapping + beq kern@ ; is zero, so must be a kernel xfer. + jsr map_process_always ; get parameters from C, X points to cmd packet - ldy 4,s ; driveptr - lda ,y ; for now, contains minor = drive number directly +kern@ lda 5,x ; minor = drive number ldb ,x ; write flag ; buffer location into Y ldy 3,x @@ -69,7 +71,8 @@ _dw_operation: @done bcs @err bne @err ldx #0 -@ret puls y,pc +@ret jsr map_kernel + puls y,pc @err ldx #0xFFFF bra @ret @@ -127,9 +130,9 @@ ReRead pshs a ldy #$0005 lbsr DWWrite puls a - ldx 4,s get read buffer pointer - ldy #256 read 256 bytes - ldd #133*1 1 second timeout + ldx 4,s ; get read buffer pointer + ldy #256 ; read 256 bytes + ldd #133*1 ; 1 second timeout bsr DWRead bcs ReadEx bne ReadEx @@ -167,6 +170,7 @@ JMCPBCK equ 0 BAUD38400 equ 0 ; These files are copied almost as-is from HDB-DOS + *PRAGMA nonewsource include "dw.def" include "dwread.s" include "dwwrite.s" diff --git a/Kernel/platform-multicomp09/multicomp09.s b/Kernel/platform-multicomp09/multicomp09.s index a49d295f..6852099d 100644 --- a/Kernel/platform-multicomp09/multicomp09.s +++ b/Kernel/platform-multicomp09/multicomp09.s @@ -242,7 +242,7 @@ init_hardware: ;; set up the map1 registers (MAPSEL=8..f) to use pages 0-7 ;; ..to match the pre-existing setup of map0. ;; _krn_mmu_map is set up with the required values. - ;; while doing this, were careful to keep MMUADR_MAP1 *clear* because we are using + ;; while doing this, keep TR=0 because we are using ;; map0 and don't want to switch the map yet. lda #(MMU_MAP0|8) ; stay in map0, select 1st mapping register for map1 ldx #MMUADR @@ -281,8 +281,8 @@ gomap1: lda #MMU_MAP1 atmap1: - ;; Multicomp09 has RAM up at the hardware vector positions - ;; so we can write the addresses directly, 2 bytes per vector; + ;; Multicomp09 has RAM at the hardware vector positions + ;; so we can write the addresses directly; 2 bytes per vector: ;; no need for a jump op-code. ldx #0xfff2 ; address of SWI3 vector ldy #badswi_handler @@ -412,25 +412,25 @@ map_process_2: ldx #MMUADR ldb ,y+ ; page from usr_mmu_map - std ,x ; Write A to MMUADR to set MAPSEL=8, then write B to MMUDAT + std ,x ; Write A to MMUADR to set MAPSEL=0, then write B to MMUDAT inca ; next mapsel ldb ,y+ ; next page from usr_mmu_map - std ,x ; Write A to MMUADR to set MAPSEL=9, then write B to MMUDAT + std ,x ; Write A to MMUADR to set MAPSEL=1, then write B to MMUDAT inca ; next mapsel ldb ,y+ ; next page from usr_mmu_map - std ,x ; Write A to MMUADR to set MAPSEL=a, then write B to MMUDAT + std ,x ; Write A to MMUADR to set MAPSEL=2, then write B to MMUDAT inca ; next mapsel ldb ,y+ ; next page from usr_mmu_map - std ,x ; Write A to MMUADR to set MAPSEL=b, then write B to MMUDAT + std ,x ; Write A to MMUADR to set MAPSEL=3, then write B to MMUDAT inca ; next mapsel ldb ,y+ ; next page from usr_mmu_map - std ,x ; Write A to MMUADR to set MAPSEL=c, then write B to MMUDAT + std ,x ; Write A to MMUADR to set MAPSEL=4, then write B to MMUDAT inca ; next mapsel ldb ,y+ ; next page from usr_mmu_map - std ,x ; Write A to MMUADR to set MAPSEL=d, then write B to MMUDAT + std ,x ; Write A to MMUADR to set MAPSEL=5, then write B to MMUDAT inca ; next mapsel ldb ,y+ ; next page from usr_mmu_map - std ,x ; Write A to MMUADR to set MAPSEL=e, then write B to MMUDAT + std ,x ; Write A to MMUADR to set MAPSEL=6, then write B to MMUDAT lda #MMU_MAP0 sta ,x ; new mapping goes live here diff --git a/Kernel/platform-multicomp09/tricks.s b/Kernel/platform-multicomp09/tricks.s index c889929f..dc70e866 100644 --- a/Kernel/platform-multicomp09/tricks.s +++ b/Kernel/platform-multicomp09/tricks.s @@ -250,7 +250,7 @@ skip2@ incb ;;; uses low 32Kbyte of kernel address space as the "window" for this ;;; use map 8,9 (0x0000-0x3fff) for dest, map 10,11 (0x4000-0x7fff) for source copybank - pshs d,x,u,y ; changing this will affect "ldb 1,s" below + pshs d,x,u,y ; changing this will affect "ldb 0,s" below ;; map in dest ldx #MMUADR ; for storing lda #(MMU_MAP1+8) ; mapsel=8, for dest, in B -- 2.34.1