page 60,132 name need title AVOID Version 6.7 .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 | ================= avoid.com Copyright: (c) 1991-2017 Roedy Green, Canadian Mind Products Greg Chicares (BIX: gchicares) wrote Weird.Com upon which AVOID 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. 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 AVOID DESQ LAN RAM:204K DOS3.3+ AVOID 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 AvoidDefaults ;; e.g. AVOID DESQVIEW ;; add Bang meaning want to ;; avoid hitting bang on %include macros.asm ;============================================================= stack segment stack ; keep MS link happy by providing null stack stack ends ;============================================================== CODE segment PARA ; start off in code. %include variables.asm ; M E S S A G E S String segment CopyrightMsg label byte db '°±²Û AVOID 6.7 Û²±°' cr cr db 'Freeware to ensure undesirable hardware and software is absent.' 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 'AVOID DESQview DOS3.3- 80386! C:3MB TIME:23:59+ TIME:00:01-' cr db 'If errorlevel 1 GoTo Trouble' cr cr db 'DESQview means you must NOT be running under DESQview.' cr db 'DOS3.3- means you need something above DOS 3.3.' cr db '80386! means you cannot run on a 386 processor.' cr db 'C:3MB avoid running if there is only 3 MB or less on drive C:' cr db 'TIME:23:59+ means avoid running the program in last minute of the day.' cr db 'TIME:00:10- means avoid running the program in first ten minutes 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 ;============================================================== com group CODE,data,Table,String ; force data segments to go at the end! assume CS:com,DS:com,ES:nothing,SS:com ; seg regs cover everything org 100H ; in Code segment ;============================================================== START proc far ; 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 'Avoid 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 'Avoid successful' 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 not OkMask ; invert bits in OkMask for AVOID ; so what is acceptable will be the reverse ; of what it would be had we used NEED ; 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,0 ; dummy as if not 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 ax,0 ; dummy as if not present ret TestDEBUGExist endp endif ;============================================ %include common.asm %include thetests.asm %include wrapup.asm