TITLE "GETDOS - Determine DOS Type and Version" ;================================================================= ; Copyright (C) 1989 by Harold F. Bower. Permission granted to ; Alpha Systems Corp. to distribute with The Libraries, Version 4 ;----------------------------------------------------------------- ; Author : Harold F. Bower ; Date : 12/26/88 ; Version : 1.0 ; Module : DDOSTYPE ; Abstract: This routine evaluates Dos version return calls and sets ; variables in DSEG to the DOS Type and version. Functions 12 ; and 48 are used to isolate the type. Recognized DOSes with ; identifying characters are: ; CP/M 1.x = "1" ; CP/M 2.x = "2" ; CP/M 3.x = "3" ; ZSDOS = "S" ; ZDDOS = "D" ; ZRDOS = "R" ; Unknown = Binary 0 ; The version number is a vendor specific byte value. ; Revision: ;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ; Module Entry Points: PUBLIC GETDOS, DOSVER, DOSTYP ; External References: EXT @BDOS ; From SYSLIB, Ver 4 .Z80 CSEG ;====================================================================== ; NAME - GETDOS ; Entry: None ; Exit : A = Set to symbolic Dos type character ; Variable DOSTYP Set to symbolic character for type of Dos ; Uses : AF ; Special Requirements: None ;====================================================================== GETDOS: PUSH HL ; Save regs PUSH BC LD C,12 ; Check for CP/M, MP/M Version CALL @BDOS LD A,H ; Is it CP/M? OR A ; ..(must be 0 if so) JR NZ,UNKDOS ; ...jump unknown if not LD A,L ; Else check version of CP/M or compatible CP 20H ; Is it CP/M 1.x? JR C,HAV1 ; ..jump if so CP 30H ; Is it CP/M 2.x? JR C,CKV2 ; ..jump if so and check other Doses CP 40H ; Is it CP/M 3.x? JR C,HAV3 ; ..jump if so and set type JR UNKDOS ; Else set unknown Dos type ; We now have CP/M 2 or compatible. Check for ZSDOS/ZDDOS CKV2: LD (DOSVER),HL ; Save this in case true CP/M 2.x LD C,48 ; Are we running under ZSDOS/ZDDOS? CALL @BDOS LD A,H ; Examine the Dos Type CP 'S' ; Is it "S" for ZSDOS? JR Z,HAVDOS ; ..jump setting vars if so CP 'D' ; Is it "D" for ZDDOS? JR Z,HAVDOS ; ..jump setting vars if so OR L ; Set flags to indicate ZRDOS or Unknown LD A,'R' ; Else assume ZRDOS and set values JR NZ,HAVDOS ; ..Jump to set ZRDOS if valid (<>0) return LD HL,(DOSVER) ; Else we have true CP/M 2.x, so retrieve LD A,'2' ; .version # and set type ID DEFB 01H ; ..Trash BC and fall thru with CP/M 2.x HAV1: LD A,'1' ; Set for CP/M 1.x DEFB 01H ; ..Trash BC and fall thru with CP/M 1.x HAV3: LD A,'3' ; Set for CP/M 3.x DEFB 01H ; ..Trash BC and fall thru with CP/M 3.x UNKDOS: LD A,00 ; Set for Unknown Dos HAVDOS: LD H,A ; Set Dos Type Char in reg LD (DOSVER),HL ; ..and save in global variable POP BC ; Restore regs POP HL RET ;============== D a t a S t o r a g e ============== DSEG DOSVER: DEFS 1 ; DOS Version number (Vendor specific) DOSTYP: DEFS 1 ; DOS type "R"=ZRDOS,"S"=ZSDOS,"D"=ZDDOS,0=unk END