dml@loral.UUCP (Dave Lewis) (01/02/86)
--------------------------------------
In the hope of stimulating some activity in this newsgroup....
I have written a replacement disk device driver for Color Computer OS-9.
This module is a vast improvement over the standard issue CCDisk; it runs
double-sided disks, 40 or 80 tracks, and still reads/writes the ol' 35 track
single siders. If there is sufficient interest out there I will post the
assembly source, commented. I'm placing this program in public domain rather
than go through all the stuff needed to market it -- $$ from people finding
it useful would be much appreciated. I've written or rewritten several OS-9
utilities too, and if there's some interest out there in netland will post
those too. Can anybody use:
A new OS9Gen that can handle double sided disks. Not finished yet but should
only take a few days.
An improved version of Dump that adds an option to start the listing at an
address other than 0000 and doesn't repeat part of the second-to-last
line's data when the last line is less than 16 bytes.
Modifications to S. B. Goldberg's 80-column directory program (which appeared
in Rainbow magazine a couple months ago) to make it print out the current
date in the header and accept multiple arguments.
A utility to split up the OS9Boot file into its component modules and store
them in files individually. I posted this a few months ago and never
got any response.
Any suggestions for programs I haven't thought of, bugs to correct, etc.
will be considered. I've been writing this stuff for my own use but other
people can probably use it too.
-------------------------------
Dave Lewis Loral Instrumentation San Diego
sdcc6 ---\ gould9 --\
ihnp4 ---->-->!sdcc3 ---->--->!loral!dml (uucp)
sdcrdcf -/ sdcsvax -/
Stupidity got us into this mess -- why can't it get us out of it?
--------------------------------dml@loral.UUCP (Dave Lewis) (02/06/86)
-------------------------------
Here is the module separator program. It works best when the source file
is on a different drive from the destination directory -- less disk grinding.
Ensure that there are no existing files in the destination directory with the
same name as any of the modules, and that there is enough free space on the
disk. Even the smallest module takes at least 2 sectors, one for the file
descriptor and one for the data.
I have gotten some response to my offer of a disk of programs for $10 but
had hoped for more. I am currently working on modifying NewDisk to work with
OS-9 Version 2 and will post the changes that need to be made to NewDisk
Version 1.
*****************************************************************
*
* This sourcecode listing is released to public domain by
*
* Dave Lewis San Diego CA October 16, 1985
*
* It may be copied and used for any purpose EXCEPT for sale.
* Include this header with all copies.
*
*****************************************************************
*
* Utility to break a multiple-module file (like OS9Boot) into its
* component modules and store them as separate files in a
* specified or default directory.
*
* Usage: Separate /Dn/DIRECTORY/filename /Dn/DIRECTORY
*
* Modules are stored in destination directory under their module
* names. Ensure there are no existing files with the same name
* as any of the modules.
*
*****************************************************************
*
NAM Separate
TTL Module separator
*
* Copyright 1985 by Dave Lewis
* 4417 Idaho apt 4
* San Diego CA 92116
* Released to public domain January, 1986
*
IFP1
USE /D0/DEFS/OS9Defs
USE /D0/DEFS/SCFDefs
ENDC
*
REV EQU 1
TYPE EQU PRGRM+OBJCT
ATTR EQU REENT+REV
*
MOD SIZE,NAME,TYPE,ATTR,EXEC,STORG
NAME FCS 'Separate'
FCB 1 Version number
*
INPATH RMB 1 Input file path number
OUTPATH RMB 1 Output file path number
FILEPTR RMB 2 Address of output filename
EOBUFPTR RMB 2 Buffer end address
EOMEMPTR RMB 2 Data memory end address
MODSIZE RMB 2 Bytes still to be written
MODPTR RMB 2 Disk file position pointer
OPTHLST RMB 60 Output pathlist buffer
DATABUF RMB 700 Module data buffer
RMB 232 Reserve stack space
RMB 20 Reserve parameter area
STORG EQU .
*
EXEC STY EOMEMPTR End of allocated memory
LEAY DATABUF+700 Find end of data buffer
STY EOBUFPTR Store end address
CLR MODPTR Zero out module offset point-
CLR MODPTR+1 er; start at BOF
LDA #READ. Access mode = read
OS9 I$OPEN Open input file
BCS SPEXIT Exit if error
STA INPATH Store input path number
*
LEAY OPTHLST,U Get pathlist buffer address
FINDPATH CMPX EOMEMPTR Test X for end of memory
BHS NOPATH No pathlist, use working dir
LDA ,X+ Get next character
CMPA #'/ Test for pathname start
BEQ FOUNDPATH
BSR ALPHTEST Test for letter (UC or lc)
BNE FINDPATH Not a letter; keep looking
FOUNDPTH LEAX -1,X Set X back to character
MOVEPATH LDA ,X+ Get next character
CMPA #C$CR Test character for `CR' or
BEQ MPEXIT blank; either indicates
CMPA #C$SPAC the end of a pathlist.
BEQ MPEXIT
STA ,Y+ Add character to outpathlist
CMPX EOMEMPTR Test for end of parameter
BLO MOVEPATH memory; can't go past it
MPEXIT LDA #'/ Prepare pathlist for addition
STA ,Y+ of a filename
*
NOPATH STY FILEPTR Save pointer to next byte
BSR GETMOD Do all modules of input file
SPEXIT OS9 F$EXIT End; pass any errors out
*
ALPHTEST TFR A,B Don't change letter in A
ANDB #$DF Change lowercase to uppercase
CMPB #'A Test for less than an `A'
BLO NOTALPH
CMPB #'Z Test for greater than a `Z'
BHI NOTALPH
CLRB Return w/Z flag set if alpha
NOTALPH RTS
*
GETMOD LDA INPATH Read from input file
LEAX DATABUF,U Point to data buffer
LDY #9 Read first 9 bytes (header)
OS9 I$READ Does not change X register
BCC GETMOD2 Continue if no error
CMPB #E$EOF Test for end-of-file error
BNE GMEXIT1 End of file just means you're
CLRB done; other errors are real
GMEXIT1 RTS
*
GETMOD2 LDD DATABUF Load first two bytes of file
CMPD #M$ID12 and test for module ID
BEQ GETMOD3 Continue if ID good
COMB Set carry flag for error
LDB #E$BMID Set error code
RTS
*
GETMOD3 LDD DATABUF+2 Load module size
STD MODSIZE Store as variable
LDD DATABUF+4 Load module name offset
PSHS U Save U
LDU MODPTR Get module offset in file
LEAU D,U Add name offset in module
LDX #0 MS 16 bits of file position
LDA INPATH Position file pointer on
OS9 I$SEEK first byte of module name
PULS U Restore U register
BCC GETMOD4 Continue if no error
GMEXIT2 RTS
*
GETMOD4 LEAX DATABUF,U
LDY #32 Module name can't exceed
LDA INPATH 32 characters
OS9 I$READ Read module name
BCS GMEXIT2 Exit if error
LDY FILEPTR Point to destination
MOVLOOP LDA ,X+ Move name to pathlist buffer
STA ,Y+
TSTA Test for last character --
BPL MOVLOOP MSB will be set
ANDA #$7F Clear MSB
STA -1,Y Store corrected character
LDA #C$CR Terminate line
STA ,Y
LEAX OPTHLST,U Point to pathlist
LDB #$F Attributes: r w e pr
LDA #WRITE. Access mode
OS9 I$CREATE Create and open output file
BCS GMEXIT2 Exit if error
STA OUTPATH Store path number
*
PSHS U Save U
LDU MODPTR Point to start of module
LDX #0 MS 16 bits of file pointer
LDA INPATH Path number
OS9 I$SEEK Position file pointer
PULS U Restore U
BCS GMEXIT2 Exit if error
LDX MODPTR Module offset in file
LDD MODSIZE Length of module
LEAX D,X Add length to position
STX MODPTR Point to next module in file
*
MODLOOP STD MODSIZE Store updated module size
CMPD #700 Is it bigger than buffer?
BLS LOADALL No, read it all
LDD #700 Fill the buffer
LOADALL TFR D,Y Y contains #bytes to read
PSHS D Save #bytes to be read
LEAX DATABUF,U Point to start of buffer
LDA INPATH Get input path number
OS9 I$READ Read data
BCS GMEXIT3 Exit if read error
CMPY ,S Were intended number of bytes
BEQ GETMOD5 actually read?
COMB If not, report it as a
LDB #E$READ read error
GMEXIT3 PULS Y,PC Pull and return
*
GETMOD5 LDA OUTPATH Get output path number
OS9 I$WRITE Write same number of bytes
BCS GMEXIT4 Exit if error
CMPY ,S Were correct number of
BEQ GETMOD6 bytes written?
COMB If not, report a write
LDB #E$WRITE error
GMEXIT4 PULS Y,PC Pull and return
*
GETMOD6 LDD MODSIZE Get total size of module
SUBD ,S++ Subtract bytes just processed
BNE MODLOOP More of this module remains
LDA OUTPATH Get output path number
OS9 I$CLOSE Close output file
LBCC GETMOD Process next module
*
RTS If error, exit
EMOD CRC bytes
SIZE EQU *
-------------------------------