TITLE 'P2DOS Disk Operating System' ;****************************************************************************** ;* * ;* P 2 D O S --Z80 REPLACEMENT DISK OPERATING SYSTEM VERSION 2.3 * ;* No more control-C to change disks! * ;* COPYRIGHT (C) 1985 BY: H.A.J. TEN BRUGGE * ;* ALL RIGHTS RESERVED MOLENSTRAAT 33 * ;* NL-7491 BD DELDEN * ;* THE NETHERLANDS * ;* TEL:..31-5407-1980 * ;* P2DOS WAS WRITTEN BY HERMAN TEN BRUGGE, WHO ASSUMES NO RESPONSIBILITY * ;* OR LIABILITY FOR ITS USE. P2DOS IS RELEASED TO THE PUBLIC DOMAIN FOR * ;* NON-COMMERCIAL USE ONLY. * ;* * ;* THE PULBLIC IS ENCOURAGED TO FREELY COPY AND USE THIS PROGRAM FOR * ;* NON-COMMERCIAL PURPOSES. ANY COMMERCIAL USE OF P2DOS IS PROHIBITED * ;* UNLESS APPROVED BY THE AUTHOR, H.A.J. TEN BRUGGE, IN WRITING. * ;* * ;* THIS IS MOD 2.3 TO THE RELEASE VERSION OF P2DOS * ;* * ;****************************************************************************** ;* ;* Mod 2.3 Revisions ;* ;* By Donald C. Kirkpatrick ;* 17595 S.W. Pheasant Lane ;* Beaverton, Oregon 97006 ;* 15 February 1988 ;* uucp: !tektronix!dadla!donk ;* ;* Name returned to P2DOS. ;* ;* Restored full compatibility with P2DOS mod 2.1 and Digital Research ;* BDOS. Moved disk error routines and path location address back to ;* where they were in P2DOS. Fixed Drive Reset Command 37 so only drives ;* specified in reset vector are affected. ;* ;* Made system file r/o an assembly time option to satisfy Benjamin Ho's ;* desire to not protect system files yet allow those of us who want ;* insurance to take insurance. ;* ;* Added single character ignore read/only status. It seemed just too ;* dangerous to allow any character except ^C to cancel r/o status. ;* This is an assembly time option, so those who wish to retain the ;* any character cancels r/o status may. The ignore r/o status ;* character was chosen to be ^X (CANCEL), but may be set to anything ;* by changing the IGNORE equate. ;* ;* Added flag to the FLAGS byte to disable ignore r/o status so a ;* running program can insist that the r/o status of a file or disk ;* be observed. ;* ;* Added an assembly time option to allow true XON (^Q) - XOFF (^S) ;* start/stop of console output. If this option is selected, only ;* a ^Q will restart suspended console output. Also added is an assembly ;* time option so suspended console output cannot be restarted by ;* ^S. It has always seemed a mistake that a second ^S would restart ;* something suspended by ^S. If neither assembly time option is ;* selected, console suspention will operate just as it always has. ;* ;************************************************************************** ;* ;* MOD 2.2 Revisions (Mod 2.2 a.k.a. Mod 0.2 of SUPRBDOS) ;* Renamed to SUPRBDOS ;* By Benjamin Ho ;* 626 Emerson St. ;* Evanston, IL 60201 ;* Background: ;* ;* P2DOS MOD 2.1 was not a major improvement on the standard CP/M BDOS. ;* While it added Public files, slightly more informative error messages, and ;* time stamp support, it did not fix the major annoyances of the CP/M BDOS, ;* namely the necessity of logging in new disks with Control-C, mystifying ;* error messages, and a delete key that looked like it didn't delete. ;* ;* P2DOS MOD 2.2 is a major enhancement which liberates the CP/M user from all ;* these annoyances. It is compatible with all CP/M software except those ;* that modify the BDOS. Fortunately, that type of program is extremely rare. ;* ;* P2DOS MOD 2.2 may be used with ZCPR3 to provide an extremely powerful ;* 100% CP/M 2.2 compatible operating system. The resulting system is not ;* subject to Digital Research's licensing agreement. The only restriction ;* is that it may be used for non-commerical use only, as stated by the ;* authors of ZCPR3 and P2DOS. ;* ;* Enjoy! ;* 9/2/86- ;* Added automatic login of changed disks--no more Control-C ;* when changing disks! ;* Removed P2DOS tie to ZCPR2. Can now be used with ZCPR3 or ;* (ugh!) normal CP/M. ;* Improved error messages: ;* Disk Error on X: Read Error ;* Write Error ;* Non-existent drive ;* File is Read-Only ;* Fixed delete key--now works like backspace. No echoing characters ;* Allowed functions 13 and 37 to recognize changes between single and ;* double sided disks on machines which normally require a warm ;* boot when "sidedness" is changed. Bios modification is needed ;* to support this feature ;* Fixed directory read bug. Function 37 bug which plagued ;* library utility program NULU 1.5 is fixed. ;* Choice of assembly by M80 and compatibles or public domain ZASM ;* System files are read/write, as in CP/M. Changed from P2DOS ;* mod 2.1 in which system files were R/O ;* Deleted P2DOS search path so the more flexible ;* ZCR3 search path could be used ;* File split into 3 sections for easy of editing. ;****************************************************************************** ; ; ; ; P 2 D O S --Z80 REPLACEMENT DISK OPERATING SYSTEM VERSION 2.3 ; ; ; NEW FEATURES OF P2DOS ARE: ; ; - TEST CONSOLE STATUS AFTER 256 CHARACTERS OUTPUT. THIS MAKES IT POSSIBLE TO ; EXIT A PROGRAM, AFTER YOU HIT ACCIDENTALY A KEY, BY TYPING ^S FOLLOWED ; BY ^C. THIS FIXES A BUG IN THE DIGITAL RESEARCH BDOS. THERE, ANY OTHER ; CHARACTER WOULD CAUSE ALL SUBSEQUENT ^S TO BE IGNORED. ; ; - ERROR ROUTINES GIVE MORE INFORMATION. ; P2DOS ERROR ON D: BAD SECTOR ; SELECT ; FILE R/O ; R/O ; FUNCTION =XXX (FILE =FILENAME.TYP) ; AS YOU CAN SEE THE ERROR IS DISPLAYED WITH THE P2DOS FUNCTION CALL. ; THE OPTION 'FILE =FILENAME.TYP' IS ONLY DISPLAYED IF THE P2DOS FUNCTION ; USES A FILENAME. AFTER ALL ERRORS A WARM BOOT IS DONE. ; ; - PUBLIC FILES ARE SUPPORTED. YOU CAN ACCESS A PUBLIC FILE FROM ANY ; USER NUMBER. THIS MAKES IT POSSIBLE TO PUT FOR EXAMPLE ALL '.COM' IN ; A SPECIAL USER NUMBER AND MAKE ALL THOSE FILES PUBLIC. YOU CAN ACCESS ALL ; THE FILES FROM ANY USER NUMBER ON THE SAME DISK. ; A PUBLIC FILE IS A FILE WITH BIT F2 (BIT 7 FROM FILENAME LETTER 2) SET TO ; ONE. PUBLIC FILES CAN ONLY BE REFERENCED BY THERE EXACT NAME AND NOT BY WILD ; CARD CHARACTERS. ; ; - SEARCH PATH IS IMPLEMENTED JUST AS IN ZCPR2 TO FIND FILES ON OTHER DRIVES ; AND IN OTHER USER AREAS. THE FILES MUST BE SYSTEM FILES AND MUST BE ; REFERENCED BY THEIR EXACT NAME AS IN PUBLIC FILE NAMES ABOVE. ; ; - AUTOMATIC DATE AND TIME STAMP IS IMPLEMENTED. THE CREATION DATE AND TIME ; IS SET WHEN THE FUNCTION MAKE IS EXECUTED. THE UPDATE DATE AND TIME IS ; SET AS THE FILE IS CLOSED. TO LET THIS FEATURE WORK YOU NEED TO HAVE A ; REAL TIME CLOCK AND THE CORRECT P2BIOS DRIVER ROUTINE. YOU ALSO HAVE TO ; INITIALISE YOUR DIRECTORY FOR TIME STAMPS. ; ; - FILE R/O ERROR MESSAGE OCCURS IF ONE OF THE FOLLOWING FILE TYPES IS ACTIVE: ; PUBLIC FILE (F2) ; FILE R/O (T1) ; SYSTEM FILE (T2) (if enabled) ; THIS MEANS THAT A SYSTEM FILE OR PUBLIC FILE CANNOT BE ERASED ACCIDENTALY. ; ; - NEW FUNCTION GET TIME (200) IS IMPLEMENTED TO GET THE CORRECT DATE AND TIME. ; ENTRY DE IS ADDRESS TO PUT TIME. THE DATE AND TIME RECORD HAS THE FOLLOWING ; LAYOUT: ; DATE: DEFS 2 DATE = 1 (SU 01-JAN-1978) ; DATE = 65535 (SU 05-JUN-2157) ; HOUR: DEFS 1 HOUR IN BCD ; MINUTE: DEFS 1 MINUTE IN BCD ; SECOND: DEFS 1 SECOND IN BCD ; FUNCTION WORKS ONLY IF CORRECT P2BIOS FUNCTION CALL IS INSTALLED. ; ; - NEW FUNCTION SET TIME (201) IS IMPLEMENTED TO SET THE CORRECT DATE AND TIME. ; ENTRY DE IS ADDRESS NEW TIME. THE DATE AND TIME LAYOUT IS AS ABOVE. ; FUNCTION WORKS ONLY IF CORRECT P2BIOS FUNCTION CALL IS INSTALLED. ; ; * DISK SIZE CAN BE AS LARGE AS 65536*16K=1 048 576 K BYTE=1 G BYTE. ; * FILE SIZE CAN BE AS LARGE AS 32*64*16K=32 768K BYTE=32 M BYTE. ; ; ; YOU CAN ENABLE/DISABLE THE FUNCTIONS MENTIONED ABOVE WITH THE FOLLOWING ; DATA AND ADDRESSES. ; ; - ENABLE PATH NAME BY PUTTING ADDRESS OF PATH IN P2DOS+11H. IF THIS VALUE IS ; 0000H NO PATH IS USED. THIS ADDRESS IS NORMALLY SET TO 0040H. ; ; - ENABLE P2DOS TIME AND DATE STAMP BY PUTTING THE CORRECT P2BIOS ADDRESS ; AT P2DOS+13H. THIS ADDRESS IS NORMALY SET TO THE P2BIOS CONSOLE STATUS ; FUNCTION. ; ; - YOU CAN ENABLE THE 256 CHARACTER DELAY FUNCTION BY SETTING BIT 0 OF ; ADDRESS P2DOS+15H. THIS BIT IS NORMALLY SET TO 1. ; ; - YOU CAN ENABLE PUBLIC FILES BY SETTING BIT 1 OF ADDRESS P2DOS+15H. ; THIS BIT IS NORMALLY SET TO 1. ; ; - YOU CAN ENABLE IGNORE R/O STATUS BY SETTING BIT 2 OF ADDRESS P2DOS+15H ; THIS BIT IS NORMALLY SET TO 1. ; ; ENTRY ADDRESSES P2BIOS ; ; FUNC NAME INPUT PARAMETERS RETURNED VALUES ; 0 BOOT NONE NONE ; 1 WBOOT NONE NONE ; 2 CONST NONE A=0FFH IF READY ; A=000H IF NOT READY ; 3 CONIN NONE A=CONSOLE CHARACTER ; 4 CONOUT C=CONSOLE CHARACTER NONE ; 5 LIST C=LIST CHARACTER NONE ; 6 PUNCH C=PUNCH CHARACTER NONE ; 7 READER NONE A=READER CHARACTER ; 8 HOME NONE NONE ; 9 SELDSK C=DRIVE NUMBER (0..15) HL=DISK PARAMETER HEADER ADDRESS ; E=INIT SELECT FLAG HL=0000H IF INVALID DRIVE ; 10 SETTRK BC=TRACK NUMBER NONE ; 11 SETSEC BC=SECTOR NUMBER NONE ; 12 SETDMA BC=DMA ADDRESS NONE ; 13 READ NONE A=00H IF NO ERROR ; A=01H IF ERROR ; 14 WRITE C=0 WRITE DATA A=00H IF NO ERROR ; C=1 WRITE DIRECTORY A=01H IF ERROR ; C=2 WRITE NEW DATA ; 15 LISTST NONE A=000H IF READY ; A=0FFH IF NOT READY ; 16 SECTRN BC=LOGICAL SECTOR HL=PHYSICAL SECTOR NUMBER ; NUMBER ; DE=TRANSLATION TABLE ; ADDRESS ; XX TIME C=000H GET TIME HL=POINTER TO TIME TABLE ; C=0FFH UPDATE CLOCK HL+0:DATE LSB SINCE 1,1,1978 ; HL=POINTER TO TIME HL+1:DATE MSB ; TABLE HL+2:HOURS (BCD) ; HL+3:MINUTES (BCD) ; HL+4:SECONDS (BCD) ; ; XX SETDSK NONE NONE ; ; ; RAMLOW EQU 00000H ; START ADDRESS MEMORY DOSSTRT EQU 0C000H ; Place your BDOS start address here P2BIOS EQU DOSSTRT+0E00H ; ; ; BOOT EQU P2BIOS+00000H ; P2 SYSTEM COLD BOOT WBOOT EQU P2BIOS+00003H ; P2 SYSTEM WARM BOOT CONST EQU P2BIOS+00006H ; P2 SYSTEM CONSOLE STATUS CONIN EQU P2BIOS+00009H ; P2 SYSTEM CONSOLE INPUT CONOUT EQU P2BIOS+0000CH ; P2 SYSTEM CONSOLE OUTPUT LIST EQU P2BIOS+0000FH ; P2 SYSTEM LIST OUTPUT PUNCH EQU P2BIOS+00012H ; P2 SYSTEM PUNCH OUTPUT READER EQU P2BIOS+00015H ; P2 SYSTEM READER INPUT HOME EQU P2BIOS+00018H ; P2 SYSTEM HOME DISK SELDSK EQU P2BIOS+0001BH ; P2 SYSTEM SELECT DISK SETTRK EQU P2BIOS+0001EH ; P2 SYSTEM SELECT TRACK SETSEC EQU P2BIOS+00021H ; P2 SYSTEM SELECT SECTOR SETDMA EQU P2BIOS+00024H ; P2 SYSTEM SET DMA ADDRESS READ EQU P2BIOS+00027H ; P2 SYSTEM READ 128 BYTES WRITE EQU P2BIOS+0002AH ; P2 SYSTEM WRITE 128 BYTES LISTST EQU P2BIOS+0002DH ; P2 SYSTEM LIST STATUS SECTRN EQU P2BIOS+00030H ; P2 SYSTEM SECTOR TRANSLATION TIME EQU P2BIOS+00033H ; P2 SYSTEM GET/SET TIME SETDSK EQU P2BIOS+00036H ; P2 SYSTEM DISK CHANGE SENSE ; ; ; INTERNAL DEFINITIONS ; CONTC EQU 003H ; KEY TO GENERATE WARM BOOT CONTE EQU 005H ; BREAK LINE CONTH EQU 008H ; BACKSPACE TAB EQU 009H ; TAB LF EQU 00AH ; LINE FEED CR EQU 00DH ; CARRIAGE RETURN CONTP EQU 010H ; SET/RESET PRINT FLAG CONTQ EQU 011H ; restart console output CONTR EQU 012H ; REPEAT LINE CONTS EQU 013H ; STOP CONSOLE OUTPUT CONTU EQU 015H ; DELETE LINE CONTX EQU 018H ; DELETE LINE (BACKSPACES) DRVSEP EQU 03AH ; DRIVE SEPERATOR (:) RUBOUT EQU 07FH ; DELETE LAST CHAR IGNORE EQU CONTX ; Ignore R/O status character ; MAXCMD EQU 40 ; NUMBER OF VALID P2DOS COMMANDS ; ;============================= ;P2DOS Customization ; ;(Formerly a.k.a. SUPRBDOS) ; ;See INSTALL.DOC for more information on installation. ; FALSE EQU 0 TRUE EQU 0FFH ; ; ;Assembly Conditionals: ; DOTIME EQU TRUE ; True if time stamp is supported ; ; ;Some systems, like the Kaypro 4, only recognize changes between single ;and double sided disks when the system is warm booted; bdos function 13 ;(reset disk) will not work. By adding a "hook" to the bios of these ;machines and setting RESDSK to TRUE, bdos functions 13 and 37 will ;allowchanges between single and double sided disks. Very handy for disk ;housekeeping utilities such as NSWP, NULU, and cataloging programs. ; ;The "hook" is added as follows: Obtain the source to your computer's BIOS. ;Examine the code for WARM BOOT. Somewhere, there should be a call to ;a routine which initializes the disk system after a warm boot, or which ;detects changes between single and double sided disks. Call this routine ;DISKINT for purposes of discussion. Modify your bios's cold boot routine to ;initialize 3 bytes at address SETDSK as "JP DISKINT". The location of SETDSK ;is arbitrary, it may be in your bios, or in a reserved spot in CP/M's page 0. ;It is assumed here that "JP DISKINT" is in the BIOS jump table one beyond ;the jump to the time routine. ; RESDSK EQU FALSE ; Set to true only if your drives ; can have more than one disk format. ; Set to false if, for example, ; drive A only supports single ; density disks and drive B only ; supports double density two-sided ; disks. IF YOU CAN'T MIX FORMATS ; ON THE SAME DRIVE OR YOUR BIOS ; ALWAYS KNOWS WHAT THE PROPER ; FORMAT IS, YOU DON'T NEED A ; DISKINT ROUTINE!!!! ; PATHON EQU FALSE ; True to enable BDOS search. ; If PATHON is set, then some code ; must be inserted either here or in ; the BIOS to initialize the path ; at RAMLOW+040H ; SYSRO EQU TRUE ; True for system files read only. ; Since P2DOS allows the run-time ; cancel of read-only status, this ; is a good saftey precaution to ; prevent accedential erasure. ; XONOFF EQU TRUE ; True for "true" xon/xoff ; When set, only ^S stops console ; output and only ^Q restarts output. ; NOXOFF EQU FALSE ; True disables ^S as a restart char ; When set, the first ^S stops ; console output, but subsequent ; ^S's will not restart output. ; XONOFF takes presedent if both ; are true. ; DEFFLG EQU 0FFH ; Default value for flag byte. ; set bit means: ; bit 0=public file enable ; bit 1=delay 256 char active ; bit 2=allow r/o ignore ; SERNO1 EQU 000H ; enter your serial number here SERNO2 EQU 000H SERNO3 EQU 000H SERNO4 EQU 000H SERNO5 EQU 000H SERNO6 EQU 000H ; ; .Z80 ASEG ORG 0100H ; L80 loads the code at 100H but, .PHASE DOSSTRT ; M80 compiles the code for exectuion ; at DOSSTRT $INCLUDE P2DOS1.MAC $INCLUDE P2DOS2.MAC ; DOSSTOP EQU $ ; IF ((DOSSTOP-DOSSTRT) GT 3584) *Bdos too large!!* ENDIF ; END