page 60,132 name need title NEED Version 6.7 .model tiny ; this is a COM file .286p ; need an smsw to check virtual state ; ideally need 32 bit registers too. ; code runs on more primitive machines. ; E Q U A T E S DEBUGGING equ 1 ; 1 if debugging 0 if not ; inserts some register dumps comment | ================= Copyright: (c) 1991-2017 Roedy Green, Canadian Mind Products Greg Chicares wrote Weird.Com upon which NEED is based. This program is copyrighted, but the executables be freely distributed for non-military use only. You may cannibalize from the source for your own programs. Ensures various environmental conditions are present. AVOID.COM ensures various environmental conditions are absent. SNIFF.COM simply reports on conditions. Many people contributed directly or indirectly. Many more helped by testing. The beta testers from BIX include: aGurski aRog Blaszczak bQuerry bStrauss dSparks Fred.Robinson gChicares hGessau instantel JeBarr lFirrantello Ligo M.Love macbeth Mike123 mReay pRoub rlis sSchneider terjeM tron wlMoore MFG, tenThumbs NEED DESQ LAN RAM:204K DOS3.3+ NEED has a great many more possible commands. See the manual for a complete list or study the source code where the MCT table is generated. Please report bugs and problems to: Roedy Green Canadian Mind Products #101 - 2536 Wark Street Victoria, BC Canada V8T 4G8 tel:(250) 361-9093 mailto:roedyg@mindprod.com http://mindprod.com | %include versionhistory.asm ;============================================================== ; R E G I S T E R C O N V E N T I O N S comment | Subroutines may trash any registers they please except CS: DS: ES: SS: and of course the outputs. Often BP or other registers are specially preserved. |; end of comment ; .XALL turns on macro expansion .SALL turns it off ; .XLIST turns off listing .LIST turns it on ;============================================================== %include equates.asm defaultSuffix equ Bang OR NeedDefaults ;; e.g. NEED C:400K+! %include macros.asm %include segments.asm %include variables.asm ; M E S S A G E S String segment CopyrightMsg label byte db '°±²Û NEED 6.7 Û²±°' cr cr db 'Freeware to ensure computer has desired hardware and software present.' cr db 'Copyright: (c) 1991-2017 Roedy Green, Canadian Mind Products' cr db '#101 - 2536 Wark Street, Victoria, BC Canada V8T 4G8',13,10 db 'tel:(250) 361-9093 mailto:roedyg@mindprod.com http://mindprod.com',13,10 db 'May be freely distributed and used for any purpose except military.' cr db 'email: roedyg@mindprod.com' eos SyntaxErrMsg label byte cr db '°±²Û Error in Command line Û²±°' db 07d eos SyntaxMsg label byte cr db ' Try something like this:' cr db 'NEED DESQview DOS3.3- 80386! C:3MB RAM:300K+ TIME:23:59' cr db 'If errorlevel 1 GoTo Trouble' cr cr db 'DESQview means you must be running under DESQview.' cr db 'DOS3.3- means you need DOS 3.3 or lower.' cr db '80386! means you must have an 386 processor, no more no less.' cr db 'C:3MB means you must have at least 3 MB of free disk space on drive C:.' cr db 'RAM:300K+ means you must have at least 300KB or more conventional RAM free.' cr db 'TIME:23:59 means the program can only run during the last minute of the day.' cr db 'There are many other tests supported. See NEED.TXT or NEED.ASM.' cr db 'If conditions met, ERRORLEVEL=0, if not ERRORLEVEL=1' eos String ends ;============================================================== START proc far ; entry point. ; P R O C E D U R E S Main proc near call SayCr ; just in case DOS left us on a partial line ; start a fresh one. call CountrySeps ; get country dependent chars to use as ; comma and decimal point mov Success,-1 ; Mark that we are succesful so far in this group mov PreviousSuccess,0 ; mark that no previous group of OR tests ; succeeded. call Parse ; calls tests as it parses each parm mov al,Success ; We succeed if current OR group or ; previous OR group succeeded. or al,PreviousSuccess jnz AllOk OhOh: call SayCr saystr 'Need failed' call SayCr ; Failed at least one test mov ax, 4c01h ; ERRORLEVEL = 1 int 21h ; Die AllOk: ; no need for a SNIFF successful message call SayCr saystr 'Need successful' call SayCr mov ax, 4c00h ; ERRORLEVEL = 0 int 21h ; normal exit to dos, all tests passed abort: ; If user blows it, we still treat him well! ; Must as if he had said NEED HELP say CopyRightMsg ; CopyRight banner say SyntaxErrMsg say SyntaxMsg mov ax, 4c04h ; ERRORLEVEL = 4 int 21h ; Die, with serious errorlevel Main endp ;============================================================== Handle1Parm proc near ; Parses one command on the line, and does all work associated with it. ; On Entry si points to counted string to look for, CX is its length ; not counting the count byte that Findcommand temporarily inserts ; leading / has already be pruned off by Filter call Trisect ; break into 3 pieces C:400K+ ; C 400K + ; Command Capacity Suffix ; ComAddr:ComLen points to C ; CapAddr:CapLen points to 400K ; Sufaddr:SufLen points to + ; for /MSDOS3.1+ ; MSDOS 3.1 + ; ComAddr:ComLen points to MSDOS3.1 ; CapAddr:CapLen is null ; SufAddr:SufLen points to + ; AlpAddr:AlpLen points to MSDOS ; VerAddr:VerLen points to 3.1 call ParseCapacity ; get desired Capacity e.g. /RAM:424K ; parse capacity first so we can have both ; /DPMI and /DMPI:400K commands ; also handles /TIME:23:30 call ParseVersion ; get possible version e.g. 310 in /DOS3.1 ; parse early on to allow possibility of both ; a /MSDOS and /MSDOS3.0 command mov cx,CapLen jcxz CantBeCapacity ShouldBeCapacity: ; should be a Capacity ; search only for capacity type keywords ; e.g. /RAM:400K mov al,CapacityStyle or TimeStyle mov si,ComAddr mov cx,ComLen call FindCommand ; find command in list ; return with pointer to MCT in BP jnc FoundCommand jmp Abort CantBeCapacity: ; might be an implied or a version type. ; First search only for Implied type keywords ; e.g. /DPMI /A20 mov al,ImpliedStyle mov si,ComAddr ; Search for implied first to catch false mov cx,ComLen ; version types e.g. /A20 which are really implied call FindCommand ; find command in list ; return with pointer to MCT in BP jnc FoundCommand ; It might have been a version style ; e.g. /MSDOS3.3 ; Don't even look unless there is some ; appended version stuff cmp verlen,0 je NoSuchCommand mov al,VersionStyle mov si,AlpAddr mov cx,AlpLen call FindCommand ; find command in list ; must match whether we have capacity or not ; return with pointer to MCT in BP jnc FoundCommand NoSuchCommand: jmp Abort ; could not find a matching command FoundCommand: mov TheBase,BP ; found match, either at comaddr or alpaddr call ParseSuffix ; Parse suffixes and store results in OkMask ; Can only be done after MCT entry found call CalcWantLevel ; Wantlevel has several possible sources ; usually just 1=present. call DoTheTest ; Test for the feature with one of the Testxxxx ; routines call Goldilocks ; see it level is below or above desired level ; returns AX=1 too low, 2=just right, 4 too high ; For NEED the OkMask is just the way it is. test al,OkMask ; decide what we got is ok. jz FailedTest PassedTest: saystr ' ' ; same length as fail msg call DisplayTheTest ; display the result with one of the Displayxxx call SayCr ; routines ret FailedTest: mov Success,0 ; note that we failed a test saystr 'oops: ' call DisplayTheTest call SayCr ret ; keep going to test other parameters Handle1Parm endp ;============================================ TestANDOperator proc near ; This is not really a test, but a logical operator to separate tests: ; E.g. NEED 80387 80386 AND 80486 ; We implement it to look like a test routine. ; It does nothing really, since tests are separated by an IMPLIED AND. mov ax,1 ; dummy as if present, i.e. good ret TestAndOperator endp ;============================================ if DEBUGGING TestDebugExist proc near ; Force tests to turn on debugging dumps. data segment Debug dw 0 ; do we want debugging dumps to show? ; initially no. If DEBUG command, then yes. data ends mov Debug,-1 ; turn on slow testing mov ax,1 ; dummy as if present ret TestDEBUGExist endp endif ;============================================ %include common.asm %include thetests.asm %include wrapup.asm