# HG changeset patch # User tlindner # Date 1030546376 0 # Node ID 28ca7d4dd2c81a0087418776c3a26e35665c354b # Parent bc2fb1daef5d3e4a19f063afa7dba7160a261f94 Initial checkin. diff -r bc2fb1daef5d -r 28ca7d4dd2c8 3rdparty/drivers/emudsk/ddh0.asm --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/3rdparty/drivers/emudsk/ddh0.asm Wed Aug 28 14:52:56 2002 +0000 @@ -0,0 +1,43 @@ +******************************************************************** +* Emudsk - Virtual disk driver for CoCo emulators +* +* $Id$ +* +* Ed. Comments Who YY/MM/DD +* ------------------------------------------------------------------ +* 01 Modified to compile under OS9Source tjl 02/08/28 + + IFP1 + USE os9defs + ENDC + +type SET Devic+Objct + MOD rend,rnam,type,ReEnt+1,fmnam,drvnam + FCB $FF all access modes + FCB $07,$FF,$E0 device address + + FCB optl number of options + +optns EQU * + FCB DT.RBF RBF device + FCB $00 drive number + FCB $00 step rate + FCB $80 type=nonstd,coco + FCB $01 double density + FDB $005a tracks + FCB $40 one side + FCB $01 no verify + FDB $0040 sectors/track + FDB $0040 "", track 0 + FCB $03 interleave + FCB $20 min allocation +optl EQU *-optns + +rnam FCS /DD/ +fmnam FCS /RBF/ +drvnam FCS /EmuDsk/ + + EMOD +rend EQU * + end + diff -r bc2fb1daef5d -r 28ca7d4dd2c8 3rdparty/drivers/emudsk/emudsk.asm --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/3rdparty/drivers/emudsk/emudsk.asm Wed Aug 28 14:52:56 2002 +0000 @@ -0,0 +1,236 @@ +******************************************************************** +* Emudsk - Virtual disk driver for CoCo emulators +* +* $Id$ +* +* Ed. Comments Who YY/MM/DD +* ------------------------------------------------------------------ +* 01 Modified to compile under OS9Source tjl 02/08/28 + +* EmuDisk floppy disk controller driver +* Edition #1 +* 04/18/96 : Written from scratch by Alan DeKok +* aland@sandelman.ocunix.on.ca +* +* This program is Copyright (C) 1996 by Alan DeKok, +* All Rights Reserved. +* License is given to individuals for personal use only. +* +* +* Comments: Ensure that device descriptors mark it as a hard drive +* +* +* $FF80-$FF82: logical record number +LSN equ $FF80 where to put the logical sector number + +* +* $FF83: command/status register. +* Output: 0=read, 1=write, 2=close. +* Input: 0=no error, non-zero=error codes (see below). +command equ $FF83 where to put the commands + +* +* $FF84-$FF85: 6809's 16-bit buffer address (cannot cross an 8K boundary due +* to interference from the MMU emulation). +buffer equ $FF84 pointer to the buffer + +* +* Returns: +* +* 0=successful +* 2=not enabled +* 4=too many MS-DOS files open, +* 5=access denied (virtual HD file locked by another program +* or MS-DOS read-only status) +* 6/12=internal error +* 254=invalid command byte +* 255=power-on state or closed. +* +* The "close" command just flushes all the read/write buffers and +* restores the metacontroller to its power-up state. The hard drive must be +* enabled by the user using the MS-DOS command "ECHO >COCO3.VHD" (another +* crash safeguard), so error code 2 indicates this has not been done. + + + nam EmuDsk + ttl os9 device driver + + ifp1 + use os9defs + use rbfdefs + endc + +tylg set Drivr+Objct +atrv set ReEnt+rev +rev set $01 + + mod eom,name,tylg,atrv,start,size + fcb $ff + + org 0 +u0000 rmb $FF Normal RBF device mem for 4 drives +size equ . + + fcb $FF This byte is the driver permissions +name fcs /EmuDsk/ + fcb 1 edition #1 + + +* Entry: Y=Ptr to device descriptor +* U=Ptr to device mem +* +* Default to only one drive supported, there's really no need for more. +INIT lda #$FF 'Invalid' value & # of drives + leax DRVBEG,u Point to start of drive tables + sta ,x DD.TOT MSB to bogus value + sta LSN + stx >LSN+1 + + ldx PD.BUF,y where the 256-byte LSN should go +* Note: OS-9 allocates buffers from system memory on page boundaries, so +* the low byte of X should now be $00, ensuring that the sector is not +* falling over an 8K MMU block boundary. + + stx >buffer set up the buffer address + sta >command get the emulator to blast over the sector + lda >command restore the error status + bne FixErr if non-zero, go fix the error and exit + puls b,x,pc restore LSN and exit + +DrivErr leas 2,s kill address of calling routine (Read/Write) + comb +* FIND ERROR CODE TO USE +* ldb #E$ find appropriate error code... + ldb #E$NotRdy not ready + rts + +* Emulator error codes translated to OS-9 error codes. +* +* 2=not enabled +* E$NotRDy - drive is not ready +* +* 4=too many MS-DOS files open, +* E$ +* +* 5=access denied (virtual HD file locked by another program +* or MS-DOS read-only status) +* E$WP - write protect +* +* 6/12=internal error +* E$CRC - CRC error +* +* 254=invalid command byte +* E$ +* +* 255=power-on state or closed. +* E$NotRdy - drive is not ready +* +FixErr leas 5,s kill B,X,PC from GetSect routine + cmpa #02 + beq NotRdy + cmpa #255 + beq NotRdy + cmpa #5 + beq WP + cmpa #6 + beq CRC + cmpa #12 + beq CRC + +* if it's something we don't recognize, it's a seek error + comb + ldb #E$Seek seek error + rts + +NotRdy comb + ldb #E$NotRdy not ready + rts + +WP comb + ldb #E$WP write protect + rts + +CRC comb + ldb #E$CRC CRC error + rts + +L03D4 comb + ldb #E$Write write error + rts + + +L03E0 comb + ldb #E$Read Read error + rts + +SETSTA ldx PD.RGS,y Get caller's register stack ptr + ldb R$B,x Get function code + cmpb #SS.WTrk Write track? + beq format Yes, ignore it + cmpb #SS.Reset Restore head to track 0? + beq format Yes, ignore it + cmpb #SS.SQD sequence down the drive (i.e. park it)? + beq park + comb set carry for error + ldb #E$UnkSvc return illegal service request error + rts + +park ldb #$02 close the drive + stb >command save in command register + +format clrb ignore physical formats. They're not + rts necessary + + emod + +eom equ * diff -r bc2fb1daef5d -r 28ca7d4dd2c8 3rdparty/drivers/emudsk/h0.asm --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/3rdparty/drivers/emudsk/h0.asm Wed Aug 28 14:52:56 2002 +0000 @@ -0,0 +1,43 @@ +******************************************************************** +* Emudsk - Virtual disk driver for CoCo emulators +* +* $Id$ +* +* Ed. Comments Who YY/MM/DD +* ------------------------------------------------------------------ +* 01 Modified to compile under OS9Source tjl 02/08/28 + + IFP1 + USE os9defs + ENDC + +type SET Devic+Objct + MOD rend,rnam,type,ReEnt+1,fmnam,drvnam + FCB $FF all access modes + FCB $07,$FF,$E0 device address + + FCB optl number of options + +optns EQU * + FCB DT.RBF RBF device + FCB $00 drive number + FCB $00 step rate + FCB $80 type=nonstd,coco + FCB $01 double density + FDB $005a tracks + FCB $40 one side + FCB $01 no verify + FDB $0040 sectors/track + FDB $0040 "", track 0 + FCB $03 interleave + FCB $20 min allocation +optl EQU *-optns + +rnam FCS /H0/ +fmnam FCS /RBF/ +drvnam FCS /EmuDsk/ + + EMOD +rend EQU * + end + diff -r bc2fb1daef5d -r 28ca7d4dd2c8 3rdparty/drivers/emudsk/makefile --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/3rdparty/drivers/emudsk/makefile Wed Aug 28 14:52:56 2002 +0000 @@ -0,0 +1,13 @@ +include ../../../Makefile.rules + +DEPENDS = ./Makefile + +DRIVERS = emudsk.dr +DESCS = h0.dd ddh0.dd +ALLOBJS = $(DRIVERS) $(DESCS) + +all: $(ALLOBJS) $(DEPENDS) + +clean: + $(RM) $(ALLOBJS) +