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.

3371 lines
124 KiB

  1. ; * * * * * * * * * * * * START OF SPECIFICATIONS * * * * * * * * * * * * * * *
  2. ;
  3. ; MODULE NAME: MSGSERV.SAL
  4. ;
  5. ; DESCRIPTIVE NAME: Message Services SALUT file
  6. ;
  7. ; FUNCTION: This module incorporates all the messages services and
  8. ; is called upon at build time to INCLUDE the code requested
  9. ; by a utility. Code is requested using the macro MSG_SERVICES.
  10. ;
  11. ; ENTRY POINT: Since this a collection of subroutines, entry point is at
  12. ; requested procedure.
  13. ;
  14. ; INPUT: Since this a collection of subroutines, input is dependent on function
  15. ; requested.
  16. ;
  17. ; EXIT-NORMAL: In all cases, CARRY FLAG = 0
  18. ;
  19. ; EXIT-ERROR: In all cases, CARRY FLAG = 1
  20. ;
  21. ; INTERNAL REFERENCES: (list of included subroutines)
  22. ;
  23. ; - SYSLOADMSG
  24. ; - SYSDISPMSG
  25. ; - SYSGETMSG
  26. ;
  27. ;
  28. ; EXTERNAL REFERENCES: None
  29. ;
  30. ; NOTES: At build time, some modules must be included. These are only included
  31. ; once using assembler switches. Other logic is included at the request
  32. ; of the utility.
  33. ;
  34. ; COMR and COMT are assembler switches to conditionally assemble code
  35. ; for RESIDENT COMMAND.COM and TRANSIENT COMMAND.COM to reduce resident
  36. ; storage and multiple EQUates.
  37. ;
  38. ; REVISION HISTORY: Created MAY 1987
  39. ;
  40. ; Label: DOS - - Message Retriever
  41. ; (c) Copyright 1988 Microsoft
  42. ;
  43. ;
  44. ; * * * * * * * * * * * * END OF SPECIFICATIONS * * * * * * * * * * * * * * * *
  45. ; Page
  46. ;
  47. ; Revision History
  48. ; ================
  49. ;
  50. ; M007 SR 08/24/90 Fixed bug #1818 -- changed
  51. ; $M_DISPLAY_H_STRING to properly
  52. ; handle Ctrl-Z being passed
  53. ;
  54. ; M013 SR 9/12/90 Make SETSTDIO flag false so that all
  55. ; these routines are no longer assembled.
  56. ;
  57. ; M016 SR 10/14/90 Bug #3380. Changed SYSLOADMSG so that
  58. ; CR-LF string also gets reinitialized
  59. ; on every cycle.
  60. ;
  61. ; M020 SR 10/26/90 Bug #3380 again. Initialize $M_DIVISOR
  62. ; & $_MSG_NUM also in SYSLOADMSG.
  63. ;
  64. ; $SALUT $M (2,5,22,62) ;;AN000;; Set SALUT formatting
  65. IF $M_STRUC ;;AN000;; IF we haven't included the structures yet THEN
  66. $M_STRUC = FALSE ;;AN000;; Let the assembler know that we have
  67. ;;AN000;; and include them
  68. PAGE
  69. SUBTTL DOS - Message Retriever - MSGSTR.INC Module
  70. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  71. ;;
  72. ;; STRUCTURE: $M_SUBLIST_STRUC
  73. ;;
  74. ;; Replacable parameters are described by a sublist structure
  75. ;;
  76. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  77. ;;
  78. $M_SUBLIST_STRUC STRUC ;;AN000;;
  79. ;;
  80. $M_S_SIZE DB 11 ;;AN000;; SUBLIST size (PTR to next SUBLIST)
  81. $M_S_RESV DB 0 ;;AN000;; RESERVED
  82. $M_S_VALUE DD ? ;;AN000;; Time, Date or PTR to data item
  83. $M_S_ID DB ? ;;AN000;; n of %n
  84. $M_S_FLAG DB ? ;;AN000;; Data-type flags
  85. $M_S_MAXW DB ? ;;AN000;; Maximum field width
  86. $M_S_MINW DB ? ;;AN000;; Minimum field width
  87. $M_S_PAD DB ? ;;AN000;; Character for Pad field
  88. ;;
  89. $M_SUBLIST_STRUC ENDS ;;AN000;;
  90. ;;
  91. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  92. ;;
  93. ;; STRUCTURE: $M_CLASS_ID
  94. ;;
  95. ;; Each class will be defined by this structure.
  96. ;;
  97. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  98. ;;
  99. $M_CLASS_ID STRUC ;;AN000;;
  100. ;;
  101. $M_CLS_ID DB -1 ;;AN000;; Class identifer
  102. $M_COMMAND_VER DW EXPECTED_VERSION ;;AN003;; COMMAND.COM version check
  103. ifdef BILINGUAL
  104. $M_NUM_CLS_MSG DW 0 ;;AN000;; Total number of message in class
  105. else
  106. $M_NUM_CLS_MSG DB 0 ;;AN000;; Total number of message in class
  107. endif
  108. ;;
  109. $M_CLASS_ID ENDS ;;
  110. ;;AN000;;
  111. $M_CLASS_ID_SZ EQU SIZE $M_CLASS_ID ;;AN000;;
  112. ;;
  113. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  114. ;;
  115. ;; STRUCTURE: $M_ID_STRUC
  116. ;;
  117. ;; Each message will be defined by this structure.
  118. ;;
  119. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  120. ;;
  121. $M_ID STRUC ;;AN000;;
  122. ;;
  123. $M_NUM DW -1 ;;AN000;; Message Number
  124. $M_TXT_PTR DW ? ;;AN000;; Pointer to message text
  125. ;;
  126. $M_ID ENDS ;;AN000;;
  127. ;;AN000;; Status Flag Values:
  128. $M_ID_SZ EQU SIZE $M_ID ;;AN000;;
  129. ;;
  130. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  131. ;;
  132. ;; STRUCTURE: $M_RES_ADDRS
  133. ;;
  134. ;; Resident data area definition of variables
  135. ;;
  136. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  137. ;;
  138. $M_RES_ADDRS STRUC ;;AN000;;
  139. ;;
  140. $M_EXT_ERR_ADDRS DD 0 ;;AN000;; Allow pointers to THREE Extended error locations
  141. $M_EXT_FILE DD 0 ;;AN001;;
  142. $M_EXT_COMMAND DD 0 ;;AN000;;
  143. $M_EXT_TERM DD -1 ;;AN000;;
  144. $M_PARSE_COMMAND DD 0 ;;AN000;;
  145. $M_PARSE_ADDRS DD 0 ;;AN000;; Allow pointers to TWO Parse error locations
  146. $M_PARSE_TERM DD -1 ;;AN000;;
  147. $M_CRIT_ADDRS DD 0 ;;AN000;; Allow pointers to TWO Critical error locations
  148. $M_CRIT_COMMAND DD 0 ;;AN000;;
  149. $M_CRIT_TERM DD -1 ;;AN000;;
  150. $M_DISK_PROC_ADDR DD -1 ;;AN004;; Address of READ_DISK_PROC
  151. $M_CLASS_ADDRS DD $M_NUM_CLS DUP(0) ;;AN000;; Allow pointers to specified classes
  152. $M_CLS_TERM DD -1 ;;AN000;;
  153. $M_DBCS_VEC DD 0 ;;AN000;; Save DBCS vector
  154. $M_HANDLE DW ? ;;AN000;;
  155. $M_SIZE DB 0 ;;AN000;;
  156. $M_CRLF DB 0DH,0AH ;;AN004;; CR LF message
  157. $M_CLASS DB ? ;;AN004;; Saved class
  158. $M_RETURN_ADDR DW ? ;;AN000;;
  159. $M_MSG_NUM DW $M_NULL ;;AN000;;
  160. $M_DIVISOR DW 10 ;;AN000;; Default = 10 (must be a WORD for division)
  161. $M_TEMP_BUF DB $M_TEMP_BUF_SZ DUP("$") ;;AN000;; Temporary buffer
  162. $M_BUF_TERM DB "$" ;;AN000;;
  163. $M_RES_ADDRS ENDS ;;AN000;;
  164. ;;
  165. $M_RES_ADDRS_SZ EQU SIZE $M_RES_ADDRS ;;AN000;;
  166. ;;
  167. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  168. ;;
  169. ;; STRUCTURE: $M_COUNTRY_INFO
  170. ;;
  171. ;; Important fields of the Get Country Information call
  172. ;;
  173. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  174. ;;
  175. $M_COUNTRY_INFO STRUC ;;AN000;; Expected Country infomation
  176. ;;
  177. $M_HEADER DB $M_RES_ADDRS_SZ-$M_TEMP_BUF_SZ-1 DUP(?) ;;AN000;; Go past first part of struc
  178. $M_DATE_FORMAT DW ? ;;AN000;; <------- Date Format
  179. $M_CURR_SEPARA DB 5 DUP(?) ;;AN000;;
  180. $M_THOU_SEPARA DB ?,0 ;;AN000;; <------- Thou Separator
  181. $M_DECI_SEPARA DB ?,0 ;;AN000;; <------- Decimal Separator
  182. $M_DATE_SEPARA DB ?,0 ;;AN000;; <------- Date Separator
  183. $M_TIME_SEPARA DB ?,0 ;;AN000;; <------- Time Separator
  184. $M_CURR_FORMAT DB ? ;;AN000;;
  185. $M_SIG_DIGS_CU DB ? ;;AN000;;
  186. $M_TIME_FORMAT DB ? ;;AN000;; <------- Time Format
  187. ;;
  188. $M_COUNTRY_INFO ENDS ;;AN000;;
  189. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  190. ;;
  191. ELSE ;;AN000;; ELSE if we have already included the STRUCTURES
  192. ;
  193. ; $SALUT $M (2,5,13,62) ;;AN000;; Set SALUT formatting for code section
  194. IF MSGDATA ;;AN000;; IF this is a request to include the data area
  195. MSGDATA = FALSE ;;AN000;; Let the assembler know not to include it again
  196. ;;AN000;; and include it
  197. PAGE
  198. SUBTTL DOS - Message Retriever - MSGRES.TAB Module
  199. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  200. ;;
  201. ;; DATA NAME: $M_RES_TABLE
  202. ;;
  203. ;; REFERENCE LABEL: $M_RT
  204. ;;
  205. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  206. ;;
  207. IF COMR ;;AN000;; Since COMMAND.COM includes this twice
  208. $M_RT EQU $M_RT2 ;;AN000;; we must redefine the label so no
  209. $M_RT2 LABEL BYTE ;;AN000;; assembly errors occur
  210. $M_ALTLABEL = TRUE ;;AN000;; Flag that label was changed
  211. ELSE ;;AN000;;
  212. $M_RT LABEL BYTE ;;AN000;;
  213. ENDIF ;;AN000;;
  214. $M_RES_ADDRS <> ;;AN000;; Resident addresses
  215. ;;
  216. include COPYRIGH.INC ;;AN001;; Include Copyright 1988 Microsoft
  217. ;;
  218. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  219. ENDIF ;;AN000;; END of include of Data table
  220. ;
  221. IF NOT $M_MSGDATA_ONLY ;;AN000;; IF this was a request for only the data table THEN
  222. ;; don't include any more code
  223. ;;AN000;; Figure out what other code to include
  224. IF DISK_PROC ;;AN003;; Is the request to include the READ_DISK code
  225. IF COMR ;;AN003;; (Only Resident COMMAND.COM should ask for it)
  226. $M_RT EQU $M_RT2 ;;AN003;;
  227. ENDIF
  228. DISK_PROC = FALSE ;;AN003;; Yes, THEN include it and reset flag
  229. PAGE
  230. SUBTTL DOS - Message Retriever - DISK_PROC Module
  231. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  232. ;;
  233. ;; PROC NAME: DISK_PROC
  234. ;;
  235. ;; FUNCTION: Used in COMMAND.COM if we need to access the Parse or Extended
  236. ;; errors from disk\diskette
  237. ;; INPUTS: AX has the message number
  238. ;; DX has the message class
  239. ;; AND ... the COMMAND.COM Variable RESGROUP:COMSPEC is
  240. ;; assumed to be set!!
  241. ;;
  242. ;; OUTPUTS: ES:DI points to message length (BYTE) followed by text
  243. ;;
  244. ;;
  245. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  246. ;;
  247. PUBLIC READ_DISK_PROC ;;
  248. ;;
  249. READ_DISK_PROC PROC FAR ;;AN003;;
  250. PUSH AX ;;AN003;; Save everything
  251. PUSH BX ;;AN003;;
  252. PUSH DX ;;AN003;;
  253. PUSH SI ;;AN003;;
  254. PUSH BP ;;AN003;;
  255. PUSH DS ;;AN003;;
  256. PUSH DI ;;AN003;;
  257. MOV BP,AX ;;AN003;; Save message number
  258. MOV AX,DOS_EXTENDED_OPEN ;;AN003;; Set INT 21 function
  259. LEA SI,RESGROUP:COMSPEC ;;AN003;; Get addressibilty to COMMAND.COM
  260. PUSH CS ;;AN003;;
  261. POP DS ;;AN003;;
  262. MOV DI,-1 ;;AN003;; No extended attribute list
  263. MOV BX,NO_CRIT_OPEN ;;AN003;; Don't generate critical error
  264. MOV DX,NOT_EX_FAIL_EX_OPEN ;;AN003;; Open Flag
  265. INT 21H ;;AN003;; Open the file
  266. POP DI ;;AN003;; Retreive LSEEK pointer
  267. ;;AN003;; Error ?
  268. ; $IF NC,LONG ;;AN003;; No,
  269. JNC $MXL1
  270. JMP $MIF1
  271. $MXL1:
  272. PUSH DI ;;AN003;; Save LSEEK pointer
  273. MOV BX,AX ;;AN003;; Set handle in BX
  274. MOV AX,DOS_LSEEK_FILE ;;AN003;; LSEEK to the errors
  275. XOR CX,CX ;;AN003;; Value has been set by COMMAND.COM
  276. MOV DX,DI ;;AN003;;
  277. INT 21H ;;AN003;; LSEEK the file
  278. POP DX ;;AN003;; Retreive LSEEK pointer
  279. ;;AN003;; Error ?
  280. ; $IF NC ;;AN003;; No,
  281. JC $MIF2
  282. INC CX ;;AN003;; Set flag to first pass
  283. ; $DO ;;AN003;;
  284. $MDO3:
  285. PUSH DX ;;AN003;; Save LSEEK pointer
  286. PUSH CX ;;AN003;; Save first pass flag
  287. PUSH AX ;;AN003;; Save number of messages (if set yet)
  288. XOR SI,SI ;;AN003;; Reset buffer index
  289. MOV AH,DOS_READ_BYTE ;;AN003;; Read
  290. MOV CX,$M_TEMP_BUF_SZ ;;AN003;; the first part of the header
  291. LEA DX,$M_RT.$M_TEMP_BUF ;;AN003;; into the temp buffer
  292. INT 21H ;;AN003;; Read it
  293. MOV DI,DX ;;AN003;;
  294. POP AX ;;AN003;;
  295. POP CX ;;AN003;;
  296. OR CX,CX ;;AN003;;
  297. ; $IF NZ ;;AN003;;
  298. JZ $MIF4
  299. XOR CX,CX ;;AN003;; Set flag to second pass
  300. ifdef BILINGUAL
  301. MOV AX,DS:[DI].$M_NUM_CLS_MSG ;;AN003;;
  302. else
  303. XOR AH,AH ;;AN003;; Get number of messages in class
  304. MOV AL,DS:[DI].$M_NUM_CLS_MSG ;;AN003;;
  305. endif
  306. MOV SI,$M_CLASS_ID_SZ ;;AN003;; Initialize index
  307. CMP DS:[DI].$M_COMMAND_VER,EXPECTED_VERSION ;;AN003;; Is this the right version of COMMAND.COM?
  308. ; $ENDIF ;;AN003;;
  309. $MIF4:
  310. POP DX ;;AN003;;
  311. ; $IF Z ;;AN003;; Yes,
  312. JNZ $MIF6
  313. ; $SEARCH ;;AN003;;
  314. $MDO7:
  315. CMP BP,WORD PTR $M_RT.$M_TEMP_BUF[SI] ;;AN003;; Is this the message I'm looking for?
  316. ; $EXITIF Z ;;AN003;; Yes, (ZF=1)
  317. JNZ $MIF7
  318. CLC ;;AN003;; Reset carry, exit search
  319. ; $ORELSE ;;AN003;; No, (ZF=0)
  320. JMP SHORT $MSR7
  321. $MIF7:
  322. ADD SI,$M_ID_SZ ;;AN003;; Increment index
  323. ADD DX,$M_ID_SZ ;;AN003;; Add offset of first header
  324. DEC AX ;;AN003;; Decrement # of messages left
  325. ; $LEAVE Z ;;AN003;; Have we exhausted all messages?
  326. JZ $MEN7
  327. CMP SI,$M_TEMP_BUF_SZ-1 ;;AN003;; No, Have we exhausted the buffer?
  328. ; $ENDLOOP A ;;AN003;; No, Check next message (ZF=1)
  329. JNA $MDO7
  330. $MEN7:
  331. STC ;;AN003;; Yes, (ZF=0) set error (ZF=0)
  332. ; $ENDSRCH ;;AN003;;
  333. $MSR7:
  334. ; $ELSE ;;AN003;; No,
  335. JMP SHORT $MEN6
  336. $MIF6:
  337. XOR CX,CX ;;AN003;; Set Zero flag to exit READ Loop
  338. STC ;;AN003;; Set Carry
  339. ; $ENDIF ;;AN003;;
  340. $MEN6:
  341. ; $ENDDO Z ;;AN003;; Get next buffer full if needed
  342. JNZ $MDO3
  343. ;;AN003;; Error ?
  344. ; $IF NC ;;AN003;; No,
  345. JC $MIF16
  346. MOV AX,DOS_LSEEK_FILE ;;AN003;; Prepare to LSEEK to the specific message
  347. XOR CX,CX ;;AN003;; Value has been set by COMMAND.COM
  348. ADD DX,$M_CLASS_ID_SZ ;;AN003;; Add offset of first header
  349. ADD DX,WORD PTR $M_RT.$M_TEMP_BUF[SI]+2 ;;AN003;; Add offset from msg structure
  350. INT 21H ;;AN003;; LSEEK the file
  351. MOV AH,DOS_READ_BYTE ;;AN003;; Read
  352. MOV CX,$M_TEMP_BUF_SZ ;;AN003;; the message
  353. LEA DX,$M_RT.$M_TEMP_BUF ;;AN003;; into the temp buffer
  354. INT 21H ;;AN003;; Read it
  355. MOV DI,DX ;;AN003;; into the temp buffer
  356. PUSH DS ;;AN003;; into the temp buffer
  357. POP ES ;;AN003;; into the temp buffer
  358. ; $ENDIF ;;AN003;;
  359. $MIF16:
  360. ; $ENDIF ;;AN003;;
  361. $MIF2:
  362. PUSHF ;;AN003;; Close file handle
  363. MOV AH,DOS_CLOSE_FILE ;;AN003;; Close file handle
  364. INT 21H ;;AN003;;
  365. $M_POPF ;;AN003;;
  366. ; $ENDIF ;;AN003;; Yes there was an error,
  367. $MIF1:
  368. POP DS ;;AN003;;
  369. POP BP ;;AN003;;
  370. POP SI ;;AN003;;
  371. POP DX ;;AN003;;
  372. POP BX ;;AN003;;
  373. POP AX ;;AN003;;
  374. ;;AN003;; abort everything
  375. RET ;;AN003;;
  376. READ_DISK_PROC ENDP ;;AN003;;
  377. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  378. ENDIF ;;AN003;; END of include for DISK_PROC
  379. ;
  380. SETSTDIO = FALSE ; M013
  381. IF SETSTDIO ;;AN000;; Is the request to include the code for SETSTDIO
  382. SETSTDIO = FALSE ;;AN000;; Yes, THEN include it and reset flag
  383. PAGE
  384. SUBTTL DOS - Message Retriever - SETSTDIO Module
  385. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  386. ;;
  387. ;; PROC NAME: SETSTDIO
  388. ;;
  389. ;; FUNCTION:
  390. ;; INPUTS:
  391. ;;
  392. ;; OUPUTS:
  393. ;;
  394. ;;
  395. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  396. ;;
  397. IF FARmsg ;AN001;
  398. SETSTDINON PROC FAR ;AN001;
  399. ELSE ;AN001;
  400. SETSTDINON PROC NEAR ;AN001;
  401. ENDIF ;AN001;
  402. PUSH AX ;AN002; Save changed regs
  403. PUSH BX ;AN002;
  404. PUSH DX ;AN002;
  405. MOV AX,DOS_IOCTL_GET_INFO ;AN001; Get info using IOCTL
  406. MOV BX,STDIN ;AN001;
  407. XOR DX,DX ;AN001;
  408. INT 21H ;AN001;
  409. OR DH,$M_CRIT_ERR_MASK ;AN001; Turn on bit
  410. MOV AX,DOS_IOCTL_SET_INFO ;AN001; Set info using IOCTL
  411. INT 21H ;AN001;
  412. POP DX ;AN002; Restore Regs
  413. POP BX ;AN002;
  414. POP AX ;AN002;
  415. RET ;AN001;
  416. ;AN001;
  417. SETSTDINON ENDP ;AN001;
  418. IF FARmsg ;AN001;
  419. SETSTDINOFF PROC FAR ;AN001;
  420. ELSE ;AN001;
  421. SETSTDINOFF PROC NEAR ;AN001;
  422. ENDIF ;AN001;
  423. PUSH AX ;AN002; Save changed regs
  424. PUSH BX ;AN002;
  425. PUSH DX ;AN002;
  426. MOV AX,DOS_IOCTL_GET_INFO ;AN001; Get info using IOCTL
  427. MOV BX,STDIN ;AN001;
  428. XOR DX,DX ;AN001;
  429. INT 21H ;AN001;
  430. AND DH,NOT $M_CRIT_ERR_MASK ;AN001; Turn off bit
  431. MOV AX,DOS_IOCTL_SET_INFO ;AN001; Set info using IOCTL
  432. INT 21H ;AN001;
  433. POP DX ;AN002; Restore Regs
  434. POP BX ;AN002;
  435. POP AX ;AN002;
  436. RET ;AN001;
  437. SETSTDINOFF ENDP ;AN001;
  438. IF FARmsg ;AN001;
  439. SETSTDOUTON PROC FAR ;AN001;
  440. ELSE ;AN001;
  441. SETSTDOUTON PROC NEAR ;AN001;
  442. ENDIF ;AN001;
  443. PUSH AX ;AN002; Save changed regs
  444. PUSH BX ;AN002;
  445. PUSH DX ;AN002;
  446. MOV AX,DOS_IOCTL_GET_INFO ;AN001; Get info using IOCTL
  447. MOV BX,STDOUT ;AN001;
  448. XOR DX,DX ;AN001;
  449. INT 21H ;AN001;
  450. OR DH,$M_CRIT_ERR_MASK ;AN001; Turn on bit
  451. MOV AX,DOS_IOCTL_SET_INFO ;AN001; Set info using IOCTL
  452. INT 21H ;AN001;
  453. POP DX ;AN002; Restore Regs
  454. POP BX ;AN002;
  455. POP AX ;AN002;
  456. RET ;AN001;
  457. SETSTDOUTON ENDP ;AN001;
  458. IF FARmsg ;AN001;
  459. SETSTDOUTOFF PROC FAR ;AN001;
  460. ELSE ;AN001;
  461. SETSTDOUTOFF PROC NEAR
  462. ENDIF ;AN001;
  463. PUSH AX ;AN002; Save changed regs
  464. PUSH BX ;AN002;
  465. PUSH DX ;AN002;
  466. MOV AX,DOS_IOCTL_GET_INFO ;AN001; Get info using IOCTL
  467. MOV BX,STDOUT ;AN001;
  468. XOR DX,DX ;AN001;
  469. INT 21H ;AN001;
  470. AND DH,NOT $M_CRIT_ERR_MASK ;AN001; Turn off bit
  471. MOV AX,DOS_IOCTL_SET_INFO ;AN001; Set info using IOCTL
  472. INT 21H ;AN001;
  473. POP DX ;AN002; Restore Regs
  474. POP BX ;AN002;
  475. POP AX ;AN002;
  476. RET ;AN001;
  477. SETSTDOUTOFF ENDP ;AN001;
  478. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  479. ENDIF ;;AN000;; END of include for SETSTDIO
  480. ;
  481. IF LOADmsg ;;AN000;; Is the request to include the code for SYSLOADMSG ?
  482. IF COMR ;;AN000;;
  483. $M_RT EQU $M_RT2 ;;AN000;;
  484. ENDIF
  485. LOADmsg = FALSE ;;AN000;; Yes, THEN include it and reset flag
  486. PAGE
  487. SUBTTL DOS - Message Retriever - LOADMSG.ASM Module
  488. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  489. ;;
  490. ;; PROC NAME: SYSLOADMSG
  491. ;;
  492. ;; FUNCTION:
  493. ;; INPUTS:
  494. ;;
  495. ;; OUPUTS:
  496. ;;
  497. ;;
  498. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  499. ;;
  500. IF FARmsg ;;AN000;;
  501. SYSLOADMSG PROC FAR ;;AN000;;
  502. ELSE ;;AN000;;
  503. SYSLOADMSG PROC NEAR ;;AN000;;
  504. ENDIF ;;AN000;;
  505. PUSH AX ;;AN000;
  506. PUSH BX ;;AN000;
  507. PUSH DX ;;AN000;
  508. PUSH ES ;;AN000;
  509. PUSH DI ;;AN000;
  510. XOR CX,CX ;;AN000; Reset to zero
  511. MOV ES,CX ;;AN000;
  512. XOR DI,DI ;;AN000;
  513. MOV AX,DOS_GET_EXT_PARSE_ADD ;;AN000;; 2FH Interface
  514. MOV DL,DOS_GET_EXTENDED ;;AN000;; Where are the Extended errors in COMMAND.COM
  515. INT 2FH ;;AN000;; Private interface
  516. MOV WORD PTR $M_RT.$M_EXT_COMMAND+2,ES ;;AN000;; Move into first avaliable table location
  517. MOV WORD PTR $M_RT.$M_EXT_COMMAND,DI ;;AN000;;
  518. ;;
  519. MOV AX,DOS_GET_EXT_PARSE_ADD ;;AN000;; 2FH Interface
  520. MOV DL,DOS_GET_PARSE ;;AN000;; Where are the Parse errors in COMMAND.COM
  521. INT 2FH ;;AN000;; Private interface
  522. MOV WORD PTR $M_RT.$M_PARSE_COMMAND+2,ES ;;AN000;; Move into first avaliable table location
  523. MOV WORD PTR $M_RT.$M_PARSE_COMMAND,DI ;;AN000;;
  524. ;;
  525. MOV AX,DOS_GET_EXT_PARSE_ADD ;;AN000;; 2FH Interface
  526. MOV DL,DOS_GET_CRITICAL ;;AN000;; Where are the Critical errors in COMMAND.COM
  527. INT 2FH ;;AN000;; Private interface
  528. MOV WORD PTR $M_RT.$M_CRIT_COMMAND+2,ES ;;AN000;; Move into first avaliable table location
  529. MOV WORD PTR $M_RT.$M_CRIT_COMMAND,DI ;;AN000;;
  530. MOV AX,DOS_GET_EXT_PARSE_ADD ;;AN001;; 2FH Interface
  531. MOV DL,DOS_GET_FILE ;;AN001;; Where are the FILE dependant in IFSFUNC.EXE
  532. INT 2FH ;;AN001;; Private interface
  533. MOV WORD PTR $M_RT.$M_EXT_FILE+2,ES ;;AN001;; Move into first avaliable table location
  534. MOV WORD PTR $M_RT.$M_EXT_FILE,DI ;;AN001;;
  535. IF COMR ;; ** Special case for RESIDENT COMMAND.COM
  536. IF2
  537. IFNDEF READ_DISK_INFO ;;AN003;;
  538. Extrn READ_DISK_PROC:Far ;;AN003;;
  539. ENDIF ;;AN003;;
  540. ENDIF ;;AN003;;
  541. ELSE ;;
  542. IF FARmsg ;;AN000;;
  543. CALL FAR PTR $M_MSGSERV_1 ;;AN000;; Get addressibilty to MSGSERV CLASS 1 (EXTENDED Errors)
  544. ELSE ;;AN000;;
  545. CALL $M_MSGSERV_1 ;;AN000;; Get addressibilty to MSGSERV CLASS 1 (EXTENDED Errors)
  546. ENDIF ;;AN000;;
  547. MOV WORD PTR $M_RT.$M_EXT_ERR_ADDRS+2,ES ;;AN000;; Move into first avaliable table location
  548. MOV WORD PTR $M_RT.$M_EXT_ERR_ADDRS,DI ;;AN000;;
  549. MOV WORD PTR $M_RT.$M_CRIT_ADDRS+2,ES ;;AN000;; Move into first avaliable table location
  550. MOV WORD PTR $M_RT.$M_CRIT_ADDRS,DI ;;AN000;;
  551. ;;
  552. IF FARmsg ;;AN000;;
  553. CALL FAR PTR $M_MSGSERV_2 ;;AN000;; Get addressibilty to MSGSERV CLASS 2 (PARSE Errors)
  554. ELSE ;;AN000;;
  555. CALL $M_MSGSERV_2 ;;AN000;; Get addressibilty to MSGSERV CLASS 2 (PARSE Errors)
  556. ENDIF ;;AN000;;
  557. MOV WORD PTR $M_RT.$M_PARSE_ADDRS+2,ES ;;AN000;; Move into first avaliable table location
  558. MOV WORD PTR $M_RT.$M_PARSE_ADDRS,DI ;;AN000;;
  559. ENDIF ;;
  560. ;;
  561. MOV AX,DOS_GET_EXT_PARSE_ADD ;;AN001;; 2FH Interface
  562. MOV DL,DOS_GET_ADDR ;;AN001;; Where is the READ_DISK_PROC in COMMAND.COM
  563. INT 2FH ;;AN001;; Private interface
  564. MOV WORD PTR $M_RT.$M_DISK_PROC_ADDR+2,ES ;;AN001;; Move into first avaliable table location
  565. MOV WORD PTR $M_RT.$M_DISK_PROC_ADDR,DI ;;AN001;;
  566. ;M016; M020
  567. ; Reinitialize the CR-LF string. Also, reinit the buffer terminator just to
  568. ;be safe. Initialize $M_MSG_NUM and $M_DIVISOR also.
  569. ;
  570. mov word ptr $M_RT.$M_CRLF,0a0dh ; Reinit CR-LF ;M016
  571. mov byte ptr $M_RT.$M_BUF_TERM,'$' ; Reinit buffer end;M016
  572. mov word ptr $M_RT.$M_MSG_NUM,$M_NULL ; M020
  573. mov word ptr $M_RT.$M_DIVISOR,$M_BASE10 ; M020
  574. $M_BUILD_PTRS %$M_NUM_CLS ;;AN000;; Build all utility classes
  575. ;;AN000;;
  576. CALL $M_GET_DBCS_VEC ;;AN000;; Save the DBCS vector
  577. IF NOT NOCHECKSTDIN ;;AN000;; IF EOF check is not to be suppressed
  578. CALL $M_CHECKSTDIN ;;AN000;; Set EOF CHECK
  579. ENDIF ;;AN000;;
  580. ;;AN000;;
  581. IF NOT NOCHECKSTDOUT ;;AN000;; IF Disk Full check is not to be suppressed
  582. CALL $M_CHECKSTDOUT ;;AN000;; Set Disk Full CHECK
  583. ENDIF ;;AN000;;
  584. ;;AN000;;
  585. IF NOVERCHECKmsg ;;AN000;; IF version check is to be supressed
  586. CLC ;;AN000;; Make sure carry is clear
  587. ELSE ;;AN000;; ELSE
  588. PUSH CX ;;AN000;;
  589. CALL $M_VERSION_CHECK ;;AN000;; Check Version
  590. ENDIF ;;AN000;;
  591. ;; Error ?
  592. ; $IF NC ;;AN000;; No.
  593. JC $MIF20
  594. IF NOT NOVERCHECKmsg ;;AN000;; IF version check was not supressed
  595. POP CX ;;AN000;; Reset stack
  596. ENDIF ;;AN000;;
  597. POP DI ;;AN000;; Restore REGS
  598. POP ES ;;AN000;;
  599. POP DX ;;AN000;;
  600. POP BX ;;AN000;;
  601. POP AX ;;AN000;;
  602. ; $ELSE ;;AN000;; Yes,
  603. JMP SHORT $MEN20
  604. $MIF20:
  605. IF NOVERCHECKmsg ;;AN000;; IF version check is to be supressed
  606. ADD SP,10 ;;AN000;;
  607. STC ;;AN000;; Reset carry flag
  608. ELSE ;;AN000;; IF version check is to be supressed
  609. ADD SP,12 ;;AN000;;
  610. STC ;;AN000;; Reset carry flag
  611. ENDIF ;;AN000;; IF version check is to be supressed
  612. ; $ENDIF ;;AN000;;
  613. $MEN20:
  614. RET ;;AN000;;
  615. ;;
  616. SYSLOADMSG ENDP ;;AN000;;
  617. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  618. PAGE
  619. SUBTTL DOS - Message Retriever - $M_VERSION_CHECK Proc
  620. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  621. ;;
  622. ;; Proc Name: $M_GET_DBCS_VEC
  623. ;;
  624. ;; Function: Get the DBCS vector and save it for later use
  625. ;;
  626. ;; Inputs: None
  627. ;;
  628. ;; Outputs: None
  629. ;;
  630. ;; Regs Changed:
  631. ;;
  632. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  633. ;;
  634. $M_GET_DBCS_VEC PROC NEAR ;;AN000;;
  635. ;;
  636. PUSH AX ;;AN000;; Save character to check
  637. PUSH SI ;;AN000;;
  638. PUSH DS ;;AN000;;
  639. MOV AX,DOS_GET_DBCS_INFO ;;AN000;; DOS function to get DBSC environment
  640. INT 21H ;;AN000;; Get environment pointer
  641. PUSH DS ;;AN000;; Get environment pointer
  642. POP ES ;;AN000;; Get environment pointer
  643. POP DS ;;AN000;; Get environment pointer
  644. ; $IF NC ;;AN000;;
  645. JC $MIF23
  646. MOV WORD PTR $M_RT.$M_DBCS_VEC,SI ;;AN000;; Save DBCS Vector
  647. MOV WORD PTR $M_RT.$M_DBCS_VEC+2,ES ;;AN000;;
  648. ; $ENDIF ;;AN000;;
  649. $MIF23:
  650. POP SI ;;AN000;;
  651. POP AX ;;AN000;; Retrieve character to check
  652. RET ;;AN000;; Return
  653. ;;
  654. $M_GET_DBCS_VEC ENDP ;;
  655. ;;
  656. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  657. IF NOCHECKSTDIN ;AN001; Are we suppose to include the code for Checking EOF ?
  658. ELSE ;AN001; Yes, THEN include it
  659. PAGE
  660. SUBTTL DOS - Message Retriever - $M_CHECKSTDIN Proc
  661. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  662. ;;
  663. ;; Proc Name: $M_CHECKSTDIN
  664. ;;
  665. ;; Function:
  666. ;;
  667. ;; Inputs: None
  668. ;;
  669. ;; Outputs:
  670. ;;
  671. ;; Regs Changed:
  672. ;;
  673. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  674. ;;
  675. $M_CHECKSTDIN PROC NEAR ;AN001;
  676. MOV AX,DOS_IOCTL_GET_INFO ;AN001; Get info using IOCTL
  677. MOV BX,STDIN ;AN001;
  678. XOR DX,DX ;AN001;
  679. INT 21H ;AN001;
  680. AND DH,1 ;clear top 7 bits
  681. OR DH,$M_CRIT_ERR_MASK ;AN001; Turn on bit
  682. MOV AX,DOS_IOCTL_SET_INFO ;AN001; Set info using IOCTL
  683. INT 21H ;AN001;
  684. RET ;AN001;
  685. $M_CHECKSTDIN ENDP ;AN001;
  686. ;;
  687. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  688. ENDIF ;AN001; END of include for EOF Check
  689. IF NOCHECKSTDOUT ;AN001; Are we suppose to include the code for Checking Disk Full?
  690. ELSE ;AN001; Yes, THEN include it
  691. PAGE
  692. SUBTTL DOS - Message Retriever - $M_CHECKSTDOUT Proc
  693. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  694. ;;
  695. ;; Proc Name: $M_CHECKSTDOUT
  696. ;;
  697. ;; Function:
  698. ;;
  699. ;; Inputs: None
  700. ;;
  701. ;; Outputs:
  702. ;;
  703. ;; Regs Changed:
  704. ;;
  705. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  706. ;;
  707. $M_CHECKSTDOUT PROC NEAR ;AN001;
  708. MOV AX,DOS_IOCTL_GET_INFO ;AN001; Get info using IOCTL
  709. MOV BX,STDOUT ;AN001;
  710. XOR DX,DX ;AN001;
  711. INT 21H ;AN001;
  712. OR DH,$M_CRIT_ERR_MASK ;AN001; Turn on bit
  713. MOV AX,DOS_IOCTL_SET_INFO ;AN001; Set info using IOCTL
  714. INT 21H ;AN001;
  715. RET ;AN001;
  716. $M_CHECKSTDOUT ENDP ;AN001;
  717. ;;
  718. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  719. ENDIF ;AN001; END of include for Disk Full Check
  720. IF NOVERCHECKmsg ;;AN000;; Are we suppose to include the code for DOS version check?
  721. ELSE ;;AN000;; Yes, THEN include it
  722. PAGE
  723. SUBTTL DOS - Message Retriever - $M_VERSION_CHECK Proc
  724. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  725. ;;
  726. ;; Proc Name: $M_VERSION_CHECK
  727. ;;
  728. ;; Function: Determine if DOS version is within allowable limits
  729. ;;
  730. ;; Inputs: None
  731. ;;
  732. ;; Outputs: CARRY_FLAG = 1 if Incorrect DOS version
  733. ;; Registers set for SYSDISPMSG
  734. ;; CARRY_FLAG = 0 if Correct DOS version
  735. ;;
  736. ;; Regs Changed: AX
  737. ;;
  738. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  739. ;;
  740. $M_VERSION_CHECK PROC NEAR ;;AN000;;
  741. ;;
  742. MOV AH,DOS_GET_VERSION ;;AN000;; Check that version matches VERSIONA.INC
  743. INT 21H ;;AN000;;
  744. ;;
  745. CMP AX,EXPECTED_VERSION ;;AN000;; IF DOS_MAJOR is correct
  746. ; $IF E ;;AN000;;
  747. JNE $MIF25
  748. CLC ;;AN000;; Clear the carry flag
  749. ; $ELSE ;;AN000;; ELSE
  750. JMP SHORT $MEN25
  751. $MIF25:
  752. IF NOT COMR ;; ** Special case for RESIDENT COMMAND.COM
  753. CMP AX,LOWEST_4CH_VERSION ;;AN000;; Does this version support AH = 4CH
  754. ; $IF B ;;AN000;; No,
  755. JNB $MIF27
  756. MOV BX,NO_HANDLE ;;AN000;; No handle (version doesn't support)
  757. ; $ELSE ;;AN000;; Yes,
  758. JMP SHORT $MEN27
  759. $MIF27:
  760. MOV BX,STDERR ;;AN000;; Standard Error
  761. ; $ENDIF ;;AN000;;
  762. $MEN27:
  763. ELSE
  764. MOV BX,NO_HANDLE ;;AN000;; No handle
  765. ENDIF
  766. MOV AX,1 ;;AN000;; Set message # 1
  767. MOV CX,NO_REPLACE ;;AN000;; No replacable parms
  768. MOV DL,NO_INPUT ;;AN000;; No input
  769. MOV DH,UTILITY_MSG_CLASS ;;AN000;; Utility class message
  770. STC ;;AN000;; Set Carry Flag
  771. ; $ENDIF ;;AN000;;
  772. $MEN25:
  773. ;;
  774. RET ;;AN000;; Return
  775. ;;
  776. $M_VERSION_CHECK ENDP ;;
  777. ;;
  778. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  779. ENDIF ;;AN000;; END of include for DOS version check
  780. ENDIF ;;AN000;; END of include for SYSLOADMSG
  781. ;
  782. IF GETmsg ;;AN000;; Is the request to include the code for SYSGETMSG ?
  783. IF COMR ;;AN000;;
  784. $M_RT EQU $M_RT2 ;;AN000;;
  785. ENDIF ;;AN000;;
  786. GETmsg = FALSE ;;AN000;; Yes, THEN include it and reset flag
  787. PAGE
  788. SUBTTL DOS - Message Retriever - GETMSG.ASM Module
  789. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  790. ;;
  791. ;; Proc Name: SYSGETMSG
  792. ;;
  793. ;; Function: The GET service returns the segment, offset and size of the
  794. ;; message text to the caller based on a message number.
  795. ;; The GET function will not display the message thus assumes
  796. ;; caller will handle replaceable parameters.
  797. ;;
  798. ;; Inputs:
  799. ;;
  800. ;; Outputs:
  801. ;;
  802. ;; Psuedocode:
  803. ;; Call $M_GET_MSG_ADDRESS
  804. ;; IF MSG_NUM exists THEN
  805. ;; Set DS:SI = MSG_TXT_PTR + 1
  806. ;; CARRY_FLAG = 0
  807. ;; ELSE
  808. ;; CARRY_FLAG = 1
  809. ;; ENDIF
  810. ;;
  811. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  812. ;;
  813. IF FARmsg ;;AN000;;
  814. SYSGETMSG PROC FAR ;;AN000;;
  815. ELSE ;;AN000;;
  816. SYSGETMSG PROC NEAR ;;AN000;;
  817. ENDIF ;;AN000;;
  818. ;;
  819. ;; Save registers needed later
  820. PUSH AX ;;AN000;; Save changed regs
  821. PUSH ES ;;AN000;;
  822. PUSH DI ;;AN000;;
  823. PUSH BP ;;AN000;;
  824. ;;
  825. IF FARmsg ;;AN000;;
  826. CALL FAR PTR $M_GET_MSG_ADDRESS ;;AN000;; Scan thru classes to find message
  827. ELSE ;;AN000;;
  828. CALL $M_GET_MSG_ADDRESS ;;AN000;; Scan thru classes to find message
  829. ENDIF ;;AN000;; Return message in ES:DI
  830. ; $IF NC ;;AN000;; Message found?
  831. JC $MIF31
  832. CMP DH,UTILITY_MSG_CLASS
  833. CLC ;;AN000;;
  834. ; $IF NE
  835. JE $MIF32
  836. PUSH ES ;;AN000;;
  837. POP DS ;;AN000;; Return message in DS:SI
  838. ; $ELSE
  839. JMP SHORT $MEN32
  840. $MIF32:
  841. IF FARmsg ;;AN000;; Yes,
  842. PUSH ES ;;AN000;;
  843. POP DS ;;AN000;; Return message in DS:SI
  844. ELSE ;;AN000;;
  845. PUSH CS ;;AN000;; Return message in DS:SI
  846. POP DS ;;AN000;;
  847. ENDIF ;;AN000;;
  848. ; $ENDIF ;;AN000;;
  849. $MEN32:
  850. MOV SI,DI ;;AN000;; Return message in DS:SI
  851. ; $ENDIF ;;AN000;;
  852. $MIF31:
  853. ;;
  854. POP BP ;;AN000;; Restore changed regs
  855. POP DI ;;AN000;;
  856. POP ES ;;AN000;;
  857. POP AX ;;AN000;;
  858. ;;
  859. RET ;;AN000;; Return
  860. ;;
  861. SYSGETMSG ENDP ;;
  862. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  863. IF $M_SUBS ;;AN000;; Include the common subroutines if they haven't yet
  864. $M_SUBS = FALSE ;;AN000;; No, then include and reset the flag
  865. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  866. ;;
  867. ;; PROC NAME: $M_GET_MSG_ADDRESS
  868. ;;
  869. ;; FUNCTION: To scan thru classes to return pointer to the message header
  870. ;; INPUTS: Access to $M_RES_ADDRESSES
  871. ;; OUPUTS: IF CX = 0 THEN Message was not found
  872. ;; IF CX > 1 THEN ES:DI points to the specified message
  873. ;; REGS CHANGED: ES,DI,CX
  874. ;;
  875. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  876. ;;
  877. IF FARmsg ;;AN000;;
  878. $M_GET_MSG_ADDRESS PROC FAR ;;AN000;;
  879. ELSE ;;AN000;;
  880. $M_GET_MSG_ADDRESS PROC NEAR ;;AN000;;
  881. ENDIF ;;AN000;;
  882. ;;
  883. PUSH SI ;;AN000;;
  884. PUSH BX ;;AN000;;
  885. XOR SI,SI ;;AN000;; Use SI as an index
  886. XOR CX,CX ;;AN000;; Use CX as an size
  887. ; $DO ;;AN000;;
  888. $MDO36:
  889. CMP DH,UTILITY_MSG_CLASS ;;AN000;; Were utility messages requested?
  890. ; $IF E ;;AN000;; Yes,
  891. JNE $MIF37
  892. IF FARmsg ;;AN000;;
  893. LES DI,DWORD PTR $M_RT.$M_CLASS_ADDRS[SI] ;;AN000;; Get address of class
  894. MOV BX,ES ;;AN000;
  895. ELSE ;;AN000;;
  896. MOV DI,WORD PTR $M_RT.$M_CLASS_ADDRS[SI] ;;AN000;; Get address of class
  897. MOV BX,DI ;;AN000;
  898. ENDIF ;;AN000;;
  899. ; $ELSE ;;AN000;; No,
  900. JMP SHORT $MEN37
  901. $MIF37:
  902. TEST DH,PARSE_ERR_CLASS ;;AN000;; Were parse errors requested?
  903. ; $IF NE ;;AN000;; Yes,
  904. JE $MIF39
  905. LES DI,DWORD PTR $M_RT.$M_PARSE_COMMAND[SI] ;;AN000;; Get address of class
  906. MOV BX,ES ;;AN000;
  907. ; $ELSE ;;AN000;; No, extended errors were specified
  908. JMP SHORT $MEN39
  909. $MIF39:
  910. CMP AX,$M_CRIT_LO ;;AN000;; Is this a critical error?
  911. ; $IF AE,AND ;;AN000;;
  912. JNAE $MIF41
  913. CMP AX,$M_CRIT_HI ;;AN000;;
  914. ; $IF BE ;;AN000;; Yes,
  915. JNBE $MIF41
  916. LES DI,DWORD PTR $M_RT.$M_CRIT_ADDRS[SI] ;;AN000;; Get address of class
  917. MOV BX,ES ;;AN000;
  918. ; $ELSE ;;AN000;;
  919. JMP SHORT $MEN41
  920. $MIF41:
  921. LES DI,DWORD PTR $M_RT.$M_EXT_ERR_ADDRS[SI] ;;AN000;; Get address of class
  922. MOV BX,ES ;;AN000;
  923. ; $ENDIF ;;AN000;;
  924. $MEN41:
  925. ; $ENDIF ;;AN000;;
  926. $MEN39:
  927. ; $ENDIF ;;AN000;;
  928. $MEN37:
  929. ;;
  930. CMP BX,$M_TERMINATING_FLAG ;;AN000;; Are we finished all classes?
  931. ; $IF E ;;AN000;; Yes,
  932. JNE $MIF46
  933. CMP DH,UTILITY_MSG_CLASS ;;AN000;; Was it a UTILITY class?
  934. ; $IF E ;;AN000;; Yes,
  935. JNE $MIF47
  936. STC ;;AN000;; Set the carry flag
  937. ; $ELSE ;;AN000;; No,
  938. JMP SHORT $MEN47
  939. $MIF47:
  940. MOV $M_RT.$M_MSG_NUM,AX ;;AN000;; Save message number
  941. MOV AX,$M_SPECIAL_MSG_NUM ;;AN000;; Set special message number
  942. MOV BP,$M_ONE_REPLACE ;;AN000;; Set one replace in message
  943. XOR SI,SI ;;AN000;; Reset the SI index to start again
  944. CLC ;;AN000;;
  945. ; $ENDIF ;;AN000;; No,
  946. $MEN47:
  947. ; $ELSE ;;AN000;;
  948. JMP SHORT $MEN46
  949. $MIF46:
  950. CMP BX,$M_CLASS_NOT_EXIST ;;AN000;; Does this class exist?
  951. ; $IF NE ;;AN001;; Yes,
  952. JE $MIF51
  953. CALL $M_FIND_SPECIFIED_MSG ;;AN000;; Try to find the message
  954. ; $ENDIF ;;AN000;;
  955. $MIF51:
  956. ADD SI,$M_ADDR_SZ_FAR ;;AN000;; Get next class
  957. CLC ;;AN000;;
  958. ; $ENDIF ;;AN000;;
  959. $MEN46:
  960. ; $LEAVE C ;;AN000;;
  961. JC $MEN36
  962. OR CX,CX ;;AN000;; Was the message found?
  963. ; $ENDDO NZ,LONG ;;AN000;;
  964. JNZ $MXL2
  965. JMP $MDO36
  966. $MXL2:
  967. $MEN36:
  968. PUSHF ;;AN006;; Save the flag state
  969. CMP DH,EXT_ERR_CLASS ;;AN006;; Was an extended error requested?
  970. ; $IF E ;;AN006;; Yes,
  971. JNE $MIF56
  972. PUSH DX ;;AN006;; Save all needed registers
  973. PUSH BP ;;AN006;;
  974. PUSH CX ;;AN006;;
  975. PUSH ES ;;AN006;;
  976. PUSH DI ;;AN006;;
  977. PUSH AX ;;AN006;;
  978. MOV AX,IFSFUNC_INSTALL_CHECK ;;AN006;; Check if IFSFUNC is installed
  979. INT 2FH ;;AN006;;
  980. CMP AL,IFSFUNC_INSTALLED ;;AN006;; Is it installed?
  981. POP AX ;;AN006;; Restore msg number
  982. ; $IF E ;;AN006;; Yes,
  983. JNE $MIF57
  984. MOV BX,AX ;;AN006;; BX is the extended error number
  985. MOV AX,IFS_GET_ERR_TEXT ;;AN006;; AX is the muliplex number
  986. INT 2FH ;;AN006;; Call IFSFUNC
  987. ; $ELSE ;;AN006;; No,
  988. JMP SHORT $MEN57
  989. $MIF57:
  990. STC ;;AN006;; Carry conditon
  991. ; $ENDIF ;;AN006;;
  992. $MEN57:
  993. ; $IF C ;;AN006;; Was there an update?
  994. JNC $MIF60
  995. POP DI ;;AN006;; No,
  996. POP ES ;;AN006;; Restore old pointer
  997. POP CX ;;AN006;;
  998. ; $ELSE ;;AN006;; Yes
  999. JMP SHORT $MEN60
  1000. $MIF60:
  1001. ADD SP,6 ;;AN006;; Throw away old pointer
  1002. CALL $M_SET_LEN_IN_CX ;;AN006;; Get the length of the ASCIIZ string
  1003. ; $ENDIF ;;AN006;;
  1004. $MEN60:
  1005. POP BP ;;AN006;; Restore other Regs
  1006. POP DX ;;AN006;;
  1007. ; $ENDIF ;;AN006;;
  1008. $MIF56:
  1009. $M_POPF ;;AN006;; Restore the flag state
  1010. POP BX ;;AN000;;
  1011. POP SI ;;AN000;;
  1012. RET ;;AN000;; Return ES:DI pointing to the message
  1013. ;;
  1014. $M_GET_MSG_ADDRESS ENDP ;;
  1015. ;;
  1016. $M_SET_LEN_IN_CX PROC NEAR ;;
  1017. ;;
  1018. PUSH DI ;;AN006;; Save position
  1019. PUSH AX ;;AN006;;
  1020. MOV CX,-1 ;;AN006;; Set CX for decrements
  1021. XOR AL,AL ;;AN006;; Prepare compare register
  1022. REPNE SCASB ;;AN006;; Scan for zero
  1023. NOT CX ;;AN006;; Change decrement into number
  1024. DEC CX ;;AN006;; Don't include the zero
  1025. POP AX ;;AN006;;
  1026. POP DI ;;AN006;; Restore position
  1027. RET ;;AN006;;
  1028. ;;
  1029. $M_SET_LEN_IN_CX ENDP ;;
  1030. ;;
  1031. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  1032. ;;
  1033. ;; PROC NAME: $M_FIND_SPECIFIED_MSG
  1034. ;;
  1035. ;; FUNCTION: To scan thru message headers until message is found
  1036. ;; INPUTS: ES:DI points to beginning of msg headers
  1037. ;; CX contains the number of messages in class
  1038. ;; DH contains the message class
  1039. ;; OUPUTS: IF CX = 0 THEN Message was not found
  1040. ;; IF CX > 1 THEN ES:DI points to header of specified message
  1041. ;;
  1042. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  1043. ;;
  1044. $M_FIND_SPECIFIED_MSG PROC NEAR ;;AN000;;
  1045. ;;
  1046. ifdef BILINGUAL
  1047. push ax ; save ax
  1048. push ax
  1049. push bx
  1050. mov ax,4f01h ; get code page
  1051. xor bx,bx
  1052. int 2fh
  1053. ifdef JAPAN
  1054. cmp bx,932
  1055. endif
  1056. ifdef KOREA
  1057. cmp bx,949
  1058. endif
  1059. ifdef TAIWAN
  1060. cmp bx,950
  1061. endif
  1062. ifdef PRC
  1063. cmp bx,936
  1064. endif
  1065. pop bx
  1066. pop ax
  1067. jz MFSM_03 ; if DBCS code page
  1068. cmp ax,$M_SPECIAL_MSG_NUM
  1069. jz MFSM_03
  1070. cmp dh,EXT_ERR_CLASS
  1071. jz MFSM_01
  1072. cmp dh,PARSE_ERR_CLASS
  1073. jz MFSM_02
  1074. add ax,UTILITY_MSG_ADJ
  1075. jmp short MFSM_03
  1076. MFSM_01:
  1077. add ax,EXT_MSG_ADJ
  1078. jmp short MFSM_03
  1079. MFSM_02:
  1080. add ax,PARSE_MSG_ADJ
  1081. MFSM_03:
  1082. endif
  1083. CMP BX,1 ;;AN004;; Do we have an address to CALL?
  1084. ; $IF E,AND ;;AN004;; Yes,
  1085. JNE $MIF64
  1086. CMP WORD PTR $M_RT.$M_DISK_PROC_ADDR,-1 ;;AN004;; Do we have an address to CALL?
  1087. ; $IF NE ;;AN004;; Yes,
  1088. JE $MIF64
  1089. CMP AX,$M_SPECIAL_MSG_NUM ;;AN004;; Are we displaying a default Ext Err?
  1090. ; $IF E ;;AN004;; . . . and . . .
  1091. JNE $MIF65
  1092. PUSH AX ;;AN004;; Reset the special message number
  1093. MOV AX,$M_RT.$M_MSG_NUM ;;AN004;; Get the old message number
  1094. CALL DWORD PTR $M_RT.$M_DISK_PROC_ADDR ;;AN004;; Call the READ_DISK_PROC to get error text
  1095. POP AX ;;AN004;; Reset the special message number
  1096. ; $ELSE ;;AN004;; Get the old message number
  1097. JMP SHORT $MEN65
  1098. $MIF65:
  1099. CALL DWORD PTR $M_RT.$M_DISK_PROC_ADDR ;;AN004;; Call the READ_DISK_PROC to get error text
  1100. ; $ENDIF ;;AN004;; Get the old message number
  1101. $MEN65:
  1102. ; $ELSE ;;AN004;;
  1103. JMP SHORT $MEN64
  1104. $MIF64:
  1105. XOR CX,CX ;;AN002;; CX = 0 will allow us to
  1106. CMP DH,UTILITY_MSG_CLASS ;;AN001;;
  1107. ; $IF NE ;;AN001;;
  1108. JE $MIF69
  1109. ifdef BILINGUAL
  1110. MOV CX,WORD PTR ES:[DI].$M_NUM_CLS_MSG ;;AN001;; Get number of messages in class
  1111. else
  1112. MOV CL,BYTE PTR ES:[DI].$M_NUM_CLS_MSG ;;AN001;; Get number of messages in class
  1113. endif
  1114. ; $ELSE ;;AN001;;
  1115. JMP SHORT $MEN69
  1116. $MIF69:
  1117. IF FARmsg ;;AN001;;
  1118. CMP BYTE PTR ES:[DI].$M_CLASS_ID,DH ;;AN002;; Check if class still exists at
  1119. ELSE
  1120. CMP BYTE PTR CS:[DI].$M_CLASS_ID,DH ;;AN002;; Check if class still exists at
  1121. ENDIF
  1122. ; $IF E ;;AN002;; pointer (hopefully)
  1123. JNE $MIF71
  1124. IF FARmsg ;;AN001;;
  1125. ifdef BILINGUAL
  1126. MOV CX,WORD PTR ES:[DI].$M_NUM_CLS_MSG ;;AN000;; Get number of messages in class
  1127. else
  1128. MOV CL,BYTE PTR ES:[DI].$M_NUM_CLS_MSG ;;AN000;; Get number of messages in class
  1129. endif
  1130. ELSE
  1131. ifdef BILINGUAL
  1132. MOV CX,WORD PTR CS:[DI].$M_NUM_CLS_MSG ;;AN000;; Get number of messages in class
  1133. else
  1134. MOV CL,BYTE PTR CS:[DI].$M_NUM_CLS_MSG ;;AN000;; Get number of messages in class
  1135. endif
  1136. ENDIF
  1137. ; $ENDIF ;;AN002;; go on to the next class
  1138. $MIF71:
  1139. ; $ENDIF ;;AN001;;
  1140. $MEN69:
  1141. ADD DI,$M_CLASS_ID_SZ ;;AN000;; Point past the class header
  1142. STC ;;AN004;; Flag that we haven't found anything yet
  1143. ; $ENDIF ;;AN004;;
  1144. $MEN64:
  1145. ; $IF C ;;AN004;; Have we found anything yet?
  1146. JNC $MIF75
  1147. CLC ;;AN004;; No, reset carry
  1148. ; $SEARCH ;;AN000;;
  1149. $MDO76:
  1150. OR CX,CX ;;AN000;; Do we have any to check?
  1151. ; $LEAVE Z ;;AN000;; No, return with CX = 0
  1152. JZ $MEN76
  1153. CMP DH,UTILITY_MSG_CLASS ;;AN001;;
  1154. ; $IF NE ;;AN001;;
  1155. JE $MIF78
  1156. CMP AX,WORD PTR ES:[DI].$M_NUM ;;AN001;; Is this the message requested?
  1157. ; $ELSE ;;AN001;;
  1158. JMP SHORT $MEN78
  1159. $MIF78:
  1160. IF FARmsg ;;AN001;;
  1161. CMP AX,WORD PTR ES:[DI].$M_NUM ;;AN000;; Is this the message requested?
  1162. ELSE
  1163. CMP AX,WORD PTR CS:[DI].$M_NUM ;;AN000;; Is this the message requested?
  1164. ENDIF
  1165. ; $ENDIF
  1166. $MEN78:
  1167. ; $EXITIF E ;;AN000;;
  1168. JNE $MIF76
  1169. ; $ORELSE ;;AN000;
  1170. JMP SHORT $MSR76
  1171. $MIF76:
  1172. DEC CX ;;AN000;; No, well do we have more to check?
  1173. ; $LEAVE Z ;;AN000;; No, return with CX = 0
  1174. JZ $MEN76
  1175. ADD DI,$M_ID_SZ ;;AN000;; Yes, skip past msg header
  1176. ; $ENDLOOP ;;AN000;;
  1177. JMP SHORT $MDO76
  1178. $MEN76:
  1179. STC ;;AN000;;
  1180. ; $ENDSRCH ;;AN000;; Check next message
  1181. $MSR76:
  1182. ; $IF NC ;;AN000;; Did we find the message?
  1183. JC $MIF86
  1184. CMP DH,UTILITY_MSG_CLASS ;;AN001;; Yes, is it a utility message?
  1185. CLC ;;AN001;;
  1186. ; $IF E ;;AN001;;
  1187. JNE $MIF87
  1188. IF FARmsg ;;AN001;;
  1189. ELSE ;;AN000;;
  1190. PUSH CS ;;AN000;;
  1191. POP ES ;;AN000;; Return ES:DI pointing to the message
  1192. ENDIF
  1193. ; $ENDIF ;;AN001;;
  1194. $MIF87:
  1195. ADD DI,WORD PTR ES:[DI].$M_TXT_PTR ;;AN000;; Prepare ES:DI pointing to the message
  1196. ; $ENDIF ;;AN004;;
  1197. $MIF86:
  1198. ; $ENDIF ;;AN004;;
  1199. $MIF75:
  1200. ;; Yes, great we can return with CX > 0
  1201. ; $IF NC ;;AN000;; Did we find the message?
  1202. JC $MIF91
  1203. XOR CH,CH ;;AN000;;
  1204. MOV CL,BYTE PTR ES:[DI] ;;AN000;; Move size into CX
  1205. INC DI ;;AN000;; Increment past length
  1206. ; $ENDIF ;;AN004;;
  1207. $MIF91:
  1208. MOV $M_RT.$M_SIZE,$M_NULL ;;AN004;; Reset variable
  1209. ifdef BILINGUAL
  1210. pop ax
  1211. endif
  1212. RET ;;AN000;; Return
  1213. ;;
  1214. $M_FIND_SPECIFIED_MSG ENDP ;;AN000;;
  1215. ;;
  1216. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  1217. ENDIF ;;AN000;; END of include of common subroutines
  1218. ENDIF ;;AN000;; END of include of SYSGETMSG
  1219. ;
  1220. IF DISPLAYmsg ;;AN000;; Is the request to include the code for SYSGETMSG ?
  1221. IF COMR ;;AN000;;
  1222. $M_RT EQU $M_RT2 ;;AN000;;
  1223. ENDIF ;;AN000;;
  1224. DISPLAYmsg = FALSE ;;AN000;; Yes, THEN include it and reset flag
  1225. PAGE
  1226. SUBTTL DOS - Message Retriever - DISPMSG.ASM Module
  1227. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  1228. ;;
  1229. ;; Proc Name: SYSDISPMSG
  1230. ;;
  1231. ;; Function: The DISPLAY service will output a defined message to a handle
  1232. ;; requested by the caller. It also provides function to display
  1233. ;; messages when handles are not applicable (ie. DOS function calls
  1234. ;; 00h to 0Ah) Replaceable parameters are allowed and are
  1235. ;; defined previous to entry.
  1236. ;;
  1237. ;; It is assumes that a PRELOAD function has already determined
  1238. ;; the addressibilty internally to the message retriever services.
  1239. ;; Inputs:
  1240. ;;
  1241. ;; Outputs:
  1242. ;;
  1243. ;; Psuedocode:
  1244. ;; Save registers needed later
  1245. ;; Get address of the message requested
  1246. ;; IF Message number exists THEN
  1247. ;; IF replacable parameters were specified THEN
  1248. ;; Display message with replacable parms
  1249. ;; ELSE
  1250. ;; Display string without replacable parms
  1251. ;; ENDIF
  1252. ;; IF character input was requested THEN
  1253. ;; Wait for character input
  1254. ;; ENDIF
  1255. ;; Clear CARRY FLAG
  1256. ;; ELSE
  1257. ;; Set CARRY FLAG
  1258. ;; ENDIF
  1259. ;; Return
  1260. ;;
  1261. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  1262. ;;
  1263. IF FARmsg ;;AN000;;
  1264. SYSDISPMSG PROC FAR ;;AN000;;
  1265. ELSE ;;AN000;;
  1266. SYSDISPMSG PROC NEAR ;;AN000;;
  1267. ENDIF ;;AN000;;
  1268. ;;
  1269. ;; Save registers and values needed later
  1270. PUSH AX ;;AN000;; Save changed REGs
  1271. PUSH BX ;;AN000;;
  1272. PUSH CX ;;AN000;;
  1273. PUSH BP ;;AN000;;
  1274. PUSH DI ;;AN000;; Save pointer to input buffer (offset)
  1275. PUSH ES ;;AN000;; Save pointer to input buffer (segment)
  1276. PUSH DX ;;AN000;; Save Input/Class request
  1277. MOV BP,CX ;;AN000;; Use BP to hold replace count
  1278. MOV WORD PTR $M_RT.$M_HANDLE,BX ;;AN000;; Save handle
  1279. MOV BYTE PTR $M_RT.$M_CLASS,DH ;;AN004;; Save class
  1280. ;; Get address of the message requested
  1281. IF FARmsg ;;AN000;;
  1282. CALL FAR PTR $M_GET_MSG_ADDRESS ;;AN000;; Scan thru classes to find message
  1283. ELSE ;;AN000;;
  1284. CALL $M_GET_MSG_ADDRESS ;;AN000;; Scan thru classes to find message
  1285. ENDIF ;;AN000;;
  1286. OR CX,CX ;;AN000;; Was message found?
  1287. ; $IF NZ ;;AN000;; YES, Message address in ES:DI
  1288. JZ $MIF93
  1289. ;; Test if replacable parameters were specified
  1290. OR BP,BP ;;AN000;; Were replacable parameters requested
  1291. ; $IF Z ;;AN000;;
  1292. JNZ $MIF94
  1293. ;; Display string without replacable parms
  1294. CALL $M_DISPLAY_STRING ;;AN000;; No, great . . . Display message
  1295. ; $ELSE ;;AN000;;
  1296. JMP SHORT $MEN94
  1297. $MIF94:
  1298. IF $M_REPLACE ;;AN000;;
  1299. ;; Display message with replacable parms
  1300. CALL $M_DISPLAY_MESSAGE ;;AN000;; Display the message with substitutions
  1301. ENDIF ;;AN000;;
  1302. ; $ENDIF ;;AN000;;
  1303. $MEN94:
  1304. ; $IF NC
  1305. JC $MIF97
  1306. POP DX ;;AN000;; Get Input/Class request
  1307. CALL $M_ADD_CRLF ;;AN004;; Check if we need to add the CR LF chars.
  1308. POP ES ;;AN000;; Get location of input buffer (if specified)
  1309. POP DI ;;AN000;;
  1310. ;; Test if character input was requested
  1311. IF INPUTmsg ;;AN000;;
  1312. OR DL,DL ;;AN000;; Was Wait-For-Input requested?
  1313. ; $IF NZ ;;AN000;;
  1314. JZ $MIF98
  1315. CALL $M_WAIT_FOR_INPUT ;;AN000;;
  1316. ; $ENDIF ;;AN000;;
  1317. $MIF98:
  1318. ENDIF ;;AN000;;
  1319. ; $ELSE ;;AN000;;
  1320. JMP SHORT $MEN97
  1321. $MIF97:
  1322. ADD SP,6 ;;AN000;;
  1323. STC ;;AN000;; Reset carry flag
  1324. ; $ENDIF ;;AN000;;
  1325. $MEN97:
  1326. ; $ELSE ;;AN000;; No,
  1327. JMP SHORT $MEN93
  1328. $MIF93:
  1329. POP ES ;;AN000;; Get pointer to input buffer (segment)
  1330. POP DI ;;AN000;; Get base pointer to first sublist (offset)
  1331. POP DX ;;AN000;; Get base pointer to first sublist (segment)
  1332. STC ;;AN000;; Set carry flag
  1333. ; $ENDIF ;;AN000;;
  1334. $MEN93:
  1335. ;;
  1336. ; $IF NC ;;AN000;; Was there an error?
  1337. JC $MIF104
  1338. POP BP ;;AN000;; No,
  1339. POP CX ;;AN000;;
  1340. POP BX ;;AN000;;
  1341. IF INPUTmsg ;;AN000;;
  1342. ADD SP,2 ;;AN000;;
  1343. ELSE ;AN000;
  1344. POP AX ;;AN000;;
  1345. ENDIF ;;AN000;;
  1346. ; $ELSE ;;AN000;; Yes,
  1347. JMP SHORT $MEN104
  1348. $MIF104:
  1349. ADD SP,8 ;;AN000;; Eliminate from stack
  1350. STC ;;AN000;;
  1351. ; $ENDIF ;;AN000;;
  1352. $MEN104:
  1353. ;;
  1354. RET ;;AN000;; Return
  1355. ;;
  1356. SYSDISPMSG ENDP ;;AN000;;
  1357. ;;
  1358. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  1359. ;
  1360. ;;
  1361. ;; PROC NAME: $M_DISPLAY_STRING
  1362. ;;
  1363. ;; FUNCTION: Will display or write string
  1364. ;; INPUTS: ES:DI points to beginning of message
  1365. ;; CX contains the length of string to write (if applicable)
  1366. ;; OUTPUTS: None
  1367. ;; REGS Revised: None
  1368. ;;
  1369. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  1370. ;;
  1371. $M_DISPLAY_STRING PROC NEAR ;;AN000;;
  1372. ;;
  1373. PUSH AX ;;AN000;;
  1374. PUSH BX ;;AN000;;
  1375. PUSH DX ;;AN000;;
  1376. ;;
  1377. MOV BX,$M_RT.$M_HANDLE ;;AN000;; Retrieve handle
  1378. ;;
  1379. IF COMR ;; ** Special case for RESIDENT COMMAND.COM
  1380. CALL $M_DISPLAY_$_STRING ;;AN000;; No, display $ terminated string
  1381. ELSE
  1382. CMP BX,$M_NO_HANDLE ;;AN000;; Was there a handle specified?
  1383. ; $IF E ;;AN000;;
  1384. JNE $MIF107
  1385. CALL $M_DISPLAY_$_STRING ;;AN000;; No, display $ terminated string
  1386. ; $ELSE ;;AN000;;
  1387. JMP SHORT $MEN107
  1388. $MIF107:
  1389. CALL $M_DISPLAY_H_STRING ;;AN000;; Yes, display string to handle
  1390. ; $ENDIF ;;AN000;;
  1391. $MEN107:
  1392. ;AN001;
  1393. ; $IF C ;;AN000;; Was there an error?
  1394. JNC $MIF110
  1395. MOV AH,DOS_GET_EXT_ERROR ;;AN000;; Yes,
  1396. MOV BX,DOS_GET_EXT_ERROR_BX ;;AN000;; Get extended error
  1397. INT 21H ;;AN000;;
  1398. XOR AH,AH ;;AN000;; Clear AH
  1399. ADD SP,6 ;;AN000;; Clean up stack
  1400. STC ;;AN000;; Flag that there was an error
  1401. ; $ELSE ;;AN000;; No,
  1402. JMP SHORT $MEN110
  1403. $MIF110:
  1404. CMP BX,$M_NO_HANDLE ;;AN000;; Was there a handle specified?
  1405. ; $IF NE ;;AN000;;
  1406. JE $MIF112
  1407. CMP AX,CX ;AN001; Was it ALL written?
  1408. ; $IF NE ;AN001; No,
  1409. JE $MIF113
  1410. CALL $M_GET_EXT_ERR_39 ;AN001; Set Extended error
  1411. ADD SP,6 ;AN001; Clean up stack
  1412. STC ;AN001; Flag that there was an error
  1413. ; $ENDIF ;AN001;
  1414. $MIF113:
  1415. ; $ENDIF ;AN001;
  1416. $MIF112:
  1417. ; $ENDIF ;;AN000;;
  1418. $MEN110:
  1419. ENDIF
  1420. ; $IF NC ;;AN000;; Was there ANY error?
  1421. JC $MIF117
  1422. POP DX ;;AN000;; Restore regs
  1423. POP BX ;;AN000;;
  1424. POP AX ;;AN000;;
  1425. ; $ENDIF ;;AN000;;
  1426. $MIF117:
  1427. RET ;;AN000;; Return
  1428. ;;
  1429. $M_DISPLAY_STRING ENDP ;;AN000;;
  1430. ;;
  1431. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  1432. ;;
  1433. ;; PROC NAME: $M_DISPLAY_$_STRING
  1434. ;;
  1435. ;; FUNCTION: Will display a $ terminated string
  1436. ;; INPUTS: ES:DI points to beginning of message text (not the length)
  1437. ;; OUPUTS: None
  1438. ;; REGS USED: AX,DX
  1439. ;;
  1440. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  1441. ;;
  1442. $M_DISPLAY_$_STRING PROC NEAR ;;AN000;;
  1443. ;;
  1444. PUSH DS ;;AN000;;
  1445. PUSH ES ;;AN000;;
  1446. POP DS ;;AN000;; Set DS to segment of message text
  1447. IF NOT COMR
  1448. CMP CX,$M_SINGLE_CHAR ;;AN000;; Is this a single character?
  1449. ; $IF E ;;AN000;; Yes,
  1450. JNE $MIF119
  1451. MOV AH,DOS_DISP_CHAR ;;AN000;; DOS Function to display CHARACTER
  1452. MOV DL,BYTE PTR ES:[DI] ;;AN000;; Get the character
  1453. INT 21H ;;AN000;; Write character
  1454. POP DS ;;AN000;; Set DS to segment of message text
  1455. MOV AL,DL ;;AN000;; Get the character in AL
  1456. CALL $M_IS_IT_DBCS ;;AN000;; Is this the first byte of a DB character
  1457. PUSH DS ;;AN000;;
  1458. PUSH ES ;;AN000;;
  1459. POP DS ;;AN000;; Set DS to segment of message text
  1460. ; $IF C ;;AN000;; Yes,
  1461. JNC $MIF120
  1462. MOV DL,BYTE PTR ES:[DI]+1 ;;AN000;; Get the next character
  1463. INT 21H ;;AN000;; Write character
  1464. CLC ;;AN000;; Clear the DBCS indicator
  1465. ; $ENDIF ;;AN000;;
  1466. $MIF120:
  1467. ; $ELSE ;;AN000;; No,
  1468. JMP SHORT $MEN119
  1469. $MIF119:
  1470. ENDIF
  1471. MOV AH,DOS_DISP_CHAR ;;AN000;; DOS Function to display CHARACTER
  1472. ; $DO ;;AN002;; No,
  1473. $MDO123:
  1474. OR CX,CX ;;AN002;; Are there any left to display?
  1475. ; $LEAVE Z ;;AN002;; Yes,
  1476. JZ $MEN123
  1477. MOV DL,BYTE PTR ES:[DI] ;;AN002;; Get the character
  1478. INT 21H ;;AN002;; Display the character
  1479. INC DI ;;AN002;; Set pointer to next character
  1480. DEC CX ;;AN002;; Count this character
  1481. ; $ENDDO Z ;;AN002;; No,
  1482. JNZ $MDO123
  1483. $MEN123:
  1484. IF NOT COMR
  1485. ; $ENDIF ;;AN000;;
  1486. $MEN119:
  1487. ENDIF
  1488. CLC ;;AN000;; Char functions used don't return carry as error
  1489. POP DS ;;AN000;;
  1490. RET ;;AN000;;
  1491. ;;
  1492. $M_DISPLAY_$_STRING ENDP ;;AN000;;
  1493. ;;
  1494. IF NOT COMR
  1495. ;
  1496. ;Scan_ctrlZ : This routine looks through the string to be printed and
  1497. ;truncates it at the Ctrl-Z if any present.
  1498. ;
  1499. ; ENTRY: ds:dx = String to be displayed
  1500. ; cx = number of chars to be displayed
  1501. ;
  1502. ; EXIT: cx = number of chars to be displayed
  1503. ;
  1504. Scan_CtrlZ proc near
  1505. push di
  1506. push ax
  1507. push es
  1508. push bx
  1509. mov di,dx
  1510. push ds
  1511. pop es ;es:di points at string
  1512. mov bx,cx ;save current count
  1513. mov al,1ah
  1514. cld
  1515. repne scasb ;find first Ctrl-Z
  1516. jnz noCtrlZ ;no CtrlZ found in string
  1517. sub bx,cx
  1518. dec bx ;bx = new count to display
  1519. noCtrlZ:
  1520. mov cx,bx ;cx = actual display count
  1521. pop bx
  1522. pop es
  1523. pop ax
  1524. pop di
  1525. ret
  1526. Scan_CtrlZ endp
  1527. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  1528. ;;
  1529. ;; PROC NAME: $M_DISPLAY_H_STRING
  1530. ;;
  1531. ;; FUNCTION: Will display a string to a specified handle
  1532. ;; INPUTS: ES:DI points to beginning of message
  1533. ;; CX contains the number of bytes to write
  1534. ;; BX contains the handle to write to
  1535. ;; OUPUTS: None
  1536. ;; REGS USED: AX,DX
  1537. ;;
  1538. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  1539. ;;
  1540. $M_DISPLAY_H_STRING PROC NEAR ;;AN000;;
  1541. ;;
  1542. XOR AX,AX ;;AN002;; Set number of bytes written to 0
  1543. OR CX,CX ;;AN002;; For performance, don't write if not necessary
  1544. ; $IF NZ ;;AN002;; Any chars to write?
  1545. JZ $MIF127
  1546. PUSH DS ;;AN000;; Yes,
  1547. PUSH ES ;;AN000;;
  1548. POP DS ;;AN000;; Set DS to segment of message text
  1549. MOV AH,DOS_WRITE_HANDLE ;;AN000;; DOS function to write to a handle
  1550. MOV DX,DI ;;AN000;; Pointer to data to write
  1551. CMP CX,$M_SINGLE_CHAR ;;AN000;; Is this a single character?
  1552. ; $IF E ;;AN000;; Yes,
  1553. JNE $MIF128
  1554. INT 21H ;;AN000;; Write character
  1555. POP DS ;;AN000;; Set DS to segment of message text
  1556. PUSH AX ;;AN000;;
  1557. MOV AL,BYTE PTR ES:[DI] ;;AN000;; Get the character
  1558. CALL $M_IS_IT_DBCS ;;AN000;; Is this the first byte of a DB character
  1559. POP AX ;;AN000;; Set DS to segment of message text
  1560. PUSH DS ;;AN000;;
  1561. PUSH ES ;;AN000;;
  1562. POP DS ;;AN000;; Set DS to segment of message text
  1563. ; $IF C ;;AN000;; Yes,
  1564. JNC $MIF129
  1565. CLC ;;AN000;; Clear the DBCS indicator
  1566. MOV AH,DOS_WRITE_HANDLE ;;AN000;; DOS function to write to a handle
  1567. INC DX ;;AN000;; Point to next character
  1568. INT 21H ;;AN000;; Write character
  1569. ; $ENDIF ;;AN000;;
  1570. $MIF129:
  1571. ;SR;
  1572. ; If the single char happened to be a Ctrl-Z, the dos write would return
  1573. ;0 chars written making the caller think there was an error writing. To
  1574. ;avoid this, we check if the single char was a Ctrl-Z and if so, return that
  1575. ;the char was written, thus fooling the caller.
  1576. ;
  1577. pushf ;save flags
  1578. cmp byte ptr es:[di],1ah ;is char a Ctrl-Z?
  1579. jnz @f ;no, continue
  1580. mov ax,cx ;yes, fake as if it was written
  1581. @@:
  1582. $M_Popf ;restore flags
  1583. ; $ELSE ;;AN000;; No,
  1584. JMP SHORT $MEN128
  1585. $MIF128:
  1586. ;SR;
  1587. ; Prescan the string looking for Ctrl-Z. We terminate the message the moment
  1588. ;we hit a Ctrl-Z. cx will contain the number of characters to be printed.
  1589. ;
  1590. push bp ; M007
  1591. push cx
  1592. call scan_ctrlZ ;cx = count without Ctrl-Z
  1593. mov bp,cx ;store no ^Z count in bp ;M007
  1594. pop cx ;get old count back ;M007
  1595. INT 21H ;;AN000;; Write String at DS:SI to handle
  1596. jnc chk_count ;no error, adjust return count
  1597. jmp short m_cnt_ok ;error, return with carry set;M007
  1598. ;M007
  1599. ; If we are writing to con and there is a Ctrl-Z in the string, the
  1600. ;return count will be much less and if this returns to the caller we can get
  1601. ;spurious error messages. We check here if the count returned is same as
  1602. ;original count or same as the count if we stop at Ctrl-Z. In the second
  1603. ;case, we fake it as if all bytes have been written. If the return count
  1604. ;does not match either count, then we had some other disk error (such as
  1605. ;insufficient disk space) and we pass it through
  1606. ;
  1607. chk_count:
  1608. cmp cx,ax ;have all bytes been written?;M007
  1609. je m_cnt_ok ;there was an error writing ;M007
  1610. cmp bp,ax ;count = Ctrl-Z count? ;M007
  1611. clc ;no error either way ;M007
  1612. jne m_cnt_ok ;no, pass it through ;M007
  1613. mov ax,cx ;return old count ;M007
  1614. m_cnt_ok: ; M007
  1615. pop bp ; M007
  1616. ; $ENDIF ;;AN000;;
  1617. $MEN128:
  1618. POP DS ;;AN000;;
  1619. ; $ENDIF ;;AN002;;
  1620. $MIF127:
  1621. ;;
  1622. RET ;;AN000;;
  1623. ;;
  1624. $M_DISPLAY_H_STRING ENDP ;;AN000;;
  1625. ;;
  1626. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  1627. ;;
  1628. ;; PROC NAME: $M_GET_EXT_ERR_39
  1629. ;;
  1630. ;; FUNCTION: Will set registers for extended error #39
  1631. ;; INPUTS: None
  1632. ;; OUPUTS: AX,BX,CX set
  1633. ;; REGS USED:
  1634. ;;
  1635. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  1636. ;;
  1637. $M_GET_EXT_ERR_39 PROC NEAR ;AN001;
  1638. ;;
  1639. MOV AX,EXT_ERR_39 ;AN001; Set AX=39
  1640. MOV BX,(ERROR_CLASS_39 SHR 8) + ACTION_39 ;AN001; Set BH=1 BL=4
  1641. MOV CH,LOCUS_39 ;AN001; Set CH=1
  1642. ;AN001;
  1643. RET ;AN001;
  1644. ;;
  1645. $M_GET_EXT_ERR_39 ENDP ;AN001;
  1646. ;;
  1647. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  1648. ENDIF
  1649. ;;
  1650. ;; PROC NAME: $M_ADD_CRLF
  1651. ;;
  1652. ;; FUNCTION: Will decide whether to display a CRLF
  1653. ;; INPUTS: DX contains the Input/Class requested
  1654. ;; OUTPUTS: None
  1655. ;; REGS Revised: CX,ES,DI
  1656. ;;
  1657. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  1658. ;;
  1659. $M_ADD_CRLF PROC NEAR ;;AN004;;
  1660. ;;
  1661. CMP DH,UTILITY_MSG_CLASS ;;AN004;; Is it a utility message?
  1662. ; $IF NE ;;AN004;; No,
  1663. JE $MIF134
  1664. TEST DH,$M_NO_CRLF_MASK ;;AN004;; Are we to supress the CR LF?
  1665. ; $IF Z ;;AN004;; No,
  1666. JNZ $MIF135
  1667. PUSH DS ;;AN004;;
  1668. POP ES ;;AN004;; Set ES to data segment
  1669. LEA DI,$M_RT.$M_CRLF ;;AN004;; Point at CRLF message
  1670. MOV CX,$M_CRLF_SIZE ;;AN004;; Set the message size
  1671. CALL $M_DISPLAY_STRING ;;AN004;; Display the CRLF
  1672. ; $ENDIF ;;AN004;;
  1673. $MIF135:
  1674. ; $ENDIF ;;AN004;;
  1675. $MIF134:
  1676. RET ;;AN004;; Return
  1677. ;;
  1678. $M_ADD_CRLF ENDP ;;AN004;;
  1679. ;;
  1680. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  1681. ;;
  1682. ;; PROC NAME: $M_IS_IT_DBCS
  1683. ;;
  1684. ;; FUNCTION: Will decide whether character is Single or Double Byte
  1685. ;; INPUTS: AL contains the byte to be checked
  1686. ;; OUPUTS: Carry flag = 0 if byte is NOT in DBCS range
  1687. ;; Carry flag = 1 if byte IS in DBCS range
  1688. ;; REGS USED: All restored
  1689. ;;
  1690. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  1691. ;;
  1692. $M_IS_IT_DBCS PROC NEAR ;;AN000;;
  1693. ;;
  1694. PUSH ES ;;AN000;; Save Extra segment register
  1695. PUSH DI ;;AN000;; Save SI register
  1696. ;;
  1697. LES DI,$M_RT.$M_DBCS_VEC ;;AN000;;
  1698. OR DI,DI ;;AN000;; Was the DBCS vector set?
  1699. ; $IF NZ ;;AN000;;
  1700. JZ $MIF138
  1701. ; $DO ;;AN000;;
  1702. $MDO139:
  1703. CMP WORD PTR ES:[DI],$M_DBCS_TERM ;;AN000;; Is this the terminating flag?
  1704. CLC ;;AN000;;
  1705. ; $LEAVE E ;;AN000;;
  1706. JE $MEN139
  1707. ;; No,
  1708. CMP AL,BYTE PTR ES:[DI] ;;AN000;; Does the character fall in the DBCS range?
  1709. ; $IF AE,AND ;;AN000;;
  1710. JNAE $MIF141
  1711. CMP AL,BYTE PTR ES:[DI]+1 ;;AN000;; Does the character fall in the DBCS range?
  1712. ; $IF BE ;;AN000;;
  1713. JNBE $MIF141
  1714. STC ;;AN000;; Yes,
  1715. ; $ENDIF ;;AN000;; Set carry flag
  1716. $MIF141:
  1717. INC DI ;;AN000;; No,
  1718. INC DI ;;AN000;; Go to next vector
  1719. ; $ENDDO ;;AN000;;
  1720. JMP SHORT $MDO139
  1721. $MEN139:
  1722. ; $ENDIF ;;AN000;;
  1723. $MIF138:
  1724. POP DI ;;AN000;;
  1725. POP ES ;;AN000;; Restore SI register
  1726. RET ;;AN000;; Return
  1727. ;;
  1728. $M_IS_IT_DBCS ENDP ;;AN000;;
  1729. ;;
  1730. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  1731. ;;
  1732. ;; PROC NAME: $M_CONVERT2ASC
  1733. ;;
  1734. ;; FUNCTION: Convert a binary number to a ASCII string
  1735. ;; INPUTS: DX:AX contains the number to be converted
  1736. ;; $M_RT_DIVISOR contains the divisor
  1737. ;; OUPUTS: CX contains the number of characters
  1738. ;; Top of stack --> Last character
  1739. ;; . . .
  1740. ;; Bot of stack --> First character
  1741. ;; REGS USED:
  1742. ;;
  1743. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  1744. ;;
  1745. $M_CONVERT2ASC PROC NEAR ;;AN000;;
  1746. ;;
  1747. POP [$M_RT.$M_RETURN_ADDR] ;;AN000;; Save Return Address
  1748. XOR BX,BX ;;AN000;; Use BP as a swapping register
  1749. ;;
  1750. XCHG BX,AX ;;AN000;; Initialize - Low Word in BP
  1751. XCHG AX,DX ;;AN000;; - High Word in AX
  1752. ; $DO ;;AN000;; DO UNTIL Low Word becomes zero
  1753. $MDO145:
  1754. DIV $M_RT.$M_DIVISOR ;;AN000;; Divide High Word by divisor
  1755. XCHG BX,AX ;;AN000;; Setup to divide Low Word using remainder
  1756. ;; and save reduced High Word in BP
  1757. DIV $M_RT.$M_DIVISOR ;;AN000;; Divide Low Word by divisor
  1758. CMP DX,9 ;;AN000;; Make a digit of the remainder
  1759. ; $IF A ;;AN000;; IF 10 to 15,
  1760. JNA $MIF146
  1761. ADD DL,55 ;;AN000;; Make A to F ASCII
  1762. ; $ELSE ;;AN000;; IF 0 to 9,
  1763. JMP SHORT $MEN146
  1764. $MIF146:
  1765. ADD DL,'0' ;;AN000;; Make 0 to 9 ASCII
  1766. ; $ENDIF ;;AN000;;
  1767. $MEN146:
  1768. PUSH DX ;;AN000;; Save the digit on the stack
  1769. INC CX ;;AN000;; Count that digit
  1770. OR AX,AX ;;AN000;; Are we done?
  1771. ; $LEAVE Z,AND ;;AN000;;
  1772. JNZ $MLL149
  1773. OR BX,BX ;;AN000;; AX and BX must be ZERO!!
  1774. ; $LEAVE Z ;;AN000;; No,
  1775. JZ $MEN145
  1776. $MLL149:
  1777. IF NOT COMR
  1778. CMP CX,$M_FIRST_THOU ;;AN000;; Are we at the first thousands mark
  1779. ; $IF E ;;AN000;; Yes,
  1780. JNE $MIF150
  1781. CMP $M_SL.$M_S_PAD,$M_COMMA ;;AN000;; Is the pad character a comma?
  1782. ; $IF E ;;AN000;; Yes,
  1783. JNE $MIF151
  1784. PUSH WORD PTR $M_RT.$M_THOU_SEPARA ;;AN000;; Insert a thousand separator
  1785. INC CX ;;AN000;;
  1786. ; $ENDIF ;;AN000;;
  1787. $MIF151:
  1788. ; $ELSE ;;AN000;; No,
  1789. JMP SHORT $MEN150
  1790. $MIF150:
  1791. CMP CX,$M_SECOND_THOU ;;AN000;; Are we at the first thousands mark
  1792. ; $IF E ;;AN000;; Yes,
  1793. JNE $MIF154
  1794. CMP $M_SL.$M_S_PAD,$M_COMMA ;;AN000;; Is the pad character a comma?
  1795. ; $IF E ;;AN000;; Yes,
  1796. JNE $MIF155
  1797. PUSH WORD PTR $M_RT.$M_THOU_SEPARA ;;AN000;; Insert a thousand separator
  1798. INC CX ;;AN000;;
  1799. ; $ENDIF ;;AN000;;
  1800. $MIF155:
  1801. ; $ELSE ;;AN000;; No,
  1802. JMP SHORT $MEN154
  1803. $MIF154:
  1804. CMP CX,$M_THIRD_THOU ;;AN000;; Are we at the first thousands mark
  1805. ; $IF E ;;AN000;; Yes,
  1806. JNE $MIF158
  1807. CMP $M_SL.$M_S_PAD,$M_COMMA ;;AN000;; Is the pad character a comma?
  1808. ; $IF E ;;AN000;; Yes,
  1809. JNE $MIF159
  1810. PUSH WORD PTR $M_RT.$M_THOU_SEPARA ;;AN000;; Insert a thousand separator
  1811. INC CX ;;AN000;;
  1812. ; $ENDIF ;;AN000;;
  1813. $MIF159:
  1814. ; $ENDIF ;;AN000;;
  1815. $MIF158:
  1816. ; $ENDIF ;;AN000;;
  1817. $MEN154:
  1818. ; $ENDIF ;;AN000;;
  1819. $MEN150:
  1820. ENDIF
  1821. XCHG AX,BX ;;AN000;; Setup to divide the reduced High Word
  1822. ;;AN000;; and Revised Low Word
  1823. XOR DX,DX ;;AN000;; Reset remainder
  1824. ; $ENDDO ;;AN000;; NEXT
  1825. JMP SHORT $MDO145
  1826. $MEN145:
  1827. ;;AN000;; Yes,
  1828. XOR DX,DX ;;AN000;; Reset remainder
  1829. XOR AX,AX ;;AN000;; Reset remainder
  1830. PUSH [$M_RT.$M_RETURN_ADDR] ;;AN000;; Restore Return Address
  1831. RET ;;AN000;; Return
  1832. ;;
  1833. $M_CONVERT2ASC ENDP ;;AN000;;
  1834. ;;
  1835. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  1836. ;;
  1837. ;; PROC NAME: $M_DISPLAY_MESSAGE
  1838. ;;
  1839. ;; FUNCTION: Will display or write entire message (with replacable parameters)
  1840. ;; INPUTS: ES:DI points to beginning of message
  1841. ;; DS:SI points to first sublist structure in chain
  1842. ;; BX contains the handle to write to (if applicable)
  1843. ;; CX contains the length of string to write (before substitutions)
  1844. ;; BP contains the count of replacables
  1845. ;;
  1846. ;; OUTPUTS:
  1847. ;; REGS USED: All
  1848. ;;
  1849. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  1850. ;;
  1851. $M_DISPLAY_MESSAGE PROC NEAR ;;AN000;;
  1852. ;;
  1853. ; $DO ;;AN000;; Note: DS:SI -> message
  1854. $MDO165:
  1855. XOR DX,DX ;;AN000;; Set size = 0
  1856. OR CX,CX ;;AN000;; Are we finished the message yet?
  1857. ; $IF NZ ;;AN000;; No,
  1858. JZ $MIF166
  1859. MOV AH,"%" ;;AN000;; Prepare to scan for %
  1860. MOV AL,0 ;;AN004;;
  1861. ;;
  1862. ; $DO ;;AN000;; Scan through string until %
  1863. $MDO167:
  1864. CMP BYTE PTR ES:[DI],AH ;;AN000;; Is this character NOT a %
  1865. ; $LEAVE E,AND ;;AN000;; No,
  1866. JNE $MLL168
  1867. CMP BYTE PTR ES:[DI+1],AH ;;AN000;; Is the next character also a %
  1868. ; $LEAVE NE,AND ;;AN000;; No,
  1869. JE $MLL168
  1870. CMP AL,AH ;;AN000;; Was the character before a %
  1871. ; $LEAVE NE ;;AN000;; No, GREAT found it
  1872. JNE $MEN167
  1873. $MLL168:
  1874. MOV AL,BYTE PTR ES:[DI] ;;AN004;; Yes, (to any of the above)
  1875. CALL $M_IS_IT_DBCS ;;AN004;; Is this character the first part of a DBCS?
  1876. ; $IF C ;;AN004;; Yes,
  1877. JNC $MIF169
  1878. INC DI ;;AN004;; Increment past second part
  1879. ; $ENDIF ;;AN004;;
  1880. $MIF169:
  1881. INC DI ;;AN000;; Next character in string
  1882. INC DX ;;AN000;; Size = Size + 1
  1883. DEC CX ;;AN000;; Decrement total size
  1884. ; $ENDDO Z ;;AN000;; Exit scan if we're at the end of the line
  1885. JNZ $MDO167
  1886. $MEN167:
  1887. ; $ENDIF ;;AN000;;
  1888. $MIF166:
  1889. ;;
  1890. PUSH SI ;;AN000;; Save beginning of sublists
  1891. XCHG CX,DX ;;AN000;; Get size of message to display (tot sz in DX)
  1892. OR BP,BP ;;AN000;; Do we have any replacables to do?
  1893. ; $IF NZ ;;AN000;; Yes,
  1894. JZ $MIF173
  1895. DEC BP ;;AN000;; Decrement number of replacables
  1896. ;; Search through sublists to find applicable one
  1897. CMP $M_RT.$M_MSG_NUM,$M_NULL ;;AN000;; Is this an Extended/Parse case
  1898. ; $IF E ;;AN000;; No,
  1899. JNE $MIF174
  1900. ; $SEARCH ;;AN000;;
  1901. $MDO175:
  1902. MOV AL,$M_SL.$M_S_ID ;;AN000;; Get ID byte
  1903. ADD AL,30H ;;AN000;; Convert to ASCII
  1904. CMP AL,BYTE PTR ES:[DI]+1 ;;AN000;; Is this the right sublist?
  1905. ; $EXITIF E ;;AN000;;
  1906. JNE $MIF175
  1907. ; $ORELSE ;;AN000;; No,
  1908. JMP SHORT $MSR175
  1909. $MIF175:
  1910. CMP AL,$M_SPECIAL_CASE ;;AN000;; Does this sublist have ID = 0
  1911. ; $LEAVE E,AND ;;AN000;; Yes,
  1912. JNE $MLL178
  1913. OR DX,DX ;;AN000;; Are we at the end of the message?
  1914. ; $LEAVE Z ;;AN000;; No,
  1915. JZ $MEN175
  1916. $MLL178:
  1917. ADD SI,WORD PTR $M_SL.$M_S_SIZE ;;AN000;; Next SUBLIST
  1918. ; $ENDLOOP ;;AN000;; Yes,
  1919. JMP SHORT $MDO175
  1920. $MEN175:
  1921. CMP $M_RT.$M_CLASS,UTILITY_MSG_CLASS ;;AN004;; Is it a utility message?
  1922. ; $IF E ;;AN004;; Yes,
  1923. JNE $MIF180
  1924. INC DX ;;AN000;; Remember to display CR,LF
  1925. INC DX ;;AN000;; at the end of the message
  1926. DEC CX ;;AN000;; Adjust message length
  1927. DEC CX ;;AN000;;
  1928. DEC DI ;;AN000;; Adjust ending address of message
  1929. DEC DI ;;AN000;;
  1930. ; $ELSE ;;AN004;; No,
  1931. JMP SHORT $MEN180
  1932. $MIF180:
  1933. MOV DX,-1 ;;AN004;; Set special case
  1934. ; $ENDIF ;;AN004;;
  1935. $MEN180:
  1936. ; $ENDSRCH ;;AN000;;
  1937. $MSR175:
  1938. ; $ENDIF ;;AN000;;
  1939. $MIF174:
  1940. ; $ENDIF ;;AN000;;
  1941. $MIF173:
  1942. ;; Prepare and display this part of message
  1943. PUSH DI ;;AN000;; Save pointer to replace number
  1944. SUB DI,CX ;;AN000;; Determine beginning of string
  1945. CALL $M_DISPLAY_STRING ;;AN000;; Display string until % (or end)
  1946. POP DI ;;AN000;; Get back pointer to replace number
  1947. POP CX ;;AN000;; Clean up stack in case error
  1948. ; $LEAVE C,LONG ;;AN000;; Fail if carry was set
  1949. JNC $MXL3
  1950. JMP $MEN165
  1951. $MXL3:
  1952. PUSH CX ;;AN000;;
  1953. ;; Save and reset pointer registers
  1954. MOV CX,DX ;;AN000;; Get the size of the rest of the message
  1955. CMP $M_SL.$M_S_ID,$M_SPECIAL_CASE-30H ;;AN000;; Is this the %0 case?
  1956. ; $IF NE ;;AN000;; No,
  1957. JE $MIF187
  1958. OR CX,CX ;;AN000;; Are we finished the whole message?
  1959. ; $IF NZ ;;AN000;; No,
  1960. JZ $MIF188
  1961. DEC CX ;;AN000;; Decrement total size (%)
  1962. DEC CX ;;AN000;; Decrement total size (#)
  1963. INC DI ;;AN000;; Go past %
  1964. INC DI ;;AN000;; Go past replace number
  1965. ; $ELSE ;;AN000;; Yes, (Note this will not leave because INC)
  1966. JMP SHORT $MEN188
  1967. $MIF188:
  1968. POP SI ;;AN000;; Get back pointer to beginning of SUBLISTs
  1969. ; $ENDIF ;;AN000;; Yes, Note this will not leave because INC
  1970. $MEN188:
  1971. ; $ELSE ;;AN000;;
  1972. JMP SHORT $MEN187
  1973. $MIF187:
  1974. OR CX,CX ;;AN000;; Are we finished the whole message?
  1975. ; $IF Z ;;AN004;; No,
  1976. JNZ $MIF192
  1977. POP SI ;;AN000;; Get back pointer to beginning of SUBLISTs
  1978. ; $ELSE ;;AN000;; No,
  1979. JMP SHORT $MEN192
  1980. $MIF192:
  1981. CMP CX,-1 ;;AN004;; Are we at the end of the message?
  1982. ; $IF Z ;;AN004;; No,
  1983. JNZ $MIF194
  1984. XOR CX,CX ;;AN004;;
  1985. ; $ENDIF ;;AN000;;
  1986. $MIF194:
  1987. OR DI,DI ;;AN004;; Turn ZF off
  1988. ; $ENDIF ;;AN000;;
  1989. $MEN192:
  1990. ; $ENDIF ;;AN000;; Note this will not leave because INC
  1991. $MEN187:
  1992. ; $LEAVE Z ;;AN000;;
  1993. JZ $MEN165
  1994. PUSH BP ;;AN000;; Save the replace count
  1995. PUSH DI ;;AN000;; Save location to complete message
  1996. PUSH ES ;;AN000;;
  1997. PUSH CX ;;AN000;; Save size of the rest of the message
  1998. XOR CX,CX ;;AN000;; Reset CX used for character count
  1999. ;; Determine what action is required on parameter
  2000. CMP $M_RT.$M_MSG_NUM,$M_NULL ;;AN000;; Is this an Extended/Parse case
  2001. ; $IF E ;;AN000;;
  2002. JNE $MIF199
  2003. IF CHARmsg ;;AN000;; Was Char specified?
  2004. TEST BYTE PTR $M_SL.$M_S_FLAG,NOT Char_Type AND $M_TYPE_MASK ;;AN000;;
  2005. ; $IF Z ;;AN000;;
  2006. JNZ $MIF200
  2007. ;; Character type requested
  2008. ;;AN000;;
  2009. LES DI,DWORD PTR $M_SL.$M_S_VALUE ;;AN000;; Load pointer to replacing parameter
  2010. CALL $M_CHAR_REPLACE ;;AN000;;
  2011. ; $ELSE ;;AN000;; Get the rest of the message to display
  2012. JMP SHORT $MEN200
  2013. $MIF200:
  2014. ENDIF ;;AN000;;
  2015. IF NUMmsg ;;AN000;; Was Nnmeric type specified?
  2016. TEST BYTE PTR $M_SL.$M_S_FLAG,NOT Sgn_Bin_Type AND $M_TYPE_MASK ;;AN000;;
  2017. ; $IF Z,OR ;;AN000;;
  2018. JZ $MLL202
  2019. TEST BYTE PTR $M_SL.$M_S_FLAG,NOT Unsgn_Bin_Type AND $M_TYPE_MASK ;;AN000;;
  2020. ; $IF Z,OR ;;AN000;;
  2021. JZ $MLL202
  2022. TEST BYTE PTR $M_SL.$M_S_FLAG,NOT Bin_Hex_Type AND $M_TYPE_MASK ;;AN000;;
  2023. ; $IF Z ;;AN000;;
  2024. JNZ $MIF202
  2025. $MLL202:
  2026. ;; Numeric type requested
  2027. LES DI,DWORD PTR $M_SL.$M_S_VALUE ;;AN000;; Load pointer to replacing parameter
  2028. CALL $M_BIN2ASC_REPLACE ;;AN000;;
  2029. ; $ELSE ;;AN000;; Get the rest of the message to display
  2030. JMP SHORT $MEN202
  2031. $MIF202:
  2032. ENDIF ;;AN000;;
  2033. IF DATEmsg ;;AN000;; Was date specified?
  2034. TEST BYTE PTR $M_SL.$M_S_FLAG,NOT Date_Type AND $M_TYPE_MASK ;;AN000;;
  2035. ; $IF E ;;AN000;;
  2036. JNE $MIF204
  2037. ;; Date type requested
  2038. CALL $M_DATE_REPLACE ;;AN000;;
  2039. ; $ELSE ;;AN000;; Get the rest of the message to display
  2040. JMP SHORT $MEN204
  2041. $MIF204:
  2042. ENDIF ;;AN000;;
  2043. IF TIMEmsg ;;AN000;; Was time (12 hour format) specified?
  2044. ;; Time type requested (Default if we have not matched until here)
  2045. CALL $M_TIME_REPLACE ;;AN000;;
  2046. ENDIF ;;AN000;;
  2047. IF DATEmsg ;;AN000;;
  2048. ; $ENDIF ;;AN000;;
  2049. $MEN204:
  2050. ENDIF ;;AN000;;
  2051. IF NUMmsg ;;AN000;;
  2052. ; $ENDIF ;;AN000;;
  2053. $MEN202:
  2054. ENDIF ;;AN000;;
  2055. IF CHARmsg ;;AN000;;
  2056. ; $ENDIF ;;AN000;;
  2057. $MEN200:
  2058. ENDIF ;;AN000;;
  2059. IF $M_REPLACE ;;AN000;;
  2060. ;; With the replace information of the Stack, display the replaceable field
  2061. CALL $M_DISPLAY_REPLACE ;;AN000;; Display the replace
  2062. ENDIF ;;AN000;;
  2063. ;; None of the above - Extended/Parse replace
  2064. ; $ELSE ;;AN000;;
  2065. JMP SHORT $MEN199
  2066. $MIF199:
  2067. IF NOT COMR
  2068. CALL $M_EXT_PAR_REPLACE ;;AN000;;
  2069. ENDIF
  2070. ; $ENDIF ;;AN000;;
  2071. $MEN199:
  2072. ;; We must go back and complete the message after the replacable parameter if there is any left
  2073. ; $IF NC ;;AN000;; IF there was an error displaying then EXIT
  2074. JC $MIF211
  2075. POP CX ;;AN000;; Get size of the rest of the message
  2076. POP ES ;;AN000;; Get address of the rest of the message
  2077. POP DI ;;AN000;;
  2078. POP BP ;;AN000;; Get replacment count
  2079. POP SI ;;AN000;; ELSE get address of first sublist structure
  2080. ; $ELSE ;;AN000;;
  2081. JMP SHORT $MEN211
  2082. $MIF211:
  2083. ADD SP,10 ;;AN000;; Clean up stack if error
  2084. STC ;;AN000;;
  2085. ; $ENDIF ;;AN000;;
  2086. $MEN211:
  2087. CMP $M_RT.$M_MSG_NUM,$M_NULL ;;AN000;; Is this an Extended/Parse case
  2088. ; $ENDDO NE,OR ;;AN000;;
  2089. JNE $MLL214
  2090. ; $ENDDO C,LONG ;;AN000;; Go back and display the rest of the message
  2091. JC $MXL4
  2092. JMP $MDO165
  2093. $MXL4:
  2094. $MLL214:
  2095. $MEN165:
  2096. ;; IF there was an error displaying then EXIT
  2097. MOV $M_RT.$M_MSG_NUM,0 ;;AN000;; Reset message number to null
  2098. RET ;;AN000;; Return
  2099. ;;
  2100. $M_DISPLAY_MESSAGE ENDP ;;AN000;;
  2101. IF NOT COMR
  2102. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  2103. ;;
  2104. ;; PROC NAME: $M_EXT_PAR_REPLACE
  2105. ;;
  2106. ;; FUNCTION:
  2107. ;; INPUTS:
  2108. ;; OUPUTS:
  2109. ;;
  2110. ;; REGS USED:
  2111. ;;
  2112. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  2113. ;;
  2114. $M_EXT_PAR_REPLACE PROC NEAR ;;AN000;;
  2115. ;;
  2116. XOR DX,DX ;;AN000;; Prepare for get binary value (HIGH)
  2117. MOV AX,$M_RT.$M_MSG_NUM ;;AN000;; Prepare for get binary value (LOW)
  2118. MOV $M_RT.$M_DIVISOR,$M_BASE10 ;;AN000;; Set default divisor
  2119. ;;
  2120. CALL $M_CONVERT2ASC ;;AN000;;
  2121. ;;
  2122. ; $DO ;;AN000;;
  2123. $MDO215:
  2124. POP AX ;;AN000;; Get character in register
  2125. MOV BYTE PTR $M_RT.$M_TEMP_BUF[BX],AL ;;AN000;; Move char into the buffer
  2126. INC BX ;;AN000;; Increase buffer count
  2127. CMP BX,$M_TEMP_BUF_SZ ;;AN000;; Is buffer full?
  2128. ; $IF E ;;AN000;; Yes,
  2129. JNE $MIF216
  2130. CALL $M_FLUSH_BUF ;;AN000;; Flush the buffer
  2131. ; $ENDIF ;;AN000;;
  2132. $MIF216:
  2133. DEC CL ;;AN000;; Have we completed replace?
  2134. ; $ENDDO Z ;;AN000;;
  2135. JNZ $MDO215
  2136. ;;
  2137. MOV AX,$M_CR_LF ;;AN000;; Move char into the buffer
  2138. MOV WORD PTR $M_RT.$M_TEMP_BUF[BX],AX ;;AN000;; Move char into the buffer
  2139. INC BX ;;AN000;; Increase buffer count
  2140. INC BX ;;AN000;; Increase buffer count
  2141. CALL $M_FLUSH_BUF ;;AN000;; Flush the buffer
  2142. RET ;;AN000::
  2143. ;;
  2144. $M_EXT_PAR_REPLACE ENDP ;;AN000;;
  2145. ;;
  2146. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  2147. ENDIF
  2148. IF $M_SUBS ;;AN000;; Include the common subroutines if they haven't yet
  2149. $M_SUBS = FALSE ;;AN000;; No, then include and reset the flag
  2150. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  2151. ;;
  2152. ;; PROC NAME: $M_GET_MSG_ADDRESS
  2153. ;;
  2154. ;; FUNCTION: To scan thru classes to return pointer to the message header
  2155. ;; INPUTS: Access to $M_RES_ADDRESSES
  2156. ;; OUPUTS: IF CX = 0 THEN Message was not found
  2157. ;; IF CX > 1 THEN DS:SI points to the specified message
  2158. ;; REGS CHANGED: ES,DI,CX,DS,SI
  2159. ;;
  2160. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  2161. ;;
  2162. IF FARmsg ;;AN000;;
  2163. $M_GET_MSG_ADDRESS PROC FAR ;;AN000;;
  2164. ELSE ;;AN000;;
  2165. $M_GET_MSG_ADDRESS PROC NEAR ;;AN000;;
  2166. ENDIF ;;AN000;;
  2167. ;;
  2168. PUSH SI ;;AN000;;
  2169. PUSH BX ;;AN000;;
  2170. XOR SI,SI ;;AN000;; Use SI as an index
  2171. XOR CX,CX ;;AN000;; Use CX as an size
  2172. ; $DO ;;AN000;;
  2173. $MDO219:
  2174. CMP DH,UTILITY_MSG_CLASS ;;AN000;; Were utility messages requested?
  2175. ; $IF E ;;AN000;; Yes,
  2176. JNE $MIF220
  2177. IF FARmsg ;;AN000;;
  2178. LES DI,DWORD PTR $M_RT.$M_CLASS_ADDRS[SI] ;;AN000;; Get address of class
  2179. MOV BX,ES ;;AN000;
  2180. ELSE ;;AN000;;
  2181. MOV DI,WORD PTR $M_RT.$M_CLASS_ADDRS[SI] ;;AN000;; Get address of class
  2182. MOV BX,DI ;;AN000;
  2183. ENDIF ;;AN000;;
  2184. ; $ELSE ;;AN000;; No,
  2185. JMP SHORT $MEN220
  2186. $MIF220:
  2187. TEST DH,PARSE_ERR_CLASS ;;AN000;; Were parse errors requested?
  2188. ; $IF NE ;;AN000;; Yes,
  2189. JE $MIF222
  2190. LES DI,DWORD PTR $M_RT.$M_PARSE_COMMAND[SI] ;;AN000;; Get address of class
  2191. MOV BX,ES ;;AN000;
  2192. ; $ELSE ;;AN000;; No, extended errors were specified
  2193. JMP SHORT $MEN222
  2194. $MIF222:
  2195. CMP AX,$M_CRIT_LO ;;AN000;; Is this a critical error?
  2196. ; $IF AE,AND ;;AN000;;
  2197. JNAE $MIF224
  2198. CMP AX,$M_CRIT_HI ;;AN000;;
  2199. ; $IF BE ;;AN000;; Yes,
  2200. JNBE $MIF224
  2201. LES DI,DWORD PTR $M_RT.$M_CRIT_ADDRS[SI] ;;AN000;; Get address of class
  2202. MOV BX,ES ;;AN000;
  2203. ; $ELSE ;;AN000;;
  2204. JMP SHORT $MEN224
  2205. $MIF224:
  2206. LES DI,DWORD PTR $M_RT.$M_EXT_ERR_ADDRS[SI] ;;AN000;; Get address of class
  2207. MOV BX,ES ;;AN000;
  2208. ; $ENDIF ;;AN000;;
  2209. $MEN224:
  2210. ; $ENDIF ;;AN000;;
  2211. $MEN222:
  2212. ; $ENDIF ;;AN000;;
  2213. $MEN220:
  2214. ;;
  2215. CMP BX,$M_TERMINATING_FLAG ;;AN000;; Are we finished all classes?
  2216. ; $IF E ;;AN000;; Yes,
  2217. JNE $MIF229
  2218. CMP DH,UTILITY_MSG_CLASS ;;AN000;; Was it a UTILITY class?
  2219. ; $IF E ;;AN000;; Yes,
  2220. JNE $MIF230
  2221. STC ;;AN000;; Set the carry flag
  2222. ; $ELSE ;;AN000;; No,
  2223. JMP SHORT $MEN230
  2224. $MIF230:
  2225. MOV $M_RT.$M_MSG_NUM,AX ;;AN000;; Save message number
  2226. MOV AX,$M_SPECIAL_MSG_NUM ;;AN000;; Set special message number
  2227. MOV BP,$M_ONE_REPLACE ;;AN000;; Set one replace in message
  2228. XOR SI,SI ;;AN000;; Reset the SI index to start again
  2229. CLC ;;AN000;;
  2230. ; $ENDIF ;;AN000;; No,
  2231. $MEN230:
  2232. ; $ELSE ;;AN000;;
  2233. JMP SHORT $MEN229
  2234. $MIF229:
  2235. CMP BX,$M_CLASS_NOT_EXIST ;;AN000;; Does this class exist?
  2236. ; $IF NE ;;AN001;; Yes,
  2237. JE $MIF234
  2238. CALL $M_FIND_SPECIFIED_MSG ;;AN000;; Try to find the message
  2239. ; $ENDIF ;;AN000;;
  2240. $MIF234:
  2241. ADD SI,$M_ADDR_SZ_FAR ;;AN000;; Get next class
  2242. CLC ;;AN000;;
  2243. ; $ENDIF ;;AN000;;
  2244. $MEN229:
  2245. ; $LEAVE C ;;AN000;;
  2246. JC $MEN219
  2247. OR CX,CX ;;AN000;; Was the message found?
  2248. ; $ENDDO NZ,LONG ;;AN000;;
  2249. JNZ $MXL5
  2250. JMP $MDO219
  2251. $MXL5:
  2252. $MEN219:
  2253. PUSHF ;;AN006;; Save the flag state
  2254. CMP DH,EXT_ERR_CLASS ;;AN006;; Was an extended error requested?
  2255. ; $IF E ;;AN006;; Yes,
  2256. JNE $MIF239
  2257. PUSH DX ;;AN006;; Save all needed registers
  2258. PUSH BP ;;AN006;;
  2259. PUSH CX ;;AN006;;
  2260. PUSH ES ;;AN006;;
  2261. PUSH DI ;;AN006;;
  2262. PUSH AX ;;AN006;;
  2263. MOV AX,IFSFUNC_INSTALL_CHECK ;;AN006;; Check if IFSFUNC is installed
  2264. INT 2FH ;;AN006;;
  2265. CMP AL,IFSFUNC_INSTALLED ;;AN006;; Is it installed?
  2266. POP AX ;;AN006;; Restore msg number
  2267. ; $IF E ;;AN006;; Yes,
  2268. JNE $MIF240
  2269. MOV BX,AX ;;AN006;; BX is the extended error number
  2270. MOV AX,IFS_GET_ERR_TEXT ;;AN006;; AX is the muliplex number
  2271. INT 2FH ;;AN006;; Call IFSFUNC
  2272. ; $ELSE ;;AN006;; No,
  2273. JMP SHORT $MEN240
  2274. $MIF240:
  2275. STC ;;AN006;; Carry conditon
  2276. ; $ENDIF ;;AN006;;
  2277. $MEN240:
  2278. ; $IF C ;;AN006;; Was there an update?
  2279. JNC $MIF243
  2280. POP DI ;;AN006;; No,
  2281. POP ES ;;AN006;; Restore old pointer
  2282. POP CX ;;AN006;;
  2283. ; $ELSE ;;AN006;; Yes
  2284. JMP SHORT $MEN243
  2285. $MIF243:
  2286. ADD SP,6 ;;AN006;; Throw away old pointer
  2287. CALL $M_SET_LEN_IN_CX ;;AN006;; Get the length of the ASCIIZ string
  2288. ; $ENDIF ;;AN006;;
  2289. $MEN243:
  2290. POP BP ;;AN006;; Restore other Regs
  2291. POP DX ;;AN006;;
  2292. ; $ENDIF ;;AN006;;
  2293. $MIF239:
  2294. $M_POPF ;;AN006;; Restore the flag state
  2295. POP BX ;;AN000;;
  2296. POP SI ;;AN000;;
  2297. RET ;;AN000;; Return ES:DI pointing to the message
  2298. ;;
  2299. $M_GET_MSG_ADDRESS ENDP ;;
  2300. ;;
  2301. $M_SET_LEN_IN_CX PROC NEAR ;;
  2302. ;;
  2303. PUSH DI ;;AN006;; Save position
  2304. PUSH AX ;;AN006;;
  2305. MOV CX,-1 ;;AN006;; Set CX for decrements
  2306. XOR AL,AL ;;AN006;; Prepare compare register
  2307. REPNE SCASB ;;AN006;; Scan for zero
  2308. NOT CX ;;AN006;; Change decrement into number
  2309. DEC CX ;;AN006;; Don't include the zero
  2310. POP AX ;;AN006;;
  2311. POP DI ;;AN006;; Restore position
  2312. RET ;;AN006;;
  2313. ;;
  2314. $M_SET_LEN_IN_CX ENDP ;;
  2315. ;;
  2316. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  2317. ;;
  2318. ;; PROC NAME: $M_FIND_SPECIFIED_MSG
  2319. ;;
  2320. ;; FUNCTION: To scan thru message headers until message is found
  2321. ;; INPUTS: ES:DI points to beginning of msg headers
  2322. ;; CX contains the number of messages in class
  2323. ;; DH contains the message class
  2324. ;; OUPUTS: IF CX = 0 THEN Message was not found
  2325. ;; IF CX > 1 THEN ES:DI points to header of specified message
  2326. ;;
  2327. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  2328. ;;
  2329. $M_FIND_SPECIFIED_MSG PROC NEAR ;;AN000;;
  2330. ;;
  2331. ifdef BILINGUAL
  2332. push ax ; save ax
  2333. push ax
  2334. push bx
  2335. mov ax,4f01h ; get code page
  2336. xor bx,bx
  2337. int 2fh
  2338. ifdef JAPAN
  2339. cmp bx,932
  2340. endif
  2341. ifdef KOREA
  2342. cmp bx,949
  2343. endif
  2344. ifdef TAIWAN
  2345. cmp bx,950
  2346. endif
  2347. ifdef PRC
  2348. cmp bx,936
  2349. endif
  2350. pop bx
  2351. pop ax
  2352. jz MFSM_13 ; if DBCS code page
  2353. cmp ax,$M_SPECIAL_MSG_NUM
  2354. jz MFSM_13
  2355. cmp dh,EXT_ERR_CLASS
  2356. jz MFSM_11
  2357. cmp dh,PARSE_ERR_CLASS
  2358. jz MFSM_12
  2359. add ax,UTILITY_MSG_ADJ
  2360. jmp short MFSM_13
  2361. MFSM_11:
  2362. add ax,EXT_MSG_ADJ
  2363. jmp short MFSM_13
  2364. MFSM_12:
  2365. add ax,PARSE_MSG_ADJ
  2366. MFSM_13:
  2367. endif
  2368. CMP BX,1 ;;AN004;; Do we have an address to CALL?
  2369. ; $IF E,AND ;;AN004;; Yes,
  2370. JNE $MIF247
  2371. CMP WORD PTR $M_RT.$M_DISK_PROC_ADDR,-1 ;;AN004;; Do we have an address to CALL?
  2372. ; $IF NE ;;AN004;; Yes,
  2373. JE $MIF247
  2374. CMP AX,$M_SPECIAL_MSG_NUM ;;AN004;; Are we displaying a default Ext Err?
  2375. ; $IF E ;;AN004;; . . . and . . .
  2376. JNE $MIF248
  2377. PUSH AX ;;AN004;; Reset the special message number
  2378. MOV AX,$M_RT.$M_MSG_NUM ;;AN004;; Get the old message number
  2379. CALL DWORD PTR $M_RT.$M_DISK_PROC_ADDR ;;AN004;; Call the READ_DISK_PROC to get error text
  2380. POP AX ;;AN004;; Reset the special message number
  2381. ; $ELSE ;;AN004;; Get the old message number
  2382. JMP SHORT $MEN248
  2383. $MIF248:
  2384. CALL DWORD PTR $M_RT.$M_DISK_PROC_ADDR ;;AN004;; Call the READ_DISK_PROC to get error text
  2385. ; $ENDIF ;;AN004;; Get the old message number
  2386. $MEN248:
  2387. ; $ELSE ;;AN004;;
  2388. JMP SHORT $MEN247
  2389. $MIF247:
  2390. XOR CX,CX ;;AN002;; CX = 0 will allow us to
  2391. CMP DH,UTILITY_MSG_CLASS ;;AN001;;
  2392. ; $IF NE ;;AN001;;
  2393. JE $MIF252
  2394. ifdef BILINGUAL
  2395. MOV CX,WORD PTR ES:[DI].$M_NUM_CLS_MSG ;;AN001;; Get number of messages in class
  2396. else
  2397. MOV CL,BYTE PTR ES:[DI].$M_NUM_CLS_MSG ;;AN001;; Get number of messages in class
  2398. endif
  2399. ; $ELSE ;;AN001;;
  2400. JMP SHORT $MEN252
  2401. $MIF252:
  2402. IF FARmsg ;;AN001;;
  2403. CMP BYTE PTR ES:[DI].$M_CLASS_ID,DH ;;AN002;; Check if class still exists at
  2404. ELSE
  2405. CMP BYTE PTR CS:[DI].$M_CLASS_ID,DH ;;AN002;; Check if class still exists at
  2406. ENDIF
  2407. ; $IF E ;;AN002;; pointer (hopefully)
  2408. JNE $MIF254
  2409. IF FARmsg ;;AN001;;
  2410. ifdef BILINGUAL
  2411. MOV CX,WORD PTR ES:[DI].$M_NUM_CLS_MSG ;;AN000;; Get number of messages in class
  2412. else
  2413. MOV CL,BYTE PTR ES:[DI].$M_NUM_CLS_MSG ;;AN000;; Get number of messages in class
  2414. endif
  2415. ELSE
  2416. ifdef BILINGUAL
  2417. MOV CX,WORD PTR CS:[DI].$M_NUM_CLS_MSG ;;AN000;; Get number of messages in class
  2418. else
  2419. MOV CL,BYTE PTR CS:[DI].$M_NUM_CLS_MSG ;;AN000;; Get number of messages in class
  2420. endif
  2421. ENDIF
  2422. ; $ENDIF ;;AN002;; go on to the next class
  2423. $MIF254:
  2424. ; $ENDIF ;;AN001;;
  2425. $MEN252:
  2426. ADD DI,$M_CLASS_ID_SZ ;;AN000;; Point past the class header
  2427. STC ;;AN004;; Flag that we haven't found anything yet
  2428. ; $ENDIF ;;AN004;;
  2429. $MEN247:
  2430. ; $IF C ;;AN004;; Have we found anything yet?
  2431. JNC $MIF258
  2432. CLC ;;AN004;; No, reset carry
  2433. ; $SEARCH ;;AN000;;
  2434. $MDO259:
  2435. OR CX,CX ;;AN000;; Do we have any to check?
  2436. ; $LEAVE Z ;;AN000;; No, return with CX = 0
  2437. JZ $MEN259
  2438. CMP DH,UTILITY_MSG_CLASS ;;AN001;;
  2439. ; $IF NE ;;AN001;;
  2440. JE $MIF261
  2441. CMP AX,WORD PTR ES:[DI].$M_NUM ;;AN001;; Is this the message requested?
  2442. ; $ELSE ;;AN001;;
  2443. JMP SHORT $MEN261
  2444. $MIF261:
  2445. IF FARmsg ;;AN001;;
  2446. CMP AX,WORD PTR ES:[DI].$M_NUM ;;AN000;; Is this the message requested?
  2447. ELSE
  2448. CMP AX,WORD PTR CS:[DI].$M_NUM ;;AN000;; Is this the message requested?
  2449. ENDIF
  2450. ; $ENDIF
  2451. $MEN261:
  2452. ; $EXITIF E ;;AN000;;
  2453. JNE $MIF259
  2454. ; $ORELSE ;;AN000;
  2455. JMP SHORT $MSR259
  2456. $MIF259:
  2457. DEC CX ;;AN000;; No, well do we have more to check?
  2458. ; $LEAVE Z ;;AN000;; No, return with CX = 0
  2459. JZ $MEN259
  2460. ADD DI,$M_ID_SZ ;;AN000;; Yes, skip past msg header
  2461. ; $ENDLOOP ;;AN000;;
  2462. JMP SHORT $MDO259
  2463. $MEN259:
  2464. STC ;;AN000;;
  2465. ; $ENDSRCH ;;AN000;; Check next message
  2466. $MSR259:
  2467. ; $IF NC ;;AN000;; Did we find the message?
  2468. JC $MIF269
  2469. CMP DH,UTILITY_MSG_CLASS ;;AN001;; Yes, is it a utility message?
  2470. CLC ;;AN001;;
  2471. ; $IF E ;;AN001;;
  2472. JNE $MIF270
  2473. IF FARmsg ;;AN001;;
  2474. ELSE ;;AN000;;
  2475. PUSH CS ;;AN000;;
  2476. POP ES ;;AN000;; Return ES:DI pointing to the message
  2477. ENDIF
  2478. ; $ENDIF ;;AN001;;
  2479. $MIF270:
  2480. ADD DI,WORD PTR ES:[DI].$M_TXT_PTR ;;AN000;; Prepare ES:DI pointing to the message
  2481. ; $ENDIF ;;AN004;;
  2482. $MIF269:
  2483. ; $ENDIF ;;AN004;;
  2484. $MIF258:
  2485. ;; Yes, great we can return with CX > 0
  2486. ; $IF NC ;;AN000;; Did we find the message?
  2487. JC $MIF274
  2488. XOR CH,CH ;;AN000;;
  2489. MOV CL,BYTE PTR ES:[DI] ;;AN000;; Move size into CX
  2490. INC DI ;;AN000;; Increment past length
  2491. ; $ENDIF ;;AN004;;
  2492. $MIF274:
  2493. MOV $M_RT.$M_SIZE,$M_NULL ;;AN004;; Reset variable
  2494. ifdef BILINGUAL
  2495. pop ax
  2496. endif
  2497. RET ;;AN000;; Return
  2498. ;;
  2499. $M_FIND_SPECIFIED_MSG ENDP ;;AN000;;
  2500. ;;
  2501. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  2502. ENDIF ;;AN000;; END of include of common subroutines
  2503. ;
  2504. IF $M_REPLACE ;;AN000;; Is the request to include the code for replaceable parms
  2505. $M_REPLACE = FALSE ;;AN000;; Tell the assembler we did
  2506. ;;
  2507. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  2508. $M_DISPLAY_REPLACE PROC NEAR ;;AN000;;
  2509. ;;
  2510. XOR BX,BX ;;AN000;; Use BX for buffer count
  2511. IF NOT COMR
  2512. CMP $M_SL.$M_S_ID,$M_SPECIAL_CASE-30H ;;AN000;; Is this the special case (convert to ASCII)
  2513. ; $IF E ;;AN000;; Yes,
  2514. JNE $MIF276
  2515. MOV WORD PTR $M_RT.$M_TEMP_BUF[BX],$M_SPACE_HYP ;;AN000;; Move in a " -"
  2516. INC BX ;;AN000;; Increment count
  2517. INC BX ;;AN000;; Increment count
  2518. MOV BYTE PTR $M_RT.$M_TEMP_BUF[BX],$M_SPACE ;;AN000;; Move in a " "
  2519. INC BX ;;AN000;; Increment count
  2520. CALL $M_FLUSH_BUF ;;AN000;; Write out " - " to prepare for special case
  2521. ; $ENDIF ;;AN000;; If it fails we will catch it later
  2522. $MIF276:
  2523. ENDIF
  2524. POP BP ;;AN000;; Remember the return address
  2525. XOR BX,BX ;;AN000;; Use BX for buffer count
  2526. XOR DX,DX ;;AN000;; Use DX for count of parms taken off the stack
  2527. MOV $M_RT.$M_SIZE,CL ;;AN000;; Save size to later clear stack
  2528. MOV AL,BYTE PTR $M_SL.$M_S_MINW ;;AN000;; Get the minimum width
  2529. ;;
  2530. CMP AL,CL ;;AN000;; Do we need pad chars added?
  2531. ; $IF A ;;AN000;; Yes,
  2532. JNA $MIF278
  2533. SUB AL,CL ;;AN000;; Calculate how many pad chars are needed.
  2534. MOV DH,AL ;;AN000;; Save the number of pad characters
  2535. TEST BYTE PTR $M_SL.$M_S_FLAG,Right_Align ;;AN000;; Was replaceable parm to be right aligned?
  2536. ; $IF NZ ;;AN000;; Yes,
  2537. JZ $MIF279
  2538. ; $DO ;;AN000;; Begin filling buffer with pad chars
  2539. $MDO280:
  2540. MOV AL,BYTE PTR $M_SL.$M_S_PAD ;;AN000;;
  2541. MOV BYTE PTR $M_RT.$M_TEMP_BUF[BX],AL ;;AN000;; Move in a pad char
  2542. INC BX ;;AN000;;
  2543. CMP BX,$M_TEMP_BUF_SZ ;;AN000;; Is buffer full?
  2544. ; $IF E ;;AN000;; Yes,
  2545. JNE $MIF281
  2546. CALL $M_FLUSH_BUF ;;AN000;; Flush the buffer
  2547. ; $ENDIF ;;AN000;;
  2548. $MIF281:
  2549. DEC DH ;;AN000;; Have we filled with enough pad chars?
  2550. ; $ENDDO Z ;;AN000;; No, next pad character
  2551. JNZ $MDO280
  2552. ; $ENDIF ;;AN000;;
  2553. $MIF279:
  2554. ; $ENDIF ;;AN000;; Yes,
  2555. $MIF278:
  2556. ;;
  2557. CMP BYTE PTR $M_SL.$M_S_MAXW,$M_UNLIM_W ;;AN000;; Is maximum width unlimited?
  2558. ; $IF NE ;;AN000;;
  2559. JE $MIF286
  2560. CMP BYTE PTR $M_SL.$M_S_MAXW,CL ;;AN000;; Will we exceed maximum width?
  2561. ; $IF B ;;AN000;; Yes,
  2562. JNB $MIF287
  2563. SUB CL,BYTE PTR $M_SL.$M_S_MAXW ;;AN000;; Calculate how many extra chars
  2564. MOV DL,CL ;;AN000;; Remember how many chars to pop off
  2565. MOV CL,BYTE PTR $M_SL.$M_S_MAXW ;;AN000;; Set new string length
  2566. ; $ENDIF ;;AN000;;
  2567. $MIF287:
  2568. ; $ENDIF ;;AN000;;
  2569. $MIF286:
  2570. OR CX,CX ;;AN000;;
  2571. ; $IF NZ ;;AN000;;
  2572. JZ $MIF290
  2573. ; $DO ;;AN000;; Begin filling buffer with string
  2574. $MDO291:
  2575. TEST BYTE PTR $M_SL.$M_S_FLAG,NOT Char_Type AND $M_TYPE_MASK ;;AN000;;
  2576. ; $IF Z,AND ;;AN000;;
  2577. JNZ $MIF292
  2578. TEST $M_SL.$M_S_FLAG,Char_field_ASCIIZ AND $M_SIZE_MASK ; Is this replace a ASCIIZ string?
  2579. ; $IF NZ ;;AN000;; Yes,
  2580. JZ $MIF292
  2581. MOV AL,BYTE PTR ES:[DI] ;;AN000;; Get first character from string
  2582. INC DI ;;AN000;; Next character in string
  2583. ; $ELSE ;;AN000;; No,
  2584. JMP SHORT $MEN292
  2585. $MIF292:
  2586. POP AX ;;AN000;; Get character in register
  2587. ; $ENDIF ;;AN000;;
  2588. $MEN292:
  2589. MOV BYTE PTR $M_RT.$M_TEMP_BUF[BX],AL ;;AN000;; Move char into the buffer
  2590. INC BX ;;AN000;; Increase buffer count
  2591. CMP BX,$M_TEMP_BUF_SZ ;;AN000;; Is buffer full?
  2592. ; $IF E ;;AN000;; Yes,
  2593. JNE $MIF295
  2594. CALL $M_FLUSH_BUF ;;AN000;; Flush the buffer
  2595. ; $ENDIF ;;AN000;;
  2596. $MIF295:
  2597. DEC CL ;;AN000;; Have we completed replace?
  2598. ; $ENDDO Z ;;AN000;; Test again
  2599. JNZ $MDO291
  2600. ; $ENDIF ;;AN000;;
  2601. $MIF290:
  2602. ;;
  2603. TEST BYTE PTR $M_SL.$M_S_FLAG,Right_Align ;;AN000;; Was replaceable parm to be left aligned?
  2604. ; $IF Z ;;AN000;; Yes,
  2605. JNZ $MIF299
  2606. OR DH,DH ;;AN000;; Do we need pad chars added?
  2607. ; $IF NZ ;;AN000;; Yes,
  2608. JZ $MIF300
  2609. ; $DO ;;AN000;; Begin filling buffer with pad chars
  2610. $MDO301:
  2611. MOV AL,BYTE PTR $M_SL.$M_S_PAD ;;AN000;;
  2612. MOV BYTE PTR $M_RT.$M_TEMP_BUF[BX],AL ;;AN000;; Move in a pad char
  2613. INC BX ;;AN000;;
  2614. CMP BX,$M_TEMP_BUF_SZ ;;AN000;; Is buffer full?
  2615. ; $IF E ;;AN000;; Yes,
  2616. JNE $MIF302
  2617. CALL $M_FLUSH_BUF ;;AN000;; Flush the buffer
  2618. ; $ENDIF ;;AN000;;
  2619. $MIF302:
  2620. DEC DH ;;AN000;; Have we filled with enough pad chars?
  2621. ; $ENDDO Z ;;AN000;; Test again
  2622. JNZ $MDO301
  2623. ; $ENDIF ;;AN000;;
  2624. $MIF300:
  2625. ; $ENDIF ;;AN000;;
  2626. $MIF299:
  2627. ;;
  2628. TEST BYTE PTR $M_SL.$M_S_FLAG,NOT Char_Type AND $M_TYPE_MASK ;;AN000;;
  2629. ; $IF Z,AND ;;AN000;;
  2630. JNZ $MIF307
  2631. TEST $M_SL.$M_S_FLAG,Char_field_ASCIIZ AND $M_SIZE_MASK ;;AN000;; Is this replace a ASCIIZ string?
  2632. ; $IF NZ ;;AN000;; Yes,
  2633. JZ $MIF307
  2634. ; $ELSE ;;AN000;;
  2635. JMP SHORT $MEN307
  2636. $MIF307:
  2637. OR DL,DL ;;AN000;;
  2638. ; $IF NE ;;AN000;;
  2639. JE $MIF309
  2640. ; $DO ;;AN000;;
  2641. $MDO310:
  2642. POP [$M_RT.$M_RETURN_ADDR] ;;AN000;; Clean Up stack using spare variable
  2643. DEC DL ;;AN000;; Are we done?
  2644. ; $ENDDO Z ;;AN000;;
  2645. JNZ $MDO310
  2646. ; $ENDIF ;;AN000;;
  2647. $MIF309:
  2648. ; $ENDIF ;;AN000;;
  2649. $MEN307:
  2650. CALL $M_FLUSH_BUF ;;AN000;; Flush the buffer for the final time
  2651. PUSH BP ;;AN000;; Restore the return address
  2652. ;;
  2653. RET ;;AN000;;
  2654. ;;
  2655. $M_DISPLAY_REPLACE ENDP ;;AN000;;
  2656. ;;
  2657. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  2658. ;;
  2659. ;; PROC NAME: $M_FLUSH_BUFFER
  2660. ;;
  2661. ;; FUNCTION: Display the contents of the temporary buffer
  2662. ;; INPUTS: DI contains the number of bytes to display
  2663. ;; OUTPUTS: BX reset to zero
  2664. ;;
  2665. ;; REGS USED:
  2666. ;;
  2667. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  2668. ;;
  2669. $M_FLUSH_BUF PROC NEAR ;;AN000;;
  2670. ;;
  2671. PUSH CX ;;AN000;; Save changed regs
  2672. PUSH ES ;;AN000;;
  2673. PUSH DI ;;AN000;;
  2674. PUSH DS ;;AN000;; Set ES pointing to buffer
  2675. POP ES ;;AN000;;
  2676. ;;
  2677. MOV CX,BX ;;AN000;; Set number of bytes to display
  2678. XOR BX,BX ;;AN000;; Reset buffer counter
  2679. LEA DI,$M_RT.$M_TEMP_BUF ;;AN000;; Reset buffer location pointer
  2680. CALL $M_DISPLAY_STRING ;;AN000;; Display the buffer
  2681. ;;
  2682. ; $IF NC ;;AN000;; Error?
  2683. JC $MIF314
  2684. POP DI ;;AN000;; No, Restore changed regs
  2685. POP ES ;;AN000;;
  2686. POP CX ;;AN000;;
  2687. ; $ELSE ;;AN000;; Yes,
  2688. JMP SHORT $MEN314
  2689. $MIF314:
  2690. ADD SP,6 ;;AN000;; Fix stack
  2691. STC ;;AN000;;
  2692. ; $ENDIF ;;AN000;; Error?
  2693. $MEN314:
  2694. ;;
  2695. RET ;;AN000;; Return
  2696. ;;
  2697. $M_FLUSH_BUF ENDP ;;AN000;;
  2698. ;;
  2699. ;;
  2700. IF CHARmsg ;;AN000;; Is the request to include the code for CHAR replace?
  2701. $M_REPLACE = TRUE ;;AN000;; Yes, THEN include it and flag that we will need common
  2702. $M_CHAR_ONLY = TRUE ;;AN000;; replacement code later
  2703. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  2704. ;;
  2705. ;; PROC NAME: $M_CHAR_REPLACE
  2706. ;;
  2707. ;; FUNCTION: Will prepare a single char or ASCIIZ string for replace
  2708. ;; INPUTS: DS:SI points at corresponding SUBLIST
  2709. ;; ES:DI contains the VALUE from SUBLIST
  2710. ;; OUTPUTS: CX contains number of characters on stack
  2711. ;; Top of stack --> Last character
  2712. ;; . . .
  2713. ;; Bot of stack --> First character
  2714. ;;
  2715. ;; OTHER REGS Revised: AX
  2716. ;;
  2717. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  2718. ;;
  2719. $M_CHAR_REPLACE PROC NEAR ;;AN000;;
  2720. ;;
  2721. POP BP ;;AN000;; Save return address
  2722. TEST $M_SL.$M_S_FLAG,NOT Char_Field_Char AND $M_SIZE_MASK ;;AN000;; Was Character specified?
  2723. ; $IF Z ;;AN000;; Yes,
  2724. JNZ $MIF317
  2725. MOV AL,BYTE PTR ES:[DI] ;;AN000;; Get the character
  2726. PUSH AX ;;AN000;; Put it on the stack
  2727. INC CX ;;AN000;; Increase the count
  2728. CALL $M_IS_IT_DBCS ;;AN000;; Is this the first byte of a DB character
  2729. ; $IF C ;;AN000;; Yes,
  2730. JNC $MIF318
  2731. MOV AL,BYTE PTR ES:[DI]+1 ;;AN000;; Get the next character
  2732. PUSH AX ;;AN000;; Put it on the stack
  2733. CLC ;;AN000;; Clear the carry
  2734. ; $ENDIF ;;AN000;;
  2735. $MIF318:
  2736. ; $ELSE ;;AN000;; No, it was an ASCIIZ string
  2737. JMP SHORT $MEN317
  2738. $MIF317:
  2739. ; $DO ;;AN000;;
  2740. $MDO321:
  2741. MOV AL,BYTE PTR ES:[DI] ;;AN000;; Get the character
  2742. OR AL,AL ;;AN000;; Is it the NULL?
  2743. ; $LEAVE Z ;;AN000;; No,
  2744. JZ $MEN321
  2745. INC DI ;;AN000;; Next character
  2746. INC CX ;;AN000;; Increment the count
  2747. ; $ENDDO ;;AN000;; Yes,
  2748. JMP SHORT $MDO321
  2749. $MEN321:
  2750. SUB DI,CX ;;AN000;; Set SI at the beginning of the string
  2751. ; $ENDIF ;;AN000;;
  2752. $MEN317:
  2753. ;;AN000;;
  2754. PUSH BP ;;AN000;; Restore return address
  2755. RET ;;AN000;; Return
  2756. ;;
  2757. $M_CHAR_REPLACE ENDP ;;AN000;;
  2758. ;;
  2759. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  2760. ENDIF ;;AN000;; END of include of CHAR replace code
  2761. ;
  2762. IF NUMmsg ;;AN000;; Is the request to include the code for NUM replace?
  2763. $M_REPLACE = TRUE ;;AN000;; Yes, THEN include it and flag that we will need common
  2764. $M_CHAR_ONLY = FALSE ;;AN000;; replacement code later
  2765. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  2766. ;;
  2767. ;; PROC NAME: $M_BIN2ASC_REPLACE
  2768. ;;
  2769. ;; FUNCTION: Convert a signed or unsigned binary number to an ASCII string
  2770. ;; and prepare to display
  2771. ;; INPUTS: DS:SI points at corresponding SUBLIST
  2772. ;; ES:DI contains the VALUE from SUBLIST
  2773. ;; OUTPUTS: CX contains number of characters on stack
  2774. ;; Top of stack --> Last character
  2775. ;; . . .
  2776. ;; Bot of stack --> First character
  2777. ;; OTHER REGS Revised: BX,DX,AX
  2778. ;;
  2779. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  2780. ;;
  2781. $M_BIN2ASC_REPLACE PROC NEAR ;;AN000;;
  2782. ;;
  2783. POP BP ;;AN000;; Save return address
  2784. ;;
  2785. XOR DX,DX ;;AN000;; Prepare for get binary value (HIGH)
  2786. XOR AX,AX ;;AN000;; Prepare for get binary value (LOW)
  2787. MOV $M_RT.$M_DIVISOR,$M_BASE16 ;;AN000;; Set default divisor
  2788. XOR BX,BX ;;AN000;; Use BP as the NEG flag (if applicable)
  2789. IF NOT COMR
  2790. TEST $M_SL.$M_S_FLAG,NOT $M_BYTE AND $M_SIZE_MASK ;;AN000;; Was BYTE specified?
  2791. ; $IF Z ;;AN000;;
  2792. JNZ $MIF325
  2793. MOV AL, BYTE PTR ES:[DI] ;;AN000;; Setup byte in AL
  2794. TEST $M_SL.$M_S_FLAG,NOT Sgn_Bin_Type AND $M_TYPE_MASK ;;AN000;; Was Signed binary specified?
  2795. ; $IF Z ;;AN000;;
  2796. JNZ $MIF326
  2797. TEST AL,10000000b ;;AN000;; Is this number negative?
  2798. ; $IF NZ ;;AN000;; Yes,
  2799. JZ $MIF327
  2800. INC BX ;;AN000;; Remember that it was negative
  2801. AND AL,01111111b ;;AN000;; Make it positive
  2802. ; $ENDIF ;;AN000;;
  2803. $MIF327:
  2804. MOV $M_RT.$M_DIVISOR,$M_BASE10 ;;AN000;;
  2805. ; $ENDIF ;;AN000;;
  2806. $MIF326:
  2807. TEST $M_SL.$M_S_FLAG,NOT Unsgn_Bin_Type AND $M_TYPE_MASK ;;AN000;; Was Signed binary specified?
  2808. ; $IF Z ;;AN000;;
  2809. JNZ $MIF330
  2810. MOV $M_RT.$M_DIVISOR,$M_BASE10 ;;AN000;;
  2811. ; $ENDIF ;;AN000;;
  2812. $MIF330:
  2813. ; $ELSE ;;AN000;;
  2814. JMP SHORT $MEN325
  2815. $MIF325:
  2816. ENDIF
  2817. TEST $M_SL.$M_S_FLAG,NOT $M_WORD AND $M_SIZE_MASK ;;AN000;; Was WORD specified?
  2818. ; $IF Z ;;AN000;;
  2819. JNZ $MIF333
  2820. MOV AX, WORD PTR ES:[DI] ;;AN000;; Setup byte in AL
  2821. TEST $M_SL.$M_S_FLAG,NOT Sgn_Bin_Type AND $M_TYPE_MASK ;; AN000;; Was Signed binary specified?
  2822. ; $IF Z ;;AN000;;
  2823. JNZ $MIF334
  2824. TEST AH,10000000b ;;AN000;; Is this number negative?
  2825. ; $IF NZ ;;AN000;; Yes,
  2826. JZ $MIF335
  2827. INC BX ;;AN000;; Remember that it was negative
  2828. AND AH,01111111b ;;AN000;; Make it positive
  2829. ; $ENDIF ;;AN000;;
  2830. $MIF335:
  2831. MOV $M_RT.$M_DIVISOR,$M_BASE10 ;;AN000;;
  2832. ; $ENDIF ;;AN000;;
  2833. $MIF334:
  2834. TEST $M_SL.$M_S_FLAG,NOT Unsgn_Bin_Type AND $M_TYPE_MASK ;;AN000;; Was Signed binary specified?
  2835. ; $IF Z ;;AN000;;
  2836. JNZ $MIF338
  2837. MOV $M_RT.$M_DIVISOR,$M_BASE10 ;;AN000;;
  2838. ; $ENDIF ;;AN000;;
  2839. $MIF338:
  2840. ; $ELSE ;;AN000;;
  2841. JMP SHORT $MEN333
  2842. $MIF333:
  2843. IF NOT COMR
  2844. MOV AX, WORD PTR ES:[DI] ;;AN000;; Setup Double word in DX:AX
  2845. MOV DX, WORD PTR ES:[DI]+2 ;;AN000;;
  2846. TEST $M_SL.$M_S_FLAG,NOT Sgn_Bin_Type AND $M_TYPE_MASK ;;AN000;; Was Signed binary specified?
  2847. ; $IF Z ;;AN000;;
  2848. JNZ $MIF341
  2849. TEST DH,10000000b ;;AN000;; Is this number negative?
  2850. ; $IF NZ ;;AN000;; Yes,
  2851. JZ $MIF342
  2852. INC BX ;;AN000;; Remember that it was negative
  2853. AND DH,01111111b ;;AN000;; Make it positive
  2854. ; $ENDIF ;;AN000;;
  2855. $MIF342:
  2856. MOV $M_RT.$M_DIVISOR,$M_BASE10 ;;AN000;;
  2857. ; $ENDIF ;;AN000;;
  2858. $MIF341:
  2859. TEST $M_SL.$M_S_FLAG,NOT Unsgn_Bin_Type AND $M_TYPE_MASK ;;AN000;; Was Signed binary specified?
  2860. ; $IF Z ;;AN000;;
  2861. JNZ $MIF345
  2862. MOV $M_RT.$M_DIVISOR,$M_BASE10 ;;AN000;;
  2863. ; $ENDIF ;;AN000;;
  2864. $MIF345:
  2865. ENDIF
  2866. ; $ENDIF ;;AN000;;
  2867. $MEN333:
  2868. ; $ENDIF ;;AN000;;
  2869. $MEN325:
  2870. ;;
  2871. CALL $M_CONVERT2ASC ;;AN000;; Convert to ASCII string
  2872. IF NOT COMR
  2873. OR BX,BX ;;AN000;;
  2874. ; $IF NZ ;;AN000;; Was number negative?
  2875. JZ $MIF349
  2876. XOR DX,DX ;;AN000;; Yes,
  2877. MOV DL,$M_NEG_SIGN ;;AN000;; Put "-" on the stack with the number
  2878. PUSH DX ;;AN000;;
  2879. ; $ENDIF ;;AN000;; No,
  2880. $MIF349:
  2881. ENDIF
  2882. ;;
  2883. PUSH BP ;;AN000;; Restore return address
  2884. RET ;;AN000;; Return
  2885. ;;
  2886. $M_BIN2ASC_REPLACE ENDP ;;AN000;;
  2887. ;;
  2888. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  2889. ENDIF ;;AN000;; END of include of NUM replace code
  2890. ;
  2891. IF DATEmsg ;;AN000;; Is the request to include the code for DATE replace?
  2892. $M_REPLACE = TRUE ;;AN000;; Yes, THEN include it and flag that we will need common
  2893. $M_CHAR_ONLY = FALSE ;;AN000;; replacement code later
  2894. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  2895. ;;
  2896. ;; PROC NAME: $M_DATE_REPLACE
  2897. ;;
  2898. ;; FUNCTION: Convert a date to a decimal ASCII string using current
  2899. ;; country format and prepare to display
  2900. ;; INPUTS: DS:SI points at corresponding SUBLIST
  2901. ;; ES:DI points at VALUE from SUBLIST
  2902. ;; OUTPUTS: CX contains number of characters on stack
  2903. ;; Top of stack --> Last character
  2904. ;; . . .
  2905. ;; Bot of stack --> First character
  2906. ;; OTHER REGS Revised: DX, AX
  2907. ;;
  2908. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  2909. ;;
  2910. $M_DATE_REPLACE PROC NEAR ;;AN000;;
  2911. ;;
  2912. POP BP ;;AN000;; Save return address
  2913. MOV $M_RT.$M_DIVISOR,$M_BASE10 ;;AN000;; Set default divisor
  2914. CALL $M_GET_DATE ;;AN000;; Set date format/separator in $M_RT
  2915. ;;AN000;; All O.K.?
  2916. XOR DX,DX ;;AN000;; Reset DX value
  2917. XOR AX,AX ;;AN000;; Reset AX value
  2918. CMP WORD PTR $M_RT.$M_DATE_FORMAT,0 ;;AN000;; USA Date Format
  2919. ; $IF E ;;AN000;; Beginning from end: (saved on the stack)
  2920. JNE $MIF351
  2921. CALL $M_YEAR ;;AN000;; Get Year
  2922. CALL $M_CONVERTDATE ;;AN000;; Convert it to an ASCII string
  2923. PUSH WORD PTR $M_RT.$M_DATE_SEPARA ;;AN000;;
  2924. INC CX ;;AN000;; Increment count
  2925. XOR AX,AX ;;AN000;; Reset AX value
  2926. MOV AL,BYTE PTR $M_SL.$M_S_VALUE+3 ;;AN000;; Get Day
  2927. CALL $M_CONVERTDATE ;;AN000;; Convert it to an ASCII string
  2928. PUSH WORD PTR $M_RT.$M_DATE_SEPARA ;;AN000;;
  2929. INC CX ;;AN000;; Increment count
  2930. MOV AL,BYTE PTR $M_SL.$M_S_VALUE+2 ;;AN000;; Get Month
  2931. CALL $M_CONVERTDATE ;;AN000;; Convert it to an ASCII string
  2932. ; $ENDIF ;;AN000;;
  2933. $MIF351:
  2934. ;;
  2935. CMP WORD PTR $M_RT.$M_DATE_FORMAT,1 ;;AN000;; EUROPE Date Format
  2936. ; $IF E ;;AN000;; Beginning from end: (saved on the stack)
  2937. JNE $MIF353
  2938. CALL $M_YEAR ;;AN000;; Get Year
  2939. CALL $M_CONVERTDATE ;;AN000;; Convert it to an ASCII string
  2940. PUSH WORD PTR $M_RT.$M_DATE_SEPARA ;;AN000;;
  2941. INC CX ;;AN000;;
  2942. XOR AX,AX ;;AN000;; Reset AX
  2943. MOV AL,BYTE PTR $M_SL.$M_S_VALUE+2 ;;AN000;; Get Month
  2944. CALL $M_CONVERTDATE ;;AN000;; Convert it to an ASCII string
  2945. PUSH WORD PTR $M_RT.$M_DATE_SEPARA ;;AN000;;
  2946. INC CX ;;AN000;;
  2947. MOV AL,BYTE PTR $M_SL.$M_S_VALUE+3 ;;AN000;; Get Day
  2948. CALL $M_CONVERTDATE ;;AN000;; Convert it to an ASCII string
  2949. ; $ENDIF ;;AN000;;
  2950. $MIF353:
  2951. ;;
  2952. CMP WORD PTR $M_RT.$M_DATE_FORMAT,2 ;;AN000;; JAPAN Date Format
  2953. ; $IF E ;;AN000;; Beginning from end: (saved on the stack)
  2954. JNE $MIF355
  2955. MOV AL,BYTE PTR $M_SL.$M_S_VALUE+3 ;;AN000;; Get Day
  2956. CALL $M_CONVERTDATE ;;AN000;; Convert it to an ASCII string
  2957. PUSH WORD PTR $M_RT.$M_DATE_SEPARA ;;AN000;;
  2958. INC CX ;;AN000;;
  2959. MOV AL,BYTE PTR $M_SL.$M_S_VALUE+2 ;;AN000;; Get Month
  2960. CALL $M_CONVERTDATE ;;AN000;; Convert it to an ASCII string
  2961. PUSH WORD PTR $M_RT.$M_DATE_SEPARA ;;AN000;;
  2962. INC CX ;;AN000;;
  2963. CALL $M_YEAR ;;AN000;; Get Year
  2964. CALL $M_CONVERTDATE ;;AN000;; Convert it to an ASCII string
  2965. ; $ENDIF ;;AN000;;
  2966. $MIF355:
  2967. ;;
  2968. PUSH BP ;;AN000;; Restore return address
  2969. RET ;;AN000;; Return
  2970. ;;
  2971. $M_DATE_REPLACE ENDP ;;AN000;;
  2972. ;;
  2973. $M_GET_DATE PROC NEAR ;;AN000;;
  2974. MOV AH,DOS_GET_COUNTRY ;;AN000;; Call DOS for country dependant info
  2975. MOV AL,0 ;;AN000;; Get current country info
  2976. LEA DX,$M_RT.$M_TEMP_BUF ;;AN000;; Set up addressibility to buffer
  2977. INT 21H ;;AN000;;
  2978. ; $IF C ;;AN000;; No,
  2979. JNC $MIF357
  2980. MOV WORD PTR $M_RT.$M_DATE_FORMAT,$M_DEF_DATE_FORM ;;AN000;; Set default date format (BH)
  2981. MOV BYTE PTR $M_RT.$M_DATE_SEPARA,$M_DEF_DATE_SEP ;;AN000;; Set default date separator (BL)
  2982. ; $ENDIF ;;AN000;;
  2983. $MIF357:
  2984. RET ;;AN000;;
  2985. $M_GET_DATE ENDP ;;AN000;;
  2986. ;;
  2987. $M_YEAR PROC NEAR ;;AN000;;
  2988. MOV AX,WORD PTR $M_SL.$M_S_VALUE ;;AN000;; Get Year
  2989. TEST $M_SL.$M_S_FLAG,Date_MDY_4 AND $M_DATE_MASK ;;AN000;; Was Month/Day/Year (2 Digits) specified?
  2990. ; $IF Z ;;AN000;;
  2991. JNZ $MIF359
  2992. CMP AX,$M_MAX_2_YEAR ;;AN000;; Get Year
  2993. ; $IF A ;;AN000;;
  2994. JNA $MIF360
  2995. MOV AX,$M_MAX_2_YEAR ;;AN000;;
  2996. ; $ENDIF ;;AN000;;
  2997. $MIF360:
  2998. ; $ENDIF ;;AN000;;
  2999. $MIF359:
  3000. RET ;;AN000;;
  3001. $M_YEAR ENDP ;;AN000;;
  3002. ;;
  3003. $M_CONVERTDATE PROC NEAR ;;AN000;;
  3004. POP WORD PTR $M_RT.$M_TEMP_BUF ;;AN000;; Save return address
  3005. MOV $M_RT.$M_SIZE,CL ;;AN000;; Save the size before conversion
  3006. CALL $M_CONVERT2ASC ;;AN000;; Convert it to an ASCII string
  3007. DEC CX ;;AN000;; Test if size only grew by 1
  3008. CMP CL,$M_RT.$M_SIZE ;;AN000;; Did size only grow by one
  3009. ; $IF E ;;AN000;; Yes,
  3010. JNE $MIF363
  3011. MOV AX,$M_TIMEDATE_PAD ;;AN000;; Get a pad character (0)
  3012. PUSH AX ;;AN000;; Save it
  3013. INC CX ;;AN000;; Count it
  3014. ; $ENDIF ;;AN000;;
  3015. $MIF363:
  3016. INC CX ;;AN000;; Restore CX
  3017. PUSH WORD PTR $M_RT.$M_TEMP_BUF ;;AN000;; Save return address
  3018. RET ;;AN000;;
  3019. $M_CONVERTDATE ENDP ;;AN000;;
  3020. ;;
  3021. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  3022. ENDIF ;;AN000;; END of include of DATE replace code
  3023. ;
  3024. IF TIMEmsg ;;AN000;; Is the request to include the code for TIME replace?
  3025. $M_REPLACE = TRUE ;;AN000;; Yes, THEN include it and flag that we will need common
  3026. $M_CHAR_ONLY = FALSE ;;AN000;; replacement code later
  3027. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  3028. ;;
  3029. ;; PROC NAME: $M_TIME_REPLACE
  3030. ;;
  3031. ;; FUNCTION: Convert a time to a decimal ASCII string
  3032. ;; and prepare to display
  3033. ;; INPUTS: DS:SI points at corresponding SUBLIST
  3034. ;; ES:DI points at VALUE from SUBLIST
  3035. ;; OUTPUTS: CX contains number of characters on stack
  3036. ;; Top of stack --> Last character
  3037. ;; . . .
  3038. ;; Bot of stack --> First character
  3039. ;; REGS USED: BP,CX,AX
  3040. ;;
  3041. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  3042. ;;
  3043. $M_TIME_REPLACE PROC NEAR ;;AN000;;
  3044. ;;
  3045. POP BP ;;AN000;; Save return address
  3046. MOV $M_RT.$M_DIVISOR,$M_BASE10 ;;AN000;; Set default divisor
  3047. CALL $M_GET_TIME ;;AN000;; All O.K.?
  3048. TEST $M_SL.$M_S_FLAG,Time_Cty_Type AND $M_TIME_MASK ;;AN000;; Is this a request for current country info?
  3049. ; $IF NZ ;;AN000;; Yes,
  3050. JZ $MIF365
  3051. CMP BYTE PTR $M_RT.$M_TIME_FORMAT,0 ;;AN000;; Is the current country format 12 Hour?
  3052. ; $IF E ;;AN000;; Yes,
  3053. JNE $MIF366
  3054. MOV AL,BYTE PTR $M_SL.$M_S_VALUE ;;AN000;; Get Hours
  3055. CMP AL,12 ;;AN000;; Is hour 12 or less?
  3056. ; $IF L,OR ;;AN000;; or
  3057. JL $MLL367
  3058. CMP AL,23 ;;AN000;; Is hour 24 or greater?
  3059. ; $IF G ;;AN000;; Yes,
  3060. JNG $MIF367
  3061. $MLL367:
  3062. MOV AL,$M_AM ;;AN000;;
  3063. PUSH AX ;;AN000;; Push an "a" to represent AM.
  3064. INC CX ;;AN000;;
  3065. ; $ELSE ;;AN000;; No,
  3066. JMP SHORT $MEN367
  3067. $MIF367:
  3068. MOV AL,$M_PM ;;AN000;;
  3069. PUSH AX ;;AN000;; Push an "p" to represent PM.
  3070. INC CX ;;AN000;;
  3071. ; $ENDIF ;;AN000;;
  3072. $MEN367:
  3073. ; $ENDIF ;;AN000;;
  3074. $MIF366:
  3075. ; $ENDIF ;;AN000;;
  3076. $MIF365:
  3077. ;;
  3078. XOR AX,AX ;;AN000;;
  3079. XOR DX,DX ;;AN000;;
  3080. TEST $M_SL.$M_S_FLAG,Time_HHMMSSHH_Cty AND $M_SIZE_MASK ;;AN000;; Was Hour/Min/Sec/Hunds (12 Hour) specified?
  3081. ; $IF NZ ;;AN000;;
  3082. JZ $MIF372
  3083. MOV AL,BYTE PTR $M_SL.$M_S_VALUE+3 ;;AN000;; Get Hundreds
  3084. CALL $M_CONVERTTIME ;;AN000;;
  3085. PUSH WORD PTR $M_RT.$M_DECI_SEPARA ;;AN000;;
  3086. INC CX ;;AN000;;
  3087. ; $ENDIF ;;AN000;;
  3088. $MIF372:
  3089. TEST $M_SL.$M_S_FLAG,Time_HHMMSSHH_Cty AND $M_SIZE_MASK ;;AN000;; Was Hour/Min/Sec/Hunds (12 Hour) specified?
  3090. ; $IF NZ,OR ;;AN000;;
  3091. JNZ $MLL374
  3092. TEST $M_SL.$M_S_FLAG,Time_HHMMSS_Cty AND $M_SIZE_MASK ;;AN000;; Was Hour/Min/Sec (12 Hour) specified?
  3093. ; $IF NZ ;;AN000;;
  3094. JZ $MIF374
  3095. $MLL374:
  3096. MOV AL,BYTE PTR $M_SL.$M_S_VALUE+2 ;;AN000;; Get Seconds
  3097. CALL $M_CONVERTTIME ;;AN000;;
  3098. PUSH WORD PTR $M_RT.$M_TIME_SEPARA ;;AN000;;
  3099. INC CX ;;AN000;;
  3100. ; $ENDIF ;;AN000;;
  3101. $MIF374:
  3102. ;; Do Hour/Min (12 Hour)
  3103. MOV AL,BYTE PTR $M_SL.$M_S_VALUE+1 ;;AN000;; Get Minutes
  3104. CALL $M_CONVERTTIME ;;AN000;;
  3105. PUSH WORD PTR $M_RT.$M_TIME_SEPARA ;;AN000;;
  3106. INC CX ;;AN000;;
  3107. ;;
  3108. MOV AL,BYTE PTR $M_SL.$M_S_VALUE ;;AN000;; Get Hours
  3109. TEST $M_SL.$M_S_FLAG,Time_Cty_Type AND $M_TIME_MASK ;;AN000;; Is this a request for current country info?
  3110. ; $IF NZ ;;AN000;; Yes,
  3111. JZ $MIF376
  3112. CMP BYTE PTR $M_RT.$M_TIME_FORMAT,0 ;;AN000;; Is the current country format 12 Hour?
  3113. ; $IF E ;;AN000;; Yes,
  3114. JNE $MIF377
  3115. CMP AL,13 ;;AN000;; Is hour less than 12?
  3116. ; $IF GE ;;AN000;; Yes,
  3117. JNGE $MIF378
  3118. SUB AL,12 ;;AN000;; Set to a 12 hour value
  3119. ; $ENDIF ;;AN000;;
  3120. $MIF378:
  3121. CMP AL,0 ;;AN000;; Is hour less than 12?
  3122. ; $IF E ;;AN000;; Yes,
  3123. JNE $MIF380
  3124. MOV AL,12 ;;AN000;; Set to a 12 hour value
  3125. ; $ENDIF ;;AN000;;
  3126. $MIF380:
  3127. ; $ENDIF ;;AN000;;
  3128. $MIF377:
  3129. ; $ENDIF ;;AN000;;
  3130. $MIF376:
  3131. CALL $M_CONVERT2ASC ;;AN000;; Convert it to ASCII
  3132. ;;
  3133. PUSH BP ;;AN000;; Restore return address
  3134. RET ;;AN000;; Return
  3135. ;;
  3136. $M_TIME_REPLACE ENDP ;;AN000;;
  3137. ;;
  3138. $M_GET_TIME PROC NEAR ;;AN000;;
  3139. MOV AH,DOS_GET_COUNTRY ;;AN000;; Call DOS for country dependant info
  3140. MOV AL,0 ;;AN000;; Get current country info
  3141. LEA DX,$M_RT.$M_TEMP_BUF ;;AN000;; Set up addressibility to buffer
  3142. INT 21H ;;AN000;;
  3143. ; $IF C ;;AN000;; No,
  3144. JNC $MIF384
  3145. MOV WORD PTR $M_RT.$M_TIME_FORMAT,$M_DEF_TIME_FORM ;;AN000;; Set default time format (BH)
  3146. MOV BYTE PTR $M_RT.$M_TIME_SEPARA,$M_DEF_TIME_SEP ;;AN000;; Set default time separator (BL)
  3147. MOV BYTE PTR $M_RT.$M_DECI_SEPARA,$M_DEF_DECI_SEP ;;AN000;; Set default time separator (BL)
  3148. ; $ENDIF ;;AN000;;
  3149. $MIF384:
  3150. RET ;;AN000;;
  3151. $M_GET_TIME ENDP ;;AN000;;
  3152. ;;
  3153. $M_CONVERTTIME PROC NEAR ;;AN000;;
  3154. POP WORD PTR $M_RT.$M_TEMP_BUF ;;AN000;; Save return address
  3155. MOV $M_RT.$M_SIZE,CL ;;AN000;; Save the size before conversion
  3156. CALL $M_CONVERT2ASC ;;AN000;; Convert it to an ASCII string
  3157. DEC CX ;;AN000;; Test if size only grew by 1
  3158. CMP CL,$M_RT.$M_SIZE ;;AN000;; Did size only grow by one
  3159. ; $IF E ;;AN000;; Yes,
  3160. JNE $MIF386
  3161. MOV AX,$M_TIMEDATE_PAD ;;AN000;; Get a pad character (0)
  3162. PUSH AX ;;AN000;; Save it
  3163. INC CX ;;AN000;; Count it
  3164. ; $ENDIF ;;AN000;;
  3165. $MIF386:
  3166. INC CX ;;AN000;; Restore CX
  3167. PUSH WORD PTR $M_RT.$M_TEMP_BUF ;;AN000;; Save return address
  3168. RET ;;AN000;;
  3169. $M_CONVERTTIME ENDP ;;AN000;;
  3170. ;;
  3171. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  3172. ENDIF ;;AN000;; END of include of TIME replace
  3173. ENDIF ;;AN000;; END of include of Replacement common code
  3174. ;
  3175. IF INPUTmsg ;;AN000;; Is the request to include the code for NUM replace?
  3176. INPUTmsg = FALSE ;;AN000;; Yes, THEN include it and reset the flag
  3177. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  3178. ;;
  3179. ;; PROC NAME: $M_WAIT_FOR_INPUT
  3180. ;;
  3181. ;; FUNCTION: To accept keyed input and return extended key value
  3182. ;; in AX register
  3183. ;; INPUTS: DL contains the DOS function requested for input
  3184. ;; OUPUTS: AX contains the extended key value that was read
  3185. ;; REGS USED:
  3186. ;;
  3187. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  3188. ;;
  3189. $M_WAIT_FOR_INPUT PROC NEAR ;;AN000;;
  3190. ;;
  3191. PUSH CX ;;AN000;; Save CX
  3192. PUSH DX ;;AN000;; Save DX
  3193. PUSH DS ;;AN000;; Save Data segment
  3194. ;;
  3195. CMP DL,DOS_CLR_KEYB_BUF_MASK ;;AN001;; Are we to clear the keyboard buffer?
  3196. ; $IF A ;;AN001;; Yes,
  3197. JNA $MIF388
  3198. MOV AL,DL ;;AN001;; Mov function into AL
  3199. AND AL,LOW_NIB_MASK ;;AN001;; Mask out the C in high nibble
  3200. MOV AH,DOS_CLR_KEYB_BUF ;;AN001;; Set input function
  3201. ; $ELSE ;;AN001;; No,
  3202. JMP SHORT $MEN388
  3203. $MIF388:
  3204. MOV AH,DL ;;AN000;; Put DOS function in AH
  3205. ; $ENDIF ;;AN001;;
  3206. $MEN388:
  3207. PUSH ES ;;AN000;; Get output buffer segment
  3208. POP DS ;;AN000;;
  3209. MOV DX,DI ;;AN000;; Get output buffer offset in case needed
  3210. INT 21H ;;AN000;; Get keyboard input
  3211. POP DS ;;AN000;;
  3212. CMP DL,DOS_BUF_KEYB_INP ;;AN000;;
  3213. CLC ;;AN000;;
  3214. ; $IF NE ;;AN000;; If character input
  3215. JE $MIF391
  3216. CALL $M_IS_IT_DBCS ;;AN000;; Is this character DBCS?
  3217. ; $IF C ;;AN000;;
  3218. JNC $MIF392
  3219. MOV CL,AL ;;AN000;; Save first character
  3220. MOV AH,DL ;;AN001;; Get back function
  3221. INT 21H ;;AN000;; Get keyboard input
  3222. MOV AH,CL ;;AN000;; Retreive first character AX = xxxx
  3223. CLC ;;AN000;; Clear carry condition
  3224. ; $ELSE ;;AN000;;
  3225. JMP SHORT $MEN392
  3226. $MIF392:
  3227. MOV AH,0 ;;AN000;; AX = 00xx where xx is SBCS
  3228. ; $ENDIF ;;AN000;;
  3229. $MEN392:
  3230. ; $ENDIF ;;AN000;;
  3231. $MIF391:
  3232. ;;
  3233. ; $IF NC ;;AN000;;
  3234. JC $MIF396
  3235. POP DX ;;AN000;;
  3236. POP CX ;;AN000;;
  3237. ; $ELSE ;;AN000;;
  3238. JMP SHORT $MEN396
  3239. $MIF396:
  3240. ADD SP,4 ;;AN000;;
  3241. STC ;;AN000;; Reset carry flag
  3242. ; $ENDIF ;;AN000;;
  3243. $MEN396:
  3244. RET ;;AN000;; Return
  3245. ;;
  3246. $M_WAIT_FOR_INPUT ENDP ;;AN000;;
  3247. ;;
  3248. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  3249. ENDIF ;;AN000;; END of include of Wait for Input
  3250. ENDIF ;;AN000;; END of include of SYSDISPMSG
  3251. ENDIF ;;AN000;; END of include of MSG_DATA_ONLY
  3252. ENDIF ;;AN000;; END of include of Structure only