Source code of Windows XP (NT5)
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.

3794 lines
144 KiB

  1. ;
  2. PAGE
  3. ;-----------------------------------------------------------------------------+
  4. ; :
  5. ; Source...: PCINPUT.INC :
  6. ; Created..: 01-01-82 :
  7. ; Standards: 01-07-86 :
  8. ; Revised..: 11-17-87 :
  9. ; Version..: PC DOS :
  10. ; Called as: FAR, NEAR or INT :
  11. ; Public as: INPUT :
  12. ; :
  13. ;-----------------------------------------------------------------------------+
  14. ;
  15. PAGE
  16. ;-----------------------------------------------------------------------------+
  17. ; :
  18. ; DEFAULT :
  19. ; :
  20. ; Performs the following functions: :
  21. ; :
  22. ; - Initializes pointers and counters :
  23. ; - Initializes input buffer with default value (from screen or strg) :
  24. ; - Set options and display input buffer as default on screen :
  25. ; - Display field delimiters :
  26. ; - Display minus or plus sign :
  27. ; :
  28. ; :
  29. ; Entry: ES:SI = Points to current ICB :
  30. ; DS:DI = Points to PB :
  31. ; :
  32. ; WR_CURSIZE = Current cursor size :
  33. ; :
  34. ; Exit: Default displayed :
  35. ; :
  36. ;-----------------------------------------------------------------------------+
  37. ;
  38. DEFAULT PROC NEAR
  39. ;
  40. ; Initialize input buffer with default buffer
  41. ;
  42. PUSH BP
  43. PUSH ES ;save registers
  44. PUSH DS
  45. PUSH DI
  46. PUSH SI
  47. ;
  48. MOV DX,ES:[SI]+ICB_FIELDLEN ;save for later ;=W
  49. MOV BX,ES:[SI]+ICB_DEFLEN ;save for later ;=W
  50. ;
  51. MOV AX,ES:[SI]+ICB_DEFSEG ;get source string segment ;=W
  52. MOV DS,AX ;=W
  53. ;
  54. MOV AX,ES:[SI]+ICB_FIELDOFF ;get destination offset ;=W
  55. MOV DI,AX ;=W
  56. ;
  57. MOV AX,ES:[SI]+ICB_FIELDSEG ;get destination segment ;=W
  58. MOV CX,ES:[SI]+ICB_DEFOFF ;get source string offset ;=W
  59. MOV SI,CX ;=W
  60. MOV ES,AX ;=W
  61. ;
  62. PUSH DI
  63. MOV CX,DX ;clear input buffer ;=W
  64. MOV AL,WR_SPACE ;=W
  65. CLD ;=W
  66. REP STOSB ;=W
  67. POP DI
  68. ; ;=W
  69. MOV BP,0
  70. MOV CX,BX ;initialize number of bytes in ;=W
  71. ; default string
  72. CMP CX,DX ;check if default string is
  73. JBE DEF10 ; longer than input buffer
  74. ;
  75. MOV CX,DX ;error set to input buffer leng
  76. MOV BP,ICB_STRU ;set error indicating default was
  77. ; truncated
  78. DEF10:
  79. CLD
  80. REP MOVSB ;move default into input buffer
  81. ;
  82. POP SI ;restore registers
  83. POP DI
  84. POP DS
  85. POP ES
  86. ;
  87. OR ES:[SI]+ICB_STATUS,BP ;save error status
  88. POP BP
  89. ;
  90. ; Calculate row and column of input field and set the desired display attribute
  91. ;
  92. MOV AX,ES:[SI]+ICB_ROW ;get input field row
  93. MOV [DI]+CR_ROW,AX
  94. ;
  95. MOV AX,ES:[SI]+ICB_COL ;get input field column
  96. MOV [DI]+CR_COL,AX
  97. ;
  98. CALL PCROWCL_CALL ;calculate row and column info
  99. ; return CR_RCOFF and CR_BEGROWOFF
  100. MOV AL,[DI]+WR_EATTR ;set the entry attribute to the
  101. MOV [DI]+WR_CATTR,AL ; current attribute
  102. ;
  103. ; Initialize variables for left justified field
  104. ;
  105. TEST ES:[SI]+ICB_OPT1,ICB_RJU ;check if right justified
  106. JNE DEF20
  107. ;
  108. MOV [DI]+WR_LEFTCHAR,1 ;set left character marker to
  109. ;beginning of input field
  110. MOV AX,ES:[SI]+ICB_FIELDLEN ;get max field length ;=W
  111. ;
  112. TEST ES:[SI]+ICB_OPT3,ICB_HOR ;check if horizontal scrolling ;=W
  113. JE DEF15 ;no ;=W
  114. MOV AX,ES:[SI]+ICB_WIDTH ;get field width for horizontal scrolling ;=W
  115. ;because we only show a windowful of field ;=W
  116. DEF15: ;=W
  117. MOV [DI]+WR_RIGHTCHAR,AX ;set ptr to rightmost character ;=W
  118. CALL CAL_COORS ;get end of field char, byte ;=W
  119. JMP DEF30 ;and next byte positions
  120. ;
  121. ; Initialize variables for right justified field
  122. ;
  123. DEF20: ;
  124. ; code here
  125. ;
  126. ;
  127. ; Display default even if password option is active
  128. ;
  129. DEF30: PUSH ES:[SI]+ICB_OPT1 ;save option word
  130. ;
  131. TEST ES:[SI]+ICB_OPT1,ICB_PSW ;check if password option active
  132. JE DEF40
  133. ;
  134. AND ES:[SI]+ICB_OPT1,NOT ICB_PSW
  135. ;set option word to force disp
  136. ; of default value
  137. DEF40:
  138. MOV AX,2 ;set option to actually display
  139. CALL WORD PTR [DI]+WR_DISPLAY ; default value in proper
  140. ; justification
  141. POP ES:[SI]+ICB_OPT1 ;restore original password
  142. ;
  143. ; Display initial cursor in proper size and location
  144. ;
  145. MOV AX,[DI]+IN_CURNOR ;set cursor size for replace
  146. MOV [DI]+WR_CURSIZE,AX
  147. ;
  148. TEST ES:[SI]+ICB_STATUS,ICB_SINS
  149. JE DEF45 ;check if insert is active
  150. ;
  151. MOV AX,[DI]+IN_CURINS ;set cursor size for insert
  152. MOV [DI]+WR_CURSIZE,AX
  153. ;
  154. DEF45:
  155. CALL CAL_COORS ;calculate coordinates ;=W
  156. CALL CURSOR ;initialize cursor size and locat
  157. ;
  158. ; Determine if characters in input buffer are allowonce chars and set flags
  159. ;
  160. jmp Def65 ;temp until bug in allowonce scan fixed
  161. PUSH ES ;save registers
  162. PUSH SI
  163. ;
  164. MOV BX,ES ;set segment of ICB
  165. MOV DX,SI ;set offset of ICB
  166. ;
  167. MOV CX,ES:[SI]+ICB_FIELDLEN ;get field length
  168. ;
  169. PUSH ES:[SI]+ICB_FIELDOFF ;get field offset
  170. PUSH ES:[SI]+ICB_FIELDSEG ;get field segment
  171. POP ES
  172. POP SI
  173. ;
  174. DEF50: MOV AL,ES:[SI] ;get character from input buffer
  175. MOV [DI]+DBC_KS,AL ; and set to PCINDBC PB
  176. ;
  177. INC SI ;point to next byte
  178. ;
  179. CALL PCINDBC_CALL ;call PCINDBC
  180. TEST [DI]+DBC_STAT,DBC_DBCS ;check if keystroke double byte
  181. JE DEF60
  182. ;
  183. CMP CX,0 ;if last loop is double character
  184. JBE DEF60 ; and is missing trailing byte
  185. ; then, consider a single byte
  186. ;
  187. MOV AH,ES:[SI] ;get character from input buffer
  188. MOV [DI]+DBC_KS,AH ; and set to PCINDBC PB
  189. INC SI ;point to next byte
  190. DEC CX ;adjust loop pointer for additial
  191. ; character read (double byte)
  192. ;
  193. DEF60: PUSH ES ;save registers
  194. PUSH SI
  195. ;
  196. MOV ES,BX ;load ICB
  197. MOV SI,DX
  198. ;
  199. CALL ON_ALLOWONCE ;Scan the allowonce string for
  200. ; the character in AX and set flag
  201. ; if found
  202. POP SI ;restore registers
  203. POP ES
  204. ;
  205. LOOP DEF50 ;get next keystroke
  206. ;
  207. POP SI ;restore registers
  208. POP ES
  209. ;
  210. ; Display field delimiters
  211. ;
  212. DEF65: ;=W
  213. MOV AX,01 ;assume "[ ]" as delimiters ;=W
  214. ; ;=W
  215. TEST ES:[SI]+ICB_OPT1,ICB_BEN ;display entry delimiters ;=W
  216. JE DEF100 ;no, leave ;=W
  217. ; ;=W
  218. TEST ES:[SI]+ICB_OPT3,ICB_WIN ;does field use windowing ;=W
  219. JE DEF70 ;no, check others ;=W
  220. ; ;=W
  221. TEST ES:[SI]+ICB_OPT1,ICB_BOX ;check if delimiter = box ;=W
  222. JE DEF90 ;no, display normal delimiters ;=W
  223. ; ;=W
  224. MOV AX,06 ;display box ;=W
  225. JMP DEF90 ;done with delimiters ;=W
  226. DEF70: ;=W
  227. TEST ES:[SI]+ICB_OPT3,ICB_HOR ;does field use horiz. window ;=W
  228. JE DEF80 ;=W
  229. ; ;=W
  230. MOV AX,03 ;display "[ >" ;=W
  231. CMP ES:[SI]+ICB_HRSTART,01H ;are we at beginning of window ? ;=W
  232. JLE DEF80 ;yes ;=W
  233. ;
  234. MOV AX,04 ;no, display "< >" ;=W
  235. DEF80: ;=W
  236. CALL DELIMITER ;do it ;=W
  237. ;
  238. TEST ES:[SI]+ICB_OPT1,ICB_BOX ;check if also need box ;=W
  239. JE DEF100 ;=W
  240. ; ;=W
  241. MOV AX,06 ;display box ;=W
  242. DEF90: ;=W
  243. CALL DELIMITER ;do it ;=W
  244. ;
  245. ; Display minus or plus sign if active
  246. ;
  247. DEF100:
  248. TEST ES:[SI]+ICB_OPT1,ICB_MUS ;Check if minus/plus sign
  249. JE DEFEXIT ; display option is active
  250. ;
  251. MOV [DI]+WR_KEYCONF,0 ;initialize to plus sign key
  252. ;
  253. TEST ES:[SI]+ICB_OPT1,ICB_SMU ;Check if default is negative
  254. JE DEF110
  255. ;
  256. OR [DI]+WR_KEYCONF,WR_MUS ;initialize to minus sign key
  257. ;
  258. DEF110: CALL PLUS_MINUS ;display plus or minus sign and
  259. ; set status
  260. ;
  261. DEFEXIT: ;continue
  262. ;
  263. RET
  264. DEFAULT ENDP
  265. ;
  266. PAGE
  267. ;-----------------------------------------------------------------------------+
  268. ; :
  269. ; PRE_EXIT :
  270. ; :
  271. ; Performs the following functions: :
  272. ; :
  273. ; - Removes field delimiters :
  274. ; - Inserts commas as specified :
  275. ; - Inserts decimal point as specified :
  276. ; - Adjusts field to specified significant digits :
  277. ; - Displays buffer contents in exit color :
  278. ; - Checks if original default has changed :
  279. ; - Check if entry is in specified numeric range :
  280. ; - Sets minus or plus sign indicator in exit color :
  281. ; - Remove thousand separators from input string buffer :
  282. ; - Restore original cursor position and size, only in text mode :
  283. ; :
  284. ; Entry: ES:SI = Points to current ICB :
  285. ; DS:DI = Points to PB :
  286. ; :
  287. ; Exit: None :
  288. ; :
  289. ;-----------------------------------------------------------------------------+
  290. ;
  291. PRE_EXIT PROC NEAR
  292. ;
  293. ; Inserts commas as specified
  294. ;
  295. ;
  296. ; Code here
  297. ;
  298. ;
  299. ; Inserts decimal point as specified
  300. ;
  301. ;
  302. ; Code here
  303. ;
  304. ;
  305. ; Adjusts field to specified significant digits
  306. ;
  307. ;
  308. ; Code here
  309. ;
  310. ;
  311. ; Calculate color attribute of exit colors
  312. ;
  313. TEST ES:[SI]+ICB_OPT1,ICB_XCL ;check if option to use exit
  314. JE PRE10 ; colors is active
  315. ;
  316. MOV AL,[DI]+WR_XATTR ;set the exit attribute to the
  317. MOV [DI]+WR_CATTR,AL ; current attribute
  318. ;
  319. ; Display default value of input buffer in proper justification
  320. ;
  321. PRE10: MOV [DI]+WR_LEFTCHAR,1 ;set left character
  322. MOV AX,ES:[SI]+ICB_FIELDLEN ;set right marker
  323. ;
  324. TEST ES:[SI]+ICB_OPT3,ICB_HOR ;horizontal scrolling mode ? ;=W
  325. JE PRE15 ;no, display all buffer ;=W
  326. MOV AX,ES:[SI]+ICB_WIDTH ;use width instead of all buffer ;=W
  327. PRE15:
  328. MOV [DI]+WR_RIGHTCHAR,AX
  329. ;
  330. MOV AX,2 ;set option to actually display
  331. CALL WORD PTR [DI]+WR_DISPLAY ; default value in proper
  332. ; ; justification
  333. ; Process minus/plus key options
  334. ;
  335. TEST ES:[SI]+ICB_OPT1,ICB_MUS ;Check if minus/plus sign
  336. JE PRE40 ; display option is active
  337. ;
  338. MOV [DI]+WR_KEYCONF,0 ;initialize to plus sign
  339. ;
  340. TEST ES:[SI]+ICB_STATUS,ICB_SMUS
  341. JE PRE20 ;Check if sign is negative
  342. ;
  343. OR [DI]+WR_KEYCONF,WR_MUS ;initialize to minus sign key
  344. ;
  345. PRE20: TEST ES:[SI]+ICB_STATUS,ICB_SPUS
  346. JE PRE30 ;Check if sign is positive
  347. ;
  348. OR [DI]+WR_KEYCONF,WR_PUS ;initialize to plus sign key
  349. ;
  350. PRE30: CALL PLUS_MINUS ;display plus or minus sign
  351. ; according to WR_KEYCONF setting
  352. ;
  353. ; Replace field entry delimiters with exit delimiters
  354. ;
  355. PRE40: TEST ES:[SI]+ICB_OPT1,ICB_BEX ;check if field delimiters
  356. JE PRE60 ; should be displayed on exit
  357. ;
  358. MOV AX,2 ;option to remove delimiters
  359. CALL DELIMITER ;display delimiters
  360. ;
  361. TEST ES:[SI]+ICB_OPT1,ICB_BOX ;check if box around field
  362. JE PRE60 ; should be displayed
  363. ;
  364. MOV AX,7 ;set option to remove box
  365. CALL DELIMITER ;display delimiters
  366. ;
  367. ; Check if default value has changed and set return flag
  368. ;
  369. PRE60: PUSH DS ;save registers
  370. PUSH SI
  371. PUSH ES
  372. PUSH DI
  373. ;
  374. MOV CX,ES:[SI]+ICB_DEFLEN ;initialize to default length
  375. CMP CX,ES:[SI]+ICB_FIELDLEN ;check if default length is less
  376. JBE PRE70 ; than field length
  377. ;
  378. MOV CX,ES:[SI]+ICB_FIELDLEN ;initialize to field length
  379. ;
  380. PRE70: MOV AX,ES:[SI]+ICB_DEFSEG ;compare default string to ;=W
  381. MOV DS,AX ;=W
  382. MOV AX,ES:[SI]+ICB_FIELDOFF ;=W
  383. MOV DI,AX ;=W
  384. ;
  385. MOV AX,ES:[SI]+ICB_DEFOFF ; current input string ;=W
  386. MOV BX,ES:[SI]+ICB_FIELDSEG ;=W
  387. MOV ES,BX ;=W
  388. MOV SI,AX ;=W
  389. ;
  390. REPE CMPSB ;compare default and input strings
  391. ;
  392. POP DI ;restore registers
  393. POP ES
  394. POP SI
  395. POP DS
  396. ;
  397. CMP CX,0 ;are we done ? ;=W
  398. JE PRE80 ;check if strings compared
  399. ;
  400. OR ES:[SI]+ICB_STATUS,ICB_SDEF
  401. ;set flag that default changed
  402. ;
  403. ; Check if entry is within specified numeric range, if not set flag
  404. ;
  405. PRE80: ;
  406. ; code here
  407. ;
  408. ;
  409. ; Remove thousand separators if specified from input string buffer
  410. ;
  411. PRE90: ;
  412. ; code here
  413. ;
  414. ;
  415. ; Restore original cursor position and size
  416. ;
  417. PRE95:
  418. TEST ES:[SI]+ICB_STATUS,ICB_CUR_ON ;is cursor on ?
  419. JE PRE100 ;no, quit
  420. CALL CURSOR ;erase the graphics cursor
  421. PRE100:
  422. OR ES:[SI]+ICB_STATUS,ICB_DONE ;exit condition found, exit ;=W
  423. ; ;=W
  424. ; Check if ICB_SAV option selected. If selected, then save contents of the ;=W
  425. ; input buffer to the default buffer. ;=W
  426. ; ;=W
  427. TEST ES:[SI]+ICB_OPT4,ICB_SAV ;check ? ;=W
  428. JE PRE200 ;no, exit now ;=W
  429. ; ;=W
  430. PUSH ES ;save registers ;=W
  431. PUSH DS ;=W
  432. PUSH DI ;=W
  433. PUSH SI ;=W
  434. ; ;=W
  435. MOV CX,ES:[SI]+ICB_ENDBYTE ;# of bytes to copy from input ;=W
  436. ; buffer to default buffer ;=W
  437. MOV ES:[SI]+ICB_DEFLEN,CX ;reset default length
  438. ;
  439. MOV AX,ES:[SI]+ICB_FIELDSEG ;get destination segment ;=W
  440. MOV DS,AX ;=W
  441. ; ;=W
  442. MOV AX,ES:[SI]+ICB_DEFOFF ;get source string offset ;=W
  443. MOV DI,AX ;=W
  444. ; ;=W
  445. MOV AX,ES:[SI]+ICB_DEFSEG ;get source string segment ;=W
  446. MOV BX,ES:[SI]+ICB_FIELDOFF ;get destination offset ;=W
  447. MOV SI,BX ;=W
  448. MOV ES,AX ;=W
  449. ; ;=W
  450. CLD ;=W
  451. REP MOVSB ;move default into input buffer ;=W
  452. ; ;=W
  453. POP SI ;restore registers ;=W
  454. POP DI ;=W
  455. POP DS ;=W
  456. POP ES ;=W
  457. PRE200: ;=W
  458. RET
  459. PRE_EXIT ENDP
  460. ; ;=W
  461. PAGE ;=W
  462. ;-----------------------------------------------------------------------------+ ;=W
  463. ; : ;=W
  464. ; RIGHT_H_JUST : ;=W
  465. ; : ;=W
  466. ; Process keystroke and update display with input buffer changes : ;=W
  467. ; for the following functions: : ;=W
  468. ; : ;=W
  469. ; Home key Up arrow Allowonce replace mode : ;=W
  470. ; End key Down arrow Allowonce insert mode : ;=W
  471. ; Left arrow Control end Allow replace mode : ;=W
  472. ; Right arrow Delete key Allow insert mode : ;=W
  473. ; : ;=W
  474. ;-----------------------------------------------------------------------------+ ;=W
  475. ; ;=W
  476. RIGHT_H_JUST PROC NEAR ;=W
  477. ; ;=W
  478. ; ;=W
  479. ; code here ;=W
  480. ; ;=W
  481. ; ;=W
  482. RET ;=W
  483. RIGHT_H_JUST ENDP ;=W
  484. ;
  485. PAGE
  486. ;-----------------------------------------------------------------------------+
  487. ; :
  488. ; RIGHT_JUST :
  489. ; :
  490. ; Process keystroke and update display with input buffer changes :
  491. ; for the following functions: :
  492. ; :
  493. ; Home key Up arrow Allowonce replace mode :
  494. ; End key Down arrow Allowonce insert mode :
  495. ; Left arrow Control end Allow replace mode :
  496. ; Right arrow Delete key Allow insert mode :
  497. ; :
  498. ;-----------------------------------------------------------------------------+
  499. ;
  500. RIGHT_JUST PROC NEAR
  501. ;
  502. ;
  503. ; code here
  504. ;
  505. ;
  506. RET
  507. RIGHT_JUST ENDP
  508. ; ;=W
  509. PAGE ;=W
  510. ;-----------------------------------------------------------------------------+ ;=W
  511. ; : ;=W
  512. ; LEFT_H_JUST : ;=W
  513. ; : ;=W
  514. ; Process keystroke and update display with input buffer changes : ;=W
  515. ; for the following functions: : ;=W
  516. ; : ;=W
  517. ; Home key Up arrow Allowonce replace mode : ;=W
  518. ; End key Down arrow Allowonce insert mode : ;=W
  519. ; Left arrow Control end Allow replace mode : ;=W
  520. ; Right arrow Delete key Allow insert mode : ;=W
  521. ; : ;=W
  522. ; : ;=W
  523. ; Following information is used: : ;=W
  524. ; : ;=W
  525. ; : ;=W
  526. ; (ICB_FIELDSEG:ICB_FIELDOFF) Beginning address of input : ;=W
  527. ; buffer in memory. : ;=W
  528. ; : ;=W
  529. ; (WR_CUBYTE) Byte offset into the input buffer : ;=W
  530. ; of where characters will be added : ;=W
  531. ; to input buffer. : ;=W
  532. ; : ;=W
  533. ; Ŀ : ;=W
  534. ; S L T L T S S : ;=W
  535. ; : ;=W
  536. ; : ;=W
  537. ; : ;=W
  538. ; (ICB_FIELDLEN) Length of input field in bytes. : ;=W
  539. ; : ;=W
  540. ; : ;=W
  541. ; The following demonstrates the before and after input buffer : ;=W
  542. ; images. (S = Single byte, L = DBCS lead byte, T = DBCS trailing : ;=W
  543. ; byte) : ;=W
  544. ; : ;=W
  545. ; Deleting a double byte: : ;=W
  546. ; Ŀ Ŀ : ;=W
  547. ; S L T L T S S L T S : ;=W
  548. ; : ;=W
  549. ; : ;=W
  550. ; Deleting a single byte: : ;=W
  551. ; Ŀ Ŀ : ;=W
  552. ; S L T S L T S L T L T : ;=W
  553. ; : ;=W
  554. ; : ;=W
  555. ; Backspace removal of a double byte: : ;=W
  556. ; Ŀ Ŀ : ;=W
  557. ; S L T L T S S L T S : ;=W
  558. ; : ;=W
  559. ; : ;=W
  560. ; Backspace removal of a single byte: : ;=W
  561. ; Ŀ Ŀ : ;=W
  562. ; S S S S L T S S S L T : ;=W
  563. ; : ;=W
  564. ; : ;=W
  565. ; Replacing a double byte with a double byte: : ;=W
  566. ; Ŀ Ŀ : ;=W
  567. ; S L T L T S S L T L T S : ;=W
  568. ; : ;=W
  569. ; : ;=W
  570. ; Replacing a double byte with a single byte: (Option 1) : ;=W
  571. ; Ŀ Ŀ : ;=W
  572. ; S L T L T S S L T S S : ;=W
  573. ; : ;=W
  574. ; : ;=W
  575. ; Replacing a double byte with a single byte: (Option 2) : ;=W
  576. ; Ŀ Ŀ : ;=W
  577. ; S L T L T S S L T S S : ;=W
  578. ; : ;=W
  579. ; : ;=W
  580. ; Replacing a single byte with a single byte: : ;=W
  581. ; Ŀ Ŀ : ;=W
  582. ; S L T S L T S L T S L T : ;=W
  583. ; : ;=W
  584. ; : ;=W
  585. ; Replacing a single byte with a double byte. : ;=W
  586. ; Ŀ Ŀ : ;=W
  587. ; S L T S S L T L T : ;=W
  588. ; : ;=W
  589. ; : ;=W
  590. ; Replacing a single byte with a double byte without enough buffer: : ;=W
  591. ; Ŀ Ŀ : ;=W
  592. ; S L T S L T S L T S L T : ;=W
  593. ; : ;=W
  594. ; : ;=W
  595. ; Inserting a single byte. : ;=W
  596. ; Ŀ Ŀ : ;=W
  597. ; S L T L T S L T S L T : ;=W
  598. ; : ;=W
  599. ; : ;=W
  600. ; Inserting a single byte without enough buffer generate an error: : ;=W
  601. ; Ŀ Ŀ : ;=W
  602. ; S L T L T S S L T L T S : ;=W
  603. ; : ;=W
  604. ; Ŀ Ŀ : ;=W
  605. ; S L T S S S L T S S : ;=W
  606. ; : ;=W
  607. ; : ;=W
  608. ; Inserting a double byte character: : ;=W
  609. ; Ŀ Ŀ : ;=W
  610. ; S L T S S L T L T S : ;=W
  611. ; : ;=W
  612. ; : ;=W
  613. ; : ;=W
  614. ; Entry: ES:SI = Points to current ICB : ;=W
  615. ; DS:DI = Points to PB : ;=W
  616. ; : ;=W
  617. ; INC_KS = Keystroke from returned from PCINCHA : ;=W
  618. ; : ;=W
  619. ; WR_KEYCONF = Bit flag inidicating the options set for INC_KS : ;=W
  620. ; WR_KEYCONF2 keystroke. : ;=W
  621. ; : ;=W
  622. ; Exit: None. : ;=W
  623. ; : ;=W
  624. ;-----------------------------------------------------------------------------+ ;=W
  625. ; ;=W
  626. LEFT_H_JUST PROC NEAR ;=W
  627. ; ;=W
  628. ; Initialize right and left boundary markers ;=W
  629. ; ;=W
  630. TEST [DI]+WR_KEYCONF,WR_MASK ;check to see if editing key entered ;=W
  631. JNE LHJ5 ;yes, must check for editing keys ;=W
  632. JMP LHJ190 ;no, skip checks for editing keys ;=W
  633. ;=W
  634. ; ;=W
  635. ; Process home key ;=W
  636. ; ;=W
  637. LHJ5: TEST [DI]+WR_KEYCONF,WR_HOM ;check if home key pressed ;=W
  638. JE LHJ10 ;=W
  639. ; ;=W
  640. ; ;=W
  641. ; add ICB_WHM option to process window home key movement ;=W
  642. ; ;=W
  643. ; ;=W
  644. MOV ES:[SI]+ICB_CURCHAR,1 ;initialize cursor to 1st byte ;=W
  645. ; position, assuming no windowing ;=W
  646. ; wrap is occurring ;=W
  647. MOV [DI]+WR_HRCHAR,1 ;reset the horiz. window ;=W
  648. CALL CAL_COORS ;calculate cursor position ;=W
  649. MOV AX,3 ;display delimiters "[ >" ;=W
  650. CALL DELIMITER ;display delimiter ;=W
  651. JMP LHJEXIT ; returns WR_CURROW, WR_CURROW ;=W
  652. ; and WR_CUBYTE ;=W
  653. ; ;=W
  654. ; Process end key ;=W
  655. ; ;=W
  656. LHJ10: TEST [DI]+WR_KEYCONF,WR_END ;check if home key pressed ;=W
  657. JNE LHJ12 ;=W
  658. JMP LHJ20
  659. LHJ12: ;=W
  660. ; ;=W
  661. ; add ICB_WEN to move cursor to end of current window row ;=W
  662. ; ;=W
  663. ; ;=W
  664. CALL CAL_COORS ;get current end of field info ;=W
  665. MOV AX,[DI]+WR_ENCHAR ;adjust one past end buffer charac ;=W
  666. INC AX ;=W
  667. MOV ES:[SI]+ICB_CURCHAR,AX ;set current cursor position to ;=W
  668. CALL CAL_COORS ;get cursor position ;=W
  669. MOV AX,4 ;display delimiters "< >" ;=W
  670. CMP [DI]+WR_FIELDEND,0 ;check if cursor past end of field ;=W
  671. JE LHJ17 ;no ;=W
  672. MOV AX,5 ;display delimiters "< ]" ;=W
  673. TEST ES:[SI]+ICB_OPT2,ICB_CSW ;is cursor wrap option on ? ;=W
  674. JE LHJ15
  675. MOV ES:[SI]+ICB_CURCHAR,1 ;wrap to first character position
  676. MOV [DI]+WR_HRCHAR,1 ;reset the horiz. window ;=W
  677. MOV AX,3 ;display delimiters "[ >" ;=W
  678. JMP LHJ19 ;exit
  679. LHJ15:
  680. TEST ES:[SI]+ICB_OPT2,ICB_AXC ;is autoexit option set ? ;=W
  681. JE LHJ16 ;no ;=W
  682. OR [DI]+WR_KEYCONF2,WR_RET ;yes, set autoexit flag ;=W
  683. LHJ16: ;=W
  684. MOV BX,ES:[SI]+ICB_FIELDLEN ;adjust horizontal window ;=W
  685. SUB BX,ES:[SI]+ICB_WIDTH ;(below this line may not work for ;=W
  686. INC BX ; DBCS support) ;=W
  687. MOV [DI]+WR_HRCHAR,BX ;=W
  688. JMP LHJ19 ;=W
  689. LHJ17: ;=W
  690. MOV CX,[DI]+WR_CUBYTE ;check if need to adjust horz. ;=W
  691. CMP CX,ES:[SI]+ICB_WIDTH ; window ;=W
  692. JA LHJ18 ;=W
  693. MOV [DI]+WR_HRCHAR,1 ;=W
  694. MOV AX,3 ;display delimiters "[ >" ;=W
  695. JMP LHJ19 ;=W
  696. LHJ18: ;=W
  697. MOV BX,[DI]+WR_ENBYTE ;yes, adjust it ;=W
  698. SUB BX,ES:[SI]+ICB_WIDTH ;=W
  699. ADD BX,2 ;=W
  700. MOV [DI]+WR_HRCHAR,BX ;=W
  701. LHJ19: ;=W
  702. CALL CAL_COORS ;re-calculate display ;=W
  703. CALL DELIMITER ;display delimiter ;=W
  704. JMP LHJEXIT ;exit ;=W
  705. ; ;=W
  706. ; Process left arrow ;=W
  707. ; ;=W
  708. LHJ20: TEST [DI]+WR_KEYCONF,WR_LFT ;check if left arrow key pressed ;=W
  709. JE LHJ40 ;=W
  710. ; ;=W
  711. ; ;=W
  712. ; add ICB_CSW option to wrap cursor from top/bottom end to end ;=W
  713. ; ;=W
  714. ; ;=W
  715. ; ;=W
  716. ; add ICB_WAR option to wrap cursor on same row end to end ;=W
  717. ; ;=W
  718. ; ;=W
  719. MOV BX,ES:[SI]+ICB_CURCHAR ;get cursor position ;=W
  720. CMP BX,1 ;is cursor in first position ? ;=W
  721. JA LHJ30 ;no ;=W
  722. TEST ES:[SI]+ICB_OPT2,ICB_CSW ;is cursor wrap option on ? ;=W
  723. JE LHJ23
  724. MOV BX,ES:[SI]+ICB_FIELDLEN ;adjust horizontal window ;=W
  725. MOV ES:[SI]+ICB_CURCHAR,BX ;wrap to first character position
  726. SUB BX,ES:[SI]+ICB_WIDTH ;(below this line may not work for ;=W
  727. INC BX ; DBCS support) ;=W
  728. MOV [DI]+WR_HRCHAR,BX ;=W
  729. ;
  730. MOV AX,5 ;display delimiters "< ]" ;=W
  731. CALL DELIMITER ;display delimiter ;=W
  732. JMP LHJ32 ;exit
  733. LHJ23:
  734. MOV AX,3 ;display delimiters "[ >" ;=W
  735. CALL DELIMITER ;display delimiter ;=W
  736. TEST ES:[SI]+ICB_OPT2,ICB_AXC ;is autoexit option set ? ;=W
  737. JE LHJ25 ;no ;=W
  738. OR [DI]+WR_KEYCONF2,WR_RET ;yes, set autoexit flag ;=W
  739. JMP LHJ400 ;=W
  740. LHJ25: ;=W
  741. CALL PCMBEEP_CALL ;error beep ;=W
  742. JMP LHJEXIT ;exit ;=W
  743. LHJ30: ;=W
  744. DEC ES:[SI]+ICB_CURCHAR ;adjust cursor to one position ;=W
  745. ;
  746. CMP BX,[DI]+WR_HRCHAR ;is cursor to the left of horz.wind. ? ;=W
  747. JG LHJ32 ;no ;=W
  748. DEC [DI]+WR_HRCHAR ;yes, adjust horiz. window ;=W
  749. MOV AX,4 ;display delimiters "< >" ;=W
  750. CALL DELIMITER ;display delimiter ;=W
  751. LHJ32: ; towards the left ;=W
  752. CALL CAL_COORS ;calculate cursor position
  753. JMP LHJEXIT ;exit ;=W
  754. ; ;=W
  755. ; Process right arrow ;=W
  756. ; ;=W
  757. LHJ40: TEST [DI]+WR_KEYCONF,WR_RGT ;check if left arrow key pressed ;=W
  758. JE LHJ60 ;=W
  759. ; ;=W
  760. ; ;=W
  761. ; add ICB_WAR option to wrap cursor on same row end to end ;=W
  762. ; ;=W
  763. ; ;=W
  764. CALL CAL_COORS ;get cursor position ;=W
  765. ; ;=W
  766. CMP [DI]+WR_FIELDEND,0 ;check if cursor past end of field ;=W
  767. JE LHJ50 ;=W
  768. ; ;=W
  769. MOV AX,5 ;display delimiters "< ]" ;=W
  770. CALL DELIMITER ;display delimiter ;=W
  771. CALL PCMBEEP_CALL ;error beep ;=W
  772. JMP LHJEXIT ;exit ;=W
  773. ; ;=W
  774. LHJ50: INC ES:[SI]+ICB_CURCHAR ;adjust cursor to one position ;=W
  775. ; towards the right ;=W
  776. MOV BX,[DI]+WR_HRCHAR ;get begin. of horiz. wondow ;=W
  777. ADD BX,ES:[SI]+ICB_WIDTH ;add width to get end of window ;=W
  778. CMP BX,ES:[SI]+ICB_CURCHAR ;is cursor past end of window ? ;=W
  779. JG LHJ52 ;no ;=W
  780. INC [DI]+WR_HRCHAR ;yes, adjust the horiz. window ;=W
  781. MOV AX,4 ;display delimiters "< >" ;=W
  782. CALL DELIMITER ;display delimiter ;=W
  783. LHJ52: ;=W
  784. CALL CAL_COORS ;calculate cursor position ;=W
  785. CMP [DI]+WR_FIELDEND,0 ;check if cursor past end of field ;=W
  786. JE LHJ55 ;no ;=W
  787. TEST ES:[SI]+ICB_OPT2,ICB_CSW ;is cursor wrap option on ? ;=W
  788. JE LHJ53
  789. MOV ES:[SI]+ICB_CURCHAR,1 ;wrap to first character position
  790. MOV [DI]+WR_HRCHAR,1 ;reset the horiz. window ;=W
  791. MOV AX,3 ;display delimiters "[ >" ;=W
  792. CALL DELIMITER ;display delimiter ;=W
  793. JMP LHJ55 ;exit
  794. LHJ53:
  795. DEC [DI]+WR_HRCHAR ;yes, adjust wind back one position ;=W
  796. MOV AX,5 ;display delimiters "< ]" ;=W
  797. CALL DELIMITER ;display delimiter ;=W
  798. TEST ES:[SI]+ICB_OPT2,ICB_AXC ;is autoexit option set ? ;=W
  799. JE LHJ55 ;no ;=W
  800. OR [DI]+WR_KEYCONF2,WR_RET ;set autoexit flag ;=W
  801. LHJ55: ;=W
  802. CALL CAL_COORS ;calculate cursor position ;=W
  803. JMP LHJEXIT ;exit ;=W
  804. ; ;=W
  805. ; Process up arrow ;=W
  806. ; ;=W
  807. LHJ60: ; ;=W
  808. ; adjust cursor position ;=W
  809. ; ;=W
  810. ;=W
  811. ; ;=W
  812. ; check for field wrap, exit, error beep ;=W
  813. ; ;=W
  814. ; ;=W
  815. ; Process down arrow ;=W
  816. ; ;=W
  817. LHJ70: ; ;=W
  818. ; adjust cursor position ;=W
  819. ; ;=W
  820. ;=W
  821. ; ;=W
  822. ; check for field wrap, exit, error beep ;=W
  823. ; ;=W
  824. ; ;=W
  825. ; Process cntrl+end key ;=W
  826. ; ;=W
  827. LHJ80: TEST [DI]+WR_KEYCONF,WR_CED ;check if control+end key pressed ;=W
  828. JE LHJ100 ;=W
  829. ; ;=W
  830. CALL CAL_COORS ;get cursor position ;=W
  831. CMP [DI]+WR_FIELDEND,0 ;check if cursor past end of field ;=W
  832. JE LHJ90 ;=W
  833. ; ;=W
  834. CALL PCMBEEP_CALL ;error beep ;=W
  835. JMP LHJEXIT ;exit ;=W
  836. LHJ90:
  837. MOV BX,[DI]+WR_CUBYTE ;delete from current byte position ;=W
  838. CALL CLEAR_BUFFER ;=W
  839. ; ;=W
  840. CALL CAL_COORS ;calculate cursor position
  841. JMP LHJEXIT ;display field, set cursor, exit ;=W
  842. ; ;=W
  843. ; Process delete key ;=W
  844. ; ;=W
  845. LHJ100: TEST [DI]+WR_KEYCONF,WR_DEL ;check if delete key pressed ;=W
  846. JE LHJ130 ;=W
  847. ; ;=W
  848. ; ;=W
  849. ; Add ICB_WDL option in off state to delete on current line only ;=W
  850. ; ;=W
  851. ; ;=W
  852. CALL CAL_COORS ;get cursor position ;=W
  853. ; ;=W
  854. CMP [DI]+WR_FIELDEND,1 ;check if cursor past end of field ;=W
  855. JE LHJ110 ;=W
  856. ; ;=W
  857. CALL REMOVE_CHAR ;remove character at current offst ;=W
  858. ; and shift remaining in place ;=W
  859. CALL CAL_COORS ;calculate cursor position
  860. JMP LHJEXIT ;display field, set cursor, exit ;=W
  861. ; ;=W
  862. LHJ110: CALL PCMBEEP_CALL ;error beep ;=W
  863. JMP LHJEXIT ;exit ;=W
  864. ; ;=W
  865. ; Process backspace key ;=W
  866. ; ;=W
  867. LHJ130: TEST [DI]+WR_KEYCONF,WR_BCK ;check if backspace key pressed ;=W
  868. JE LHJ160 ;=W
  869. ; ;=W
  870. MOV BX,ES:[SI]+ICB_CURCHAR ;get cursor position ;=W
  871. CMP BX,1 ;check if cursor is at first ;=W
  872. JA LHJ140 ; field position ;=W
  873. ;
  874. TEST ES:[SI]+ICB_OPT2,ICB_CSW ;is cursor wrap option on ? ;=W
  875. JE LHJ133
  876. MOV BX,ES:[SI]+ICB_FIELDLEN ;adjust horizontal window ;=W
  877. MOV ES:[SI]+ICB_CURCHAR,BX ;wrap to first character position
  878. SUB BX,ES:[SI]+ICB_WIDTH ;(below this line may not work for ;=W
  879. INC BX ; DBCS support) ;=W
  880. MOV [DI]+WR_HRCHAR,BX ;=W
  881. ;
  882. MOV AX,5 ;display delimiters "< ]" ;=W
  883. CALL DELIMITER ;display delimiter ;=W
  884. JMP LHJ145 ;exit
  885. LHJ133:
  886. MOV AX,3 ;display delimiters "[ >" ;=W
  887. TEST ES:[SI]+ICB_OPT2,ICB_AXC ;is autoexit option set ? ;=W
  888. JE LHJ135 ;no ;=W
  889. OR [DI]+WR_KEYCONF2,WR_RET ;yes, set autoexit flag ;=W
  890. CALL DELIMITER ;display delimiter ;=W
  891. JMP LHJ400 ;=W
  892. LHJ135: ;=W
  893. CALL DELIMITER ;display delimiter ;=W
  894. CALL PCMBEEP_CALL ;error beep ;=W
  895. JMP LHJEXIT ;exit ;=W
  896. LHJ140: ;=W
  897. DEC ES:[SI]+ICB_CURCHAR ;adjust cursor to one position
  898. ; towards the left ;=W
  899. CMP BX,[DI]+WR_HRCHAR ;is cursor in front of the wind. ? ;=W
  900. JG LHJ142 ;no ;=W
  901. DEC [DI]+WR_HRCHAR ;yes, adjust the horiz. window ;=W
  902. MOV AX,4 ;display delimiters "< >" ;=W
  903. CALL DELIMITER ;display delimiter ;=W
  904. LHJ142: ;=W
  905. ; ;=W
  906. CALL CAL_COORS ;get cursor position ;=W
  907. CALL REMOVE_CHAR ;remove character at current offst ;=W
  908. ; and shift remaining in place ;=W
  909. LHJ145: ;=W
  910. CALL CAL_COORS ;calculate cursor position
  911. JMP LHJEXIT ;display field, set cursor, exit ;=W
  912. ; ;=W
  913. ; Process insert key toggle ;=W
  914. ; ;=W
  915. LHJ160: TEST [DI]+WR_KEYCONF,WR_INS ;check if insert key pressed ;=W
  916. JE LHJ180 ; if not, continue ;=W
  917. ; ;=W
  918. TEST ES:[SI]+ICB_STATUS,ICB_SINS ;check if in insert mode ? ;=W
  919. JE LHJ165 ;no, put in insert mode ;=W
  920. ; ;=W
  921. MOV BX,[DI]+IN_CURNOR ;set cursor size for normal ;=W
  922. MOV [DI]+WR_CURSIZE,BX ; cursor ;=W
  923. ; ;=W
  924. AND ES:[SI]+ICB_STATUS,NOT ICB_SINS ;=W
  925. JMP LHJ170 ;turn insert mode off ;=W
  926. ; ;=W
  927. LHJ165: MOV BX,[DI]+IN_CURINS ;set cursor size for insert ;=W
  928. MOV [DI]+WR_CURSIZE,BX ; cursor ;=W
  929. ; ;=W
  930. OR ES:[SI]+ICB_STATUS,ICB_SINS ;=W
  931. ;turn insert mode on ;=W
  932. ; ;=W
  933. LHJ170: ;=W
  934. ; ;=W
  935. PUSH DS ;save registers ;=W
  936. PUSH DI ;=W
  937. ; ;=W
  938. MOV DI,40H ;point DS:DI to KB_FLAG in BIOS ;=W
  939. MOV DS,DI ;=W
  940. MOV DI,17H ;=W
  941. MOV AX,[DI] ;get current BIOS KB_FLAG ;=W
  942. ; ;=W
  943. AND AX,NOT WR_INSSTATE ;set BIOS insert active flag off ;=W
  944. ; ;=W
  945. TEST ES:[SI]+ICB_STATUS,ICB_SINS ;=W
  946. JE LHJ175 ;check if insert should be set on ;=W
  947. ; ;=W
  948. OR AX,WR_INSSTATE ;set BIOS insert active flag on ;=W
  949. ; ;=W
  950. LHJ175: POP DI ;restore registers ;=W
  951. POP DS ;=W
  952. ; ;=W
  953. JMP LHJEXIT ;exit ;=W
  954. ; ;=W
  955. ; Process allowonce key option ;=W
  956. ; ;=W
  957. LHJ180: ; ;=W
  958. ; insert or replace ;=W
  959. ; ;=W
  960. ; ;=W
  961. ; ;=W
  962. ; adjust input buffer ;=W
  963. ; ;=W
  964. ; ;=W
  965. ; ;=W
  966. ; check for field wrap, exit, error beep ;=W
  967. ; ;=W
  968. ; ;=W
  969. ; ;=W
  970. ; adjust cursor position ;=W
  971. ; ;=W
  972. ; ;=W
  973. ; Process allowed keystroke in replace mode ;=W
  974. ; ;=W
  975. LHJ190: TEST [DI]+WR_KEYCONF,WR_ALL ;check if allow key pressed ;=W
  976. JNE LHJ195 ;=W
  977. ; ;=W
  978. CALL PCMBEEP_CALL ;error beep key not defined ;=W
  979. JMP LHJEXIT ;exit ;=W
  980. ; ;=W
  981. LHJ195: TEST ES:[SI]+ICB_STATUS,ICB_SINS ;=W
  982. JE LHJ198 ;check if insert is active ;=W
  983. ; ;=W
  984. JMP LHJ270 ;do insert display ;=W
  985. ; ;=W
  986. LHJ198: ;=W
  987. CALL CAL_COORS ;get cursor position ;=W
  988. CMP [DI]+WR_FIELDEND,0 ;check if cursor past end of field ;=W
  989. JE LHJ200 ;=W
  990. ; ;=W
  991. CALL PCMBEEP_CALL ;error beep key not defined ;=W
  992. JMP LHJEXIT ;exit ;=W
  993. ; ;=W
  994. ; Check if character to be replaced in field buffer is double byte character ;=W
  995. ; ;=W
  996. LHJ200: PUSH ES ;save registers ;=W
  997. PUSH SI ;=W
  998. ; ;=W
  999. PUSH ES:[SI]+ICB_FIELDSEG ;get segment of input buffer ;=W
  1000. PUSH ES:[SI]+ICB_FIELDOFF ;get offset of input buffer ;=W
  1001. POP SI ;=W
  1002. POP ES ;=W
  1003. ; ;=W
  1004. ADD SI,[DI]+WR_CUBYTE ;add cursor offset into buffer ;=W
  1005. DEC SI ;make zero based ;=W
  1006. ; ;=W
  1007. MOV CX,ES ;save offset of character to ;=W
  1008. MOV DX,SI ; replace ;=W
  1009. ; ;=W
  1010. MOV AL,ES:[SI] ;get byte that cursor is pointing ;=W
  1011. MOV [DI]+DBC_KS,AL ; to check if DBCS ;=W
  1012. CALL PCINDBC_CALL ;call routine to check if char ;=W
  1013. ; is lead double byte char ;=W
  1014. ; ;=W
  1015. POP SI ;restore registers ;=W
  1016. POP ES ;=W
  1017. ; ;=W
  1018. TEST [DI]+DBC_STAT,DBC_DBCS ;check if char is lead DBCS ;=W
  1019. JE LHJ220 ; if no, jump to single byte code ;=W
  1020. ; ;=W
  1021. ; Replace double byte character with double byte character ;=W
  1022. ; ;=W
  1023. TEST [DI]+WR_KEYCONF2,WR_DBC ;check if keystroke is DBC ;=W
  1024. JE LHJ210 ;continue with single byte ;=W
  1025. ; ;=W
  1026. MOV AX,[DI]+INC_KS ;set double byte character to ;=W
  1027. ; input buffer replacing ;=W
  1028. ; double byte character ;=W
  1029. PUSH ES ;=W
  1030. PUSH SI ;=W
  1031. ; ;=W
  1032. MOV ES,CX ;save offset of character to ;=W
  1033. MOV SI,DX ; replace ;=W
  1034. MOV ES:[SI],AX ;replace double byte ;=W
  1035. ; ;=W
  1036. POP SI ;restore registers ;=W
  1037. POP ES ;=W
  1038. ; ;=W
  1039. JMP LHJ260 ;exit ;=W
  1040. ; ;=W
  1041. ; Replace double byte character with single byte character ;=W
  1042. ; ;=W
  1043. LHJ210: MOV AX,[DI]+INC_KS ;get keystroke and replace double ;=W
  1044. ; byte with single byte ;=W
  1045. ; ;=W
  1046. PUSH ES ;=W
  1047. PUSH SI ;=W
  1048. ; ;=W
  1049. MOV ES,CX ;save offset of character to ;=W
  1050. MOV SI,DX ; replace single byte ;=W
  1051. MOV ES:[SI],AL ;=W
  1052. ; ;=W
  1053. POP SI ;restore registers ;=W
  1054. POP ES ;=W
  1055. ; ;=W
  1056. MOV AX,ES:[SI]+ICB_FIELDLEN ;set ending byte ;=W
  1057. MOV [DI]+WR_RIGHTBYTE,AX ;=W
  1058. ; ;=W
  1059. MOV AX,[DI]+WR_CUBYTE ;set markers for shift to remove ;=W
  1060. INC AX ;adjust past replaced leading byte ;=W
  1061. MOV [DI]+WR_LEFTBYTE,AX ; trailing byte ;=W
  1062. ; ;=W
  1063. MOV BX,1 ;set number of positions to shift ;=W
  1064. MOV AX,2 ;set option to shift left ;=W
  1065. CALL SHIFT ;call shift 1 position toward left ;=W
  1066. JMP LHJ260 ;exit ;=W
  1067. ; ;=W
  1068. ; Replace single byte character with single byte character ;=W
  1069. ; ;=W
  1070. LHJ220: TEST [DI]+WR_KEYCONF2,WR_DBC ;check if double byte character ;=W
  1071. JNE LHJ230 ; continue with single byte ;=W
  1072. ; ;=W
  1073. MOV AX,[DI]+INC_KS ;get keystroke ;=W
  1074. ; ;=W
  1075. PUSH ES ;=W
  1076. PUSH SI ;=W
  1077. ; ;=W
  1078. MOV ES,CX ;save offset of character to ;=W
  1079. MOV SI,DX ; replace single byte ;=W
  1080. MOV ES:[SI],AL ;=W
  1081. ; ;=W
  1082. POP SI ;restore registers ;=W
  1083. POP ES ;=W
  1084. ; ;=W
  1085. JMP LHJ260 ;exit ;=W
  1086. ; ;=W
  1087. ; Replace single byte character with double byte character ;=W
  1088. ; ;=W
  1089. LHJ230: ;=W
  1090. CALL CAL_COORS ;calculate cursor position ;=W
  1091. MOV BX,[DI]+WR_ENBYTE ;get end byte of input field ;=W
  1092. MOV AX,[DI]+WR_ENCHAR ;get end character of field ;=W
  1093. CMP AX,ES:[SI]+ICB_CURCHAR ;is cursor past end character ;=W
  1094. JA LHJ240 ;=W
  1095. ; ;=W
  1096. MOV BX,[DI]+WR_CUBYTE ;set cursor character position ;=W
  1097. LHJ240: ;=W
  1098. MOV AX,ES:[SI]+ICB_FIELDLEN ;get end of field position ;=W
  1099. SUB AX,BX ;subtract to get the remaining space ;=W
  1100. CMP AX,1 ;will byte fit ? ;=W
  1101. JGE LHJ250 ;yes ;=W
  1102. ; ;=W
  1103. CALL PCMBEEP_CALL ;error beep because replace char ;=W
  1104. JMP LHJEXIT ; will not fit and exit ;=W
  1105. ; ;=W
  1106. LHJ250: MOV BX,ES:[SI]+ICB_FIELDLEN ;set ending byte ;=W
  1107. MOV [DI]+WR_RIGHTBYTE,BX ;=W
  1108. ; ;=W
  1109. MOV BX,[DI]+WR_CUBYTE ;set markers for shift to remove ;=W
  1110. INC BX ;adjust past replaced leading byte ;=W
  1111. MOV [DI]+WR_LEFTBYTE,BX ; trailing byte ;=W
  1112. ; ;=W
  1113. MOV BX,1 ;set number of positions to shift ;=W
  1114. MOV AX,1 ;set option to shift right ;=W
  1115. CALL SHIFT ;call shift 1 position toward ;=W
  1116. ; left ;=W
  1117. MOV AX,[DI]+INC_KS ;get keystroke ;=W
  1118. ; ;=W
  1119. PUSH ES ;=W
  1120. PUSH SI ;=W
  1121. ; ;=W
  1122. MOV ES,CX ;save offset of character to ;=W
  1123. MOV SI,DX ; replace double byte ;=W
  1124. MOV ES:[SI],AX ;=W
  1125. ; ;=W
  1126. POP SI ;restore registers ;=W
  1127. POP ES ;=W
  1128. ; ;=W
  1129. ; Calculate new ending and cursor coordinates ;=W
  1130. ; ;=W
  1131. LHJ260: ;=W
  1132. CALL CAL_COORS ;calculate cursor position ;=W
  1133. INC ES:[SI]+ICB_CURCHAR ;point to next char ;=W
  1134. MOV BX,[DI]+WR_HRCHAR ;get begin. of horiz. wondow ;=W
  1135. ADD BX,ES:[SI]+ICB_WIDTH ;add width to get end of window ;=W
  1136. CMP BX,ES:[SI]+ICB_CURCHAR ;is cursor past end of window ? ;=W
  1137. JG LHJ265 ;no ;=W
  1138. INC [DI]+WR_HRCHAR ;yes, adjust the horiz. window ;=W
  1139. MOV AX,4 ;display delimiters "< >" ;=W
  1140. CALL DELIMITER ;display delimiter ;=W
  1141. LHJ265: ;=W
  1142. CALL CAL_COORS ;calculate cursor position ;=W
  1143. CMP [DI]+WR_FIELDEND,0 ;check if cursor past end of field ;=W
  1144. JE LHJ267 ;no ;=W
  1145. TEST ES:[SI]+ICB_OPT2,ICB_CSW ;is cursor wrap option on ? ;=W
  1146. JE LHJ266
  1147. MOV ES:[SI]+ICB_CURCHAR,1 ;wrap to first character position
  1148. MOV [DI]+WR_HRCHAR,1 ;reset the horiz. window ;=W
  1149. MOV AX,3 ;display delimiters "[ >" ;=W
  1150. CALL DELIMITER ;display delimiter ;=W
  1151. JMP LHJ267 ;exit
  1152. LHJ266:
  1153. DEC [DI]+WR_HRCHAR ;yes, adjust wind back one position ;=W
  1154. MOV AX,5 ;display delimiters "< ]" ;=W
  1155. CALL DELIMITER ;display delimiter ;=W
  1156. TEST ES:[SI]+ICB_OPT2,ICB_AXD ;is autoexit option set ? ;=W
  1157. JE LHJ267 ;no ;=W
  1158. OR [DI]+WR_KEYCONF2,WR_RET ;set autoexit flag ;=W
  1159. LHJ267: ;=W
  1160. CALL CAL_COORS ;calculate cursor position ;=W
  1161. JMP LHJEXIT ;display field, set cursor, exit ;=W
  1162. ; ;=W
  1163. ; Process allowed keystroke in insert mode ;=W
  1164. ; ;=W
  1165. LHJ270: ;=W
  1166. CALL CAL_COORS ;get cursor position ;=W
  1167. CMP [DI]+WR_FIELDEND,0 ;check if cursor past end of field ;=W
  1168. JE LHJ280 ;=W
  1169. ; ;=W
  1170. CALL PCMBEEP_CALL ;error beep key not defined ;=W
  1171. JMP LHJEXIT ;exit ;=W
  1172. ; ;=W
  1173. ; Check if enough room available to insert single or double byte character ;=W
  1174. ; ;=W
  1175. LHJ280: ;=W
  1176. MOV CX,ES:[SI]+ICB_FIELDSEG ;get segment of input buffer ;=W
  1177. MOV DX,ES:[SI]+ICB_FIELDOFF ;get offset of input buffer ;=W
  1178. ; ;=W
  1179. ADD DX,[DI]+WR_CUBYTE ;add cursor offset into buffer ;=W
  1180. DEC DX ;make zero based ;=W
  1181. ; ;=W
  1182. MOV BX,1 ;initialize to single byte ;=W
  1183. ; ;=W
  1184. TEST [DI]+WR_KEYCONF2,WR_DBC ;check for double byte character ;=W
  1185. JE LHJ290 ;=W
  1186. ; ;=W
  1187. MOV BX,2 ;reset to double byte character ;=W
  1188. LHJ290: ;=W
  1189. PUSH BX ;=W
  1190. CALL CAL_COORS ;calculate cursor position ;=W
  1191. MOV BX,[DI]+WR_ENBYTE ;get end byte of input field ;=W
  1192. MOV AX,[DI]+WR_ENCHAR ;get end character of field ;=W
  1193. CMP AX,ES:[SI]+ICB_CURCHAR ;is cursor past end character ;=W
  1194. JA LHJ300 ;=W
  1195. ; ;=W
  1196. MOV BX,[DI]+WR_CUBYTE ;set cursor character position ;=W
  1197. LHJ300: ;=W
  1198. MOV AX,ES:[SI]+ICB_FIELDLEN ;get end of field position ;=W
  1199. SUB AX,BX ;subtract to get the remaining space ;=W
  1200. POP BX ;=W
  1201. CMP AX,BX ;will byte fit ? ;=W
  1202. JGE LHJ310 ;yes ;=W
  1203. ; ;=W
  1204. CALL PCMBEEP_CALL ;error beep replace character ;=W
  1205. JMP LHJEXIT ; will not fit and exit ;=W
  1206. ; ;=W
  1207. ; Shift to insert single or double byte character, BX= # bytes to shift ;=W
  1208. ; ;=W
  1209. LHJ310: MOV AX,ES:[SI]+ICB_FIELDLEN ;set ending byte to make room in ;=W
  1210. MOV [DI]+WR_RIGHTBYTE,AX ; buffer by shifting characters ;=W
  1211. ; ;=W
  1212. MOV AX,[DI]+WR_CUBYTE ;set markers for shift to remove ;=W
  1213. MOV [DI]+WR_LEFTBYTE,AX ; trailing byte ;=W
  1214. ; ;=W
  1215. MOV AX,1 ;set option to shift right, BX= ;=W
  1216. ; number of bytes to insert ;=W
  1217. CALL SHIFT ;call shift 1 position toward ;=W
  1218. ; left ;=W
  1219. MOV AX,[DI]+INC_KS ;get keystroke ;=W
  1220. ; ;=W
  1221. ; Insert single byte character ;=W
  1222. ; ;=W
  1223. CMP BX,2 ;check how many bytes should be ;=W
  1224. JE LHJ320 ; inserted ;=W
  1225. ; ;=W
  1226. PUSH ES ;=W
  1227. PUSH SI ;=W
  1228. ; ;=W
  1229. MOV ES,CX ;save offset of character to ;=W
  1230. MOV SI,DX ; replace single byte ;=W
  1231. MOV ES:[SI],AL ;insert single byte character ;=W
  1232. ; ;=W
  1233. POP SI ;restore registers ;=W
  1234. POP ES ;=W
  1235. ; ;=W
  1236. JMP LHJ330 ;=W
  1237. ; ;=W
  1238. ; Insert double byte character ;=W
  1239. ; ;=W
  1240. LHJ320: PUSH ES ;=W
  1241. PUSH SI ;=W
  1242. ; ;=W
  1243. MOV ES,CX ;save offset of character to ;=W
  1244. MOV SI,DX ; replace ;=W
  1245. MOV ES:[SI],AX ;insert double byte character ;=W
  1246. ; ;=W
  1247. POP SI ;restore registers ;=W
  1248. POP ES ;=W
  1249. ; ;=W
  1250. ; Calculate new ending and cursor coordinates ;=W
  1251. ; ;=W
  1252. LHJ330: ;=W
  1253. CALL CAL_COORS ;get new end coordinates ;=W
  1254. ; ;=W
  1255. INC ES:[SI]+ICB_CURCHAR ;point to next char ;=W
  1256. MOV BX,[DI]+WR_HRCHAR ;get begin. of horiz. wondow ;=W
  1257. ADD BX,ES:[SI]+ICB_WIDTH ;add width to get end of window ;=W
  1258. CMP BX,ES:[SI]+ICB_CURCHAR ;is cursor past end of window ? ;=W
  1259. JG LHJ332 ;no ;=W
  1260. INC [DI]+WR_HRCHAR ;yes, adjust the horiz. window ;=W
  1261. MOV AX,4 ;display delimiters "< >" ;=W
  1262. CALL DELIMITER ;display delimiter ;=W
  1263. LHJ332: ;=W
  1264. CALL CAL_COORS ;calculate cursor position
  1265. CMP [DI]+WR_FIELDEND,0 ;check if cursor past end of field ;=W
  1266. JE LHJ335 ;no ;=W
  1267. TEST ES:[SI]+ICB_OPT2,ICB_CSW ;is cursor wrap option on ? ;=W
  1268. JE LHJ333
  1269. MOV ES:[SI]+ICB_CURCHAR,1 ;wrap to first character position
  1270. MOV [DI]+WR_HRCHAR,1 ;reset the horiz. window ;=W
  1271. MOV AX,3 ;display delimiters "[ >" ;=W
  1272. CALL DELIMITER ;display delimiter ;=W
  1273. JMP LHJ335 ;exit
  1274. LHJ333:
  1275. DEC [DI]+WR_HRCHAR ;yes, adjust wind back one position ;=W
  1276. MOV AX,5 ;display delimiters "< ]" ;=W
  1277. CALL DELIMITER ;display delimiter ;=W
  1278. TEST ES:[SI]+ICB_OPT2,ICB_AXD ;is autoexit option set ? ;=W
  1279. JE LHJ335 ;no ;=W
  1280. OR [DI]+WR_KEYCONF2,WR_RET ;set autoexit flag ;=W
  1281. LHJ335:
  1282. CALL CAL_COORS ;calculate cursor position ;=W
  1283. JMP LHJEXIT ;display cursor
  1284. ; ;=W
  1285. ; Display field & Exit ;=W
  1286. ; ;=W
  1287. LHJ400:
  1288. CALL WORD PTR [DI]+WR_DISPLAY ;display current input buffer ;=W
  1289. ; in left justified field ;=W
  1290. JMP LHJCUR
  1291. LHJEXIT: ;=W
  1292. CALL WORD PTR [DI]+WR_DISPLAY ;display current input buffer ;=W
  1293. ; in left justified field ;=W
  1294. TEST ES:[SI]+ICB_STATUS,ICB_CUR_ON ;is cursor on ?
  1295. JNE LHJCUR ;cursor is already on, don't turn it on ;=W
  1296. CALL CURSOR ;display cursor ;=W
  1297. LHJCUR:
  1298. ; ;=W
  1299. RET ;=W
  1300. LEFT_H_JUST ENDP ;=W
  1301. ;
  1302. PAGE
  1303. ;-----------------------------------------------------------------------------+
  1304. ; :
  1305. ; LEFT_JUST :
  1306. ; :
  1307. ; Process keystroke and update display with input buffer changes :
  1308. ; for the following functions: :
  1309. ; :
  1310. ; Home key Up arrow Allowonce replace mode :
  1311. ; End key Down arrow Allowonce insert mode :
  1312. ; Left arrow Control end Allow replace mode :
  1313. ; Right arrow Delete key Allow insert mode :
  1314. ; :
  1315. ; :
  1316. ; Following information is used: :
  1317. ; :
  1318. ; :
  1319. ; (ICB_FIELDSEG:ICB_FIELDOFF) Beginning address of input :
  1320. ; buffer in memory. :
  1321. ; :
  1322. ; (WR_CUBYTE) Byte offset into the input buffer :
  1323. ; of where characters will be added :
  1324. ; to input buffer. :
  1325. ; :
  1326. ; Ŀ :
  1327. ; S L T L T S S :
  1328. ; :
  1329. ; :
  1330. ; :
  1331. ; (ICB_FIELDLEN) Length of input field in bytes. :
  1332. ; :
  1333. ; :
  1334. ; The following demonstrates the before and after input buffer :
  1335. ; images. (S = Single byte, L = DBCS lead byte, T = DBCS trailing :
  1336. ; byte) :
  1337. ; :
  1338. ; Deleting a double byte: :
  1339. ; Ŀ Ŀ :
  1340. ; S L T L T S S L T S :
  1341. ; :
  1342. ; :
  1343. ; Deleting a single byte: :
  1344. ; Ŀ Ŀ :
  1345. ; S L T S L T S L T L T :
  1346. ; :
  1347. ; :
  1348. ; Backspace removal of a double byte: :
  1349. ; Ŀ Ŀ :
  1350. ; S L T L T S S L T S :
  1351. ; :
  1352. ; :
  1353. ; Backspace removal of a single byte: :
  1354. ; Ŀ Ŀ :
  1355. ; S S S S L T S S S L T :
  1356. ; :
  1357. ; :
  1358. ; Replacing a double byte with a double byte: :
  1359. ; Ŀ Ŀ :
  1360. ; S L T L T S S L T L T S :
  1361. ; :
  1362. ; :
  1363. ; Replacing a double byte with a single byte: (Option 1) :
  1364. ; Ŀ Ŀ :
  1365. ; S L T L T S S L T S S :
  1366. ; :
  1367. ; :
  1368. ; Replacing a double byte with a single byte: (Option 2) :
  1369. ; Ŀ Ŀ :
  1370. ; S L T L T S S L T S S :
  1371. ; :
  1372. ; :
  1373. ; Replacing a single byte with a single byte: :
  1374. ; Ŀ Ŀ :
  1375. ; S L T S L T S L T S L T :
  1376. ; :
  1377. ; :
  1378. ; Replacing a single byte with a double byte. :
  1379. ; Ŀ Ŀ :
  1380. ; S L T S S L T L T :
  1381. ; :
  1382. ; :
  1383. ; Replacing a single byte with a double byte without enough buffer: :
  1384. ; Ŀ Ŀ :
  1385. ; S L T S L T S L T S L T :
  1386. ; :
  1387. ; :
  1388. ; Inserting a single byte. :
  1389. ; Ŀ Ŀ :
  1390. ; S L T L T S L T S L T :
  1391. ; :
  1392. ; :
  1393. ; Inserting a single byte without enough buffer generate an error: :
  1394. ; Ŀ Ŀ :
  1395. ; S L T L T S S L T L T S :
  1396. ; :
  1397. ; Ŀ Ŀ :
  1398. ; S L T S S S L T S S :
  1399. ; :
  1400. ; :
  1401. ; Inserting a double byte character: :
  1402. ; Ŀ Ŀ :
  1403. ; S L T S S L T L T S :
  1404. ; :
  1405. ; :
  1406. ; :
  1407. ; Entry: ES:SI = Points to current ICB :
  1408. ; DS:DI = Points to PB :
  1409. ; :
  1410. ; INC_KS = Keystroke from returned from PCINCHA :
  1411. ; :
  1412. ; WR_KEYCONF = Bit flag inidicating the options set for INC_KS :
  1413. ; WR_KEYCONF2 keystroke. :
  1414. ; :
  1415. ; Exit: None. :
  1416. ; :
  1417. ;-----------------------------------------------------------------------------+
  1418. ;
  1419. LEFT_JUST PROC NEAR
  1420. ;
  1421. ; Initialize right and left boundary markers
  1422. ;
  1423. MOV [DI]+WR_LEFTCHAR,1 ;set left character to beginning
  1424. ; of field
  1425. ;
  1426. MOV AX,ES:[SI]+ICB_FIELDLEN ;set right marker past end of
  1427. INC AX ; field
  1428. MOV [DI]+WR_RIGHTCHAR,AX
  1429. ;
  1430. TEST [DI]+WR_KEYCONF,WR_MASK ;check to see if editing key entered ;=W
  1431. JNE LJ5 ;yes, must check for editing keys ;=W
  1432. JMP LJ190 ;no, skip checks for editing keys ;=W
  1433. ;
  1434. ; Process home key
  1435. ;
  1436. LJ5: TEST [DI]+WR_KEYCONF,WR_HOM ;check if home key pressed
  1437. JE LJ10
  1438. ;
  1439. ;
  1440. ; add ICB_WHM option to process window home key movement
  1441. ;
  1442. ;
  1443. MOV ES:[SI]+ICB_CURCHAR,1 ;initialize cursor to 1st byte
  1444. ; position, assuming no windowing
  1445. ; wrap is occurring
  1446. CALL CAL_COORS ;get cursor position ;=W
  1447. JMP LJEXIT ; returns WR_CURROW, WR_CURROW
  1448. ; and WR_CUBYTE
  1449. ;
  1450. ; Process end key
  1451. ;
  1452. LJ10: TEST [DI]+WR_KEYCONF,WR_END ;check if home key pressed
  1453. JE LJ20
  1454. ;
  1455. ;
  1456. ; add ICB_WEN to move cursor to end of current window row
  1457. ;
  1458. ;
  1459. CALL CAL_COORS ;get current end of field info ;=W
  1460. ;
  1461. MOV AX,[DI]+WR_ENCHAR ;adjust one past end buffer charac
  1462. INC AX
  1463. MOV ES:[SI]+ICB_CURCHAR,AX ;set current cursor position to
  1464. ; end of field
  1465. CALL CAL_COORS ;get cursor position ;=W
  1466. CMP [DI]+WR_FIELDEND,0 ;check if cursor past end of field ;=W
  1467. JE LJ17 ;no ;=W
  1468. TEST ES:[SI]+ICB_OPT2,ICB_CSW ;is cursor wrap option on ? ;=W
  1469. JE LJ16
  1470. MOV ES:[SI]+ICB_CURCHAR,1 ;wrap to first character position
  1471. CALL CAL_COORS ;get cursor position
  1472. JMP LJEXIT ;exit
  1473. LJ16:
  1474. TEST ES:[SI]+ICB_OPT2,ICB_AXC ;is autoexit option set ? ;=W
  1475. JE LJ17 ;no ;=W
  1476. OR [DI]+WR_KEYCONF2,WR_RET ;yes, set autoexit flag ;=W
  1477. LJ17: ;=W
  1478. JMP LJEXIT ;exit
  1479. ;
  1480. ; Process left arrow
  1481. ;
  1482. LJ20: TEST [DI]+WR_KEYCONF,WR_LFT ;check if left arrow key pressed
  1483. JE LJ40
  1484. ;
  1485. ;
  1486. ; add ICB_WAR option to wrap cursor on same row end to end
  1487. ;
  1488. ;
  1489. CMP ES:[SI]+ICB_CURCHAR,1 ;check if cursor is at first
  1490. JA LJ30 ; field position
  1491. ;
  1492. TEST ES:[SI]+ICB_OPT2,ICB_AXC ;is autoexit option set ? ;=W
  1493. JE LJ25 ;no ;=W
  1494. OR [DI]+WR_KEYCONF2,WR_RET ;yes, set autoexit flag ;=W
  1495. JMP LJCUR ;=W
  1496. LJ25: ;=W
  1497. TEST ES:[SI]+ICB_OPT2,ICB_CSW ;is cursor wrap option on ? ;=W
  1498. JE LJ27
  1499. MOV AX,ES:[SI]+ICB_FIELDLEN ;get last position
  1500. MOV ES:[SI]+ICB_CURCHAR,AX ;put as current position
  1501. CALL CAL_COORS
  1502. JMP LJEXIT
  1503. LJ27:
  1504. CALL PCMBEEP_CALL ;error beep
  1505. JMP LJEXIT ;exit
  1506. ;
  1507. LJ30: DEC ES:[SI]+ICB_CURCHAR ;adjust cursor to one position
  1508. ; towards the left
  1509. CALL CAL_COORS ;get cursor position ;=W
  1510. JMP LJEXIT ;exit
  1511. ;
  1512. ; Process right arrow
  1513. ;
  1514. LJ40: TEST [DI]+WR_KEYCONF,WR_RGT ;check if left arrow key pressed
  1515. JE LJ60
  1516. ;
  1517. ;
  1518. ; add ICB_CSW option to wrap cursor from top/bottom end to end
  1519. ;
  1520. ;
  1521. ;
  1522. ; add ICB_AXC option to auto enter if cursor reaches end
  1523. ;
  1524. ;
  1525. ;
  1526. ; add ICB_WAR option to wrap cursor on same row end to end
  1527. ;
  1528. ;
  1529. CALL CAL_COORS ;get cursor position ;=W
  1530. CMP [DI]+WR_FIELDEND,0 ;check if cursor past end of field
  1531. JE LJ50
  1532. ;
  1533. CALL PCMBEEP_CALL ;error beep
  1534. JMP LJEXIT ;exit
  1535. ;
  1536. LJ50: INC ES:[SI]+ICB_CURCHAR ;adjust cursor to one position
  1537. ; towards the left
  1538. CALL CAL_COORS ;get cursor position ;=W
  1539. CMP [DI]+WR_FIELDEND,0 ;check if cursor past end of field ;=W
  1540. JE LJ55 ;no ;=W
  1541. TEST ES:[SI]+ICB_OPT2,ICB_CSW ;is cursor wrap option on ? ;=W
  1542. JE LJ52
  1543. MOV ES:[SI]+ICB_CURCHAR,1 ;wrap to first character position
  1544. CALL CAL_COORS ;get cursor position
  1545. JMP LJEXIT ;exit
  1546. LJ52:
  1547. TEST ES:[SI]+ICB_OPT2,ICB_AXC ;is autoexit option set ? ;=W
  1548. JE LJ55 ;no ;=W
  1549. OR [DI]+WR_KEYCONF2,WR_RET ;set autoexit flag ;=W
  1550. LJ55: ;=W
  1551. JMP LJEXIT ;exit
  1552. ;
  1553. ; Process up arrow
  1554. ;
  1555. LJ60: ;
  1556. ; adjust cursor position
  1557. ;
  1558. ;
  1559. ; check for field wrap, exit, error beep
  1560. ;
  1561. ;
  1562. ; Process down arrow
  1563. ;
  1564. LJ70: ;
  1565. ; adjust cursor position
  1566. ;
  1567. ;
  1568. ; check for field wrap, exit, error beep
  1569. ;
  1570. ;
  1571. ; Process cntrl+end key
  1572. ;
  1573. LJ80: TEST [DI]+WR_KEYCONF,WR_CED ;check if control+end key pressed
  1574. JE LJ100
  1575. ;
  1576. CALL CAL_COORS ;get cursor position ;=W
  1577. CMP [DI]+WR_FIELDEND,0 ;check if cursor past end of field
  1578. JE LJ90
  1579. ;
  1580. CALL PCMBEEP_CALL ;error beep
  1581. JMP LJEXIT ;exit
  1582. ;
  1583. LJ90: CALL CAL_COORS ;get current end of field info ;=W
  1584. ;
  1585. MOV AX,ES:[SI]+ICB_FIELDLEN ;set rightmost area to refresh on
  1586. MOV [DI]+WR_RIGHTDISP,AX ; display to entire field
  1587. ;
  1588. MOV BX,[DI]+WR_CUBYTE ;delete from current byte position
  1589. CALL CLEAR_BUFFER
  1590. ;
  1591. CALL CAL_COORS ;get cursor position ;=W
  1592. JMP LJ340 ;display field, set cursor, exit
  1593. ;
  1594. ; Process delete key
  1595. ;
  1596. LJ100: TEST [DI]+WR_KEYCONF,WR_DEL ;check if delete key pressed
  1597. JE LJ130
  1598. ;
  1599. ;
  1600. ; Add ICB_WDL option in off state to delete on current line only
  1601. ;
  1602. ;
  1603. CALL CAL_COORS ;get cursor position ;=W
  1604. CMP [DI]+WR_FIELDEND,1 ;check if cursor past end of field
  1605. JE LJ110
  1606. ;
  1607. CALL REMOVE_CHAR ;remove character at current offst
  1608. ; and shift remaining in place
  1609. JMP LJ340 ;display field, set cursor, exit
  1610. ;
  1611. LJ110: CALL PCMBEEP_CALL ;error beep
  1612. JMP LJEXIT ;exit
  1613. ;
  1614. ; Process backspace key
  1615. ;
  1616. LJ130: TEST [DI]+WR_KEYCONF,WR_BCK ;check if backspace key pressed
  1617. JE LJ160
  1618. ;
  1619. CMP ES:[SI]+ICB_CURCHAR,1 ;check if cursor is at first
  1620. JA LJ140 ; field position
  1621. ;
  1622. TEST ES:[SI]+ICB_OPT2,ICB_AXC ;is autoexit option set ? ;=W
  1623. JE LJ135 ;no ;=W
  1624. OR [DI]+WR_KEYCONF2,WR_RET ;yes, set autoexit flag ;=W
  1625. JMP LJCUR ;=W
  1626. LJ135: ;=W
  1627. TEST ES:[SI]+ICB_OPT2,ICB_CSW ;is cursor wrap option on ? ;=W
  1628. JE LJ137
  1629. MOV AX,ES:[SI]+ICB_FIELDLEN ;get last position
  1630. MOV ES:[SI]+ICB_CURCHAR,AX ;put as current position
  1631. CALL CAL_COORS
  1632. JMP LJEXIT
  1633. LJ137:
  1634. CALL PCMBEEP_CALL ;error beep
  1635. JMP LJEXIT ;exit
  1636. ;
  1637. LJ140: DEC ES:[SI]+ICB_CURCHAR ;adjust cursor to one position
  1638. ; towards the left
  1639. CALL CAL_COORS ;get cursor position ;=W
  1640. CALL REMOVE_CHAR ;remove character at current offst
  1641. ; and shift remaining in place
  1642. ;
  1643. CALL CAL_COORS ;get cursor position ;=W
  1644. JMP LJ340 ;display field, set cursor, exit
  1645. ;
  1646. ; Process insert key toggle
  1647. ;
  1648. LJ160: TEST [DI]+WR_KEYCONF,WR_INS ;check if insert key pressed
  1649. JE LJ180 ; if not, continue
  1650. ;
  1651. TEST ES:[SI]+ICB_STATUS,ICB_SINS ;check if in insert mode ?
  1652. JE LJ165 ;no, put in insert mode
  1653. ;
  1654. MOV BX,[DI]+IN_CURNOR ;set cursor size for normal
  1655. MOV [DI]+WR_CURSIZE,BX ; cursor
  1656. ;
  1657. AND ES:[SI]+ICB_STATUS,NOT ICB_SINS
  1658. JMP LJ170 ;turn insert mode off
  1659. ;
  1660. LJ165: MOV BX,[DI]+IN_CURINS ;set cursor size for insert
  1661. MOV [DI]+WR_CURSIZE,BX ; cursor
  1662. ;
  1663. OR ES:[SI]+ICB_STATUS,ICB_SINS
  1664. ;turn insert mode on
  1665. ;
  1666. LJ170:
  1667. ;
  1668. PUSH DS ;save registers
  1669. PUSH DI
  1670. ;
  1671. MOV DI,40H ;point DS:DI to KB_FLAG in BIOS
  1672. MOV DS,DI
  1673. MOV DI,17H
  1674. MOV AX,[DI] ;get current BIOS KB_FLAG
  1675. ;
  1676. AND AX,NOT WR_INSSTATE ;set BIOS insert active flag off
  1677. ;
  1678. TEST ES:[SI]+ICB_STATUS,ICB_SINS
  1679. JE LJ175 ;check if insert should be set on
  1680. ;
  1681. OR AX,WR_INSSTATE ;set BIOS insert active flag on
  1682. ;
  1683. LJ175: POP DI ;restore registers
  1684. POP DS
  1685. ;
  1686. JMP LJEXIT ;exit
  1687. ;
  1688. ; Process allowonce key option
  1689. ;
  1690. LJ180: ;
  1691. ; insert or replace
  1692. ;
  1693. ;
  1694. ;
  1695. ; adjust input buffer
  1696. ;
  1697. ;
  1698. ;
  1699. ; check for field wrap, exit, error beep
  1700. ;
  1701. ;
  1702. ;
  1703. ; adjust cursor position
  1704. ;
  1705. ;
  1706. ; Process allowed keystroke in replace mode
  1707. ;
  1708. LJ190: TEST [DI]+WR_KEYCONF,WR_ALL ;check if allow key pressed
  1709. JNE LJ195
  1710. ;
  1711. CALL PCMBEEP_CALL ;error beep key not defined
  1712. JMP LJEXIT ;exit
  1713. ;
  1714. LJ195: TEST ES:[SI]+ICB_STATUS,ICB_SINS
  1715. JE LJ198 ;check if insert is active
  1716. ;
  1717. JMP LJ270 ;do insert display
  1718. ;
  1719. LJ198:
  1720. CALL CAL_COORS ;get cursor position ;=W
  1721. CMP [DI]+WR_FIELDEND,0 ;check if cursor past end of field
  1722. JE LJ200
  1723. ;
  1724. CALL PCMBEEP_CALL ;error beep key not defined
  1725. JMP LJEXIT ;exit
  1726. ;
  1727. ; Check if character to be replaced in field buffer is double byte character
  1728. ;
  1729. LJ200: PUSH ES ;save registers
  1730. PUSH SI
  1731. ;
  1732. PUSH ES:[SI]+ICB_FIELDSEG ;get segment of input buffer
  1733. PUSH ES:[SI]+ICB_FIELDOFF ;get offset of input buffer
  1734. POP SI
  1735. POP ES
  1736. ;
  1737. ADD SI,[DI]+WR_CUBYTE ;add cursor offset into buffer
  1738. DEC SI ;make zero based
  1739. ;
  1740. MOV CX,ES ;save offset of character to
  1741. MOV DX,SI ; replace
  1742. ;
  1743. MOV AL,ES:[SI] ;get byte that cursor is pointing
  1744. MOV [DI]+DBC_KS,AL ; to check if DBCS
  1745. CALL PCINDBC_CALL ;call routine to check if char
  1746. ; is lead double byte char
  1747. ;
  1748. POP SI ;restore registers
  1749. POP ES
  1750. ;
  1751. TEST [DI]+DBC_STAT,DBC_DBCS ;check if char is lead DBCS
  1752. JE LJ220 ; if no, jump to single byte code
  1753. ;
  1754. ; Replace double byte character with double byte character
  1755. ;
  1756. TEST [DI]+WR_KEYCONF2,WR_DBC ;check if keystroke is DBC
  1757. JE LJ210 ;continue with single byte
  1758. ;
  1759. MOV AX,[DI]+INC_KS ;set double byte character to
  1760. ; input buffer replacing
  1761. ; double byte character
  1762. PUSH ES
  1763. PUSH SI
  1764. ;
  1765. MOV ES,CX ;save offset of character to
  1766. MOV SI,DX ; replace
  1767. MOV ES:[SI],AX ;replace double byte
  1768. ;
  1769. POP SI ;restore registers
  1770. POP ES
  1771. ;
  1772. JMP LJ260 ;exit
  1773. ;
  1774. ; Replace double byte character with single byte character
  1775. ;
  1776. LJ210: MOV AX,[DI]+INC_KS ;get keystroke and replace double
  1777. ; byte with single byte
  1778. ;
  1779. PUSH ES
  1780. PUSH SI
  1781. ;
  1782. MOV ES,CX ;save offset of character to
  1783. MOV SI,DX ; replace single byte
  1784. MOV ES:[SI],AL
  1785. ;
  1786. POP SI ;restore registers
  1787. POP ES
  1788. ;
  1789. MOV AX,ES:[SI]+ICB_FIELDLEN ;set ending byte
  1790. MOV [DI]+WR_RIGHTBYTE,AX
  1791. ;
  1792. MOV AX,[DI]+WR_CUBYTE ;set markers for shift to remove
  1793. INC AX ;adjust past replaced leading byte ;=W
  1794. MOV [DI]+WR_LEFTBYTE,AX ; trailing byte
  1795. ;
  1796. MOV BX,1 ;set number of positions to shift
  1797. MOV AX,2 ;set option to shift left
  1798. CALL SHIFT ;call shift 1 position toward left
  1799. JMP LJ260 ;exit
  1800. ;
  1801. ; Replace single byte character with single byte character
  1802. ;
  1803. LJ220: TEST [DI]+WR_KEYCONF2,WR_DBC ;check if double byte character
  1804. JNE LJ230 ; continue with single byte
  1805. ;
  1806. MOV AX,[DI]+INC_KS ;get keystroke
  1807. ;
  1808. PUSH ES
  1809. PUSH SI
  1810. ;
  1811. MOV ES,CX ;save offset of character to
  1812. MOV SI,DX ; replace single byte
  1813. MOV ES:[SI],AL
  1814. ;
  1815. POP SI ;restore registers
  1816. POP ES
  1817. ;
  1818. JMP LJ260 ;exit
  1819. ;
  1820. ; Replace single byte character with double byte character
  1821. ;
  1822. LJ230: MOV BX,ES:[SI]+ICB_CURCHAR ;set cursor character position
  1823. MOV [DI]+WR_LEFTCHAR,BX ; to left marker
  1824. ;
  1825. CALL CAL_COORS ;get the current end of field ;=W
  1826. ; coordinates
  1827. MOV AX,[DI]+WR_ENCHAR ;get end character of field
  1828. CMP AX,ES:[SI]+ICB_CURCHAR ;is cursor past end character
  1829. JA LJ240
  1830. ;
  1831. MOV AX,ES:[SI]+ICB_CURCHAR ;cursor is past last char
  1832. ;
  1833. LJ240: MOV [DI]+WR_RIGHTCHAR,AX ;set right marker
  1834. ;
  1835. MOV BX,1 ;One byte is already available
  1836. ; check if room for trailing byte
  1837. MOV AX,1 ;set up call to LEFT_DISP to
  1838. CALL WORD PTR [DI]+WR_DISPLAY ; determine if additional byte
  1839. ; will fit in input buffer
  1840. CMP AX,0 ;check if double byte character
  1841. JE LJ250 ; will fit
  1842. ;
  1843. CALL PCMBEEP_CALL ;error beep because replace char
  1844. JMP LJEXIT ; will not fit and exit
  1845. ;
  1846. LJ250: MOV BX,ES:[SI]+ICB_FIELDLEN ;set ending byte
  1847. MOV [DI]+WR_RIGHTBYTE,BX
  1848. ;
  1849. MOV BX,[DI]+WR_CUBYTE ;set markers for shift to remove
  1850. INC BX ;adjust past replaced leading byte
  1851. MOV [DI]+WR_LEFTBYTE,BX ; trailing byte
  1852. ;
  1853. MOV BX,1 ;set number of positions to shift
  1854. MOV AX,1 ;set option to shift right
  1855. CALL SHIFT ;call shift 1 position toward
  1856. ; left
  1857. MOV AX,[DI]+INC_KS ;get keystroke
  1858. ;
  1859. PUSH ES
  1860. PUSH SI
  1861. ;
  1862. MOV ES,CX ;save offset of character to
  1863. MOV SI,DX ; replace double byte
  1864. MOV ES:[SI],AX
  1865. ;
  1866. POP SI ;restore registers
  1867. POP ES
  1868. ;
  1869. ; Calculate new ending and cursor coordinates
  1870. ;
  1871. LJ260:
  1872. MOV BX,[DI]+WR_ENCHAR ;set rightmost area to refresh on ;=W
  1873. CALL CAL_COORS ;get new end coordinates ;=W
  1874. CMP BX,[DI]+WR_ENCHAR ;is old END_CHAR > new END_CHAR ? ;=W
  1875. JG LJ261 ;yes, use old END_CHAR (so display ;=W
  1876. MOV BX,[DI]+WR_ENCHAR ; is updated correctly)
  1877. LJ261: ;set rightmost area to refresh on ;=W
  1878. MOV [DI]+WR_RIGHTDISP,BX ; display to new ending character
  1879. INC ES:[SI]+ICB_CURCHAR ;point to next char
  1880. CALL CAL_COORS ;get cursor position ;=W
  1881. CMP [DI]+WR_FIELDEND,0 ;check if cursor past end of field ;=W
  1882. JE LJ265 ;no ;=W
  1883. TEST ES:[SI]+ICB_OPT2,ICB_CSW ;is cursor wrap option on ? ;=W
  1884. JE LJ262
  1885. MOV ES:[SI]+ICB_CURCHAR,1 ;wrap to first character position
  1886. JMP LJ340 ;display field, set cursor, exit
  1887. LJ262:
  1888. TEST ES:[SI]+ICB_OPT2,ICB_AXD ;is autoexit option set ? ;=W
  1889. JE LJ265 ;no ;=W
  1890. OR [DI]+WR_KEYCONF2,WR_RET ;set autoexit flag ;=W
  1891. LJ265: ;=W
  1892. JMP LJ340 ;display field, set cursor, exit
  1893. ;
  1894. ; Process allowed keystroke in insert mode
  1895. ;
  1896. LJ270:
  1897. CALL CAL_COORS ;get cursor position ;=W
  1898. CMP [DI]+WR_FIELDEND,0 ;check if cursor past end of field
  1899. JE LJ280
  1900. ;
  1901. CALL PCMBEEP_CALL ;error beep key not defined
  1902. JMP LJEXIT ;exit
  1903. ;
  1904. ; Check if enough room available to insert single or double byte character
  1905. ;
  1906. LJ280:
  1907. MOV CX,ES:[SI]+ICB_FIELDSEG ;get segment of input buffer
  1908. MOV DX,ES:[SI]+ICB_FIELDOFF ;get offset of input buffer
  1909. ;
  1910. ADD DX,[DI]+WR_CUBYTE ;add cursor offset into buffer
  1911. DEC DX ;make zero based
  1912. ;
  1913. MOV BX,1 ;initialize to single byte
  1914. ;
  1915. TEST [DI]+WR_KEYCONF2,WR_DBC ;check for double byte character
  1916. JE LJ290
  1917. ;
  1918. MOV BX,2 ;reset to double byte character
  1919. ;
  1920. LJ290: MOV AX,ES:[SI]+ICB_CURCHAR ;set cursor character position
  1921. MOV [DI]+WR_LEFTCHAR,AX ; to left marker
  1922. ;
  1923. CALL CAL_COORS ;get the current end of field ;=W
  1924. ; coordinates
  1925. MOV AX,[DI]+WR_ENCHAR ;get end character of field
  1926. ;
  1927. CMP AX,ES:[SI]+ICB_CURCHAR ;is cursor past end character
  1928. JA LJ300
  1929. ;
  1930. MOV AX,ES:[SI]+ICB_CURCHAR ;cursor is past last char
  1931. DEC AX
  1932. ;
  1933. LJ300: MOV [DI]+WR_RIGHTCHAR,AX ;set right marker
  1934. ;
  1935. MOV AX,1 ;set up call to LEFT_DISP to
  1936. CALL WORD PTR [DI]+WR_DISPLAY ; determine if additional byte
  1937. ; will fit in input buffer
  1938. ; BX= number of bytes to insert
  1939. CMP AX,0 ;check if double byte character
  1940. JE LJ310 ; will fit
  1941. ;
  1942. CALL PCMBEEP_CALL ;error beep replace character
  1943. JMP LJEXIT ; will not fit and exit
  1944. ;
  1945. ; Shift to insert single or double byte character, BX= # bytes to shift
  1946. ;
  1947. LJ310: MOV AX,ES:[SI]+ICB_FIELDLEN ;set ending byte to make room in
  1948. MOV [DI]+WR_RIGHTBYTE,AX ; buffer by shifting characters
  1949. ;
  1950. MOV AX,[DI]+WR_CUBYTE ;set markers for shift to remove
  1951. MOV [DI]+WR_LEFTBYTE,AX ; trailing byte
  1952. ;
  1953. MOV AX,1 ;set option to shift right, BX=
  1954. ; number of bytes to insert
  1955. CALL SHIFT ;call shift 1 position toward
  1956. ; left
  1957. MOV AX,[DI]+INC_KS ;get keystroke
  1958. ;
  1959. ; Insert single byte character
  1960. ;
  1961. CMP BX,2 ;check how many bytes should be
  1962. JE LJ320 ; inserted
  1963. ;
  1964. PUSH ES
  1965. PUSH SI
  1966. ;
  1967. MOV ES,CX ;save offset of character to
  1968. MOV SI,DX ; replace single byte
  1969. MOV ES:[SI],AL ;insert single byte character
  1970. ;
  1971. POP SI ;restore registers
  1972. POP ES
  1973. ;
  1974. JMP LJ330
  1975. ;
  1976. ; Insert double byte character
  1977. ;
  1978. LJ320: PUSH ES
  1979. PUSH SI
  1980. ;
  1981. MOV ES,CX ;save offset of character to
  1982. MOV SI,DX ; replace
  1983. MOV ES:[SI],AX ;insert double byte character
  1984. ;
  1985. POP SI ;restore registers
  1986. POP ES
  1987. ;
  1988. ; Calculate new ending and cursor coordinates
  1989. ;
  1990. LJ330:
  1991. CALL CAL_COORS ;get new end coordinates ;=W
  1992. ;
  1993. MOV AX,[DI]+WR_ENCHAR ;set rightmost area to refresh on
  1994. MOV [DI]+WR_RIGHTDISP,AX ; display to old ending character
  1995. ;
  1996. INC ES:[SI]+ICB_CURCHAR ;point to next char
  1997. ;
  1998. CALL CAL_COORS ;get cursor position ;=W
  1999. CMP [DI]+WR_FIELDEND,0 ;check if cursor past end of field ;=W
  2000. JE LJ340 ;no ;=W
  2001. TEST ES:[SI]+ICB_OPT2,ICB_CSW ;is cursor wrap option on ? ;=W
  2002. JE LJ335
  2003. MOV ES:[SI]+ICB_CURCHAR,1 ;wrap to first character position
  2004. JMP LJ340 ;display field, set cursor, exit
  2005. LJ335:
  2006. TEST ES:[SI]+ICB_OPT2,ICB_AXD ;is autoexit option set ? ;=W
  2007. JE LJ340 ;no ;=W
  2008. OR [DI]+WR_KEYCONF2,WR_RET ;set autoexit flag ;=W
  2009. ;
  2010. ; Display field
  2011. ;
  2012. LJ340:
  2013. MOV AX,ES:[SI]+ICB_CURCHAR ;set left character to cursor
  2014. DEC AX ; last cursor position
  2015. MOV [DI]+WR_LEFTCHAR,AX
  2016. ;
  2017. MOV AX,[DI]+WR_RIGHTDISP ;set right character marker to ;=W
  2018. MOV [DI]+WR_RIGHTCHAR,AX ; max possible field length
  2019. ;
  2020. CALL CAL_COORS ;get end of field char, byte ;=W
  2021. ; and next byte positions
  2022. MOV AX,2 ;set display option
  2023. CALL WORD PTR [DI]+WR_DISPLAY ;display current input buffer
  2024. ; in left justified field
  2025. ;
  2026. ; Exit
  2027. ;
  2028. LJEXIT: ;continue
  2029. TEST ES:[SI]+ICB_STATUS,ICB_CUR_ON ;is cursor on ?
  2030. JNE LJCUR ;cursor is already on, don't turn it on ;=W
  2031. CALL CURSOR ;display cursor ;=W
  2032. LJCUR:
  2033. ;
  2034. RET
  2035. LEFT_JUST ENDP
  2036. ;-----------------------------------------------------------------------------+
  2037. ; :
  2038. ; CAL_COORS :
  2039. ; :
  2040. ; Calculates character coordinates based on the display format :
  2041. ; currently active (windowing and horizontal display). :
  2042. ; :
  2043. ; The following examples demonstrate the values that are set on :
  2044. ; exit from this routine: :
  2045. ; :
  2046. ; :
  2047. ; Example: Horizontal field coordinates calculated. :
  2048. ; :
  2049. ; :
  2050. ; 123456789012345678901234567890 :
  2051. ; 2 :
  2052. ; 3 [sLtLtssss....] :
  2053. ; ^ :
  2054. ; :
  2055. ; WR_ENCHAR = 7 :
  2056. ; WR_ENBYTE = 9 :
  2057. ; WR_RGCHAR = 7 :
  2058. ; :
  2059. ; WR_CUCHAR = 3 :
  2060. ; WR_CUBYTE = 4 :
  2061. ; WR_UPCHAR = 3 :
  2062. ; WR_DNCHAR = 3 :
  2063. ; WR_CURROW = 3 :
  2064. ; WR_CURCOL = 13 :
  2065. ; :
  2066. ; WR_LFCHAR = 1 :
  2067. ; WR_HRCHAR = 1 :
  2068. ; :
  2069. ; :
  2070. ; Example: Horizontal field scroll coordinates calculated: :
  2071. ; :
  2072. ; :
  2073. ; 123456789012345678901234567890 :
  2074. ; 2 Ŀ :
  2075. ; 3 sLtLt Ltsss..... :
  2076. ; :
  2077. ; ^ :
  2078. ; :
  2079. ; WR_ENCHAR = 7 :
  2080. ; WR_ENBYTE = 10 :
  2081. ; WR_RGCHAR = 7 :
  2082. ; :
  2083. ; WR_CUCHAR = 3 :
  2084. ; WR_CUBYTE = 4 :
  2085. ; WR_UPCHAR = 3 :
  2086. ; WR_DNCHAR = 3 :
  2087. ; WR_CURROW = 3 :
  2088. ; WR_CURCOL = 14 :
  2089. ; :
  2090. ; WR_HRCHAR = 2 :
  2091. ; :
  2092. ; WR_LFCHAR = 1 :
  2093. ; :
  2094. ; :
  2095. ; :
  2096. ; Example: Windowed field coordinates calculated. :
  2097. ; :
  2098. ; :
  2099. ; 123456789012345678901234567890 :
  2100. ; 2 WR_LFCHAR= 6 :
  2101. ; 3 WR_UPCHAR= 3 :
  2102. ; 4 ijĿ :
  2103. ; 5 ABCDE :
  2104. ; 6 FGHI. :
  2105. ; 7 ڳ WR_RGCHAR= 10 :
  2106. ; 8 ij WR_ENCHAR= 9 :
  2107. ; 9 :
  2108. ; WR_CUCHAR= 8 :
  2109. ; WR_CURCOL= 24 :
  2110. ; WR_CURROW= 6 :
  2111. ; :
  2112. ; WR_DNCHAR= 13 :
  2113. ; :
  2114. ; :
  2115. ; Entry: ICB_CURCHAR = The character position into the input field from :
  2116. ; which the exit coordinates will be calculated. :
  2117. ; :
  2118. ; WR_HRCHAR = The character position into the input field that :
  2119. ; is currently the first displayed character of the :
  2120. ; horizontal window. :
  2121. ; :
  2122. ; ICB_WIDTH = The width of windowed or horizontal scroll field. :
  2123. ; :
  2124. ; ICB_FIELDLEN = Input field buffer length. :
  2125. ; :
  2126. ; ICB_FIELDOFF = Input field buffer offset. :
  2127. ; :
  2128. ; ICB_FIELDSEG = Input field buffer segment. :
  2129. ; :
  2130. ; :
  2131. ; Exit: WR_RGCHAR = Character offset into input buffer of the character :
  2132. ; appearing at the beginning of the current line that :
  2133. ; WR_CUCHAR is located on. :
  2134. ; :
  2135. ; WR_LFCHAR = Character offset into input buffer of the character :
  2136. ; appearing at the end of the current line that :
  2137. ; WR_CUCHAR is located on. :
  2138. ; :
  2139. ; WR_UPCHAR = Character offset into input buffer of the character :
  2140. ; displayed directly above the position that :
  2141. ; WR_CUCHAR is located on. :
  2142. ; :
  2143. ; WR_DNCHAR = Character offset into input buffer of the character :
  2144. ; displayed directly below the position that :
  2145. ; WR_CUCHAR is located on. :
  2146. ; :
  2147. ; WR_ENCHAR = Number of characters currently entered in the :
  2148. ; field. This value may be less than the number :
  2149. ; of bytes used to represent the characters if :
  2150. ; double byte characters are present. :
  2151. ; :
  2152. ; WR_CURROW = Actual row offset into the video buffer of the :
  2153. ; character specified by WR_CURCHAR. :
  2154. ; :
  2155. ; WR_CURCOL = Actual column offset into the video buffer of the :
  2156. ; character specified by WR_CUCHAR. :
  2157. ; :
  2158. ; WR_ENBYTE = Number of bytes currently used to represent :
  2159. ; entered characters in the buffer. This counter :
  2160. ; can be used to calculate the current end :
  2161. ; position of the entered data in the field. :
  2162. ; :
  2163. ; WR_CUBYTE = Number of bytes into input field where WR_CUCHAR :
  2164. ; appears. :
  2165. ; : ;=W
  2166. ; WR_CUCHAR = Offset of current cursor position in input field. : ;=W
  2167. ; : ;=W
  2168. ; WR_HRBYTE = Number of bytes into input field where WR_HRCHAR :
  2169. ; appears. :
  2170. ; :
  2171. ; WR_FIELDEND = Boolean flag, 0 = cursor not past end of field : ;=W
  2172. ; 1 = cursor is past end of field : ;=W
  2173. ; :
  2174. ;-----------------------------------------------------------------------------+
  2175. ;
  2176. CAL_COORS PROC NEAR
  2177. ;
  2178. PUSH AX ;save registers
  2179. PUSH BX
  2180. PUSH CX
  2181. PUSH DX
  2182. PUSH ES
  2183. PUSH SI
  2184. PUSH BP ;=W
  2185. ; ;=W
  2186. ; initialize general variables for all display modes ;=W
  2187. ;
  2188. MOV [DI]+WR_FIELDEND,0 ;initialize boolean flag that ;=W
  2189. ;cursor is not past end of field ;=W
  2190. MOV AX,ES:[SI]+ICB_CURCHAR ;get current char. offset ;=W
  2191. MOV [DI]+WR_CUCHAR,AX ;save it ;=W
  2192. ;
  2193. MOV AX,ES:[SI]+ICB_ROW ;initialize row offset of field ;=W
  2194. DEC AX ;=W
  2195. MOV [DI]+WR_CURROW,AX ;char row offset inot video buf ;=W
  2196. MOV AX,ES:[SI]+ICB_COL ;initialize col offset of field ;=W
  2197. DEC AX ;=W
  2198. MOV [DI]+WR_CURCOL,AX ;char col offset into video buf ;=W
  2199. ;
  2200. MOV [DI]+WR_LFCHAR,1 ;leftmost character possible char ;=W
  2201. MOV [DI]+WR_RGCHAR,1 ;rightmost character possible char ;=W
  2202. MOV [DI]+WR_ENBYTE,0 ;end byte of data in input buffer ;=W
  2203. MOV [DI]+WR_ENCHAR,0 ;end character in input buffer ;=W
  2204. MOV [DI]+WR_HRBYTE,1 ;byte of first char in horz. window ;=W
  2205. ;
  2206. MOV AX,[DI]+WR_CUCHAR ;get current position ;=W
  2207. MOV [DI]+WR_UPCHAR,1 ;topmost char in current column ;=W
  2208. MOV [DI]+WR_DNCHAR,1 ;bottommost char in current column ;=W
  2209. ;
  2210. MOV BP,0 ;have not found current char yet ;=W
  2211. MOV CX,1 ;counter tracking number of bytes ;=W
  2212. MOV DX,1 ;counter tracking number of chars ;=W
  2213. ;
  2214. ; Determine display format of field
  2215. ;
  2216. TEST ES:[SI]+ICB_OPT3,ICB_WIN ;check if windowing option on
  2217. JE CC10
  2218. ;
  2219. JMP CC200 ;process window option
  2220. ;
  2221. CC10: TEST ES:[SI]+ICB_OPT3,ICB_HOR ;check if horizontal scroll option
  2222. JE CC20 ; on
  2223. ;
  2224. JMP CC100 ;process horizontal scroll
  2225. ;
  2226. ; Process fully displayed horizontal field
  2227. ;
  2228. CC20: ;=W
  2229. MOV [DI]+WR_HRCHAR,1 ;leftmost character possible char
  2230. ;
  2231. ; Examine the next byte in the input buffer
  2232. ;
  2233. CC30: CMP CX,ES:[SI]+ICB_FIELDLEN ;check if entire field has been
  2234. JBE CC35 ; scanned and exit
  2235. ;
  2236. CMP BP,0 ;found current char yet ? ;=W
  2237. JE CC40 ;no, find it ;=W
  2238. JMP CCEXIT
  2239. ;
  2240. CC35: PUSH ES ;save registers
  2241. PUSH SI
  2242. ;
  2243. PUSH ES:[SI]+ICB_FIELDSEG ;get segment of input buffer
  2244. PUSH ES:[SI]+ICB_FIELDOFF ;get offset of input buffer
  2245. POP SI
  2246. POP ES
  2247. ;
  2248. DEC CX ;make byte count zero based
  2249. ADD SI,CX ;add byte count to input fld offst
  2250. INC CX ;make byte count one based
  2251. MOV AL,ES:[SI] ;get byte in input buffer to
  2252. MOV [DI]+DBC_KS,AL ; check if DBCS
  2253. CALL PCINDBC_CALL ;call routine to check if char
  2254. ; is lead double byte char
  2255. ;
  2256. POP SI ;restore registers
  2257. POP ES
  2258. ;
  2259. ; Check if end data byte and character should be updated
  2260. ;
  2261. CMP AL,WR_BLANK ;check if blanking character found
  2262. JE CC40 ;now adjust pointers
  2263. ;
  2264. MOV [DI]+WR_ENBYTE,CX ;set current byte count
  2265. MOV [DI]+WR_ENCHAR,DX ;set current character count
  2266. MOV [DI]+WR_RGCHAR,DX ;set right most character
  2267. ;
  2268. ; Check if current character pointer
  2269. ;
  2270. CC40: CMP [DI]+WR_CUCHAR,DX ;check if current character found
  2271. JNE CC50
  2272. ;
  2273. MOV BP,1 ;current char found ;=W
  2274. MOV [DI]+WR_UPCHAR,DX ;set up and down character
  2275. MOV [DI]+WR_DNCHAR,DX ; to current character
  2276. ;
  2277. MOV [DI]+WR_CUBYTE,CX ;set current character byte count
  2278. ADD [DI]+WR_CURCOL,CX ;set actual column of cursor based
  2279. DEC [DI]+WR_CURCOL ; on current character byte count ;=W
  2280. ;
  2281. ; Increment pointers and counters to next character and byte position check
  2282. ;
  2283. CC50: INC CX ;adjust byte counter
  2284. INC DX ;adjust character counter
  2285. ;
  2286. TEST [DI]+DBC_STAT,DBC_DBCS ;check if byte is leading DBC byte
  2287. JE CC30
  2288. ;
  2289. INC CX ;adjust byte count for trail byte
  2290. JMP CC30
  2291. ;
  2292. ; Calculate horizontal scroll coordinates
  2293. ;
  2294. CC100:
  2295. MOV AX,[DI]+WR_CUCHAR ;initialize current character
  2296. CMP AX,[DI]+WR_HRCHAR ;horizontal display position must
  2297. JAE CC120 ; not be less than current char
  2298. ; position
  2299. MOV [DI]+WR_HRCHAR,AX ;set current char position as
  2300. ; new horizontal position
  2301. ;
  2302. ; Examine the next byte in the input buffer
  2303. ;
  2304. CC120: CMP CX,ES:[SI]+ICB_FIELDLEN ;check if entire field has been
  2305. JBE CC122 ; scanned and exit ;=W
  2306. ;
  2307. CMP BP,0 ;found current char yet ? ;=W
  2308. JE CC130 ;no, find it ;=W
  2309. ;
  2310. JMP CCEXIT ;=W
  2311. CC122: ;=W
  2312. PUSH ES ;save registers
  2313. PUSH SI
  2314. ;
  2315. PUSH ES:[SI]+ICB_FIELDSEG ;get segment of input buffer
  2316. PUSH ES:[SI]+ICB_FIELDOFF ;get offset of input buffer
  2317. POP SI
  2318. POP ES
  2319. ;
  2320. DEC CX ;make byte count zero based
  2321. ADD SI,CX ;add byte count to input fld offst
  2322. INC CX ;make byte count one based
  2323. MOV AL,ES:[SI] ;get byte in input buffer to
  2324. MOV [DI]+DBC_KS,AL ; check if DBCS
  2325. CALL PCINDBC_CALL ;call routine to check if char
  2326. ; is lead double byte char
  2327. ;
  2328. POP SI ;restore registers
  2329. POP ES
  2330. ; ;=W
  2331. ; Set WR_HRBYTE to correct byte count ;=W
  2332. ; ;=W
  2333. CMP [DI]+WR_HRCHAR,DX ;is this position the first char ;=W
  2334. ;in the horizl. window ? ;=W
  2335. JNE CC125 ;no ;=W
  2336. ;
  2337. MOV [DI]+WR_HRBYTE,CX ;save # byte for first char in h. wind. ;=W
  2338. ;
  2339. ; Check if end data byte and character should be updated
  2340. ;
  2341. CC125: CMP AL,WR_BLANK ;check if blanking character found
  2342. JE CC130 ;now adjust pointers
  2343. ;
  2344. MOV [DI]+WR_ENBYTE,CX ;set current byte count
  2345. MOV [DI]+WR_ENCHAR,DX ;set current character count
  2346. MOV [DI]+WR_RGCHAR,DX ;set right most character
  2347. ;
  2348. ; Check if current character pointer
  2349. ;
  2350. CC130: CMP [DI]+WR_CUCHAR,DX ;check if current character found
  2351. JNE CC140
  2352. ;
  2353. MOV BP,1 ;current char found
  2354. MOV [DI]+WR_UPCHAR,DX ;set up and down character
  2355. MOV [DI]+WR_DNCHAR,DX ; to current character
  2356. ;
  2357. MOV [DI]+WR_CUBYTE,CX ;set current character byte count
  2358. MOV BX,CX ;set actual column of cursor based ;=W
  2359. ; on current character byte count ;=W
  2360. SUB BX,[DI]+WR_HRBYTE ;subtract beginning of horiz. wind. ;=W
  2361. ADD [DI]+WR_CURCOL,BX ;add to window offset = new column ;=W
  2362. ;
  2363. ; Increment pointers and counters to next character and byte position check
  2364. ;
  2365. CC140: INC CX ;adjust byte counter
  2366. INC DX ;adjust character counter
  2367. ;
  2368. TEST [DI]+DBC_STAT,DBC_DBCS ;check if byte is leading DBC byte
  2369. JE CC120
  2370. ;
  2371. INC CX ;adjust byte count for trail byte
  2372. JMP CC120
  2373. ;
  2374. ; Calculate windowing coordinates ;=W
  2375. ;
  2376. CC200: ;=W
  2377. ;
  2378. ; Examine the next byte in the input buffer ;=W
  2379. ;
  2380. CMP CX,ES:[SI]+ICB_FIELDLEN ;check if entire field has been ;=W
  2381. JBE CC235 ; scanned and exit ;=W
  2382. ;
  2383. CMP BP,0 ;found current char yet ? ;=W
  2384. JE CC240 ;no, find it ;=W
  2385. ;
  2386. JMP CCBYE ;boolean flag should have been set ;=W
  2387. ; already, if needed ;=W
  2388. CC235: PUSH ES ;save registers ;=W
  2389. PUSH SI ;=W
  2390. ;
  2391. PUSH ES:[SI]+ICB_FIELDSEG ;get segment of input buffer ;=W
  2392. PUSH ES:[SI]+ICB_FIELDOFF ;get offset of input buffer ;=W
  2393. POP SI ;=W
  2394. POP ES ;=W
  2395. ;
  2396. DEC CX ;make byte count zero based ;=W
  2397. ADD SI,CX ;add byte count to input fld offst ;=W
  2398. INC CX ;make byte count one based ;=W
  2399. MOV AL,ES:[SI] ;get byte in input buffer to ;=W
  2400. MOV [DI]+DBC_KS,AL ; check if DBCS ;=W
  2401. CALL PCINDBC_CALL ;call routine to check if char ;=W
  2402. ; is lead double byte char ;=W
  2403. ;
  2404. POP SI ;restore registers ;=W
  2405. POP ES ;=W
  2406. ; ;=W
  2407. ; Check if end data byte and character should be updated ;=W
  2408. ; ;=W
  2409. CMP AL,WR_BLANK ;check if blanking character found ;=W
  2410. JE CC240 ;now adjust pointers ;=W
  2411. ;
  2412. MOV [DI]+WR_ENBYTE,CX ;set current byte count ;=W
  2413. MOV [DI]+WR_ENCHAR,DX ;set current character count ;=W
  2414. MOV [DI]+WR_RGCHAR,DX ;set right most character ;=W
  2415. ; ;=W
  2416. ; Check if current character pointer ;=W
  2417. ; ;=W
  2418. CC240:
  2419. CMP [DI]+WR_CUCHAR,DX ;check if current character found ;=W
  2420. JNE CC250 ;no ;=W
  2421. ;
  2422. MOV BP,1 ;found current char
  2423. MOV [DI]+WR_CUBYTE,CX ;set current character byte count ;=W
  2424. ;
  2425. PUSH DX ;needed for division ;=W
  2426. MOV AX,CX ;get current cursor pos. in field ;=W
  2427. DEC AX ;make it zero based for divide ;=W
  2428. ;
  2429. CMP CX,ES:[SI]+ICB_FIELDLEN ;are we past end of field ? ;=W
  2430. JLE CC241 ;no ;=W
  2431. MOV [DI]+WR_FIELDEND,1 ;yes, set boolean flag ;=W
  2432. DEC AX ;make cursor pos. be inside field ;=W
  2433. ; for division ;=W
  2434. CWD ;calculate current row,column ;=W
  2435. IDIV ES:[SI]+ICB_WIDTH ; row = cur_byte / width-1 ;=W
  2436. ; col = cur_byte mod width-1 ;=W
  2437. INC DX ;reposition cursor in correct pos. ;=W
  2438. JMP CC244 ;=W
  2439. CC241: ;=W
  2440. CWD ;calculate current row,column for ;=W
  2441. IDIV ES:[SI]+ICB_WIDTH ; cursor positions inside the field ;=W
  2442. ; row = cur_byte / width of field ;=W
  2443. ; col = cur_byte mod width of field ;=W
  2444. CC244: ;=W
  2445. ADD [DI]+WR_CURROW,AX ;set actual row of cursor ;=W
  2446. ADD [DI]+WR_CURCOL,DX ;set actual column of cursor ;=W
  2447. ;
  2448. MOV BX,CX ;calculate WR_LFCHAR ;=W
  2449. CC245: DEC BX ;get the correct cur_byte ;=W
  2450. MOV AX,BX ;cur_byte/width ;=W
  2451. CWD ;=W
  2452. IDIV ES:[SI]+ICB_WIDTH ;=W
  2453. CMP DX,0 ;is the remainder zero ? ;=W
  2454. JNE CC245 ;no, not at beginning of row, do again ;=W
  2455. ;
  2456. MOV [DI]+WR_LFCHAR,BX ;yes, this is beginning of row ;=W
  2457. ;
  2458. POP DX ;=W
  2459. ;
  2460. ; Increment pointers and counters to next character and byte position check ;=W
  2461. ; ;=W
  2462. CC250: INC CX ;adjust byte counter ;=W
  2463. INC DX ;adjust character counter ;=W
  2464. ;
  2465. TEST [DI]+DBC_STAT,DBC_DBCS ;check if byte is leading DBC byte ;=W
  2466. JE CC260 ;=W
  2467. ;
  2468. INC CX ;adjust byte count for trail byte ;=W
  2469. CC260:
  2470. JMP CC200 ;=W
  2471. ;
  2472. ; Exit
  2473. ;
  2474. CCEXIT: ;=W
  2475. MOV AX,[DI]+WR_CUBYTE ;is cursor past end of field ;=W
  2476. CMP AX,ES:[SI]+ICB_FIELDLEN ;?? ;=W
  2477. JLE CCBYE ;no ;=W
  2478. ;
  2479. MOV [DI]+WR_FIELDEND,1 ;yes, set boolean flag ;=W
  2480. CCBYE:
  2481. MOV AX,[DI]+WR_ENBYTE ;set ICB_ENDBYTE ;=W
  2482. MOV ES:[SI]+ICB_ENDBYTE,AX ;=W
  2483. ;
  2484. MOV AX,[DI]+WR_HRBYTE ;set ICB_HRSTART ;=W
  2485. MOV ES:[SI]+ICB_HRSTART,AX ;=W
  2486. ;
  2487. POP BP
  2488. POP SI ;restore registers
  2489. POP ES
  2490. POP DX ;restore registers
  2491. POP CX
  2492. POP BX
  2493. POP AX
  2494. ;
  2495. RET
  2496. CAL_COORS ENDP
  2497. ;
  2498. PAGE ;=W
  2499. ;-----------------------------------------------------------------------------+ ;=W
  2500. ; : ;=W
  2501. ; SET_DISP_ADDR : ;=W
  2502. ; : ;=W
  2503. ; Determine which display routine to use. The choice is between : ;=W
  2504. ; left justified, right justified, double byte support, no double : ;=W
  2505. ; byte support, windowing, horizontal scrolling. : ;=W
  2506. ; Also pick the justify routine to use. : ;=W
  2507. ; : ;=W
  2508. ; Ŀ : ;=W
  2509. ; DISPLAY : ;=W
  2510. ; : ;=W
  2511. ; Ŀ : ;=W
  2512. ; Ŀ Ŀ : ;=W
  2513. ; LEFT_DISP RIGHT_DISP : ;=W
  2514. ; : ;=W
  2515. ; Ŀ Ŀ : ;=W
  2516. ; LEFT_H_DISP RIGHT_H_DISP : ;=W
  2517. ; : ;=W
  2518. ; Ŀ Ŀ : ;=W
  2519. ; LEFTS_DISP RIGHTS_DISP : ;=W
  2520. ; : ;=W
  2521. ; : ;=W
  2522. ; : ;=W
  2523. ; : ;=W
  2524. ; : ;=W
  2525. ; : ;=W
  2526. ; DISPLAY ROUTINES : ;=W
  2527. ; LEFT_DISP - left justified, double byte support, windowing : ;=W
  2528. ; LEFTS_DISP - left justified, no double byte support, windowing : ;=W
  2529. ; LEFT_H_DISP - left justified, double byte support, horizontal scrolling : ;=W
  2530. ; RIGHT_DISP - right justified, double byte support, windowing : ;=W
  2531. ; RIGHTS_DISP - right justified, no double byte support, windowing : ;=W
  2532. ; RIGHT_H_DISP - right justified, double byte support, horizontal scrolling : ;=W
  2533. ; : ;=W
  2534. ; JUSTIFY ROUTINES : ;=W
  2535. ; LEFT_H_JUST - left justified, horizontal scrolling : ;=W
  2536. ; LEFT_JUST - left justified, windowing : ;=W
  2537. ; RIGHT_H_JUST - right justified, horizontal scrolling : ;=W
  2538. ; RIGHT_JUST - right justified, windowing : ;=W
  2539. ; : ;=W
  2540. ; Entry: ES:SI - ICB control block : ;=W
  2541. ; DS:DI - IN control block : ;=W
  2542. ; Exit: none : ;=W
  2543. ; : ;=W
  2544. ;-----------------------------------------------------------------------------+ ;=W
  2545. ; ;=W
  2546. SET_DISP_ADDR PROC NEAR ;=W
  2547. ;
  2548. PUSH AX ;=W
  2549. PUSH BX ;=W
  2550. ;
  2551. TEST ES:[SI]+ICB_OPT1,ICB_RJU ;check if field right just ;=W
  2552. JNE SD20 ;if yes, jump ;=W
  2553. ;
  2554. ; Display value of input buffer left justified ;=W
  2555. ;
  2556. TEST ES:[SI]+ICB_OPT3,ICB_HOR ;check if field is in horizontial ;=W
  2557. JE SD10 ;no, windowing mode ;=W
  2558. ;
  2559. MOV AX,OFFSET LEFT_H_DISP ;=W
  2560. MOV BX,OFFSET LEFT_H_JUST ;=W
  2561. ;
  2562. JMP SDEXIT ;=W
  2563. SD10: ;=W
  2564. MOV AX,OFFSET LEFT_DISP ;=W
  2565. MOV BX,OFFSET LEFT_JUST ;=W
  2566. ;
  2567. TEST DS:[DI]+IN_OPT,IN_ADBCS ;check if double byte is active ;=W
  2568. JNE SDEXIT ;yes ;=W
  2569. MOV AX,OFFSET LEFTS_DISP ;no, single byte only ;=W
  2570. JMP SDEXIT ;=W
  2571. ;
  2572. ; Display default value of input buffer right justified ;=W
  2573. ;
  2574. SD20: ;=W
  2575. TEST ES:[SI]+ICB_OPT3,ICB_HOR ;check if field is in horizontial ;=W
  2576. JE SD30 ;no, windowing mode ;=W
  2577. ;
  2578. MOV AX,OFFSET RIGHT_H_DISP ;=W
  2579. MOV BX,OFFSET RIGHT_H_JUST ;=W
  2580. ;
  2581. JMP SDEXIT ;=W
  2582. SD30: ;=W
  2583. MOV AX,OFFSET RIGHT_DISP ;=W
  2584. MOV BX,OFFSET RIGHT_DISP ;=W
  2585. ;
  2586. TEST DS:[DI]+IN_OPT,IN_ADBCS ;check if double byte is active ;=W
  2587. JNE SDEXIT ;yes ;=W
  2588. MOV AX,OFFSET RIGHTS_DISP ;no, single byte only ;=W
  2589. ;
  2590. SDEXIT: ;=W
  2591. MOV DS:[DI]+WR_DISPLAY,AX ;save addr of routine to call ;=W
  2592. MOV DS:[DI]+WR_JUSTIFY,BX ;save addr of routine to call ;=W
  2593. ;
  2594. POP BX ;=W
  2595. POP AX ;=W
  2596. ;
  2597. RET ;=W
  2598. SET_DISP_ADDR ENDP ;=W
  2599. ;
  2600. PAGE ;=W
  2601. ;-----------------------------------------------------------------------------+ ;=W
  2602. ; : ;=W
  2603. ; RIGHTS_DISP : ;=W
  2604. ; : ;=W
  2605. ; Entry: : ;=W
  2606. ; : ;=W
  2607. ; Exit: : ;=W
  2608. ; : ;=W
  2609. ;-----------------------------------------------------------------------------+ ;=W
  2610. ; ;=W
  2611. RIGHTS_DISP PROC NEAR ;=W
  2612. ; ;=W
  2613. ; ;=W
  2614. ; code here ;=W
  2615. ; ;=W
  2616. ; ;=W
  2617. RET ;=W
  2618. RIGHTS_DISP ENDP ;=W
  2619. ;
  2620. PAGE
  2621. ;-----------------------------------------------------------------------------+
  2622. ; :
  2623. ; RIGHT_H_DISP :
  2624. ; :
  2625. ; Entry: :
  2626. ; :
  2627. ; Exit: :
  2628. ; :
  2629. ;-----------------------------------------------------------------------------+
  2630. ;
  2631. RIGHT_H_DISP PROC NEAR
  2632. ;
  2633. ;
  2634. ; code here
  2635. ;
  2636. ;
  2637. RET
  2638. RIGHT_H_DISP ENDP
  2639. ;
  2640. PAGE ;=W
  2641. ;-----------------------------------------------------------------------------+ ;=W
  2642. ; : ;=W
  2643. ; RIGHT_DISP : ;=W
  2644. ; : ;=W
  2645. ; Entry: : ;=W
  2646. ; : ;=W
  2647. ; Exit: : ;=W
  2648. ; : ;=W
  2649. ;-----------------------------------------------------------------------------+ ;=W
  2650. ; ;=W
  2651. RIGHT_DISP PROC NEAR ;=W
  2652. ; ;=W
  2653. ; ;=W
  2654. ; code here ;=W
  2655. ; ;=W
  2656. ; ;=W
  2657. RET ;=W
  2658. RIGHT_DISP ENDP ;=W
  2659. ; ;=W
  2660. PAGE ;=W
  2661. ;-----------------------------------------------------------------------------+ ;=W
  2662. ; : ;=W
  2663. ; LEFT_H_DISP : ;=W
  2664. ; : ;=W
  2665. ; Calculates if the specified character will fit in the input : ;=W
  2666. ; buffer at the specified character position without display. : ;=W
  2667. ; The byte offset where this character should be inserted is : ;=W
  2668. ; returned or a flag indicating that the character will not fit. : ;=W
  2669. ; : ;=W
  2670. ; Displays the specified portion of the input field buffer from : ;=W
  2671. ; the left character marker to the end of the field. The following : ;=W
  2672. ; display options are handled by this routine: : ;=W
  2673. ; : ;=W
  2674. ; - Display of the input field in a wrapped window : ;=W
  2675. ; - Adjustment of double byte characters to prevent malformed : ;=W
  2676. ; characters : ;=W
  2677. ; : ;=W
  2678. ; : ;=W
  2679. ; The following pointers are used: : ;=W
  2680. ; : ;=W
  2681. ; (ICB_FIELDSEG:ICB_FIELDOFF) Beginning address of input : ;=W
  2682. ; buffer in memory. : ;=W
  2683. ; : ;=W
  2684. ; (WR_HRCHAR) Left marker delimiting the left : ;=W
  2685. ; most character position in the : ;=W
  2686. ; input buffer. : ;=W
  2687. ; : ;=W
  2688. ; : ;=W
  2689. ; : ;=W
  2690. ; : ;=W
  2691. ; : ;=W
  2692. ; Ŀ : ;=W
  2693. ; S L T L T S L T S S S S : ;=W
  2694. ; : ;=W
  2695. ; Ĵ : ;=W
  2696. ; Area to display (ICB_WIDTH) : ;=W
  2697. ; : ;=W
  2698. ; : ;=W
  2699. ; ICB_FIELDLEN Length of input field in bytes. : ;=W
  2700. ; : ;=W
  2701. ; : ;=W
  2702. ; Entry: ES:SI = Points to current ICB : ;=W
  2703. ; DS:DI = Points to PB : ;=W
  2704. ; : ;=W
  2705. ; WR_CATTR = Logical color attribute to use when updating screen : ;=W
  2706. ; if the use of the color attribute string is not : ;=W
  2707. ; specified. : ;=W
  2708. ; : ;=W
  2709. ; CR_RCOFF = Beginning offset of the upper left input field : ;=W
  2710. ; display corner from the beginning of the video : ;=W
  2711. ; buffer. : ;=W
  2712. ; : ;=W
  2713. ; CR_SCRWIDTH = Width of the video buffer in characters and : ;=W
  2714. ; attributes. : ;=W
  2715. ; : ;=W
  2716. ; WR_HRCHAR = The offset into the input buffer, in characters, : ;=W
  2717. ; of where to begin display. : ;=W
  2718. ; : ;=W
  2719. ; Exit: (none) : ;=W
  2720. ;-----------------------------------------------------------------------------+ ;=W
  2721. ; ;=W
  2722. LEFT_H_DISP PROC NEAR ;=W
  2723. ;
  2724. PUSH ES ;save PB pointers ;=W
  2725. PUSH DI ;=W
  2726. PUSH BX ;=W
  2727. PUSH [DI]+CR_RCOFF ;save input field display offset ;=W
  2728. ; ;=W
  2729. ; Initialize MOVEG parm block ;=W
  2730. ;
  2731. MOV AX,ES:[SI]+ICB_FIELDOFF ;get offset of the input buffer ;=W
  2732. MOV [DI]+WR_FIELDOFF,AX ;=W
  2733. ;=W
  2734. MOV AX,ES:[SI]+ICB_FIELDSEG ;get segment of the input buffer ;=W
  2735. MOV [DI]+MG_TEXTSEG,AX ;=W
  2736. ;=W
  2737. MOV AX,ES:[SI]+ICB_ATTROFF ;get offset of color attribute buffer ;=W
  2738. MOV [DI]+MG_ATTOFF,AX ;=W
  2739. ;=W
  2740. MOV AX,ES:[SI]+ICB_ATTRSEG ;get segment of color attribute ;=W
  2741. MOV [DI]+MG_ATTSEG,AX ;buffer ;=W
  2742. ;=W
  2743. MOV AX,[DI]+IN_LVBSEG ;get segment of the LVB ;=W
  2744. MOV [DI]+MG_MIXSEG,AX ;=W
  2745. ;=W
  2746. MOV AL,[DI]+WR_CATTR ;get logical color attribute ;=W
  2747. MOV [DI]+MG_SOURCE_A,AL ;=W
  2748. ; ;=W
  2749. ; Display all characters in input buffer starting with WR_HRCHAR ;=W
  2750. ; and continuing until ICB_WIDTH-1 number of characters has been displayed. ;=W
  2751. ;
  2752. MOV AX,ES:[SI]+ICB_FIELDOFF ;calcuate beginning character ;=W
  2753. ADD AX,[DI]+WR_HRBYTE ;to display ;=W
  2754. DEC AX ;=W
  2755. MOV [DI]+WR_FIELDOFF,AX ;save it ;=W
  2756. MOV [DI]+MG_TEXTOFF,AX ; to display ;=W
  2757. ;
  2758. MOV [DI]+MG_OPT,MG_WA+MG_SC+MG_UA ;=W
  2759. ;set write attribute option ;=W
  2760. ;set use logical attribute option ;=W
  2761. TEST ES:[SI]+ICB_OPT1,ICB_PSW ;check if password option active ;=W
  2762. JNE LHD10 ;=W
  2763. ;
  2764. OR [DI]+MG_OPT,MG_WC ;set write character option ;=W
  2765. LHD10: ;=W
  2766. MOV AX,ES:[SI]+ICB_WIDTH ;get field width ;=W
  2767. MOV [DI]+MG_NUM,AX ;number of words to move into the ;=W
  2768. ; LVB ;=W
  2769. ;
  2770. MOV AX,[DI]+IN_LVBOFF ;set the actual LVB offset of ;=W
  2771. ADD AX,[DI]+CR_RCOFF ; the character to write ;=W
  2772. MOV [DI]+MG_MIXOFF,AX ;=W
  2773. ;
  2774. CALL PCMOVEG_CALL ;call PCMOVEG to write the char(s) ;=W
  2775. ; ;=W
  2776. ; Check if last character is DBCS ;=W
  2777. ; ;=W
  2778. PUSH ES ;=W
  2779. PUSH SI ;=W
  2780. ;
  2781. MOV AX,ES:[SI]+ICB_FIELDSEG ;get input buffer segment ;=W
  2782. MOV BX,ES:[SI]+ICB_FIELDOFF ;get input buffer offset ;=W
  2783. ADD BX,[DI]+WR_HRBYTE ;add offset of beginning of window ;=W
  2784. ADD BX,ES:[SI]+ICB_WIDTH ;add width to get last character ;=W
  2785. SUB BX,2 ;subtract to get correct byte ;=W
  2786. MOV ES,AX ;=W
  2787. MOV SI,BX ;=W
  2788. MOV AL,ES:[SI] ;get the character ;=W
  2789. ;
  2790. POP SI ;=W
  2791. POP ES ;=W
  2792. ;
  2793. PUSH AX ;=W
  2794. MOV [DI]+DBC_KS,AL ;=W
  2795. CALL PCINDBC_CALL ;check if char is lead DBCS ;=W
  2796. POP AX ;=W
  2797. TEST [DI]+DBC_STAT,DBC_DBCS ;is it ? ;=W
  2798. JE LHD30 ;no, display the character ;=W
  2799. ;
  2800. MOV AL,1DH ;display '', can't split DBCS char ;=W
  2801. ; ;=W
  2802. ; Display the last character ;=W
  2803. ; ;=W
  2804. LHD30: ;=W
  2805. MOV [DI]+MG_OPT,MG_WA+MG_SC+MG_UA ;=W
  2806. ;set write attribute option ;=W
  2807. ;set use logical attribute option ;=W
  2808. TEST ES:[SI]+ICB_OPT1,ICB_PSW ;check if password option active ;=W
  2809. JNE LHD40 ;=W
  2810. ;
  2811. OR [DI]+MG_OPT,MG_WC+MG_UC ;set write character option ;=W
  2812. LHD40: ;=W
  2813. MOV [DI]+MG_SOURCE_C,AL ;character to display ;=W
  2814. MOV [DI]+MG_NUM,1 ;number of words to move into the ;=W
  2815. ; LVB ;=W
  2816. ;
  2817. MOV AX,ES:[SI]+ICB_WIDTH ;add width to get last character ;=W
  2818. MOV BX,2 ;=W
  2819. MUL BX ;x2 to account for attr. bytes ;=W
  2820. ADD AX,[DI]+IN_LVBOFF ;set the actual LVB offset of ;=W
  2821. ADD AX,[DI]+CR_RCOFF ; the character to write ;=W
  2822. SUB AX,2 ;subtract to get correct byte ;=W
  2823. MOV [DI]+MG_MIXOFF,AX ;=W
  2824. ;
  2825. CALL PCMOVEG_CALL ;call PCMOVEG to write the char(s) ;=W
  2826. LHDEXIT: ;=W
  2827. POP [DI]+CR_RCOFF ;save input field display offset ;=W
  2828. POP BX ;restore registers ;=W
  2829. POP DI ;=W
  2830. POP ES ;=W
  2831. ;
  2832. RET ;=W
  2833. LEFT_H_DISP ENDP ;=W
  2834. ;
  2835. PAGE
  2836. ;-----------------------------------------------------------------------------+
  2837. ; :
  2838. ; LEFT_DISP :
  2839. ; :
  2840. ; Calculates if the specified character will fit in the input :
  2841. ; buffer at the specified character position without display. :
  2842. ; The byte offset where this character should be inserted is :
  2843. ; returned or a flag indicating that the character will not fit. :
  2844. ; :
  2845. ; Displays the specified portion of the input field buffer from :
  2846. ; the left character marker to the end of the field. The following :
  2847. ; display options are handled by this routine: :
  2848. ; :
  2849. ; - Display of the input field in a wrapped window :
  2850. ; - Adjustment of double byte characters to prevent malformed :
  2851. ; characters :
  2852. ; :
  2853. ; :
  2854. ; The following pointers are used: :
  2855. ; :
  2856. ; (ICB_FIELDSEG:ICB_FIELDOFF) Beginning address of input :
  2857. ; buffer in memory. :
  2858. ; :
  2859. ; (WR_LEFTCHAR) Left marker delimiting the left :
  2860. ; most character position in the :
  2861. ; input buffer. :
  2862. ; :
  2863. ; Right marker delimiting the right :
  2864. ; most character position in the :
  2865. ; input buffer. (WR_RIGHTCHAR) :
  2866. ; :
  2867. ; Ŀ :
  2868. ; S L T L T S L T S S S S :
  2869. ; :
  2870. ; Ĵ :
  2871. ; Area to display :
  2872. ; :
  2873. ; :
  2874. ; ICB_FIELDLEN Length of input field in bytes. :
  2875. ; :
  2876. ; :
  2877. ; Entry: ES:SI = Points to current ICB :
  2878. ; DS:DI = Points to PB :
  2879. ; :
  2880. ; AX 1 = This option will calculate if the specified number :
  2881. ; of bytes in BX can fit into input buffer at the :
  2882. ; specified character position considering the display :
  2883. ; coordinates and options. No update of the display :
  2884. ; screen will occur. A flag indicating if the bytes :
  2885. ; can be inserted or not is returned. If the bytes :
  2886. ; will fit the offset from the beginning of the input :
  2887. ; field in bytes is returned indicating where the :
  2888. ; characters should be inserted. :
  2889. ; :
  2890. ; 2 = This option will update the display screen in the :
  2891. ; proper format with the input buffer characters :
  2892. ; starting at the specified left offset character :
  2893. ; to the right character marker. :
  2894. ; :
  2895. ; BX = Number of bytes to insert starting at the specified :
  2896. ; character position. :
  2897. ; :
  2898. ; WR_CATTR = Logical color attribute to use when updating screen :
  2899. ; if the use of the color attribute string is not :
  2900. ; specified. :
  2901. ; :
  2902. ; CR_RCOFF = Beginning offset of the upper left input field :
  2903. ; display corner from the beginning of the video :
  2904. ; buffer. :
  2905. ; :
  2906. ; CR_SCRWIDTH = Width of the video buffer in characters and :
  2907. ; attributes. :
  2908. ; :
  2909. ; WR_LEFTCHAR = The offset into the input buffer, in characters, :
  2910. ; of where the specified bytes should fit. :
  2911. ; :
  2912. ; WR_RIGHTCHAR = The offset into the input buffer, in characters, :
  2913. ; of where the right most character position. :
  2914. ; :
  2915. ; :
  2916. ; Exit: If AX on entry is set to 1 then on exit: :
  2917. ; :
  2918. ; AX 0 = The specified number of characters will fit. :
  2919. ; 1 = The specified number of characters will not fit. :
  2920. ; :
  2921. ; WR_LEFTBYTE = The offset into the input buffer, in bytes, of the :
  2922. ; left most character position. :
  2923. ; :
  2924. ; WR_RIGHTBYTE = The offset into the input buffer, in bytes, of the :
  2925. ; right most character position. :
  2926. ; :
  2927. ; :
  2928. ; If AX on entry is set to 2 then the input field buffer is :
  2929. ; displayed on the screen. :
  2930. ; :
  2931. ;-----------------------------------------------------------------------------+
  2932. ;
  2933. LEFT_DISP PROC NEAR
  2934. ;
  2935. PUSH ES ;save PB pointers
  2936. PUSH DI
  2937. PUSH BX
  2938. PUSH [DI]+CR_RCOFF ;save input field display offset
  2939. ;
  2940. CALL LEFT_DISP_INIT ;initialize internal counter & vars ;=W
  2941. ;
  2942. JMP LF20 ;begin of first row
  2943. ;
  2944. ; Start a new row in LVB
  2945. ;
  2946. LF10: MOV AX,[DI]+CR_RCOFF ;set ptr into LVB to next row.
  2947. ADD AX,[DI]+CR_SCRWIDTH ; Start with current position in
  2948. SUB AX,ES:[SI]+ICB_WIDTH ; LVB, add screen width in text
  2949. SUB AX,ES:[SI]+ICB_WIDTH ; and attributes, then subtract
  2950. MOV [DI]+CR_RCOFF,AX ; the length of the input field
  2951. ; twice since length is just in
  2952. ; text chars
  2953. ;
  2954. ; Do not start new row
  2955. ;
  2956. LF20: MOV AX,ES:[SI]+ICB_WIDTH ;counter contains number of bytes
  2957. MOV [DI]+WR_CNTR2,AX ; available in current row of
  2958. ; input field
  2959. ;
  2960. ; Prepare to place next byte into LVB, verify chars remaining in input buffer
  2961. ;
  2962. LF30: MOV AX,[DI]+WR_CNTR3 ;check if last character has been
  2963. CMP [DI]+WR_RIGHTCHAR,AX ; written in LVB (rightmost)
  2964. JGE LF40 ;if not last char jump ?
  2965. ;
  2966. JMP LF160 ;yes, last character written
  2967. ; prepare to exit
  2968. ;
  2969. ; Check if end of field on display has been reached
  2970. ;
  2971. LF40: MOV AX,ES:[SI]+ICB_FIELDLEN ;loop if number chars moved is
  2972. CMP [DI]+WR_CNTR1,AX ; less than input buffer length
  2973. JLE LF50 ;
  2974. ;
  2975. JMP LF160
  2976. ;
  2977. ; Not complete
  2978. ;
  2979. LF50: CMP [DI]+WR_CNTR2,0 ;loop while number of bytes
  2980. JE LF10 ; remaining in the row is greater
  2981. ; than zero, jump if bytes avail
  2982. ;
  2983. CMP [DI]+WR_MOVE,1 ;check if entry option is to
  2984. JNE LF60 ; determine if bytes may be
  2985. ; inserted in displayed field
  2986. ;
  2987. MOV AX,[DI]+WR_LEFTCHAR ;check if insertion calculations
  2988. CMP [DI]+WR_CNTR3,AX ; should begin by comparing
  2989. JNE LF60 ; current counter with beginning
  2990. ; left character marker
  2991. ;
  2992. MOV AL,1 ;check if insertion calculations
  2993. CMP [DI]+WR_INSDONE,AL ; are complete
  2994. JE LF60 ;if yes, jump
  2995. ;
  2996. ; Adjust counters after pretending to insert a character into string and LVB
  2997. ;
  2998. MOV AX,[DI]+WR_BYTESINST ;dec number bytes avail in row
  2999. ADD [DI]+WR_CNTR1,AX ;inc number bytes moved into LVB
  3000. SUB [DI]+WR_CNTR2,AX ;dec number bytes remaining in row
  3001. MOV [DI]+WR_INSDONE,1 ;set flag indicating insert calc
  3002. JMP LF30 ; complete
  3003. ;
  3004. ; Determine if current byte is a DBCS lead byte
  3005. ;
  3006. LF60: MOV BX,[DI]+WR_FIELDOFF ;get the current byte in the
  3007. ;
  3008. PUSH ES ;save registers
  3009. PUSH SI
  3010. ;
  3011. PUSH ES:[SI]+ICB_FIELDSEG ; input field buffer
  3012. PUSH [DI]+WR_FIELDOFF ;get the current byte in the
  3013. POP SI
  3014. POP ES
  3015. ;
  3016. MOV AL,ES:[SI] ;get character in input buffer
  3017. ;
  3018. POP SI ;restore registers
  3019. POP ES
  3020. ;
  3021. MOV [DI]+DBC_KS,AL
  3022. ;
  3023. CALL PCINDBC_CALL ;call routine to check if char
  3024. ; is lead double byte char
  3025. ;
  3026. TEST [DI]+DBC_STAT,DBC_DBCS ;check if char is lead DBCS
  3027. JNE LF70 ;if yes, jump to double byte code
  3028. ;
  3029. JMP LF130 ;if no, jump to single byte code
  3030. ;
  3031. ; Current byte is leading byte of a double byte character
  3032. ;
  3033. LF70: CMP [DI]+WR_CNTR2,1 ;check if there is room in current
  3034. JNE LF80 ; row for double byte character
  3035. ;
  3036. JMP LF110 ;no room, adjust to next row
  3037. ;
  3038. ; Double byte character fits on current row
  3039. ;
  3040. LF80: CMP [DI]+WR_MOVE,2 ;check if option to actually
  3041. JNE LF100 ; update display is active
  3042. ;
  3043. MOV AX,[DI]+WR_LEFTCHAR ;check if character should be
  3044. CMP [DI]+WR_CNTR3,AX ; displayed by verifying that
  3045. JL LF100 ; current character falls
  3046. ; between the left and right
  3047. MOV AX,[DI]+WR_RIGHTCHAR ; character markers
  3048. CMP [DI]+WR_CNTR3,AX
  3049. JG LF100
  3050. ;
  3051. MOV AX,[DI]+WR_FIELDOFF ;get offset of character(s)
  3052. MOV [DI]+MG_TEXTOFF,AX ; to display
  3053. ;
  3054. MOV [DI]+MG_OPT,MG_WA+MG_SC ;set write attribute option
  3055. ;
  3056. TEST ES:[SI]+ICB_OPT1,ICB_USC ;use attribute string
  3057. JNE LF84
  3058. ;
  3059. OR [DI]+MG_OPT,MG_UA ;set use logical attribute option
  3060. ;
  3061. LF84: TEST ES:[SI]+ICB_OPT1,ICB_PSW ;is option for password write
  3062. JNE LF85 ; active
  3063. ;
  3064. OR [DI]+MG_OPT,MG_WC ;set write character option
  3065. ;
  3066. LF85: MOV [DI]+MG_NUM,2 ;number of words to move into LVB
  3067. MOV AX,[DI]+IN_LVBOFF ;set actual offset into LVB
  3068. ADD AX,[DI]+CR_RCOFF ; where character(s) will be
  3069. MOV [DI]+MG_MIXOFF,AX ; written
  3070. ;
  3071. CALL PCMOVEG_CALL ;call PCMOVEG to write characters
  3072. ;
  3073. ; Adjust pointers and counters after moving double byte character
  3074. ;
  3075. LF100: MOV AX,[DI]+WR_CNTR3 ;LEFT returns the right and left
  3076. CMP AX,[DI]+WR_LEFTCHAR ; byte positions of the right and
  3077. JNE LF104 ; left chars. See if the current
  3078. ;
  3079. MOV AX,[DI]+WR_CNTR4 ; char is the left char, if so
  3080. MOV [DI]+WR_LEFTBYTE,AX ; store the byte offset, WR_CNTR4,
  3081. JMP LF106 ; into WR_LEFTBYTE
  3082. ;
  3083. ; Update right byte marker
  3084. ;
  3085. LF104: MOV AX,[DI]+WR_CNTR3 ;LEFT returns the right and left
  3086. CMP AX,[DI]+WR_RIGHTCHAR ; byte positions of the right and
  3087. JNE LF106 ; left chars. See if the current
  3088. ;
  3089. MOV AX,[DI]+WR_CNTR4 ; char is the right char, if so
  3090. MOV [DI]+WR_RIGHTBYTE,AX ; store the byte offset, WR_CNTR4,
  3091. ; into WR_RIGHTBYTE
  3092. ;
  3093. LF106: ADD [DI]+WR_FIELDOFF,2 ;inc number bytes moved from input
  3094. ; buffer
  3095. ADD [DI]+CR_RCOFF,4 ;inc pointer into LVB
  3096. ADD [DI]+WR_CNTR1,2 ;inc number of bytes moved into
  3097. ; LVB
  3098. SUB [DI]+WR_CNTR2,2 ;dec number of bytes remain
  3099. INC [DI]+WR_CNTR3 ;inc number of characters moved
  3100. ; into LVB from input string
  3101. ADD [DI]+WR_CNTR4,2 ;inc number of bytes moved from
  3102. JMP LF30 ; input string
  3103. ;
  3104. ; Blank fill remaining screen character positions on current row to prevent
  3105. ; double byte character from being split
  3106. ;
  3107. LF110: CMP [DI]+WR_MOVE,2 ;check if option to update display
  3108. JNE LF120 ; is active
  3109. ;
  3110. MOV AX,[DI]+WR_LEFTCHAR ;check if current character
  3111. CMP [DI]+WR_CNTR3,AX ; should be displayed by verifying
  3112. JL LF120 ; that the character falls
  3113. ; within the left and right
  3114. MOV AX,[DI]+WR_RIGHTCHAR ; character markers
  3115. CMP [DI]+WR_CNTR3,AX
  3116. JG LF120
  3117. ;
  3118. MOV AL,WR_BLANK ;get blanking character
  3119. MOV [DI]+MG_SOURCE_C,AL
  3120. ;
  3121. MOV [DI]+MG_OPT,MG_WA+MG_SC+MG_UC
  3122. ;set write attr, char and syn chk
  3123. TEST ES:[SI]+ICB_OPT1,ICB_USC
  3124. JNE LF114 ;use attribute string
  3125. ;
  3126. OR [DI]+MG_OPT,MG_UA ;set use logical attribute option
  3127. ;
  3128. LF114: TEST ES:[SI]+ICB_OPT1,ICB_PSW ;check if password option active
  3129. JNE LF115
  3130. ;
  3131. OR [DI]+MG_OPT,MG_WC ;set write character option
  3132. ;
  3133. LF115: MOV [DI]+MG_NUM,1 ;number of words to move into the
  3134. ; LVB
  3135. MOV AX,[DI]+IN_LVBOFF ;set the actual LVB offset of
  3136. ADD AX,[DI]+CR_RCOFF ; the character to write
  3137. MOV [DI]+MG_MIXOFF,AX
  3138. ;
  3139. CALL PCMOVEG_CALL ;call PCMOVEG to write the char(s)
  3140. ;
  3141. ; Adjust pointers and counters after writing blanking character to LVB
  3142. ;
  3143. LF120: ADD [DI]+CR_RCOFF,2 ;inc pointer into the LVB
  3144. INC [DI]+WR_CNTR1 ;inc number of bytes moved into
  3145. ; the LVB
  3146. DEC [DI]+WR_CNTR2 ;dec number of bytes remaining in
  3147. JMP LF10 ; the current row
  3148. ;
  3149. ; Byte is a single byte character
  3150. ;
  3151. LF130: CMP [DI]+WR_MOVE,2 ;check if option to update display
  3152. JNE LF150 ; is active
  3153. ;
  3154. MOV AX,[DI]+WR_LEFTCHAR ;check if current character
  3155. CMP [DI]+WR_CNTR3,AX ; should be displayed by verifying
  3156. JL LF150 ; that the character falls
  3157. ;
  3158. MOV AX,[DI]+WR_RIGHTCHAR ; character markers
  3159. CMP [DI]+WR_CNTR3,AX
  3160. JG LF150
  3161. ;
  3162. MOV AX,[DI]+WR_FIELDOFF ;get offset of character(s)
  3163. MOV [DI]+MG_TEXTOFF,AX ; to display
  3164. ;
  3165. MOV [DI]+MG_OPT,MG_WA+MG_SC+MG_UA
  3166. ;set write attribute option
  3167. ;set use logical attribute option
  3168. TEST ES:[SI]+ICB_OPT1,ICB_PSW ;check if password option active
  3169. JNE LF135
  3170. ;
  3171. OR [DI]+MG_OPT,MG_WC ;set write character option
  3172. ;
  3173. LF135: MOV [DI]+MG_NUM,1 ;number of words to move into the
  3174. ; LVB
  3175. ;
  3176. MOV AX,[DI]+IN_LVBOFF ;set the actual LVB offset of
  3177. ADD AX,[DI]+CR_RCOFF ; the character to write
  3178. MOV [DI]+MG_MIXOFF,AX
  3179. ;
  3180. CALL PCMOVEG_CALL ;call PCMOVEG to write the char(s)
  3181. ;
  3182. ; Adjust pointers and counters after moving single byte character
  3183. ;
  3184. LF150: MOV AX,[DI]+WR_CNTR3 ;LEFT returns the right and left
  3185. CMP AX,[DI]+WR_LEFTCHAR ; byte positions of the right and
  3186. JNE LF154 ; left chars. See if the current
  3187. ;
  3188. MOV AX,[DI]+WR_CNTR4 ; char is the left char, if so
  3189. MOV [DI]+WR_LEFTBYTE,AX ; store the byte offset, WR_CNTR4,
  3190. JMP LF156 ; into WR_LEFTBYTE
  3191. ;
  3192. ; Update right byte marker
  3193. ;
  3194. LF154: MOV AX,[DI]+WR_CNTR3 ;LEFT returns the right and left
  3195. CMP AX,[DI]+WR_RIGHTCHAR ; byte positions of the right and
  3196. JNE LF156 ; left chars. See if the current
  3197. ;
  3198. MOV AX,[DI]+WR_CNTR4 ; char is the right char, if so
  3199. MOV [DI]+WR_RIGHTBYTE,AX ; store the byte offset, WR_CNTR4,
  3200. ; into WR_RIGHTBYTE
  3201. ;
  3202. LF156: INC [DI]+WR_FIELDOFF ;inc pointer input buffer
  3203. ADD [DI]+CR_RCOFF,2 ;inc pointer into LVB
  3204. INC [DI]+WR_CNTR1 ;inc counter with number bytes
  3205. ; moved into LVB
  3206. DEC [DI]+WR_CNTR2 ;dec counter with number of bytes
  3207. ; remaining in current row
  3208. ADD [DI]+WR_CNTR3,1 ;inc counter with number of chars
  3209. ; moved into the LVB from input
  3210. ; buffer
  3211. ADD [DI]+WR_CNTR4,1 ;inc counter with number of bytes
  3212. JMP LF30 ; moved into the LVB from input
  3213. ; buffer
  3214. ;
  3215. ; Completed updating LVB, adjust pointers
  3216. ;
  3217. LF160: CMP [DI]+WR_MOVE,1 ;Check if option to calculate
  3218. JNE LFEXIT ; if chars fit in buffer
  3219. ;
  3220. ; Set up proper return values for insert calculation
  3221. ;
  3222. MOV AX,1 ;set flag indicating insert did
  3223. ; not fit
  3224. MOV BX,[DI]+WR_CNTR3 ;see if input field fit into LVB
  3225. DEC BX ; by comparing the right char
  3226. CMP [DI]+WR_RIGHTCHAR,BX ; number with the number of chars
  3227. JNE LFEXIT ; moved into the LVB. If they
  3228. ; are equal the string fit into
  3229. ; the LVB.
  3230. CMP [DI]+WR_INSDONE,1 ;see if insert has been done
  3231. JE LF170 ;if yes set up return values
  3232. ;
  3233. MOV BX,ES:[SI]+ICB_FIELDLEN ;if no, then insert is at end of
  3234. SUB BX,[DI]+WR_CNTR1 ; line i.e. past right char
  3235. INC BX ;see if there is enough room left
  3236. CMP BX,[DI]+WR_BYTESINST ; to display char being inserted
  3237. JL LFEXIT
  3238. ;
  3239. LF170: MOV AX,0 ;set flag indicating insert fits
  3240. ;
  3241. ; Restores the registers to entry values and exits
  3242. ;
  3243. LFEXIT: POP [DI]+CR_RCOFF ;save input field display offset
  3244. ;
  3245. POP BX ;restore registers
  3246. POP DI
  3247. POP ES
  3248. ;
  3249. RET
  3250. LEFT_DISP ENDP
  3251. ;
  3252. PAGE
  3253. ;-----------------------------------------------------------------------------+ ;=W
  3254. ; : ;=W
  3255. ; LEFTS_DISP (no double byte support) : ;=W
  3256. ; : ;=W
  3257. ; Calculates if the specified character will fit in the input : ;=W
  3258. ; buffer at the specified character position without display. : ;=W
  3259. ; The byte offset where this character should be inserted is : ;=W
  3260. ; returned or a flag indicating that the character will not fit. : ;=W
  3261. ; : ;=W
  3262. ; Displays the specified portion of the input field buffer from : ;=W
  3263. ; the left character marker to the end of the field. The following : ;=W
  3264. ; display options are handled by this routine: : ;=W
  3265. ; : ;=W
  3266. ; - Display of the input field in a wrapped window : ;=W
  3267. ; - Adjustment of double byte characters to prevent malformed : ;=W
  3268. ; characters : ;=W
  3269. ; : ;=W
  3270. ; : ;=W
  3271. ; The following pointers are used: : ;=W
  3272. ; : ;=W
  3273. ; (ICB_FIELDSEG:ICB_FIELDOFF) Beginning address of input : ;=W
  3274. ; buffer in memory. : ;=W
  3275. ; : ;=W
  3276. ; (WR_LEFTCHAR) Left marker delimiting the left : ;=W
  3277. ; most character position in the : ;=W
  3278. ; input buffer. : ;=W
  3279. ; : ;=W
  3280. ; Right marker delimiting the right : ;=W
  3281. ; most character position in the : ;=W
  3282. ; input buffer. (WR_RIGHTCHAR) : ;=W
  3283. ; : ;=W
  3284. ; Ŀ : ;=W
  3285. ; S L T L T S L T S S S S : ;=W
  3286. ; : ;=W
  3287. ; Ĵ : ;=W
  3288. ; Area to display : ;=W
  3289. ; : ;=W
  3290. ; : ;=W
  3291. ; ICB_FIELDLEN Length of input field in bytes. : ;=W
  3292. ; : ;=W
  3293. ; : ;=W
  3294. ; Entry: ES:SI = Points to current ICB : ;=W
  3295. ; DS:DI = Points to PB : ;=W
  3296. ; : ;=W
  3297. ; AX 1 = This option will calculate if the specified number : ;=W
  3298. ; of bytes in BX can fit into input buffer at the : ;=W
  3299. ; specified character position considering the display : ;=W
  3300. ; coordinates and options. No update of the display : ;=W
  3301. ; screen will occur. A flag indicating if the bytes : ;=W
  3302. ; can be inserted or not is returned. If the bytes : ;=W
  3303. ; will fit the offset from the beginning of the input : ;=W
  3304. ; field in bytes is returned indicating where the : ;=W
  3305. ; characters should be inserted. : ;=W
  3306. ; : ;=W
  3307. ; 2 = This option will update the display screen in the : ;=W
  3308. ; proper format with the input buffer characters : ;=W
  3309. ; starting at the specified left offset character : ;=W
  3310. ; to the right character marker. : ;=W
  3311. ; : ;=W
  3312. ; BX = Number of bytes to insert starting at the specified : ;=W
  3313. ; character position. : ;=W
  3314. ; : ;=W
  3315. ; WR_CATTR = Logical color attribute to use when updating screen : ;=W
  3316. ; if the use of the color attribute string is not : ;=W
  3317. ; specified. : ;=W
  3318. ; : ;=W
  3319. ; CR_RCOFF = Beginning offset of the upper left input field : ;=W
  3320. ; display corner from the beginning of the video : ;=W
  3321. ; buffer. : ;=W
  3322. ; : ;=W
  3323. ; CR_SCRWIDTH = Width of the video buffer in characters and : ;=W
  3324. ; attributes. : ;=W
  3325. ; : ;=W
  3326. ; WR_LEFTCHAR = The offset into the input buffer, in characters, : ;=W
  3327. ; of where the specified bytes should fit. : ;=W
  3328. ; : ;=W
  3329. ; WR_RIGHTCHAR = The offset into the input buffer, in characters, : ;=W
  3330. ; of where the right most character position. : ;=W
  3331. ; : ;=W
  3332. ; : ;=W
  3333. ; Exit: If AX on entry is set to 1 then on exit: : ;=W
  3334. ; : ;=W
  3335. ; AX 0 = The specified number of characters will fit. : ;=W
  3336. ; 1 = The specified number of characters will not fit. : ;=W
  3337. ; : ;=W
  3338. ; WR_LEFTBYTE = The offset into the input buffer, in bytes, of the : ;=W
  3339. ; left most character position. : ;=W
  3340. ; : ;=W
  3341. ; WR_RIGHTBYTE = The offset into the input buffer, in bytes, of the : ;=W
  3342. ; right most character position. : ;=W
  3343. ; : ;=W
  3344. ; : ;=W
  3345. ; If AX on entry is set to 2 then the input field buffer is : ;=W
  3346. ; displayed on the screen. : ;=W
  3347. ; : ;=W
  3348. ;-----------------------------------------------------------------------------+ ;=W
  3349. ; ;=W
  3350. LEFTS_DISP PROC NEAR ;=W
  3351. ;
  3352. PUSH ES ;save PB pointers ;=W
  3353. PUSH DI ;=W
  3354. PUSH BX ;=W
  3355. PUSH [DI]+CR_RCOFF ;save input field display offset ;=W
  3356. ;
  3357. CALL LEFT_DISP_INIT ;initialize internal counters & vars ;=W
  3358. ;
  3359. JMP LS20 ;begin of first row ;=W
  3360. ; ;=W
  3361. ; Start a new row in LVB ;=W
  3362. ; ;=W
  3363. LS10: MOV AX,[DI]+CR_RCOFF ;set ptr into LVB to next row. ;=W
  3364. ADD AX,[DI]+CR_SCRWIDTH ; Start with current position in ;=W
  3365. SUB AX,ES:[SI]+ICB_WIDTH ; LVB, add screen width in text ;=W
  3366. SUB AX,ES:[SI]+ICB_WIDTH ; and attributes, then subtract ;=W
  3367. MOV [DI]+CR_RCOFF,AX ; the length of the input field ;=W
  3368. ; twice since length is just in ;=W
  3369. ; text chars ;=W
  3370. ; ;=W
  3371. ; Do not start new row ;=W
  3372. ; ;=W
  3373. LS20: MOV AX,ES:[SI]+ICB_WIDTH ;counter contains number of bytes ;=W
  3374. MOV [DI]+WR_CNTR2,AX ; available in current row of ;=W
  3375. ; input field ;=W
  3376. ; ;=W
  3377. ; Prepare to place next byte into LVB, verify chars remaining in input buffer ;=W
  3378. ; ;=W
  3379. LS30: MOV AX,[DI]+WR_CNTR3 ;check if last character has been ;=W
  3380. CMP [DI]+WR_RIGHTCHAR,AX ; written in LVB (rightmost) ;=W
  3381. JGE LS40 ;if not last char jump ? ;=W
  3382. ;
  3383. JMP LS160 ;yes, last character written ;=W
  3384. ; prepare to exit ;=W
  3385. ; ;=W
  3386. ; Check if end of field on display has been reached ;=W
  3387. ; ;=W
  3388. LS40: MOV AX,ES:[SI]+ICB_FIELDLEN ;loop if number chars moved is ;=W
  3389. CMP [DI]+WR_CNTR1,AX ; less than input buffer length ;=W
  3390. JLE LS50 ; ;=W
  3391. ;
  3392. JMP LS160 ;=W
  3393. ; ;=W
  3394. ; Not complete ;=W
  3395. ; ;=W
  3396. LS50: CMP [DI]+WR_CNTR2,0 ;loop while number of bytes ;=W
  3397. JE LS10 ; remaining in the row is greater ;=W
  3398. ; than zero, jump if bytes avail ;=W
  3399. ;
  3400. CMP [DI]+WR_MOVE,1 ;check if entry option is to ;=W
  3401. JNE LS130 ; determine if bytes may be ;=W
  3402. ; inserted in displayed field ;=W
  3403. ;
  3404. MOV AX,[DI]+WR_LEFTCHAR ;check if insertion calculations ;=W
  3405. CMP [DI]+WR_CNTR3,AX ; should begin by comparing ;=W
  3406. JNE LS130 ; current counter with beginning ;=W
  3407. ; left character marker ;=W
  3408. ;
  3409. MOV AL,1 ;check if insertion calculations ;=W
  3410. CMP [DI]+WR_INSDONE,AL ; are complete ;=W
  3411. JE LS130 ;if yes, jump ;=W
  3412. ; ;=W
  3413. ; Adjust counters after pretending to insert a character into string and LVB ;=W
  3414. ; ;=W
  3415. MOV AX,[DI]+WR_BYTESINST ;dec number bytes avail in row ;=W
  3416. ADD [DI]+WR_CNTR1,AX ;inc number bytes moved into LVB ;=W
  3417. SUB [DI]+WR_CNTR2,AX ;dec number bytes remaining in row ;=W
  3418. MOV [DI]+WR_INSDONE,1 ;set flag indicating insert calc ;=W
  3419. JMP LS30 ; complete ;=W
  3420. ; ;=W
  3421. ; Byte is a single byte character ;=W
  3422. ; ;=W
  3423. LS130: CMP [DI]+WR_MOVE,2 ;check if option to update display ;=W
  3424. JNE LS150 ; is active ;=W
  3425. ;
  3426. MOV AX,[DI]+WR_LEFTCHAR ;check if current character ;=W
  3427. CMP [DI]+WR_CNTR3,AX ; should be displayed by verifying ;=W
  3428. JL LS150 ; that the character falls ;=W
  3429. ; within the left and right ;=W
  3430. MOV AX,[DI]+WR_RIGHTCHAR ; character markers ;=W
  3431. CMP [DI]+WR_CNTR3,AX ;=W
  3432. JG LS150 ;=W
  3433. ;
  3434. MOV AX,[DI]+WR_FIELDOFF ;get offset of character(s) ;=W
  3435. MOV [DI]+MG_TEXTOFF,AX ; to display ;=W
  3436. ;
  3437. MOV [DI]+MG_OPT,MG_WA+MG_SC+MG_UA ;=W
  3438. ;set write attribute option ;=W
  3439. ;set use logical attribute option ;=W
  3440. TEST ES:[SI]+ICB_OPT1,ICB_PSW ;check if password option active ;=W
  3441. JNE LS135 ;=W
  3442. ;
  3443. OR [DI]+MG_OPT,MG_WC ;set write character option ;=W
  3444. ;
  3445. LS135: MOV [DI]+MG_NUM,1 ;number of words to move into the ;=W
  3446. ; LVB ;=W
  3447. ;
  3448. MOV AX,[DI]+IN_LVBOFF ;set the actual LVB offset of ;=W
  3449. ADD AX,[DI]+CR_RCOFF ; the character to write ;=W
  3450. MOV [DI]+MG_MIXOFF,AX ;=W
  3451. ;
  3452. CALL PCMOVEG_CALL ;call PCMOVEG to write the char(s) ;=W
  3453. ; ;=W
  3454. ; Adjust pointers and counters after moving single byte character ;=W
  3455. ; ;=W
  3456. LS150: MOV AX,[DI]+WR_CNTR3 ;LEFT returns the right and left ;=W
  3457. CMP AX,[DI]+WR_LEFTCHAR ; byte positions of the right and ;=W
  3458. JNE LS154 ; left chars. See if the current ;=W
  3459. ;
  3460. MOV AX,[DI]+WR_CNTR4 ; char is the left char, if so ;=W
  3461. MOV [DI]+WR_LEFTBYTE,AX ; store the byte offset, WR_CNTR4, ;=W
  3462. JMP LS156 ; into WR_LEFTBYTE ;=W
  3463. ; ;=W
  3464. ; Update right byte marker ;=W
  3465. ; ;=W
  3466. LS154: MOV AX,[DI]+WR_CNTR3 ;LEFT returns the right and left ;=W
  3467. CMP AX,[DI]+WR_RIGHTCHAR ; byte positions of the right and ;=W
  3468. JNE LS156 ; left chars. See if the current ;=W
  3469. ;
  3470. MOV AX,[DI]+WR_CNTR4 ; char is the right char, if so ;=W
  3471. MOV [DI]+WR_RIGHTBYTE,AX ; store the byte offset, WR_CNTR4, ;=W
  3472. ; into WR_RIGHTBYTE ;=W
  3473. LS156: INC [DI]+WR_FIELDOFF ;inc pointer input buffer ;=W
  3474. ADD [DI]+CR_RCOFF,2 ;inc pointer into LVB ;=W
  3475. INC [DI]+WR_CNTR1 ;inc counter with number bytes ;=W
  3476. ; moved into LVB ;=W
  3477. DEC [DI]+WR_CNTR2 ;dec counter with number of bytes ;=W
  3478. ; remaining in current row ;=W
  3479. ADD [DI]+WR_CNTR3,1 ;inc counter with number of chars ;=W
  3480. ; moved into the LVB from input ;=W
  3481. ; buffer ;=W
  3482. ADD [DI]+WR_CNTR4,1 ;inc counter with number of bytes ;=W
  3483. JMP LS30 ; moved into the LVB from input ;=W
  3484. ; buffer ;=W
  3485. ; ;=W
  3486. ; Completed updating LVB, adjust pointers ;=W
  3487. ; ;=W
  3488. LS160: CMP [DI]+WR_MOVE,1 ;Check if option to calculate ;=W
  3489. JNE LSEXIT ; if chars fit in buffer ;=W
  3490. ; ;=W
  3491. ; Set up proper return values for insert calculation ;=W
  3492. ; ;=W
  3493. MOV AX,1 ;set flag indicating insert did ;=W
  3494. ; not fit ;=W
  3495. MOV BX,[DI]+WR_CNTR3 ;see if input field fit into LVB ;=W
  3496. DEC BX ; by comparing the right char ;=W
  3497. CMP [DI]+WR_RIGHTCHAR,BX ; number with the number of chars ;=W
  3498. JNE LSEXIT ; moved into the LVB. If they ;=W
  3499. ; are equal the string fit into ;=W
  3500. ; the LVB. ;=W
  3501. CMP [DI]+WR_INSDONE,1 ;see if insert has been done ;=W
  3502. JE LS170 ;if yes set up return values ;=W
  3503. ;
  3504. MOV BX,ES:[SI]+ICB_FIELDLEN ;if no, then insert is at end of ;=W
  3505. SUB BX,[DI]+WR_CNTR1 ; line i.e. past right char ;=W
  3506. INC BX ;see if there is enough room left ;=W
  3507. CMP BX,[DI]+WR_BYTESINST ; to display char being inserted ;=W
  3508. JL LSEXIT ;=W
  3509. ;
  3510. LS170: MOV AX,0 ;set flag indicating insert fits ;=W
  3511. ; ;=W
  3512. ; Restores the registers to entry values and exits ;=W
  3513. ; ;=W
  3514. LSEXIT: POP [DI]+CR_RCOFF ;save input field display offset ;=W
  3515. ;
  3516. POP BX ;restore registers ;=W
  3517. POP DI ;=W
  3518. POP ES ;=W
  3519. ;
  3520. RET ;=W
  3521. LEFTS_DISP ENDP ;=W
  3522. ;
  3523. PAGE
  3524. ;-----------------------------------------------------------------------------+ ;=W
  3525. ; : ;=W
  3526. ; DRAW_DEM : ;=W
  3527. ; Draw a input field delimiter : ;=W
  3528. ; : ;=W
  3529. ; Entry: : ;=W
  3530. ; ES:SI address of icon : ;=W
  3531. ; GC_ROW - character row to display delimiter : ;=W
  3532. ; GC_COL - character column to display delimiter : ;=W
  3533. ; : ;=W
  3534. ; Exit: None : ;=W
  3535. ; : ;=W
  3536. ;-----------------------------------------------------------------------------+ ;=W
  3537. DRAW_DEM PROC NEAR ;=W
  3538. ;
  3539. PUSH AX ;=W
  3540. PUSH BX ;=W
  3541. PUSH CX ;=W
  3542. PUSH DX ;=W
  3543. PUSH DI ;=W
  3544. PUSH SI ;=W
  3545. PUSH DS ;=W
  3546. PUSH ES ;=W
  3547. PUSH BP ;=W
  3548. ;
  3549. MOV BP,AX
  3550. ;
  3551. MOV DX,300H + graph_addr ;=W
  3552. MOV AH,2 ; Write Mode 2 ;=W
  3553. MOV AL,5 ; Write Mode Register ;=W
  3554. OUT DX,AX ;=W
  3555. ;
  3556. MOV DL,seq_addr ;=W
  3557. MOV AH,0FFH ;enable all maps ;=W
  3558. MOV AL,s_map ;map mask ;=W
  3559. OUT DX,AX ;set the registers ;=W
  3560. ;
  3561. MOV AX,[DI]+WR_ROWBYTES ;=W
  3562. MOV BX,50H ;=W
  3563. MUL BX ;=W
  3564. ;=W
  3565. MOV BX,[DI]+GC_ROW ;=W
  3566. MUL BX ;=W
  3567. ADD AX,[DI]+GC_COL ;=W
  3568. ;
  3569. MOV BH,[DI]+WR_CATTR ;get current color attribute ;=W
  3570. ;
  3571. CMP [DI]+WR_VIDMODE,11H ;check for graphics mode 11H
  3572. JNE DD05 ;nop, continue
  3573. MOV BH,0FH ;yes, mode 11 is only black &
  3574. ;
  3575. DD05: MOV CL,4 ;count for shift ;=W
  3576. SHR BX,CL ;separate background/foreground ;=W
  3577. MOV CL,4 ;count for shift ;=W
  3578. SHR BL,CL ;put in low order nibble ;=W
  3579. XCHG BL,BH ;foreground/background are reversed ;=W
  3580. ; for delimiter
  3581. ; BL = background color, BH = foreground color
  3582. CMP BP,02 ;check if we want to remove delimiters ;=W
  3583. JNE DD10 ;no, ok ;=W
  3584. MOV BH,BL ;make both background color ;=W
  3585. ;=W
  3586. DD10: ;=W
  3587. MOV CL,[DI]+WR_VIDMODE ;=W
  3588. MOV DX,[DI]+IN_OPT
  3589. ;
  3590. PUSH ES ;make DS:SI point to bit maps ;=W
  3591. POP DS ;=W
  3592. ;
  3593. MOV DI,AX ;=W
  3594. MOV AX,0A000H ;=W
  3595. MOV ES,AX ;=W
  3596. ;
  3597. TEST DX,IN_MCGA ;mode 11H, non-VGA hardware?
  3598. JNE DD100 ;if so, go do it
  3599. ;--------------------------------------------- ;=W
  3600. ; Mode 10,11,12 with VGA : ;=W
  3601. ;--------------------------------------------- ;=W
  3602. MOV DX,300H + graph_addr ;graphics chip ;=W
  3603. XOR CH,CH ;=W
  3604. ;
  3605. MOV AL,CL ;save vid mode
  3606. MOV CL,0EH ;# pixel rows in delimiter ;=W
  3607. CMP AL,10H ;are we in graphics mode 10H
  3608. JE DD40 ;yes, # rows ok
  3609. ADD CL,2 ;no, mode 11,12 have 16 pixel rows
  3610. DD40: ; instead of 14 pixel rows.
  3611. MOV BP,02H ;# pixel columns/8 in delimiter ;=W
  3612. ;
  3613. MOV AH,0FFH ;=W
  3614. MOV AL,g_bit_mask ;bit mask index ;=W
  3615. OUT DX,AX ;set bit mask ;=W
  3616. DD50: ;=W
  3617. PUSH CX ;=W
  3618. PUSH DI ;=W
  3619. MOV CX,BP ;=W
  3620. DD60: ;=W
  3621. MOV AH,0FFH ;background ;=W
  3622. MOV AL,g_bit_mask ;bit mask index ;=W
  3623. OUT DX,AX ;set bit mask ;=W
  3624. ;
  3625. MOV AL,ES:[DI] ;latch data ;=W
  3626. MOV ES:[DI],BH ;set the dot ;=W
  3627. ;
  3628. LODSB ;foreground ;=W
  3629. XCHG AL,AH ;=W
  3630. ;
  3631. MOV AL,g_bit_mask ;bit mask index ;=W
  3632. OUT DX,AX ;set bit mask ;=W
  3633. ;
  3634. MOV AL,ES:[DI] ;latch data ;=W
  3635. MOV ES:[DI],BL ;set the dot ;=W
  3636. ;
  3637. INC DI ;=W
  3638. LOOP DD60 ;=W
  3639. ;
  3640. POP DI ;=W
  3641. ADD DI,LINELEN ;=W
  3642. POP CX ;=W
  3643. LOOP DD50 ;=W
  3644. JMP DDEXIT ;=W
  3645. ;--------------------------------------------- ;=W
  3646. ; Mode 11H with no VGA : ;=W
  3647. ;--------------------------------------------- ;=W
  3648. DD100: XOR CH,CH
  3649. MOV CL,10H ;# pixel rows in delimiter
  3650. MOV BP,02H ;# of pixel columns in delimiter
  3651. DD110: PUSH CX
  3652. PUSH DI
  3653. ;
  3654. MOV CX,BP
  3655. ;
  3656. DD120: LODSB ;get icon row
  3657. ;
  3658. DD130: XOR AL,0FFH
  3659. MOV ES:[DI],AL ;set the dot
  3660. INC DI
  3661. LOOP DD120
  3662. ;
  3663. POP DI
  3664. ;
  3665. ADD DI,50H ;line length, 80
  3666. ;
  3667. POP CX
  3668. ;
  3669. LOOP DD110
  3670. ;
  3671. DDEXIT: POP BP
  3672. POP ES
  3673. POP DS
  3674. POP SI
  3675. POP DI
  3676. POP DX
  3677. POP CX
  3678. POP BX
  3679. POP AX
  3680. ;
  3681. RET
  3682. DRAW_DEM ENDP
  3683. ;
  3684. PAGE
  3685. ;-----------------------------------------------------------------------------+ ;=W
  3686. ; : ;=W
  3687. ; GET_MONO_DOS : ;=W
  3688. ; Get segment and offset of the DOS monocasing table and return it : ;=W
  3689. ; : ;=W
  3690. ; Entry: None : ;=W
  3691. ; : ;=W
  3692. ; Exit: None : ;=W
  3693. ; : ;=W
  3694. ;-----------------------------------------------------------------------------+ ;=W
  3695. GET_MONO_DOS PROC NEAR ;=W
  3696. ;
  3697. PUSH SI ;save registers ;=W
  3698. PUSH ES ;=W
  3699. PUSH DI ;=W
  3700. ;
  3701. MOV AH,65H ;extended country info ;=W
  3702. MOV AL,02H ;get uppercase table ptrs ;=W
  3703. MOV BX,-1 ;default code page ;=W
  3704. MOV DX,-1 ;default country id ;=W
  3705. MOV CX,05H ;# bytes returned ;=W
  3706. PUSH DS ;=W
  3707. POP ES ;ES:DI ptrs to return buffer ;=W
  3708. MOV DI,OFFSET WR_CUCHAR ;use as temp buffer ;=W
  3709. ;
  3710. INT 21H ;=W
  3711. ;
  3712. INC DI ;skip info id ;=W
  3713. MOV SI,DI ;we need DI so use SI ;=W
  3714. POP DI ;=W
  3715. ;
  3716. MOV AX,WORD PTR [SI] ;get DOS monocasing table offset ;=W
  3717. MOV [DI]+IN_MONOOFF,AX ;save it ;=W
  3718. ADD SI,2 ;=W
  3719. MOV AX,WORD PTR [SI] ;get DOS monocasing table segment ;=W
  3720. MOV [DI]+IN_MONOSEG,AX ;save it ;=W
  3721. ;
  3722. POP ES ;restore registers ;=W
  3723. POP SI ;=W
  3724. ;
  3725. RET ;=W
  3726. GET_MONO_DOS ENDP
  3727. ;
  3728. PAGE
  3729. ;-----------------------------------------------------------------------------+ ;=W
  3730. ; : ;=W
  3731. ; GET_DBCS : ;=W
  3732. ; Get segment and offset of the DOS double byte support table. : ;=W
  3733. ; : ;=W
  3734. ; Entry: DS:DI : ;=W
  3735. ; : ;=W
  3736. ; Exit: None : ;=W
  3737. ; : ;=W
  3738. ;-----------------------------------------------------------------------------+ ;=W
  3739. GET_DBCS PROC NEAR ;=W
  3740. ;
  3741. PUSH SI
  3742. PUSH ES ;=W
  3743. PUSH DI ;=W
  3744. PUSH DI ;=W
  3745. ;
  3746. MOV AH,65H ;get extended country info
  3747. MOV AL,07H ;get DBCS environment table
  3748. INT 21H ;DOS function call,vector returned
  3749. ; in ES:DI
  3750. POP SI ;ptr, SI -> IN_PB
  3751. INC DI ;skip over id byte returned
  3752. MOV AX,WORD PTR ES:[DI] ;get offset of DBCS table
  3753. MOV [DI]+IN_DBCSOFF,AX ;save it
  3754. ;
  3755. ADD DI,2 ;skip over offset to get segment
  3756. MOV BX,WORD PTR ES:[DI] ;get segment of DBCS table
  3757. MOV [DI]+IN_DBCSSEG,BX ;save it
  3758. ;
  3759. POP DI
  3760. ;
  3761. MOV SI,AX ;Point to DBCS table to get length
  3762. MOV ES,BX
  3763. MOV AX,WORD PTR ES:[SI]
  3764. MOV [DI]+IN_DBCSLEN,AX
  3765. ADD [DI]+IN_DBCSOFF,2 ;change offset to point to table
  3766. ;
  3767. POP ES
  3768. POP SI
  3769. ;
  3770. RET
  3771. GET_DBCS ENDP