]> wirehaze git hosting - MS-DOS.git/blob - v4.0/src/INC/PCINPUT.INC

wirehaze git hosting

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