Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

875 lines
39 KiB

  1. ;/*
  2. ; * Microsoft Confidential
  3. ; * Copyright (C) Microsoft Corporation 1988 - 1991
  4. ; * All Rights Reserved.
  5. ; */
  6. ;************************************************************
  7. ;**
  8. ;** NAME: Support for HP PCL printers added to GRAPHICS.
  9. ;**
  10. ;** DESCRIPTION: I added an entry in the VERB_JMP_TAB and the equate DEF to
  11. ;** handle the new statement DEFINE. I also made the new variable
  12. ;** DATA_TYPE have the default of DATA_COL in the procedure
  13. ;** LOAD_PROFILE, so the default assumes IBM type printers.
  14. ;**
  15. ;** DOCUMENTATION NOTES: This version of GRLOAD.ASM differs from the previous
  16. ;** version only in terms of documentation.
  17. ;**
  18. ;**
  19. ;************************************************************
  20. PAGE ,132 ;AN000;
  21. TITLE DOS - GRAPHICS Command - Profile Load Modules ;AN000;
  22. ;AN000;
  23. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
  24. ;; DOS - GRAPHICS Command
  25. ;;
  26. ;; ;AN000;
  27. ;; File Name: GRLOAD.ASM ;AN000;
  28. ;; ---------- ;AN000;
  29. ;; ;AN000;
  30. ;; Description: ;AN000;
  31. ;; ------------ ;AN000;
  32. ;; This file contains the modules used to load the ;AN000;
  33. ;; GRAPHICS profile into resident memory. ;AN000;
  34. ;; ;AN000;
  35. ;; ************* The EGA Dynamic Save Area will be built (by ;AN000;
  36. ;; ** NOTE ** CHAIN_INTERRUPTS in file GRINST.ASM) over top of these ;AN000;
  37. ;; ************* modules to avoid having to relocate this save just before ;AN000;
  38. ;; terminating. This is safe since the maximum memory used is ;AN000;
  39. ;; 288 bytes and the profile loading modules are MUCH larger than ;AN000;
  40. ;; this. So GRLOAD.ASM MUST be linked before GRINST.ASM and after ;AN000;
  41. ;; GRPRINT.ASM. ;AN000;
  42. ;; ;AN000;
  43. ;; ;AN000;
  44. ;; Documentation Reference: ;AN000;
  45. ;; ------------------------ ;AN000;
  46. ;; PLACID Functional Specifications ;AN000;
  47. ;; OASIS High Level Design ;AN000;
  48. ;; OASIS GRAPHICS I1 Overview ;AN000;
  49. ;; ;AN000;
  50. ;; Procedures Contained in This File: ;AN000;
  51. ;; ---------------------------------- ;AN000;
  52. ;; LOAD_PROFILE - Main module for profile loading ;AN000;
  53. ;; ;AN000;
  54. ;; Include Files Required: ;AN000;
  55. ;; ----------------------- ;AN000;
  56. ;; ?????????? - Externals for profile loading modules ;AN000;
  57. ;; ;AN000;
  58. ;; External Procedure References: ;AN000;
  59. ;; ------------------------------ ;AN000;
  60. ;; None ;AN000;
  61. ;; ;AN000;
  62. ;; Linkage Instructions: ;AN000;
  63. ;; --------------------- ;AN000;
  64. ;; Refer to GRAPHICS.ASM ;AN000;
  65. ;; ;AN000;
  66. ;; Change History: ;AN000;
  67. ;; --------------- ;AN000;
  68. ;; ;AN000;
  69. ;; ;AN000;
  70. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
  71. ;; ;AN000;
  72. ;; ;AN000;
  73. CODE SEGMENT PUBLIC 'CODE' BYTE ;; ;AN000;
  74. ;; ;AN000;
  75. INCLUDE STRUC.INC ;; ;AN000;
  76. INCLUDE GRINST.EXT ;; Bring in external declarations ;AN000;
  77. ;; for transient command processing ;AN000;
  78. INCLUDE GRSHAR.STR ;; ;AN000;
  79. INCLUDE GRPARSE.EXT ;; ;AN000;
  80. INCLUDE GRLOAD2.EXT ;; ;AN000;
  81. INCLUDE GRLOAD3.EXT ;; ;AN000;
  82. INCLUDE GRMSG.EQU ;; ;AN000;
  83. ;; ;AN000;
  84. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
  85. ;; ;AN000;
  86. ;; Public Symbols ;AN000;
  87. ;; ;AN000;
  88. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
  89. ;; ;AN000;
  90. PUBLIC LOAD_PROFILE ;AN000;
  91. PUBLIC GROW_SHARED_DATA ;AN000;
  92. PUBLIC BLOCK_START ;AN000;
  93. PUBLIC BLOCK_END ;AN000;
  94. PUBLIC FIRST_BLOCK ;AN000;
  95. PUBLIC MAX_BLOCK_END ;AN000;
  96. PUBLIC GROUPS_DONE ;AN000;
  97. PUBLIC STMTS_DONE ;AN000;
  98. PUBLIC STMTS_DONE ;AN000;
  99. PUBLIC PTD_FOUND ;AN000;
  100. PUBLIC BUILD_STATE ;AN000;
  101. PUBLIC STMT_ERROR ;AN000;
  102. PUBLIC FILE_ERROR ;AN000;
  103. PUBLIC PARSE_ERROR ;AN000;
  104. PUBLIC END_OF_FILE ;AN000;
  105. PUBLIC MEM_OVERFLOW ;AN000;
  106. PUBLIC STMT_BUFFER ;AN000;
  107. PUBLIC CUR_STMT ;AN000;
  108. PUBLIC PREV_STMT ;AN000;
  109. PUBLIC PRT_BOX_ERROR ;AN000;
  110. ;; ;AN000;
  111. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
  112. ;; ;AN000;
  113. ASSUME CS:CODE,DS:CODE ;; ;AN000;
  114. ;; ;AN000;
  115. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
  116. ;; ;AN000;
  117. ;; ;AN000;
  118. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
  119. ;; ;AN000;
  120. ;; Profile Load Variables ;AN000;
  121. ;; ;AN000;
  122. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
  123. ;; ;AN000;
  124. NO EQU 0 ;; ;AN000;
  125. YES EQU 1 ;; ;AN000;
  126. ;; ;AN000;
  127. ;; ;AN000;
  128. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
  129. ;; ;AN000;
  130. ;; Module Name: ;AN000;
  131. ;; LOAD_PROFILE ;AN000;
  132. ;; ;AN000;
  133. ;; Input Parameters: ;AN000;
  134. ;; DS,ES,SS - points to our transient segment ;AN000;
  135. ;; ;AN000;
  136. ;; Output Parameters: ;AN000;
  137. ;; Temporary Shared Data Area ;AN000;
  138. ;; Carry flag set if errors in profile. ;AN000;
  139. ;; ;AN000;
  140. ;; Data Structures Referenced: ;AN000;
  141. ;; Shared Data Area ;AN000;
  142. ;; Profile Load Variables ;AN000;
  143. ;; ;AN000;
  144. ;; Description: ;AN000;
  145. ;; Build the profile information in the Temporary Shared Data Area. ;AN000;
  146. ;; The information will be built for the printer type parsed off ;AN000;
  147. ;; the command line. ALL Printer Type Descriptions will be ;AN000;
  148. ;; parsed to issue error messages and determine the maximum ;AN000;
  149. ;; amount of resident memory required for initial load. ;AN000;
  150. ;; The Shared Data Area begins with a fixed length section ;AN000;
  151. ;; and then has several variable length sections. PROFILE_BUILD_PTR ;AN000;
  152. ;; is used to build the variable length sections by serving ;AN000;
  153. ;; as a running pointer to the sections as they are built. ;AN000;
  154. ;; ;AN000;
  155. ;; Register Usage: ;AN000;
  156. ;; BP - points to beginning of Temp Shared Data ;AN000;
  157. ;; ;AN000;
  158. ;; Called By: ;AN000;
  159. ;; GRAPHICS_INSTALL ;AN000;
  160. ;; ;AN000;
  161. ;; External Calls: ;AN000;
  162. ;; PARSE_PRINTER, PARSE_DISPLAYMODE, PARSE_SETUP, PARSE_RESTORE ;AN000;
  163. ;; PARSE_PRINTBOX, PARSE_GRAPHICS, PARSE_COLORSELECT, ;AN000;
  164. ;; PARSE_COLORPRINT, GET_STATEMENT ;AN000;
  165. ;; SYSPARSE ;AN000;
  166. ;; ;AN000;
  167. ;; Logic: ;AN000;
  168. ;; IF profile path not specified THEN ;AN000;
  169. ;; PROFILE_PATH := "GRAPHICS.PRO" /* Current directory */ ;AN000;
  170. ;; Open profile using PROFILE_PATH ;AN000;
  171. ;; IF error during open THEN ;AN000;
  172. ;; PROFILE_PATH := ARG(V0) with "GRAPHICS.COM" replaced ;AN000;
  173. ;; by "GRAPHICS.PRO" ;AN000;
  174. ;; Open profile using PROFILE_PATH ;AN000;
  175. ;; IF error during open THEN ;AN000;
  176. ;; Issue "Cannot find profile" msg ;AN000;
  177. ;; Set carry flag ;AN000;
  178. ;; RETURN ;AN000;
  179. ;; ENDIF ;AN000;
  180. ;; ENDIF ;AN000;
  181. ;; ELSE ;AN000;
  182. ;; Open profile using specified path ;AN000;
  183. ;; IF error during open THEN ;AN000;
  184. ;; Issue "Cannot find profile" msg ;AN000;
  185. ;; Set carry flag ;AN000;
  186. ;; RETURN ;AN000;
  187. ;; ENDIF ;AN000;
  188. ;; ENDIF ;AN000;
  189. ;; /* don't start building until we find our printer type*/ ;AN000;
  190. ;; PARSE_MODE := NOBUILD ;AN000;
  191. ;; MAX_BUILD_PTR := 0 ;AN000;
  192. ;; CALL GROW_SHARED_DATA(PROFILE-BUILD_PTR,size of FIXED PART ;AN000;
  193. ;; of Shared Data Area) ;AN000;
  194. ;; WHILE (not end of file) AND (no I/O error) DO ;AN000;
  195. ;; CALL GET_STATEMENT ;AN000;
  196. ;; IF I/O error THEN ;AN000;
  197. ;; Issue error message ;AN000;
  198. ;; ELSE ;AN000;
  199. ;; CALL SYSPARSE to parse the statement verb ;AN000;
  200. ;; IF verb found THEN ;AN000;
  201. ;; IF invalid verb THEN ;AN000;
  202. ;; Issue error message ;AN000;
  203. ;; PARSE_MODE := ERROR ;AN000;
  204. ;; ELSE ;AN000;
  205. ;; CASE statement verb ;AN000;
  206. ;; PRINTER: ;AN000;
  207. ;; CALL PARSE_PRINTER ;AN000;
  208. ;; DISPLAYMODE: ;AN000;
  209. ;; CALL PARSE_DISPLAYMODE ;AN000;
  210. ;; PRINTBOX: ;AN000;
  211. ;; CALL PARSE_PRINTBOX ;AN000;
  212. ;; SETUP: ;AN000;
  213. ;; CALL PARSE_SETUP ;AN000;
  214. ;; RESTORE: ;AN000;
  215. ;; CALL PARSE_RESTORE ;AN000;
  216. ;; GRAPHICS: ;AN000;
  217. ;; CALL PARSE_GRAPHICS ;AN000;
  218. ;; COLORPRINT: ;AN000;
  219. ;; CALL PARSE_COLORPRINT ;AN000;
  220. ;; COLORSELECT: ;AN000;
  221. ;; CALL PARSE_COLORSELECT ;AN000;
  222. ;; ENDCASE ;AN000;
  223. ;; IF error on statement THEN ;AN000;
  224. ;; IF OVERFLOW bit set in RETURN_CODE THEN ;AN000;
  225. ;; Issue "Insufficient memory" message ;AN000;
  226. ;; RETURN to caller ;AN000;
  227. ;; ELSE ;AN000;
  228. ;; IF MISSING bit set in RETURN_CODE THEN ;AN000;
  229. ;; Issue "required statement missing" message ;AN000;
  230. ;; ENDIF ;AN000;
  231. ;; IF INVALID bit set in RETURN_CODE THEN ;AN000;
  232. ;; Issue "statement invalid" message ;AN000;
  233. ;; ENDIF ;AN000;
  234. ;; IF SEQUENCE bit set in RETURN_CODE THEN ;AN000;
  235. ;; Issue "out of sequence" message ;AN000;
  236. ;; ENDIF ;AN000;
  237. ;; display the statement in error ;AN000;
  238. ;; ENDIF ;AN000;
  239. ;; PARSE_MODE := ERROR ;AN000;
  240. ;; ENDIF ;AN000;
  241. ;; ENDIF ;AN000;
  242. ;; ENDIF ;AN000;
  243. ;; ENDIF ;AN000;
  244. ;; ENDWHILE ;AN000;
  245. ;; ;AN000;
  246. ;; /* Check length of last PTD */ ;AN000;
  247. ;; IF PROFILE_BUILD_PTR > MAX_BUILD_PTR THEN ;AN000;
  248. ;; MAX_BUILD_PTR := PROFILE_BUILD_PTR ;AN000;
  249. ;; ENDIF ;AN000;
  250. ;; ;AN000;
  251. ;; /* Make sure all required statements were in previous */ ;AN000;
  252. ;; /* Printer Type Description */ ;AN000;
  253. ;; /* Must have completed PRINTER, DISPLAYMODE, PRINTBOX and */ ;AN000;
  254. ;; /* GRAPHICS statements */ ;AN000;
  255. ;; IF PRT+DISP+BOX+GR bits not all set in STMTS_DONE THEN ;AN000;
  256. ;; Issue "required statement missing" message ;AN000;
  257. ;; Display "END OF FILE." ;AN000;
  258. ;; ENDIF ;AN000;
  259. ;; ;AN000;
  260. ;; IF errors during build THEN ;AN000;
  261. ;; set carry flag ;AN000;
  262. ;; ELSE ;AN000;
  263. ;; SD_TOTAL_SIZE := MAX_BUILD_PTR - TEMP_SHARED_DATA_PTR ;AN000;
  264. ;; ENDIF ;AN000;
  265. ;; RETURN ;AN000;
  266. ;; ;AN000;
  267. ;; ;AN000;
  268. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
  269. ;; ;AN000;
  270. FILE_NOT_FOUND EQU 2 ;; DOS Int21H error codes ;AN000;
  271. PATH_NOT_FOUND EQU 3 ;; ;AN000;
  272. ;; ;AN000;
  273. SUBLIST LABEL BYTE ;; Message substituion list for stmt # ;AN000;
  274. DB 11 ;; sublist size ;AN000;
  275. DB 0 ;; ;AN000;
  276. DW STMT_NUM ;; \ Dword pointer to item ;AN000;
  277. SUBLIST_SEG DW ? ;; / ;AN000;
  278. DB 1 ;; Substitution # ;AN000;
  279. ;; Flag format a0sstttt ;; ;AN000;
  280. DB 00100001B ;; Unsigned binary word - left align ;AN000;
  281. ;;;; DB 00000000B ;; charcater ;AN000;
  282. DB 0 ;; max field width ;AN000;
  283. DB 1 ;; min width width ;AN000;
  284. DB ' ' ;; pad characeter ;AN000;
  285. ;; ;AN000;
  286. STMT_NUM DW 0 ;; ;AN000;
  287. ;; ;AN000;
  288. ;; ;AN000;
  289. FILE_ERROR DB 0 ;; Error opening or reading PROFILE ;AN000;
  290. PARSE_ERROR DB 0 ;; Syntax errors in PROFILE ;AN000;
  291. END_OF_FILE DB 0 ;; 1 if end of file ;AN000;
  292. MEM_OVERFLOW DB 0 ;; 1 if insufficient memory ;AN000;
  293. ;; ;AN000;
  294. STMT_ERROR DB 0 ;; Error flag for individual stmt errors ;AN000;
  295. MISSING EQU 1 ;; Required statement missing ;AN000;
  296. INVALID EQU 2 ;; Invalid statement format ;AN000;
  297. SEQUENCE EQU 4 ;; Statement out of sequence ;AN000;
  298. ;; ;AN000;
  299. DEFAULT_PATH DB "GRAPHICS.PRO",0 ;; ;AN000;
  300. BUFFER DB 64 DUP("$") ;; ;AN000;
  301. ;; ;AN000;
  302. HANDLE DW 0 ;; Profile handle ;AN000;
  303. ;; ;AN000;
  304. BUILD_STATE DB 0 ;; 1 if we are currently building ;AN000;
  305. ;; data. 0 means syntax checking ;AN000;
  306. ;; only ;AN000;
  307. ;; ;AN000;
  308. ;; Keep track of whether this PTD ;AN000;
  309. ;; matches the type requested ;AN000;
  310. PTD_FOUND DB 0 ;; Values are NO (0), YES (1) and ;AN000;
  311. PROCESSED EQU 2 ;; PROCESSED (2) ;AN000;
  312. ;; ;AN000;
  313. VERB DB 0 ;; PTR into VERB_JMP_TAB ;AN000;
  314. ;; ;AN000;
  315. VERB_JMP_TAB LABEL WORD ;; ;AN000;
  316. DW OFFSET PARSE_PRINTER ;; ;AN000;
  317. DW OFFSET PARSE_DISPLAYMODE ;; ;AN000;
  318. DW OFFSET PARSE_PRINTBOX ;; ;AN000;
  319. DW OFFSET PARSE_SETUP ;; ;AN000;
  320. DW OFFSET PARSE_RESTORE ;; ;AN000;
  321. DW OFFSET PARSE_GRAPHICS ;; ;AN000;
  322. DW OFFSET PARSE_COLORPRINT ;; ;AN000;
  323. DW OFFSET PARSE_COLORSELECT ;; ;AN000;
  324. DW OFFSET PARSE_DARKADJUST ;; ;AN000;
  325. ;\/ ~~mda(001) ----------------------------------------------------------
  326. ; Added the following so that LOAD_PROFILE will parse the
  327. ; DEFINE statement.
  328. ;
  329. DW OFFSET PARSE_DEFINE ;
  330. ;/\ ~~mda(001) ----------------------------------------------------------
  331. ;; ;AN000;
  332. STMTS_DONE DW 0 ;; ;AN000;
  333. GROUPS_DONE DW 0 ;; ;AN000;
  334. PREV_STMT DW 0 ;; ;AN000;
  335. CUR_STMT DW 0 ;; ;AN000;
  336. ;; ;AN000;
  337. PRT EQU 1 ;; Bit masks for STMTS_DONE and ;AN000;
  338. DISP EQU 2 ;; GROUPS_DONE. There is one ;AN000;
  339. BOX EQU 4 ;; bit for each statement except ;AN000;
  340. GR EQU 8 ;; DARKADJUST ;AN000;
  341. SET EQU 10H ;; ;AN000;
  342. REST EQU 20H ;; ;AN000;
  343. COLS EQU 40H ;; ;AN000;
  344. COLP EQU 80H ;; ;AN000;
  345. DARK EQU 100H ;; ;AN000;
  346. ;\/ ~~mda(001) ----------------------------------------------------------
  347. ; Added the following for the DEFINE statement.
  348. ;
  349. DEF EQU 200H
  350. ;/\ ~~mda(001) ----------------------------------------------------------
  351. ;; ;AN000;
  352. BLOCK_START DW ? ;; Extents of the variable size block ;AN000;
  353. BLOCK_END DW ? ;; currently being built ;AN000;
  354. ;; These are relative to the ;AN000;
  355. ;; start of the Shared Data Area ;AN000;
  356. ;; so the area can be relocated ;AN000;
  357. MAX_BLOCK_END DW 0 ;; End of largest PTD contained ;AN000;
  358. ;; in profile ;AN000;
  359. FIRST_BLOCK DW ? ;; Pointer to first variable block ;AN000;
  360. ;; (end of fixed part) ;AN000;
  361. PRT_BOX_ERROR DB 0 ;; ;AN000;
  362. ;; ;AN000;
  363. LOAD_PROFILE PROC NEAR ;; ;AN000;
  364. ;; ;AN000;
  365. PUSH CS ;; ;AN000;
  366. POP SUBLIST_SEG ;; setup segment for message sublist ;AN000;
  367. ;; ;AN000;
  368. CALL OPEN_FILE ;; ;AN000;
  369. .IF <FILE_ERROR EQ YES> ;; Check for error during open ;AN000;
  370. STC ;; ;AN000;
  371. RET ;; ;AN000;
  372. .ENDIF ;; ;AN000;
  373. ;; ;AN000;
  374. MOV BP,TEMP_SHARED_DATA_PTR ;; BP points to START of Shared Data ;AN000;
  375. MOV AX,SIZE SHARED_DATA_AREA_STR ;; size of fixed part of Shared Data ;AN000;
  376. MOV BLOCK_END,0 ;; Initialize BLOCK_START,BLOCK_END ;AN000;
  377. MOV [BP].DARKADJUST_VALUE,0 ;; Init some values in the fixed ;AN000;
  378. MOV [BP].NUM_PRT_COLOR,0 ;; area ;AN000;
  379. MOV [BP].COLORPRINT_PTR,-1 ;; ;AN000;
  380. MOV [BP].NUM_PRT_BANDS,0 ;; ;AN000;
  381. MOV [BP].COLORSELECT_PTR,-1 ;; ;AN000;
  382. MOV [BP].PRINTER_TYPE,BLACK_WHITE ;; ;AN000;
  383. ;\/ ~~mda(001) ----------------------------------------------------------
  384. ; Make the default DATA_TYPE be DATA_COL for the IBM printers.
  385. ;
  386. MOV [BP].DATA_TYPE,DATA_COL ;
  387. ;/\ ~~mda(001) ----------------------------------------------------------
  388. CALL GROW_SHARED_DATA ;; to the first byte after the ;AN000;
  389. ;; fixed part of Shared Data ;AN000;
  390. MOV AX,BLOCK_END ;; Variable size data will be built ;AN000;
  391. MOV BLOCK_START,AX ;; starting at BLOCK_START ;AN000;
  392. MOV FIRST_BLOCK,AX ;; Save start of variable data ;AN000;
  393. ;; ;AN000;
  394. MOV SI,BUFFER_PTR ;; Set up SI for GET_BYTE ;AN000;
  395. CALL GET_BYTE ;; Get first byte from file ;AN000;
  396. MOV NEXT_BYTE,AL ;; and store it ;AN000;
  397. MOV BUFFER_PTR,SI ;; Save SI for next GET_BYTE ;AN000;
  398. .WHILE <END_OF_FILE EQ NO> AND ;; Keep parsing until end of file or ;AN000;
  399. .WHILE <FILE_ERROR EQ NO> ;; file error occurs ;AN000;
  400. MOV STMT_ERROR,0 ;; Clear parse error flags ;AN000;
  401. CALL GET_STATEMENT ;; Get next profile statement ;AN000;
  402. INC STMT_NUM ;; ;AN000;
  403. .IF NC ;; Carry flag set if get unsuccessful ;AN000;
  404. CALL PARSE_VERB ;; Index into verb jump table returned ;AN000;
  405. ;; in BX ;AN000;
  406. .IF <AX EQ 0> THEN ;; AX=0 if there is a recognized ;AN000;
  407. MOV AX,CUR_STMT ;; ;AN000;
  408. MOV PREV_STMT,AX ;; Save last statement verb ;AN000;
  409. CALL VERB_JMP_TAB[BX] ;; statement to parse ;AN000;
  410. .ELSEIF <AX NE -1> THEN ;; ;AN000;
  411. OR STMT_ERROR,INVALID ;; ;AN000;
  412. MOV PARSE_ERROR,YES ;; ;AN000;
  413. MOV BUILD_STATE,NO ;; ;AN000;
  414. .ENDIF ;; ;AN000;
  415. .IF <STMT_ERROR NE 0> ;; An error was detected ;AN000;
  416. CALL SHOW_PARSE_ERROR ;; ;AN000;
  417. MOV PARSE_ERROR,YES ;; ;AN000;
  418. MOV STMT_ERROR,0 ;; ;AN000;
  419. .ENDIF ;; ;AN000;
  420. .ENDIF ;; ;AN000;
  421. .ENDWHILE ;; ;AN000;
  422. ;; ;AN000;
  423. .IF <BIT STMTS_DONE AND PRT> ;; Must have at least one PRINTER ;AN000;
  424. CALL TERMINATE_DISPLAYMODE ;; Terminate the last PRINTER and ;AN000;
  425. CALL TERMINATE_PRINTER ;; DISPLAYMODE sections ;AN000;
  426. .ELSE ;; ;AN000;
  427. OR STMT_ERROR,MISSING ;; ;AN000;
  428. .ENDIF ;; ;AN000;
  429. .IF <STMT_ERROR NE 0> ;; ;AN000;
  430. CALL SHOW_PARSE_ERROR ;; Issue Profile syntax messages ;AN000;
  431. .ENDIF ;; ;AN000;
  432. ;; ;AN000;
  433. ;; ;AN000;
  434. MOV AX,3E00H ;; Close the file ;AN000;
  435. MOV BX,HANDLE ;; ;AN000;
  436. INT 21H ;; ;AN000;
  437. ;; ;AN000;
  438. .IF <PARSE_ERROR EQ YES> ;; ;AN000;
  439. MOV AX,SYNTAX_ERRORS ;; Issue "Syntax errors found in ;AN000;
  440. MOV CX,0 ;; profile" message. ;AN000;
  441. CALL DISP_ERROR ;; ;AN000;
  442. .ENDIF ;; ;AN000;
  443. ;; ;AN000;
  444. .IF <PTD_FOUND EQ NO> ;; Did we find the requested printer ;AN000;
  445. MOV AX,INVALID_PRT ;; type? If not issue error ;AN000;
  446. MOV CX,0 ;; message. ;AN000;
  447. CALL DISP_ERROR ;; ;AN000;
  448. MOV PARSE_ERROR,YES ;; ;AN000;
  449. .ENDIF ;; ;AN000;
  450. ;; ;AN000;
  451. .IF <PARSE_ERROR EQ YES> OR ;; ;AN000;
  452. .IF <PRT_BOX_ERROR EQ YES> OR ;; ;AN000;
  453. .IF <FILE_ERROR EQ YES> ;; Set carry flag if profile load ;AN000;
  454. STC ;; was unsuccessful ;AN000;
  455. .ELSE ;; ;AN000;
  456. .IF <MEM_OVERFLOW EQ YES> ;; Everthing else was OK BUT we ran ;AN000;
  457. .IF <INSTALLED EQ YES> ;; out of memory!!! ;AN000;
  458. MOV AX,NB_FREE_BYTES ;; ;AN000;
  459. .IF <AX LT RESIDENT_SHARED_DATA_SIZE> ;AN000;
  460. MOV AX,NO_MEMORY ;; We ran out of physical memory! ;AN000;
  461. .ELSE ;; ;AN000;
  462. MOV AX,UNABLE_RELOAD ;; Allocated shared data is too small ;AN000;
  463. .ENDIF ;; ;AN000;
  464. .ELSE ;; ;AN000;
  465. MOV AX,NO_MEMORY ;; We ran out of physical memory ;AN000;
  466. .ENDIF ;; ;AN000;
  467. MOV CX,0 ;; ;AN000;
  468. CALL DISP_ERROR ;; ;AN000;
  469. STC ;; Indicate unsuccessful ;AN000;
  470. .ELSE ;; ;AN000;
  471. MOV AX,MAX_BLOCK_END ;; Extent of largest PRINTER section ;AN000;
  472. MOV [BP].SD_TOTAL_SIZE,AX ;; we parsed. ;AN000;
  473. CLC ;; SUCCESSFUL LOAD!!!! ;AN000;
  474. .ENDIF ;; ;AN000;
  475. .ENDIF ;; ;AN000;
  476. ;; ;AN000;
  477. RET ;; ;AN000;
  478. ;; ;AN000;
  479. LOAD_PROFILE ENDP ;; ;AN000;
  480. ;; ;AN000;
  481. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
  482. ;; ;AN000;
  483. ;; Module Name: ;AN000;
  484. ;; SHOW_PARSE_ERROR ;AN000;
  485. ;; ;AN000;
  486. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
  487. ;; ;AN000;
  488. CARRAIGE_RET EQU 13 ;; ;AN000;
  489. LINE_FEED EQU 10 ;; ;AN000;
  490. ;; ;AN000;
  491. SHOW_PARSE_ERROR PROC ;; ;AN000;
  492. ;; ;AN000;
  493. MOV ERROR_DEVICE,STDOUT ;; profile syntax messages to STDOUT ;AN000;
  494. ;; ;AN000;
  495. .IF <BIT STMT_ERROR AND MISSING> ;AN000;
  496. PUSH SI ;; ;AN000;
  497. MOV AX,MISSING_STMT ;; ;AN000;
  498. MOV CX,1 ;; ;AN000;
  499. MOV SI,OFFSET SUBLIST ;; ;AN000;
  500. CALL DISP_ERROR ;; ;AN000;
  501. POP SI ;; ;AN000;
  502. .ENDIF ;; ;AN000;
  503. .IF <BIT STMT_ERROR AND INVALID> ;AN000;
  504. PUSH SI ;; ;AN000;
  505. MOV AX,INVALID_STMT ;; ;AN000;
  506. MOV CX,1 ;AN000;
  507. MOV SI,OFFSET SUBLIST ;; ;AN000;
  508. CALL DISP_ERROR ;; ;AN000;
  509. POP SI ;; ;AN000;
  510. .ENDIF ;; ;AN000;
  511. .IF <BIT STMT_ERROR AND SEQUENCE> ;AN000;
  512. PUSH SI ;; ;AN000;
  513. MOV AX,OUT_SEQ_STMT ;; ;AN000;
  514. MOV CX,1 ;AN000;
  515. MOV SI,OFFSET SUBLIST ;; ;AN000;
  516. CALL DISP_ERROR ;; ;AN000;
  517. POP SI ;; ;AN000;
  518. .ENDIF ;; ;AN000;
  519. ;; ;AN000;
  520. MOV DI,STMT_END_INDEX ;; ;AN000;
  521. MOV STMT_BUFFER[DI],'$' ;; For display ;AN000;
  522. MOV AH,9 ;; ;AN000;
  523. MOV DX,OFFSET STMT_BUFFER ;AN000;
  524. INT 21H ;; ;AN000;
  525. MOV DL,CARRIAGE_RET ;; ;AN000;
  526. MOV AH,2 ;; ;AN000;
  527. INT 21H ;; ;AN000;
  528. MOV DL,LINE_FEED ;; ;AN000;
  529. MOV AH,2 ;; ;AN000;
  530. INT 21H ;; ;AN000;
  531. ;; ;AN000;
  532. MOV ERROR_DEVICE,STDERR ;; reset to STDERR ;AN000;
  533. ;; ;AN000;
  534. RET ;; ;AN000;
  535. ;; ;AN000;
  536. SHOW_PARSE_ERROR ENDP ;; ;AN000;
  537. ;; ;AN000;
  538. ;; ;AN000;
  539. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
  540. ;; ;AN000;
  541. ;; Module Name: ;AN000;
  542. ;; OPEN_FILE ;AN000;
  543. ;; ;AN000;
  544. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
  545. ;; ;AN000;
  546. ;; ;AN000;
  547. OPEN_FILE PROC NEAR ;; ;AN000;
  548. ;; ;AN000;
  549. .IF <PROFILE_PATH NE 0> ;; If a path was specified then ;AN000;
  550. MOV DX,OFFSET PROFILE_PATH ;; try and open it ;AN000;
  551. MOV AX,3D00H ;; ;AN000;
  552. INT 21H ;; Open it ;AN000;
  553. .IF C ;; Open error if carry flag set ;AN000;
  554. .IF <AX EQ FILE_NOT_FOUND> OR ;; Check for error other than ;AN000;
  555. .IF <AX EQ PATH_NOT_FOUND> ;; file not found ;AN000;
  556. MOV AX,PROFILE_NOT_FOUND ;; ;AN000;
  557. MOV CX,0 ;; ;AN000;
  558. CALL DISP_ERROR ;; Issue "File not found" common msg ;AN000;
  559. MOV FILE_ERROR,YES ;; ;AN000;
  560. .ELSE ;; ;AN000;
  561. CALL FILE_ERROR_PROC ;; Issue "Open error" ;AN000;
  562. .ENDIF ;; ;AN000;
  563. .ELSE ;; ;AN000;
  564. MOV HANDLE,AX ;; ;AN000;
  565. .ENDIF ;; File opened OK ;AN000;
  566. .ELSE ;; No path parameter ;AN000;
  567. MOV DX,OFFSET DEFAULT_PATH ;; Try and open "GRAPHICS.PRO" ;AN000;
  568. MOV AX,3D00H ;; ;AN000;
  569. INT 21H ;; Open it ;AN000;
  570. .IF C ;; Open error if carry flag set ;AN000;
  571. .IF <AX EQ FILE_NOT_FOUND> OR ;; Check for file not found error ;AN000;
  572. .IF <AX EQ PATH_NOT_FOUND> ;; ;AN000;
  573. CALL COPY_ARGV0 ;; ;AN000;
  574. MOV DX,OFFSET PROFILE_PATH ;; Try and open "GRAPHICS.PRO" in ;AN000;
  575. MOV AX,3D00H ;; ARGV0 directory ;AN000;
  576. INT 21H ;; ;AN000;
  577. .IF C ;; Issue "File not found" common msg ;AN000;
  578. .IF <AX EQ FILE_NOT_FOUND> OR ;AN000;
  579. .IF <AX EQ PATH_NOT_FOUND> ;AN000;
  580. MOV AX,PROFILE_NOT_FOUND ;; ;AN000;
  581. MOV CX,0 ;; ;AN000;
  582. CALL DISP_ERROR ;; Issue "File not found"common MSG;AN000;
  583. MOV FILE_ERROR,YES ;; ;AN000;
  584. .ELSE ;; ;AN000;
  585. CALL FILE_ERROR_PROC ;; Issue "Open error" ;AN000;
  586. .ENDIF ;; ;AN000;
  587. .ELSE ;; ;AN000;
  588. MOV HANDLE,AX ;; ;AN000;
  589. .ENDIF ;; File opened OK ;AN000;
  590. .ELSE ;; ;AN000;
  591. CALL FILE_ERROR_PROC ;; Issue "Open error" ;AN000;
  592. .ENDIF ;; ;AN000;
  593. .ELSE ;; ;AN000;
  594. MOV HANDLE,AX ;; ;AN000;
  595. .ENDIF ;; ;AN000;
  596. .ENDIF ;; ;AN000;
  597. ;; ;AN000;
  598. RET ;; ;AN000;
  599. OPEN_FILE ENDP ;; ;AN000;
  600. ;; ;AN000;
  601. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
  602. ;; ;AN000;
  603. ;; Module Name: ;AN000;
  604. ;; COPY_ARGV0 ;AN000;
  605. ;; ;AN000;
  606. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
  607. ;; ;AN000;
  608. ;; ;AN000;
  609. COPY_ARGV0 PROC ;; ;AN000;
  610. ;; ;AN000;
  611. PUSH ES ;; ;AN000;
  612. PUSH DI ;; ;AN000;
  613. PUSH SI ;; ;AN000;
  614. ;; ;AN000;
  615. MOV DI,2CH ;; Locate environment string ;AN000;
  616. MOV ES,[DI] ;; ;AN000;
  617. XOR SI,SI ;; ;AN000;
  618. .WHILE <<WORD PTR ES:[SI]> NE 0> ;; ;AN000;
  619. INC SI ;; ;AN000;
  620. .ENDWHILE ;; ;AN000;
  621. ADD SI,4 ;; ;AN000;
  622. LEA DI,PROFILE_PATH ;; Move string to work area ;AN000;
  623. .REPEAT ;; ;AN000;
  624. MOV AL,ES:[SI] ;; ;AN000;
  625. MOV [DI],AL ;; ;AN000;
  626. INC SI ;; ;AN000;
  627. INC DI ;; ;AN000;
  628. .UNTIL <<BYTE PTR ES:[SI]> EQ 0> ;; ;AN000;
  629. MOV BYTE PTR [DI],0 ;; ;AN000;
  630. MOV BYTE PTR [DI]-3,"P" ;; Change COM to PRO ;AN000;
  631. MOV BYTE PTR [DI]-2,"R" ;; ;AN000;
  632. MOV BYTE PTR [DI]-1,"O" ;; ;AN000;
  633. ;; ;AN000;
  634. POP SI ;; ;AN000;
  635. POP DI ;; ;AN000;
  636. POP ES ;; ;AN000;
  637. RET ;; ;AN000;
  638. ;; ;AN000;
  639. COPY_ARGV0 ENDP ;; ;AN000;
  640. ;; ;AN000;
  641. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
  642. ;; ;AN000;
  643. ;; Module Name: ;AN000;
  644. ;; FILE_ERROR_PROC ;AN000;
  645. ;; ;AN000;
  646. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
  647. ;; ;AN000;
  648. ;; ;AN000;
  649. FILE_ERROR_PROC PROC ;; ;AN000;
  650. MOV AX,FILE_ERRORS ;; ;AN000;
  651. MOV CX,0 ;; ;AN000;
  652. CALL DISP_ERROR ;; ;AN000;
  653. MOV FILE_ERROR,YES ;; ;AN000;
  654. RET ;; ;AN000;
  655. FILE_ERROR_PROC ENDP ;; ;AN000;
  656. ;; ;AN000;
  657. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
  658. ;; ;AN000;
  659. ;; Module Name: ;AN000;
  660. ;; GET_STATEMENT ;AN000;
  661. ;; ;AN000;
  662. ;; Input Parameters: ;AN000;
  663. ;; NONE ;AN000;
  664. ;; ;AN000;
  665. ;; Output Parameters: ;AN000;
  666. ;; PROFILE_LINE ;AN000;
  667. ;; RETURN CODE : 0 - successfull read ;AN000;
  668. ;; : 1 - end of file ;AN000;
  669. ;; : 2 - error during read ;AN000;
  670. ;; ;AN000;
  671. ;; ;AN000;
  672. ;; Data Structures Referenced: ;AN000;
  673. ;; ;AN000;
  674. ;; Description: ;AN000;
  675. ;; Get a statement from the profile. ;AN000;
  676. ;; The file read in 512 byte buffers and parsed into ;AN000;
  677. ;; lines by the presence of a carriage return at the end of each line. ;AN000;
  678. ;; ;AN000;
  679. ;; Called By: ;AN000;
  680. ;; LOAD_PROFILE ;AN000;
  681. ;; ;AN000;
  682. ;; External Calls: ;AN000;
  683. ;; NONE ;AN000;
  684. ;; ;AN000;
  685. ;; Logic: ;AN000;
  686. ;; FOUND := FALSE ;AN000;
  687. ;; RETURN_CODE := 0 ;AN000;
  688. ;; WHILE NOT FOUND DO ;AN000;
  689. ;; IF end of buffer THEN ;AN000;
  690. ;; Read next profile record into buffer ;AN000;
  691. ;; IF successful read THEN ;AN000;
  692. ;; point to first byte in buffer ;AN000;
  693. ;; ELSE ;AN000;
  694. ;; IF end of file THEN ;AN000;
  695. ;; Close profile ;AN000;
  696. ;; RETURN_CODE := 1 ;AN000;
  697. ;; FOUND := TRUE ;AN000;
  698. ;; ELSE ;AN000;
  699. ;; RETURN_CODE := 2 ;AN000;
  700. ;; FOUND := TRUE ;AN000;
  701. ;; ENDIF ;AN000;
  702. ;; ENDIF ;AN000;
  703. ;; ENDIF ;AN000;
  704. ;; copy byte to PROFILE_LINE ;AN000;
  705. ;; IF byte in buffer is a CR THEN ;AN000;
  706. ;; FOUND := TRUE ;AN000;
  707. ;; ENDIF ;AN000;
  708. ;; ENDWHILE ;AN000;
  709. ;; RETURN ;AN000;
  710. ;; ;AN000;
  711. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
  712. ;; ;AN000;
  713. FOUND DB 0 ;; ;AN000;
  714. ;; ;AN000;
  715. CARRIAGE_RET EQU 13 ;; ;AN000;
  716. LINE_FEED EQU 10 ;; ;AN000;
  717. NEXT_BYTE DB 0 ;; Save area for byte just read ;AN000;
  718. BUFFER_SIZE EQU 512 ;; ;AN000;
  719. FILE_BUFFER DB 512 DUP(0) ;; ;AN000;
  720. BUFFER_PTR DW 512 ;; ;AN000;
  721. BUFFER_END DW 512 ;; ;AN000;
  722. STMT_BUFFER DB 255 DUP(0) ;; ;AN000;
  723. DB ? ;; In case we have to insert a CR ;AN000;
  724. DB ? ;; and a LF ;AN000;
  725. DB ? ;; Too put the "$" for displaying the ;AN000;
  726. ;; line. ;AN000;
  727. ;; ;AN000;
  728. STMT_END_INDEX DW ? ;; ;AN000;
  729. MAX_STMT_LEN EQU 255 ;; ;AN000;
  730. CR_FOUND DB 0 ;; 1 if we found a line terminator ;AN000;
  731. ;; ;AN000;
  732. GET_STATEMENT PROC ;; ;AN000;
  733. ;; ;AN000;
  734. MOV FOUND,NO ;; ;AN000;
  735. MOV STMT_ERROR,0 ;; Clear error flags ;AN000;
  736. XOR DI,DI ;; Index for extracted statement ;AN000;
  737. MOV SI,BUFFER_PTR ;; Init file buffer ptr ;AN000;
  738. ;; ;AN000;
  739. MOV AL,NEXT_BYTE ;; Restore current byte ;AN000;
  740. MOV CR_FOUND,NO ;; ;AN000;
  741. ;; ;AN000;
  742. ;; ;AN000;
  743. .WHILE <FOUND EQ NO> AND ;; Keep parsing until we find a stmt ;AN000;
  744. .WHILE <FILE_ERROR EQ NO> AND ;; or a file error occurs ;AN000;
  745. .WHILE <END_OF_FILE EQ NO> ;; or we reach end of file ;AN000;
  746. .IF <CR_FOUND EQ YES> ;; ;AN000;
  747. .IF <AL EQ LINE_FEED> ;; Return the line feed as well ;AN000;
  748. .IF <DI NA MAX_STMT_LEN> ;; Truncate lines longer than MAX ;AN000;
  749. MOV STMT_BUFFER[DI],AL ;; MOVE TO statement buffer ;AN000;
  750. INC DI ;; Point to next byte in file buffr ;AN000;
  751. .ELSE ;; ;AN000;
  752. OR STMT_ERROR,INVALID ;; Line has been truncated > ERROR ;AN000;
  753. MOV PARSE_ERROR,YES ;; ;AN000;
  754. MOV BUILD_STATE,NO ;; ;AN000;
  755. .ENDIF ;; ;AN000;
  756. CALL GET_BYTE ;; Get the first byte of next statement ;AN000;
  757. .ENDIF ;; ;AN000;
  758. MOV FOUND,YES ;; Time to leave this WHILE ;AN000;
  759. MOV NEXT_BYTE,AL ;; Save the byte we just read ;AN000;
  760. .ELSE ;; ;AN000;
  761. .IF <DI NA MAX_STMT_LEN> ;; Truncate lines longer than MAX ;AN000;
  762. MOV STMT_BUFFER[DI],AL ;; move byte to statement buffer ;AN000;
  763. INC DI ;; Point to next byte in file buffer ;AN000;
  764. .ELSE ;; ;AN000;
  765. OR STMT_ERROR,INVALID ;; Line has been truncated > ERROR ;AN000;
  766. MOV PARSE_ERROR,YES ;; ;AN000;
  767. MOV BUILD_STATE,NO ;; ;AN000;
  768. .ENDIF ;; ;AN000;
  769. .IF <AL EQ CARRIAGE_RET> ;; Found a line terminator ;AN000;
  770. MOV CR_FOUND,YES ;; Indicate carriage return found ;AN000;
  771. .ENDIF ;; and go through once more to ;AN000;
  772. CALL GET_BYTE ;; check for a line feed ;AN000;
  773. .ENDIF ;; ;AN000;
  774. .ENDWHILE ;; ;AN000;
  775. ;; ;AN000;
  776. .IF <STMT_BUFFER[DI-1] NE CARRIAGE_RET> AND ;; ;AN000;
  777. .IF <STMT_BUFFER[DI-1] NE LINE_FEED> ;; ;AN000;
  778. MOV STMT_BUFFER[DI],CARRIAGE_RET ;; ;AN000;
  779. MOV STMT_BUFFER[DI+1],LINE_FEED ;; ;AN000;
  780. INC DI ;; ;AN000;
  781. INC DI ;; ;AN000;
  782. .ENDIF ;; ;AN000;
  783. MOV STMT_END_INDEX,DI ;; ;AN000;
  784. MOV BUFFER_PTR,SI ;; Save buffer ptr for next time ;AN000;
  785. ;; ;AN000;
  786. .IF <END_OF_FILE EQ YES> ;; ;AN000;
  787. .IF <DI EQ 0> ;; Clear carry if we read something ;AN000;
  788. STC ;; and no file error occured otherwise ;AN000;
  789. .ELSE ;; set carry indicating unsuccessful ;AN000;
  790. CLC ;; get. ;AN000;
  791. .ENDIF ;; ;AN000;
  792. .ELSE ;; ;AN000;
  793. .IF <FILE_ERROR EQ YES> ;; ;AN000;
  794. STC ;; ;AN000;
  795. .ELSE ;; ;AN000;
  796. CLC ;; ;AN000;
  797. .ENDIF ;; ;AN000;
  798. .ENDIF ;; ;AN000;
  799. RET ;; ;AN000;
  800. ;; ;AN000;
  801. GET_STATEMENT ENDP ;; ;AN000;
  802. ;; ;AN000;
  803. ;; ;AN000;
  804. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
  805. ;; ;AN000;
  806. ;; Module Name: ;AN000;
  807. ;; GET_BYTE ;AN000;
  808. ;; ;AN000;
  809. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
  810. ;; ;AN000;
  811. GET_BYTE PROC ;; ;AN000;
  812. ;; ;AN000;
  813. .IF <SI EQ BUFFER_END> ;; If buffer empty do another read ;AN000;
  814. MOV AH,3FH ;; ;AN000;
  815. MOV DX,OFFSET FILE_BUFFER ;; ;AN000;
  816. MOV CX,BUFFER_SIZE ;; ;AN000;
  817. MOV BX,HANDLE ;; ;AN000;
  818. INT 21H ;; ;AN000;
  819. .IF C ;; Carry set by DOS if file error ;AN000;
  820. CALL FILE_ERROR_PROC ;; ;AN000;
  821. .ELSE ;; ;AN000;
  822. .IF <AX EQ 0> ;; End of file if AX=0 ;AN000;
  823. MOV END_OF_FILE,YES ;; ;AN000;
  824. MOV AH,3EH ;; Close the file ;AN000;
  825. MOV BX,HANDLE ;; ;AN000;
  826. INT 21H ;; ;AN000;
  827. .ELSE ;; ;AN000;
  828. MOV BUFFER_END,AX ;; Number of bytes read ;AN000;
  829. XOR SI,SI ;; Buffer pointer := 0 ;AN000;
  830. .ENDIF ;; ;AN000;
  831. .ENDIF ;; ;AN000;
  832. .ENDIF ;; ;AN000;
  833. ;; ;AN000;
  834. .IF <FILE_ERROR EQ YES> OR ;; ;AN000;
  835. .IF <END_OF_FILE EQ YES> ;; ;AN000;
  836. STC ;; Unsuccessful get ;AN000;
  837. .ELSE ;; ;AN000;
  838. .IF <<FILE_BUFFER[SI]> EQ 1AH> ;; cHECK for EOF marker ;AN000;
  839. MOV END_OF_FILE,YES ;; ;AN000;
  840. STC ;; ;AN000;
  841. .ELSE ;; ;AN000;
  842. MOV AL,FILE_BUFFER[SI] ;; Return byte in AL ;AN000;
  843. INC SI ;; ;AN000;
  844. CLC ;; Successful get ;AN000;
  845. .ENDIF ;; ;AN000;
  846. .ENDIF ;; ;AN000;
  847. RET ;; ;AN000;
  848. ;; ;AN000;
  849. GET_BYTE ENDP ;; ;AN000;
  850. ;; ;AN000;
  851. ;; ;AN000;
  852. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
  853. ;; ;AN000;
  854. ;; Module Name: ;AN000;
  855. ;; GROW_SHARED_DATA ;AN000;
  856. ;; ;AN000;
  857. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
  858. ;; ;AN000;
  859. GROW_SHARED_DATA PROC ;; ;AN000;
  860. PUSH BX ;; ;AN000;
  861. ADD BLOCK_END,AX ;; Grow the current block by AX ;AN000;
  862. MOV BX,BLOCK_END ;; ;AN000;
  863. .IF <BX A NB_FREE_BYTES> ;; Check for overflow ;AN000;
  864. MOV BUILD_STATE,NO ;; Stop building shared data ;AN000;
  865. MOV MEM_OVERFLOW,YES ;; ;AN000;
  866. .ENDIF ;; ;AN000;
  867. POP BX ;; ;AN000;
  868. RET ;; ;AN000;
  869. GROW_SHARED_DATA ENDP ;; ;AN000;
  870. ;; ;AN000;
  871. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
  872. ;AN000;
  873. CODE ENDS ;; ;AN000;
  874. END ;AN000;
  875. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
  876.