Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!rutgers!mit-eddie!killer!chasm From: chasm@killer.DALLAS.TX.US (Charles Marslett) Newsgroups: comp.sys.atari.8bit Subject: MYDOS 4.51 source posting Keywords: DOS MYDOS A65 SOURCE Message-ID: <8450@killer.DALLAS.TX.US> Date: 24 Jun 89 16:24:21 GMT Organization: The Unix(R) Connection, Dallas, Texas Lines: 709 # This is a shell archive (Part 1 of 3) # # It contains a note describing the changes made to # MYDOS from version 4.50 to 4.51, a short file # describing how to rebuild MYDOS from the source # files, and the source to the BUILD utility program # used to install MYDOS into memory -- the final step # in rebuilding MYDOS from the sources. # # Run it through the Bourne shell "sh" or an unshar program. # Assemble the BUILD.ASM file using the just posted A65 # assembler and read the other two. # # The source to MYDOS 4.51 follows in the two remaining parts of # this posting. # #----cut here-----cut here-----cut here-----cut here----# #!/bin/sh # shar: Shell Archiver # Run the following text with /bin/sh to create: # changes # read.me # build.asm # This archive created: Sat Jun 24 08:36:56 1989 sed 's/^X//' << \SHAR_EOF > changes XMYDOS 4.51 -- Released June 14, 1989 X XMYDOS 4.51 restores some of the X"features" of 4.3, including being Xwritten in Atari AMAC syntax (that Xis, compatible with MADMAC and my Xown A65 assemblers). This seems more Xconsistent than MAC/65. See the Xfollowing list for the changed Xcode. Like 4.50, it mostly fixes Xbugs in features that never worked Xright in the past. the changes are Xvery minor. X X XChanges from 4.50 to 4.51 -- X X1.Lock/Unlock work the way they X used to. Query is the default. X2.A bug inserted into the program X load code is corrected (some code X that has to be resident was moved X into the DUP overlay area). X3.The code to work around I/O errors X deleting the program file in most X BASIC program "starter"s is re- X inserted (inadvertently removed X in 4.50). X4.Formatting of disks with bad sec- X tors is reenabled (with warning). X5.Corrected code to copy DOS.SYS X from one diskette to another (this X never really worked before). X6.The RAMdisk configuration code in- X serted by Bob Puff was retained, X but the old code (with specifiable X I/O port) is restored for non- X Axlon, non-XE compatible RAMdisks. X7.The correction to keep the VTOC X of other disks from being corrupt- X ed when I/O errors occurred while X writing a VTOC was worse than the X problem (any I/O error scrambles X all VTOCs with output files open). X Perhaps the best fix is to retry X forever? Anyway, this is still a X problem area. X8.And, of course, the assembler A65 X is included. The executable code X in MYDOS 4.51 was all assembled X using A65. X XCopying DOS.SYS -- we now . . . X X1) load the 3 boot sectors into RAM X from the source disk. X2) copy the actual file, renaming it X "diamond"OS.SYS on the destina- X tion disk. X3) write the 3 boot sectors to the X destination drive (updating the X sector link mask, link location X and sector size flag). X4) rename "diamond"OS.SYS to DOS.SYS X (updating the sector size flag X and the starting sector number of X DOS.SYS). X X XTo do (before 1990, at least): X X1. Add script (batch file) support. X2. Enable BASIC if no cartridge is X installed and the [B] command is X issued. Then, disable BASIC if X the [L] or [N] commands are X issued. X XAny volunteers? X X XEnjoy, X XCharles Marslett X XUsenet: chasm@killer.dallas.tx.us XCompuserve: 73317,3662 X XJune 16, 1989 SHAR_EOF sed 's/^X//' << \SHAR_EOF > read.me X X X X X X X X X X X X X X X MYDOS 4.51 Source Code Documentation X X X Copyright (C) 1988, 1989 by WORDMARK Systems and the authors: X X Charles Marslett X 2705 Pinewood Dr. X Garland, TX 75042 X CIS: 73317,3662 X UseNet: CHASM@KILLER.DALLAS.TX.US X X and X X Robert Puff X Suite 222 X 2117 Buffalo Rd. X Rochester, NY 14624 X GEnie: BOB.PUFF X X X X This software may be freely used and distributed provided that X this copyright notice is left intact, and provided that: X X (1) The source code in machine readable form is provided with X any binary distribution, or made available at no additional cost X to the recipients of the binary distribution. X X (2) A binary version of a derivative work may be sold for a X reasonable distribution charge (less than $50), and the X source code in machine readable format must be available. X X (3) A derivative work may not impose and restriction on the free X distribution of the source code. X X X X X X X X X X X X X X X X X X X X X X This is the source code to MYDOS version 4.51. It is written in X Atari AMAC format. Use the included A65 assembler, Atari AMAC or the X Atari MADMAC programs to assemble it. If you do not want a listing, or X do not have a printer, and you are assembling with A65, you can specify X "-" as the listing file and only the object files will ge generated. X If you want a listing you will probably have to increase the "FILES" X configuration parameter to 4 (so the included files can be read -- this X is the cause of the "I" errors). X X Here are a few notes on how to create a working copy of MYDOS X from the source: X X (1) It is easiest to use an older version of MYDOS to assemble the X new DOS. All filenames used in assembling use the D: default drive X number; so go to your DOS menu, and set the default drive (and X directory) to where your source code resides. The source code and X object files will all fit on one double density disk. If you only X have single density drive(s), then separate the MDOS and MDUP files, X but put the object files on the same disk prior to BUILDing. X X (2) Load A65 and enter D:MDOS.ASM as the source file. Press return X for the object file and either - or P: for the listing file. A65 will X exit back to the MYDOS menu when the assembly is completed. X X (3) Load A65 and enter D:MDUP.ASM as the source file. This will X assemble the rest of the resident code, and also the non-resident X DUP.SYS part. Again A65 will return to the MYDOS menu. X X (4) If necessary, copy the MDOS.OBJ and MDUP.OBJ files to a diskette X containing BUILD. Now load (and execute) BUILD. This file will read X the MDOS.OBJ and MDUP.OBJ files you just created. When asked to, X press START, and you will be in the new DOS! Now use the [H] command X to write out DOS files, and you're set! X X X What the files contain: X X The MDOS.ASM and MDUP.ASM files are "header" files, that have X some equates, and simply INCLUDE the actual source files (source X files are MDOS1.ASM, MDOS2.ASM, MDOS3.ASM, MDOS4.ASM, MDUP1.ASM, X MDUP2.ASM, MDUP3.ASM, MDUP4.ASM, MDUP5.ASM, MDUP6.ASM and MDUP3.ASM). X Be warned that there are absolute references that MDUP makes to the X MDOS files; these are limited to locations in MDOS1.ASM so if the X MDOS.ASM or MDOS1.ASM files are modified in any way, these references X may need to be changed as well. They are located in the very beginning X of the MDUP.ASM file. X X The DOS.SYS file itself is contained mostly in the MDOSx files; X but the code that takes care of MEM.SAV and loading DUP.SYS is in the X file MDUP1.ASM. Because the DOS is split between two files, you must X take note of the last byte the assembly of MDOS.ASM produced, and X place this address in the "ORIGIN = xxxx" statement in the MDUP.ASM X segment, or the possibility of both files running into each other X will exist. X X I think that is about it. If you find/correct any bugs, or do X any major modifications, Mr. Marslett and I would like to see them. X Please see the above references on how to contact us. X X Bob Puff 11/28/88 X Charles Marslett 6/14/89 SHAR_EOF sed 's/^X//' << \SHAR_EOF > build.asm X TITLE 'DOUBLE DENSITY MYDOS3 SYSTEM DISK BUILDER' X; X; Copyright 1984, Charles Marslett, Wordmark Systems X; X; Permission is granted by the author for any use whatsoever of this X; code, so long as this notice remains in the source code, and so X; long as the source to this routine, however modified or unmodified, X; is made available for a nominal cost. X; X; X; Some important absolute addresses X; XCIOV = $E456 ;CIO ENTRY VECTOR X; XMENUP = $02E0 ;THE RUN ENTRY POINT OF "MDUP.OBJ" X; XORIGIN = $4800 ;GOTTA BE BIG ENOUGH TO NOT HIT EITHER COPY OF MYDOS X; XZCTR = $FA ;A GENERAL PURPOSE COUNTER XBPTR = $FC ;A GENERAL PURPOSE POINTER XZPTR = $FE ;AND ANOTHER GENERAL PURPOSE POINTER X; X; Define the fields of IOCB $10 that I use X; X ORG $0351 X DS 1 XICMD DS 1 X DS 1 XIBUF DS 4 XILEN DS 2 XIAUX1 DS 1 XIAUX2 DS 1 X; X; The BUILD program itself -- loads MDOS.OBJ and MDUP.OBJ into memory above X; itself, then relocates the code down over the previous version of MYDOS X; that we are running with and starts it up. This is how we create a new X; version of MYDOS. X; X ORG ORIGIN X; XSTART LDX #LOW[SIGNON] X LDY #HIGH[SIGNON] ;LOG ONTO THE SCREEN X JSR DMSG X; X LDA #$C0 X STA BPTR+1 ;POINT BPTR AT $C000 X LDY #0 X STY BPTR X LDA #$FF X STA SAVC X LDX #$10 XCLRC STA (BPTR),Y X INY X BNE CLRC X INC BPTR+1 X DEX X BNE CLRC X; X LDA #HIGH[BUFFER] X STA BPTR+1 ;POINT BPTR AT "BUFFER" X LDA #LOW[BUFFER] X STA BPTR X LDX #$20 X LDA #0 XMVLP1 STA (BPTR),Y ;FILL THE 8K BUFFER WITH $00 BYTES X INY X BNE MVLP1 X INC BPTR+1 X DEX X BNE MVLP1 X; X; COPY NEW DOS CODE FROM FILE "MDOS.OBJ" X; X LDX #LOW[MSG01] X LDY #HIGH[MSG01] X JSR DMSG ;ANNOUNCE WE ARE READING "D:MDOS.OBJ" X LDY #LOW[DOSFIL] X LDA #HIGH[DOSFIL] X JSR LOADBF ;LOAD CONTENTS OF "MDOS.OBJ" X; X; COPY NEW DOS AND DUP CODE FROM FILE "MDUP.OBJ" X; X LDX #LOW[MSG02] X LDY #HIGH[MSG02] X JSR DMSG ;ANNOUNCE WE ARE READING "D:MDUP.OBJ" X LDY #LOW[DUPFIL] X LDA #HIGH[DUPFIL] X JSR LOADBF ;LOAD CONTENTS OF "MDUP.OBJ" X; X; MOVE BUFFER DOWN TO LOW MEMORY X; X LDX #LOW[MSG03] X LDY #HIGH[MSG03] X JSR DMSG ;ANNOUNCE WE ARE RELOCATING DOS AND DUP CODE X LDA #$07 X STA ZPTR+1 X LDA #$00 X STA ZPTR ;SET DESTINATION POINTER TO $0700 X LDA #HIGH[BUFFER] X STA BPTR+1 X LDA #LOW[BUFFER] X STA BPTR ;SET SOURCE POINTER TO "BUFFER" X; X LDY #0 XMVLP2 LDA (BPTR),Y X STA (ZPTR),Y ;COPY 256 BYTES AT A TIME UNTIL WE X INY ;ARE ABOUT TO OVERWRITE BUILD ITSELF X BNE MVLP2 ;(THIS IS TOO MUCH, I HOPE, BUT IT WORKS) X INC BPTR+1 X INC ZPTR+1 X LDA ZPTR+1 X CMP #HIGH[START] X BNE MVLP2 X; X; REINITIALIZE THE SYSTEM X; X LDX #LOW[MSG04] X LDY #HIGH[MSG04] X JSR WFSTR ;ANNOUNCE STARTUP AND WAIT FOR A KEY X; X JSR DOSINI ;REINITIALIZE THE NEW MYDOS X; X LDX #0 X LDA #3 X STA ICMD-16 X LDA #$2C X STA IAUX1-16 X LDA #LOW[EC] X STA IBUF-16 X LDA #HIGH[EC] X STA IBUF+1-16 X JSR CIOV ;REOPEN THE KEYBOARD/SCREEN "E:" DEVICE X; X LDX #LOW[MSG05] X LDY #HIGH[MSG05] X JSR WFSTR ;ANNOUNCE WE ARE READY TO RUN THE NEW MYDOS X; X JMP (MENUP) ;ENTER BACK AT MENU (USE "H" TO SAVE NEW DOS) X; X; X; LOAD CONTENTS OF OBJECT FILE INTO BUFFER X; XLOADBF STY IBUF X STA IBUF+1 X LDA #$FF X STA MINAD X STA MINAD+1 ;SET LOW ADDRESS TO $FFFF X LDA #3 X STA ICMD X LDA #4 X STA IAUX1 X LDA #0 X STA MAXAD ;SET HIGH ADDRESS TO $0000 X STA MAXAD+1 X STA IAUX2 X LDX #$10 X JSR CIOV ;OPEN D:MDOS.OBJ OR D:MDUP.OBJ X BPL GOTFIL X LDX #LOW[NOFIL] X LDY #HIGH[NOFIL] X JSR DMSG ;REPORT IT IF WE CANNOT OPEN THE FILE X JMP ($000A) X; XGOTFIL LDA #7 ;ELSE, X STA ICMD ;CHANGE COMMAND TO READ X LDA #LOW[BUFAD] X STA IBUF X LDA #HIGH[BUFAD] ;BUFFER ADDRESS TO THAT OF LOCAL BUF. X STA IBUF+1 X LDA #2 X STA ILEN X LDA #0 X STA ILEN+1 ;LENGTH TO 2 BYTES X LDX #$10 X JSR CIOV ;READ HEADER X BMI INVHDR ;IF ERROR, REPORT IT X LDA BUFAD X AND BUFAD+1 X CMP #$FF ;ELSE, VALID HEADER? X BPL RDNXTB XINVHDR LDX #LOW[NOHDR] X LDY #HIGH[NOHDR] X JSR DMSG ;IF NOT, REPORT THAT ERROR X JMP ($000A) X; XRDNXTB LDA #LOW[BUFAD] ;READ THE NEXT WORD PAIR (START & END ADDR) X STA IBUF X LDA #HIGH[BUFAD] X STA IBUF+1 X LDA #4 X STA ILEN ;SET LENGTH TO 4 BYTES X LDA #0 X STA ILEN+1 X LDX #$10 X JSR CIOV ;READ START/END ADDRESSES X BPL RDDATA ;IF NO ERROR, LOAD THE DATA X CPY #$88 ;ELSE, IS IT EOF? X BNE ABORT ;IF NOT EOF, REPORT THE ERROR X JMP MOVER ;IF EOF, WE HAVE LOADED IT ALL, RETURN NORMALLY X; XRDDATA LDA BUFAD+2 X LDY BUFAD+3 X CPY MAXAD+1 X BCC NOTMAX ;IF THIS BLOCK SETS A NEW HIGH ADDRESS LOADED X BNE NEWMAX X CMP MAXAD X BCC NOTMAX XNEWMAX STY MAXAD+1 ;UPDATE THE HIGH WATER MARK X STA MAXAD XNOTMAX SEC X SBC BUFAD X STA ZCTR X TYA X SBC BUFAD+1 X STA ZCTR+1 X INC ZCTR X BNE LENOK X INC ZCTR+1 XLENOK JSR DEBUG1 X LDY BUFAD+1 X LDA BUFAD X CPY MINAD+1 ;AND IF IT SETS A NEW LOW ADDRESS LOADED X BCC NEWMIN X BNE NOTMIN X CMP MINAD X BCS NOTMIN ;UPDATE THE LOW WATER MARK XNEWMIN CPY #$03 X BCC NOTMIN X STY MINAD+1 X STA MINAD XNOTMIN CPY #$07 X BCC DONTMV X CPY #$C0 ;SKIP THE INDIRECT BUFFER AND MOVE X BCS DONTMV ;IF THE ADDR <0700 OR >BFFF X ADC #LOW[BUFFER-$700] X PHA X TYA X ADC #HIGH[BUFFER-$700] X TAY X PLA XDONTMV STA BPTR X STY BPTR+1 X JSR DEBUG2 X LDA #0 X STA ILEN X STA ILEN+1 ;READ ONE BYTE AT A TIME XGETNB LDX #$10 X JSR CIOV X BPL STBYTE ;AND IF NO ERROR, STORE IT XABORT LDX #LOW[ABORTED] X LDY #HIGH[ABORTED] X JSR DMSG ;REAL I/O ERROR X JMP ($000A) ;EXIT TO DOS X; XSTBYTE LDY BPTR X BNE STBY0 X LDY BPTR+1 ;TEST FOR BUFFER POINTER BEING STILL VALID X CPY #$C0 X BNE STBY0 X STA SAVC X BEQ STBY3 XSTBY0 LDY #0 X STA (BPTR),Y ;ALL OK, STORE THE BYTE JUST READ XSTBY3 INC BPTR X BNE STBT1 X INC BPTR+1 XSTBT1 LDA ZCTR X BNE STBT2 ;INCREMENT THE MEMORY POINTER X DEC ZCTR+1 XSTBT2 DEC ZCTR X LDA ZCTR X ORA ZCTR+1 ;DECREMENT THE BYTE COUNTER X BNE GETNB ;IF STILL IN THE BLOCK, READ THE NEXT BYTE X JMP RDNXTB ;ELSE, EXAMINE THE NEXT BLOCK X; XMOVER LDA #12 ;DONE WITH THE LOAD, X STA ICMD X LDX #$10 X JSR CIOV ;CLOSE LOAD FILE X JSR PSTR X DB '(',0 X LDA MINAD+1 X JSR PHEX ;REPORT THE LOW AND HIGH WATER MARKS X LDA MINAD X JSR PHEX X JSR PSTR X DB '-',0 X LDA MAXAD+1 X JSR PHEX X LDA MAXAD X JSR PHEX X LDX #LOW[LOADED] X LDY #HIGH[LOADED] X JSR DMSG X RTS ;AND RETURN TO THE MAIN LINE CODE X; X; PROGRAM FILE (NEW FMS) X; XDOSFIL DB 'D:MDOS.OBJ',$9B X; X; PROGRAM FILE (NEW UTILITY PROGRAM) X; XDUPFIL DB 'D:MDUP.OBJ',$9B X; X; CONSOLE KEYBOARD/DISPLAY X; XEC DB 'E:',$9B X; X; DISPLAY A MESSAGE AND WAIT FOR "START" X; XWFSTR JSR DMSG ;NESTED CALL TO DISPLAY THE MESSAGE X LDA #8 X STA $D01F XWFSTRT LDA $D01F ;READ CONSOLE SWITCHES X AND #1 X BNE WFSTRT ;WAIT UNTIL START IS DEPRESSED X RTS X; X; DISPLAY A MESSAGE TO THE OPERATOR X; XDMSG STX ZPTR X STY ZPTR+1 X LDA #0 X STA ZCTR XMSGLP LDY ZCTR X LDA (ZPTR),Y X BEQ DXIT X JSR BYTOUT X INC ZCTR X BNE MSGLP X; XDXIT RTS X; XCODE DB '0123456789ABCDEF' X; X; DISPLAY A 4 DIGIT HEX NUMBER ON THE SCREEN X; XPHEX PHA X LSR A X LSR A X LSR A X LSR A X TAX X LDA CODE,X X JSR BYTOUT X PLA X AND #$0F X TAX X LDA CODE,X X; XBYTOUT LDX #11 X STX ICMD-$10 X LDX #0 X STX ILEN-$10 X STX ILEN-$10+1 X JSR CIOV X RTS X; XPSTR PLA X STA ZPTR X PLA X STA ZPTR+1 XPLOOP INC ZPTR X BNE POUT X INC ZPTR+1 XPOUT LDX #0 X LDA (ZPTR,X) X BEQ PEXIT X JSR BYTOUT X JMP PLOOP X; XPEXIT LDA ZPTR+1 X PHA X LDA ZPTR X PHA X RTS X; X; REPORT THE HIGH AND LOW BUFFER LIMITS X; XDEBUG1 JSR PSTR X DB '(',0 X LDA BUFAD+1 X JSR PHEX X LDA BUFAD X JSR PHEX X JSR PSTR X DB '-',0 X LDA BUFAD+3 X JSR PHEX X LDA BUFAD+2 X JSR PHEX X RTS X; XDEBUG2 JSR PSTR X DB ')' X DB $1E,$1E,$1E,$1E,$1E X DB $1E,$1E,$1E,$1E,$1E X DB $1E,0 X RTS X; X; ROUTINE TO REINITIALIZE DOS 2.0 X; XDOSINI LDA $704 X STA $00C X LDA $704+1 X STA $00C+1 X JMP ($00C) ;==REINITIALIZE ENTIRE DOS/DUP X; X; MESSAGES TO OPERATOR X; XSIGNON DC $9B,$9B,' ' X DC 'M','Y','D','O','S','3',' ','d','o','u','b','l','e' X DC ' ','d','e','n','s','i','t','y' X DC ' ','A','T','A','R','I',' ','O','S',' ',$9B X DB ' ' X DC ' ',' ',' ',' ',' ',' ','s','y','s','t','e','m' X DC ' ','d','i','s','k',' ','b','u','i','l','d','e','r' X DC ' ',' ',' ',' ',' ',' ',' ',$9B,$9B X DB 0 X; XMSG01 DB 'LOADING MDOS.OBJ',0 XMSG02 DB 'LOADING MDUP.OBJ',0 XLOADED DB $1E,$1E,$1E,$1E,$1E X DB $1E,$1E,$1E,$1E,$1E X DB $1E,$1E,$1E,$1E,$1E X DB $1E,$1E,$1E,$1E,$1E X DB $1E,$1E,'ED',$FE,$9B,0 XMSG03 DB 'Moving DOS/DUP into place',$9B,0 XMSG04 DB 'PRESS ' X DC 'S','T','A','R','T' X DB ' TO INITIALIZE NEW DOS',$9B,0 XMSG05 DB 'PRESS ' X DC 'S','T','A','R','T' X DB ' TO ENTER NEW DOS.',$9B,0 X; XNOFIL DB 'Cannot open Object File',$9B,0 XNOHDR DB 'Invalid Header in Object File',$9B,0 XABORTED DB 'I/O Error, load aborted',$9B,0 X; X; BUFFER FOR PATCHING A RUNNING DOS X; XMAXAD DS 2 XMINAD DS 2 XSAVC DS 1 XBUFAD DS 6 ;FOR ADDRESSES XBUFFER DS START-$0700 X; X; EXECUTION FORCED, LOAD RUN ADDRESS X; X; ORG $02E0 X; DW START ;run address X; X END START SHAR_EOF # End of shell archive exit 0 =========================================================================== Charles Marslett STB Systems, Inc. <== Apply all standard disclaimers Wordmark Systems <== No disclaimers required -- that's just me chasm@killer.dallas.tx.us