summaryrefslogtreecommitdiff
path: root/v4.0/src/SELECT/MACROS3.INC
diff options
context:
space:
mode:
Diffstat (limited to 'v4.0/src/SELECT/MACROS3.INC')
-rw-r--r--v4.0/src/SELECT/MACROS3.INC382
1 files changed, 382 insertions, 0 deletions
diff --git a/v4.0/src/SELECT/MACROS3.INC b/v4.0/src/SELECT/MACROS3.INC
new file mode 100644
index 0000000..13af97e
--- /dev/null
+++ b/v4.0/src/SELECT/MACROS3.INC
@@ -0,0 +1,382 @@
1;;****************************************************************************
2;; Assembler MACROS for use with SELECT.
3;; File: MACROS3.INC
4;; Latest Change Date: July 28, 1987
5;;
6;; These macros define powerful assembler verbs neccessary for SELECT.
7;;
8;; Note: Many of the macros make use of an ASCII-N string for passing
9;; parameters. The string is defined below.
10;; DW count
11;; DB "string_variable",?
12;;
13;; COUNT is the length of the string and is a word.
14;; It is necessary to follow the string with at least one byte for the
15;; purpose of changing the ASCII-N string to an ASCII-Z string.
16;;
17;;****************************************************************************
18page ;AN000;
19;;************************************************************************;;
20;;
21;; CHECK_DEFAULT_DRIVE: Determine if default drive is drive A:
22;;
23;; SYNTAX: CHECK_DEFAULT_DRIVE
24;;
25;; INPUT:
26;; None.
27;;
28;; OUTPUT:
29;; CY = 0: Drive A is the default drive
30;; CY = 1: Drive A is NOT the default drive
31;;
32;; OPERATION: DOS Function Call 19h is performed to get the default drive.
33;; If the default drive is not drive A (AL <> 0), the carry flag is set.
34;;
35;;************************************************************************;;
36CHECK_DEFAULT_DRIVE MACRO ;;AN000;
37 MOV AH, 19H ;;AN000; Fn. Number for getting current drive
38 DOSCALL ;;AN000;
39 .IF < ZERO AL > ;;AN000; Is A the default drive?
40 CLC ;;AN000; Yes!
41 .ELSE ;;AN000;
42 STC ;;AN000; No!
43 .ENDIF ;;AN000;
44 ENDM ;;AN000;
45;;************************************************************************;;
46;;
47;; CHECK_DISK: Check is the specified fixed disk is present. If disk is
48;; present, return disk partition status.
49;;
50;; SYNTAX: CHECK_DISK immed_disk, var_disk, var_status, var_status_2, buffer
51;;
52;; INPUT:
53;; immed_disk = 1: First fixed disk.
54;; = 2: Second fixed disk.
55;;
56;; OUTPUT:
57;; var_disk = 0: Disk not present.
58;; = 1: Disk present - No DOS or EDOS partitions
59;; = 2: Disk present - DOS or EDOS partitions exist
60;; var_status = 01H: Primary DOS partition exists
61;; = 02H: Extended DOS partitions exists
62;; = 04H: Logical drives exist
63;; = 08H: Free space exists in EDOS partition
64;; = 10H: Free space exists on disk
65;; More than one status bit can be set
66;; var_status_2 = 0: There is no free space in EDOS partition and the
67;; disk.
68;; = 1: There is free space in the EDOS partition.
69;; = 2: There is no EDOS partition, but there is free
70;; disk space.
71;; buffer = Buffer for fixed disk status information.
72;;
73;; OPERATION: A call is performed to the FDISK utility (GET_DISK_STATUS)
74;; to get the status of the specified fixed disk drive. The returned
75;; status information is checked and the memory variables are set as
76;; specified above.
77;;
78;;************************************************************************;;
79CHECK_DISK MACRO IMMED_DISK, VAR_DISK, VAR_STATUS, VAR_STATUS_2, BUFFER ;;AN000;
80
81 LEA DI, BUFFER ;;AN000;
82 MOV AX, IMMED_DISK ;;AN000;
83 CALL CHECK_DISK_ROUTINE ;;AN000;
84 MOV VAR_DISK, CX ;;AN000;
85 MOV VAR_STATUS, BX ;;AN000;
86 MOV VAR_STATUS_2, DX ;;AN000;
87 ENDM ;;AN000;
88;;************************************************************************;;
89;;
90;; CHECK_DISKETTE: Check the type of diskettes attached to the system.
91;;
92;; SYNTAX: CHECK_DISKETTE var_disk_a, var_disk_b, var_tot, buffer
93;;
94;; INPUT:
95;; buffer = Buffer for IOCTL
96;;
97;; OUTPUT:
98;; var_disk_a = 0FFH Diskette drive A not present
99;; = 0 360k diskette (5.25 inch)
100;; = 1 740K diskette (3.5 inch)
101;; = 2 1.2M diskette (5.25 inch)
102;; = 7 1.44M diskette (3.5 inch)
103;; var_disk_b = 0FFH Diskette drive B not present
104;; = 0, 1, 2, 7 as defined above for diskette A.
105;; var_tot = total number of diskettes attached (1 or 2)
106;;
107;; OPERATION: Interrupt 11H is performed to get equipment status. The number
108;; of diskettes attached will be returned as specified above. A call
109;; is then made to the IOCTL function of DOS (AH = 44h) to get the type
110;; of media the disk drives are. The function returns its data in a
111;; 26 byte buffer, where the second byte contains a description of the
112;; drive. The codes are as follows:
113;; 0 = 320/360 KB 5-1/4-inch
114;; 1 = 5-1/4-inch, 1.2 MB
115;; 2 = 3-1/2-inch, 720 KB
116;; 3 = 8 inch single density
117;; 4 = 8 inch double density
118;; 5 = Fixed disk
119;; 6 = Tape drive
120;; 7 = Other
121;;
122;;************************************************************************;;
123CHECK_DISKETTE MACRO VAR_DISK_A, VAR_DISK_B, VAR_TOT, BUFFER ;;AN000;
124 INT 11H ;;AN000; See how many diskette drives there are
125 .IF < BIT AL NAND DISKETTES_EXIST > ;;AN000; Are there diskettes?
126 MOV AX, 0 ;;AN000; There are no diskettes.
127 .ELSE ;;AN000;
128 MOV CL,6 ;;AN000; Number of bits to shift
129 SHR AL,CL ;;AN000; Diskette bits are 6 and 7. Shift to right
130 MOV AH, 0 ;;AN000; Clear the high byte
131 INC AX ;;AN000; Make into the actual number of diskettes
132 .IF < AX GT MAX_NUM_DISKETTE > ;;AN000; Are there more then 2 diskette drives?
133 MOV AX, MAX_NUM_DISKETTE ;;AN000; Yes, but we are only concern with two.
134 .ENDIF ;;AN000;
135 .ENDIF ;;AN000;
136 MOV VAR_TOT, AL ;;AN000; Store the number of diskette drives.
137 ;;**********************************************************************
138 ;; Examine diskette drive A first.
139 ;;**********************************************************************
140 MOV VAR_DISK_A, E_DISKETTE_INV ;;AN000;
141 MOV VAR_DISK_B, E_DISKETTE_INV ;;AN000;
142 MOV DI, OFFSET VAR_DISK_A ;;AN000;
143 .FOR BL = 1 TO VAR_TOT ;;AN000;
144 MOV AX, 440DH ;;AN000;
145 MOV CX, 0860H ;;AN000;
146 MOV DX, OFFSET BUFFER ;;AN000;
147 DOSCALL ;;AN000;
148 MOV SI, OFFSET BUFFER + 1 ;;AN000;
149 MOV AL, [SI] ;;AN000;
150 .IF < AL EQ E_DISKETTE_1200 > ;;AN111;JW
151 MOV AL,E_DISKETTE_360 ;;AN111;JW
152 .ENDIF ;;AN111;JW
153 .IF < AL EQ E_DISKETTE_1440 > ;;AN000;
154 .IF < <WORD PTR [SI+3]> NE E_1440_TRACKS > OR ;;AN000;
155 .IF < <WORD PTR [SI+19]> NE E_1440_SECTORS > ;;AN000;
156 MOV AL, E_DISKETTE_INV ;;AN000;
157 .else ;yuk- don't have time to get this working on 1.4M drives
158 mov al, e_diskette_720 ;so pretend there is no such thing
159 .ENDIF ;;AN000;
160 .ENDIF ;;AN000;
161 MOV [DI], AL ;;AN000;
162 MOV DI, OFFSET VAR_DISK_B ;;AN000;
163 .NEXT BL ;;AN000;
164 ;;**********************************************************************
165 ;; Check for compatible A: to B: combinations ;AN000;JW
166 ;;**********************************************************************
167 .IF < VAR_DISK_A eq E_DISKETTE_720 > or ;;AN000;JW
168 .IF < VAR_DISK_A eq E_DISKETTE_1440 > ;;AN000;JW
169 .IF < VAR_DISK_B eq E_DISKETTE_360 > ;;AN000;JW
170 MOV VAR_DISK_B, E_DISKETTE_INV ;;AN000;JW
171 DEC VAR_TOT ;;AN000;JW
172 .ENDIF ;;AN000;JW
173 .ENDIF ;;AN000;JW
174 .IF < VAR_DISK_A eq E_DISKETTE_360 > ;;AN000;JW
175 .IF < VAR_DISK_B eq E_DISKETTE_720 > or ;;AN000;JW
176 .IF < VAR_DISK_B eq E_DISKETTE_1440 > ;;AN000;JW
177 MOV VAR_DISK_B, E_DISKETTE_INV ;;AN000;JW
178 DEC VAR_TOT ;;AN000;JW
179 .ENDIF ;;AN000;JW
180 .ENDIF ;;AN000;JW
181 ;;
182 ENDM ;;AN000;
183;;************************************************************************;;
184;;
185;; CHECK_VALID_MEDIA: Check if the diskettes attached will support
186;; installation of SELECT. Also, check if install destination will
187;; be selected by user or determined by SELECT.
188;;
189;; SYNTAX: CHECK_VALID_MEDIA var_disk_a, var_disk_b, var_tot, var_disk,
190;; var_def, var_index, var_option
191;;
192;; INPUT:
193;; var_disk_a = diskette A presence and type
194;; var_disk_b = diskette B presence and type
195;; var_tot = total number of dikettes
196;; var_disk = 0: first fixed disk is not present
197;; > 0: first fixed disk is present
198;;
199;; OUTPUT:
200;; CY = 0: Success variables are returned as defined below.
201;; CY = 1: Error - invalid media
202;; var_def = 0 use default destination drive
203;; = 1 default destination drive not applicable
204;; var_index = 1 default destination is drive C
205;; = 2 default destination is drive B
206;; var_option = 1 possible drive B or C
207;; = 2 possible drive A or C
208;; = 3 possible drive A or B or C
209;; = 4 possible drive A or B
210;;
211;; OPERATION: The diskette drive types are checked for valid media type.
212;; If the diskette media types are valid, a check is made to determine if
213;; install destination will be user selected or will be determined by
214;; SELECT. The following checks are made.
215;;
216;; - if one diskette, return valid media and default destination is A
217;;
218;; - If two diskettes only, return valid and:
219;; if A = B, default = B
220;; if A <> B, default = A
221;; if A and B are mixed 720 and 1.44, destination option is A or B
222;;
223;; - If one diskette and a fixed disk only, return valid media and
224;; destination option is drive A or C.
225;;
226;; - If two diskettes and a fixed disk, return valid media and:
227;; if A = B, destination option is B or C
228;; if A <> B, destination option is A or C
229;; if A and B are mixed 720 and 1.44, destination option is
230;; A or B or C
231;;
232;;************************************************************************;;
233CHECK_VALID_MEDIA MACRO VAR_DISK_A, VAR_DISK_B, VAR_TOT, VAR_DISK, VAR_DEF, VAR_INDEX, VAR_OPTION ;;AN111;JW
234
235 MOV AL, VAR_DISK_A ;;AN111;JW
236 MOV BL, VAR_DISK_B ;;AN111;JW
237 MOV SI, VAR_DISK ;;AN111;JW
238 CALL CHECK_VALID_MEDIA_ROUTINE ;;AN111;JW
239 MOV VAR_DEF, CL ;;AN111;JW
240 MOV VAR_INDEX, DX ;;AN111;JW
241 MOV VAR_OPTION, DI ;;AN111;JW
242 ENDM ;;AN111;JW
243;;************************************************************************;;
244;;
245;; SCAN_DISK_TABLE: Scan the specified disk status table from the
246;; specified index item for specified field and return status information.
247;;
248;; SYNTAX: SCAN_DISK_TABLE immed_disk, var_index, var_ref
249;;
250;; INPUT:
251;; immed_disk = 1: First fixed disk
252;; = 2: Second fixed disk
253;; var_index = Index of the information to return
254;;
255;; OUTPUT:
256;; var_ret = 0: Success - Index into table is valid
257;; = 1: Error - Index invalid or end of table
258;; N_NAME_PART = Partition name.
259;; N_SIZE_PART = Partition size.
260;; N_STATUS_PART = Partition status
261;; P_DRIVE_PART = Drive letter assigned.
262;;
263;; OPERATION:
264;; Starts scanning the disk table from the point indicated by var_index
265;; for either the name, status or type. The table is scanned until either
266;; the desired entry is found, or the end of the table is reached. If
267;; the end of the table is reached before a marching entry is found, then
268;; var_ret returns 1, else if an entry is found, it returns 0.
269;; If found, var_index will also return the index of the entry.
270;;
271;; Note: The index of the first entry in the table is 1.
272;;
273;;************************************************************************;;
274SCAN_DISK_TABLE MACRO IMMED_DISK, VAR_INDEX, VAR_RET ;;AN000;
275
276 MOV CX, IMMED_DISK ;;AN000;
277 MOV AX, VAR_INDEX ;;AN000;
278 CALL SCAN_DISK_TABLE_ROUTINE ;;AN000;
279 MOV VAR_RET, AX ;;AN000;
280 ENDM ;;AN000;
281;;************************************************************************;;
282;;
283;; UPDATE_DISK_TABLE: Update the specifed disk status table for the
284;; specified index item.
285;;
286;; SYNTAX: UPDATE_DISK_TABLE immed_disk, var_index, var_ref
287;;
288;; INPUT:
289;; immed_disk = 1: First fixed disk
290;; = 2: Second fixed disk
291;; var_index = Index into table
292;;
293;; OUTPUT:
294;; var_ret = 0: Success - Index into table is valid
295;; = 1: Error - Index into table is not valid
296;; partition name = N_NAME_PART
297;; partition size = N_SIZE_PART
298;; partition status = N_STATUS_PART
299;; partition type = N_TYPE_PART
300;; drive letter = P_DRIVE_PART
301;;
302;; OPERATION: If the index into the disk table is valid, the disk table
303;; is updated for the specifed index. Disk status information is obtained
304;; from pre-defined locations as specified above.
305;;
306;;************************************************************************;;
307UPDATE_DISK_TABLE MACRO IMMED_DISK, VAR_INDEX, VAR_REF ;;AN000;
308
309 MOV CX, IMMED_DISK ;;AN000;
310 MOV AX, VAR_INDEX ;;AN000;
311 CALL UPDATE_DISK_TABLE_ROUTINE ;;AN000;
312 MOV VAR_REF, AX ;;AN000;
313 ENDM ;;AN000;
314;;************************************************************************;;
315;;
316;; GET_PARTITION_SIZE: Return DOS and EDOS partition size in ASCII-N format.
317;;
318;; SYNTAX: GET_PARTITION_SIZE var_tot, var_dos, name_dos, name_edos
319;;
320;; INPUT:
321;; var_tot = Free disk space
322;; var_dos = Size of DOS partition
323;;
324;; OUTPUT:
325;; name_dos = Size of DOS partition in ASCII-N format.
326;; name_edos = Size of EDOS partition in ASCII-N format.
327;;
328;; OPERATION: The DOS partition size is converted to ASCII-N format.
329;; The size of the Extended DOS partition is obtained by subtracting
330;; the size of DOS partition from the free disk space. If the size of
331;; any partition is zero, a zero string length is returned.
332;;
333;;************************************************************************;;
334GET_PARTITION_SIZE MACRO VAR_TOT, VAR_DOS, NAME_DOS, NAME_EDOS ;;AN000;
335 ;;
336 PUSH VAR_TOT ;;AN000; Save the variable
337 MOV AX, VAR_DOS ;;AN000; Size of the DOS partition.
338 SUB VAR_TOT, AX ;;AN000; Subtract the dos partition size
339 WORD_TO_CHAR VAR_TOT, NAME_EDOS ;;AN000; Convert binay values to ASCII
340 WORD_TO_CHAR VAR_DOS, NAME_DOS ;;AN000;
341 POP VAR_TOT ;;AN000;
342 ENDM ;;AN000;
343;;************************************************************************;;
344;;
345;; CHECK_MACHINE: Return the model byte
346;;
347;; SYNTAX: CHECK_MACHINE mac_type p_flag
348;;
349;; INPUT:
350;;
351;; OUTPUT:
352;; mac_type = model byte
353;; p_flag = PS2 presence (E_YES, E_NO)
354;;
355;; OPERATION: An INT 15H is executed to return a pointer to the system
356;; descriptor vector. The model byte is retrieved from this vector
357;; and placed in the supplied variable. The ps2 flag is also set.
358;;
359;;************************************************************************;;
360CHECK_MACHINE MACRO MAC_TYPE, P_FLAG ;;AN000;JW
361 ;;
362 MOV AH,0C0H ;;AN000; INT 15H system config request
363 INT 15H ;;AN000; system services
364 .IF < nc > ;;AN000;
365 MOV AH,ES: BYTE PTR [BX+2] ;;AN000; get the model byte
366 .ELSE ;;AN000;
367 MOV AH,00 ;;AN000;
368 .ENDIF ;;AN000;
369 MOV MAC_TYPE,AH ;;AN000; save the model byte
370 MOV P_FLAG,E_YES ;;AN000;
371 ;;
372 .IF < AH eq 0 > or ;;AN000; if old pc
373 .IF < AH eq 0FBH > or ;;AN000; if pc XT
374 .IF < AH eq 0F9H > or ;;AN000; if pc convertible
375 .IF < AH eq 0FCH > and ;;AN000; if pc AT and
376 .IF <<ES:BYTE PTR [BX+3]> le 02 > ;;AN000; sub-model byte le 2
377 MOV P_FLAG,E_NO ;;AN000; not a ps2
378 .ENDIF ;;AN000;
379 ENDM ;;AN000;
380
381INCLUDE MACROS4.INC ;AN000;
382 \ No newline at end of file