; M A C R O S common to all three utilities. CPUIDx macro ;; in case no support for CPUID instruction db 0fh,0a2h endm ;====== CR macro ; Carriage return line feed db 0dh,0ah endm ;====== EOS macro ; marks end of display string db 0dh,0ah,'$' endm ;====== Say macro String ;; MACRO To display message on screen ;; on entry String is address of $ delimited message. ;; Preserves all registers push dx lea dx,String call Say$ pop dx endm ;====== saystr macro StringLit ;; MACRO To display message on screen ;; on entry Stringlit is a string in form "abcd", without term $ ;; Preserves all registers String segment Place = $ db StringLit,'$' ;; build $ terminated string literal String ends push dx mov dx,offset COM:Place ;; masm gets confused with lea call Say$ pop dx endm ;====== if DEBUGGING ;; debugging version DUMP macro StringLit local Bypass ;; MACRO To display bebugging message on screen with regisiter dump ;; on entry Stringlit is a string in form "abcd", without term $ ;; Preserves all registers test Debug,-1 jz Bypass saystr StringLit call DumpRegs Bypass: endm else ;; production version DUMP macro StringLit ;; production dummy version does nothing endm endif ;====== SayWhen macro Value,StringLit local NotThisOne ;; must be VERY first line ;; Compares ax to value and displays string literal if match, ;; and returns, otherwise does nothing. ;; Sort of a poor man's CASE ;; Clobbers DX String segment Place = $ db StringLit,'$' ;; build $ terminated string literal String ends cmp ax,Value jne NotThisOne lea dx,Place call Say$ ret NotThisOne: endm ;====== ACCEPT macro ClassName,ExternalName,Where,AuxInput,Allowables,NeedDefaults,AvoidDefaults,Junk ;; Generates one line in the Master Control Table (MCT) ;; A little too fat to ininitialize with a STRUC. ;; See notes below on the MCT structure we are building. ;; Check that all parms needed are present .errb ;; missing parm .errb if ((Where) and (ImpliedStyle or Aux)) NE 0 .erre Auxinput ;; should not be 0 else .errnz Auxinput ;; must be 0 endif .errb .errb .errb .errnb ;; too much stufff String segment public ;; Build the external name of the command in separate region of memory ;; to avoid messing up the fixed length table items. StringStart = $ org $+1 ;; leave room for count db &ExternalName& ;; build variable length string StringEnd = $ StringLen = (StringEnd - StringStart) - 1 org StringStart ;; overlay count byte db StringLen org StringEnd ;; move to end of string String ends Table segment public dw offSet COM:StringStart ;; save pointer to counted string ;; e.g. 03 RAM dw &AuxInput& ;; auxilliary input to test routine ;; e.g. 0=A: 1=B: drive number ;; Also used for implied level desired. ;; Build the multipurpose flag word ;; -- suffixes allowed ;; -- where the desired test value comes from implied, capacity etc. db Bang OR (&Allowables&) OR (&Where&) ;; always allow Bang ;; Flags for suffixes allowed ;; Also Where flags to control ;; where data to compute WantLevel ;; comes from. ;; Build default suffix ;; Default suffixes to assume if ;; user supplies no prefixes. ;; Bang always one ;; of them. db defaultSuffix dw offset COM:Test&ClassName& ;; pointer to Test routine ;; determines if feature present ;; and in what degree dw offset COM:Display&ClassName& ;; pointer to display routine ;; displays current state in words Table ends endm ;======