summaryrefslogtreecommitdiff
path: root/v4.0/src/DEV/PRINTER/CPSFONT.ASM
diff options
context:
space:
mode:
authorGravatar Mark Zbikowski2024-04-25 21:24:10 +0100
committerGravatar Microsoft Open Source2024-04-25 22:32:27 +0000
commit2d04cacc5322951f187bb17e017c12920ac8ebe2 (patch)
tree80ee017efa878dfd5344b44249e6a241f2a7f6e2 /v4.0/src/DEV/PRINTER/CPSFONT.ASM
parentMerge pull request #430 from jpbaltazar/typoptbr (diff)
downloadms-dos-main.tar.gz
ms-dos-main.tar.xz
ms-dos-main.zip
MZ is back!HEADmain
Diffstat (limited to 'v4.0/src/DEV/PRINTER/CPSFONT.ASM')
-rw-r--r--v4.0/src/DEV/PRINTER/CPSFONT.ASM1961
1 files changed, 1961 insertions, 0 deletions
diff --git a/v4.0/src/DEV/PRINTER/CPSFONT.ASM b/v4.0/src/DEV/PRINTER/CPSFONT.ASM
new file mode 100644
index 0000000..74fa12b
--- /dev/null
+++ b/v4.0/src/DEV/PRINTER/CPSFONT.ASM
@@ -0,0 +1,1961 @@
1
2 PAGE ,132
3
4;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
5;;
6;; FILENAME: CPS Device Driver -- Font Parser
7;; MODULE NAME: CPSFONT
8;; TYPE: Font Parser Module
9;; LINK PROCEDURE: Link CPS+CPSSUB+CPSINT9+...+CPSINIT into .EXE format
10;; CPS must be first. CPSINIT must be last. Everything
11;; before CPSINIT will be resident.
12;; INCLUDE FILES:
13;; CPSPEQU.INC
14;;
15;;
16;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
17 ;;
18INCLUDE CPSPEQU.INC ;;
19 ;;
20;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
21 ;;
22CSEG SEGMENT PUBLIC 'CODE' ;;
23 ASSUME CS:CSEG ;;
24 ASSUME DS:NOTHING ;;
25 ;;
26PUBLIC FTABLE,FONT_PARSER ;;
27 ;;
28;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
29;;
30;; ************************************
31;; ** **
32;; ** Resident Code **
33;; ** **
34;; ************************************
35;;
36;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
37 ;;
38;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
39;;
40;; FONT_PARSER data
41;;
42;; -- Interface table : FTABLE
43;;
44;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
45FTABLE: FBUFS <0FFFFH,,,> ;; for temporary testing
46FTB1 FTBLK <,,,,,,,,,,,,> ;; -- at most 12 entries
47FTB2 FTBLK <,,,,,,,,,,,,> ;;
48FTB3 FTBLK <,,,,,,,,,,,,> ;;
49FTB4 FTBLK <,,,,,,,,,,,,> ;;
50FTB5 FTBLK <,,,,,,,,,,,,> ;;
51FTB6 FTBLK <,,,,,,,,,,,,> ;;
52FTB7 FTBLK <,,,,,,,,,,,,> ;;
53FTB8 FTBLK <,,,,,,,,,,,,> ;;
54FTB9 FTBLK <,,,,,,,,,,,,> ;;
55FTBa FTBLK <,,,,,,,,,,,,> ;;
56FTBb FTBLK <,,,,,,,,,,,,> ;;
57FTBc FTBLK <,,,,,,,,,,,,> ;;
58 ;;
59FP_ERROR DW 0000H ;; internal error register
60 ;;
61 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
62 ;; the followings are bytes accumulated
63 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
64FTAG_LEN EQU 8 ;; FILE TAGE in the font file header
65FTAG_COUNT DW 0000H ;;
66 ;;
67FTAG_PATTERN LABEL BYTE ;;
68 DB 0FFH ;;
69 DB 'FONT ' ;;
70 ;;
71 ;;
72 ;; POINTER in the font file header
73fptr_LOW LABEL WORD ;;
74fptr_LOL DB 00H ;; NEXT
75fptr_LOH DB 00H ;;
76fptr_HIGH LABEL WORD ;;
77fptr_HIL DB 00H ;;
78fptr_HIH DB 00H ;;
79 ;;
80 ;;
81 ;;
82ENTRY_WORD LABEL WORD ;;
83ENTRY_LOB DB 00H ;; ENTRY COUNT
84ENTRY_HIB DB 00H ;;
85NEXT_LOW LABEL WORD ;;
86NEXT_LOL DB 00H ;; NEXT
87NEXT_LOH DB 00H ;;
88NEXT_HIGH LABEL WORD ;;
89NEXT_HIL DB 00H ;;
90NEXT_HIH DB 00H ;;
91TYPE_WORD LABEL WORD ;;
92TYPE_LOB DB 00H ;; TYPE
93TYPE_HIB DB 00H ;;
94TID_CNT DW 00000H ;; TYPEID COUNT(0 to 8)
95TYPE_ID : DB ' ' ;; TYPEID
96CPG_WORD LABEL WORD ;;
97CPG_LOB DB 00H ;; CODE PAGE
98CPG_HIB DB 00H ;;
99FONT_LOW LABEL WORD ;;
100FONT_LOL DB 00H ;; FONT ADDRESS
101FONT_LOH DB 00H ;;
102FONT_HIGH LABEL WORD ;;
103FONT_HIL DB 00H ;;
104FONT_HIH DB 00H ;;
105;; the followings are contained in the font-block in the exact order & length
106MOD_WORD LABEL WORD ;;
107MOD_LOB DB 00H ;; MODIFIER
108MOD_HIB DB 00H ;;
109FONTS_WORD LABEL WORD ;;
110FONTS_LOB DB 00H ;; FONTS
111FONTS_HIB DB 00H ;;
112FDLEN_WORD LABEL WORD ;;
113FDLEN_LOB DB 00H ;; FONT DATA LENGTH
114FDLEN_HIB DB 00H ;;
115PRE_FONT_ND EQU ($-MOD_WORD) ;; used to update target for font data
116 ;; to follow. -- for NON-DISPLAY
117DISP_ROWS DB 00H ;; DISPLAY's parameters :
118DISP_COLS DB 00H ;; BOX SIZE
119DISP_X DB 00H ;; ASPECT RATIO
120DISP_Y DB 00H ;;
121COUNT_WORD LABEL WORD ;; NO. OF DISPLAY CHARACTERS
122COUNT_LOB DB 00H ;;
123COUNT_HIB DB 00H ;;
124PRE_FONT_D EQU ($-MOD_WORD) ;; used to update target for font data
125 ;; to follow. -- for DISPLAY
126 ;;
127PTR_SEL_WORD LABEL WORD ;;
128PTR_SELOB DB 00H ;;
129PTR_SEHIB DB 00H ;;
130PRE_FONT_P0 EQU ($-PTR_SELOB+PRE_FONT_ND) ;; to update target for font data
131 ;; to follow -- for PRINTER with
132 ;; selection type = 0.
133 ;;
134PTR_LEN_WORD LABEL WORD ;;
135PTR_LNLOB DB 00H ;;
136PTR_LNHIB DB 00H ;;
137PRE_FONT_P EQU ($-PTR_SELOB+PRE_FONT_ND) ;; to update target for font data
138 ;; to follow -- for PRINTER with
139 ;; selection type <> 0.
140 ;;
141 ;;
142;; also update STAGE_CASES and indexing constants
143 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
144 ;; the stage the parsing is in : ;;;;;
145 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
146 ;;
147STAGE_CASES LABEL WORD ;; the stage the parsing is in :
148 ;;
149 ;; *** INDEXED BY STAGE-INDEX
150 ;;
151 DW OFFSET ENTRYLO ;; 0
152 DW OFFSET ENTRYHI ;; 1
153 DW OFFSET NEXTLOL ;; 2
154 DW OFFSET NEXTLOH ;; 3
155 DW OFFSET NEXTHIL ;; 4
156 DW OFFSET NEXTHIH ;; 5
157 DW OFFSET TYPELO ;; 6
158 DW OFFSET TYPEHI ;; 7
159 DW OFFSET TYPEIDS ;; 8
160 DW OFFSET CPGLO ;; 9
161 DW OFFSET CPGHI ;; A
162 DW OFFSET FONTLOL ;; B
163 DW OFFSET FONTLOH ;; C
164 DW OFFSET FONTHIL ;; D
165 DW OFFSET FONTHIH ;; E
166 DW 00H ;; MATCH case -- end of SEARCH stages
167 DW 00H ;; SCAN case -- before PRE-FOUND stage
168 DW OFFSET MODLO ;; 11
169 DW OFFSET MODHI ;; 12
170 DW OFFSET FONTSLO ;; 13
171 DW OFFSET FONTSHI ;; 14
172 DW OFFSET FDLENLO ;; 15
173 DW OFFSET FDLENHI ;; 16 -- lead to FONT case,NON- DISPLAY
174 DW OFFSET DSPROWS ;; 17 -- DISPLAY only
175 DW OFFSET DSPCOLS ;; 18
176 DW OFFSET DSPX ;; 19
177 DW OFFSET DSPY ;; 1A
178 DW OFFSET DSPCOUNTLO ;; 1B
179 DW OFFSET DSPCOUNTHI ;; 1C -- lead to FONT case, DISPLAY
180 DW OFFSET PTRSELLO ;; 1D -- PRINTER only
181 DW OFFSET PTRSELHI ;; 1E
182 DW OFFSET PTRLENLO ;; 1F
183 DW OFFSET PTRLENHI ;; 20 -- lead to FONT case, PRINTER
184 DW 00H ;; FOUND case
185 DW 00H ;; GET_FONT case
186 DW 00H ;; PASS special stage
187 DW OFFSET FILETAG ;; 24
188 DW OFFSET fptrLOL ;; 25
189 DW OFFSET fptrLOH ;; 26
190 DW OFFSET fptrHIL ;; 27
191 DW OFFSET fptrHIH ;; 28
192 DW 00H ;; FPTR_SKIP_CASE
193 ;;
194 ;; The followings are individual stage
195STAGE_MAX EQU ($-STAGE_CASES)/2 ;; number of stages
196 ;;
197 ;; STAGE-INDEX
198 ;;
199 ;; **** INDEX TO STAGE_CASES ****
200ENTRY_LOX EQU 00H ;;
201ENTRY_HIX EQU 01H ;;
202NEXT_LOLX EQU 02H ;; NEXT
203NEXT_LOHX EQU 03H ;;
204NEXT_HILX EQU 04H ;;
205NEXT_HIHX EQU 05H ;;
206TYPE_LOBX EQU 06H ;; TYPE
207TYPE_HIBX EQU 07H ;;
208TYPE_IDX EQU 08H ;; TYPEID
209CPG_LOBX EQU 09H ;; CODE PAGE
210CPG_HIBX EQU 0AH ;;
211FONT_LOLX EQU 0BH ;; FONT ADDRESS
212FONT_LOHX EQU 0CH ;;
213FONT_HILX EQU 0DH ;;
214FONT_HIHX EQU 0EH ;;
215 ;; ------------------------------
216MATCHX EQU 0FH ;; MATCH is the end of SEARCH's stages
217SCANX EQU 10H ;; SCANX is before the PRE-FOUND stages
218 ;; ------------------------------
219MOD_LOBX EQU 11H ;; MODIFIER
220MOD_HIBX EQU 12H ;;
221FONTS_LOBX EQU 13H ;; FONTS
222FONTS_HIBX EQU 14H ;;
223FDLEN_LOBX EQU 15H ;; FONT DATA LENGTH
224FDLEN_HIBX EQU 16H ;;
225DISP_ROWSX EQU 17H ;; DISPLAY -- CHAR. SIZE
226DISP_COLSX EQU 18H ;;
227DISP_XX EQU 19H ;; DISPLAY -- ASPECT RATIO
228DISP_YX EQU 1AH ;;
229COUNT_LOBX EQU 1BH ;; DISPLAY -- COUNT
230COUNT_HIBX EQU 1CH ;;
231PTRSELLOX EQU 1DH ;;
232PTRSELHIX EQU 1EH ;;
233PTRLENLOX EQU 1FH ;;
234PTRLENHIX EQU 20H ;;
235 ;;
236 ;; ------------------------------
237FOUNDX EQU 21H ;; GET_FX is the end of PRE-FOUND stage
238GET_FX EQU 22H ;;
239 ;; ------------------------------
240PASSX EQU 23H ;; see pass_brk table
241 ;; ------------------------------
242FTAGX EQU 24H ;; RESTART ==> FILE TAG
243 ;;
244fptr_LOLX EQU 25H ;; POINTER in font file header
245fptr_LOHX EQU 26H ;;
246fptr_HILX EQU 27H ;;
247fptr_HIHX EQU 28H ;; ---------------------------------
248 ;;
249fptr_SKIPX EQU 29H ;; ==> ENTRY_LOX
250 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
251 ;; PASS -- to skip some bytes ;;;;;;
252 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
253 ;; the PASS mechanism is used to skip
254 ;; a number of bytes between two fields
255 ;; The numbers are tabulated in
256 ;; PASS_BRK table in the accumulative
257 ;; sum. The PASS_POSTX(and PASS_POSTXX)
258 ;; are used to tell what is the stage
259 ;; after all the bytes have skipped.
260 ;;
261PASS_POSTX DW STAGE_MAX ;; the stage after pass-stage
262 ;;
263FILE_OFFSET EQU 0BH ;; spaces to be skipped in font file :
264 ;; ( after TAG, before POINTER)
265 ;;
266PASS_CNT DW 0 ;;
267PASS_BRK LABEL WORD ;;
268 DW FILE_OFFSET ;; skip in the font file header
269 DW FILE_OFFSET+2 ;; pass header-length, needs to reset
270 ;; PASS_CNT for each of the font_header
271 DW FILE_OFFSET+8 ;; pass header-reserved bytes
272PASS_INDX EQU ($-PASS_BRK)/2 ;;
273 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
274 ;; the control variables : ;;;;;;;;
275 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
276STAGE DW STAGE_MAX ;; of the STAGE-INDEX
277 ;;
278Pre_font_len DW 00000H ;; no. of bytes before the FONT DATA
279 ;;
280 ;;
281COUNT_LO DW 00000H ;; no. of bytes parsed so far
282COUNT_hI DW 00000H ;;
283 ;;
284HIT_LO DW 00000H ;; the next byte that is addressed by :
285HIT_HI DW 00000H ;; either NEXT or TARGET in FTBLK.
286 ;;
287HIT_FLAG DW 00000H ;; IF ZERO, the NEXT is approaching
288HIT_BX DW 00000H ;; where FTB is found for nearest hit
289 ;;
290NUM_FTB DW 00000H ;; as defined in the FP_BUFFER
291 ;;
292;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
293;;
294;; FONT_PARSER routine
295;;
296;; -- to be called at every packet received to extract informations
297;; from Font File on byte basis.
298;;
299;; -- Interface though FTABLE
300;;
301;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
302 ;;
303FONT_PARSER PROC ;;
304 PUSH DS ;; save all registers Revised
305 PUSH ES ;;
306 PUSH AX ;;
307 PUSH BX ;;
308 PUSH CX ;;
309 PUSH DX ;;
310 PUSH DI ;;
311 PUSH SI ;;
312 ;; BP isn't used, so it isn't saved
313 LEA BX,FTABLE ;;
314 PUSH CS ;;
315 POP ES ;; ES:[BX]
316 LDS SI,FTP.BUFFER_ADDR ;; DS:[SI]
317 MOV CX,FTP.BUFFER_LEN ;; CX = length of packet
318 MOV DX,FTP.NUM_FTBLK ;; DX = number of FTB
319 MOV cs:num_ftb,DX ;;
320 AND DX,DX ;;
321 JNZ VALID_BUFFER ;;
322 MOV cs:fp_error,0020H ;; ERROR 0020H
323 JMP FP_RET ;;
324VALID_BUFFER : ;;
325 MOV AX,FTP.FLAG ;;
326 AND AX,FLAG_RESTART ;;
327 Jnz has_RESTART ;;
328 JMP NO_RESTART ;;
329 ;;
330 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
331has_restart : ;;
332 PUSH BX ;; reset all the output fields
333 ADD BX,TYPE FBUFS ;; FTP = FONT BLOCK
334 XOR AX,AX ;;
335 ;;
336 MOV cs:ftag_count,AX ;;
337 MOV cs:fptr_low,AX ;;
338 MOV cs:fptr_high,AX ;;
339 MOV cs:pre_font_len,AX ;;
340 MOV cs:count_lo,AX ;;
341 MOV cs:count_hi,AX ;;
342 MOV cs:next_low,AX ;;
343 MOV cs:next_high,AX ;;
344 MOV cs:hit_lo,AX ;;
345 MOV cs:hit_hi,AX ;;
346 MOV cs:hit_flag,AX ;;
347 MOV cs:pass_cnt,AX ;;
348 MOV cs:pass_postx,STAGE_MAX ;;
349 ;;
350 MOV cs:stage,STAGE_MAX ;;
351 ;;
352RESET_FTB : ;;
353 MOV FTP.FTB_STATUS,FSTAT_SEARCH
354 MOV FTP.FTB_TYPE,AX ;;
355 MOV FTP.FTB_MOD,AX ;;
356 MOV FTP.FTB_FONTS,AX ;;
357 MOV FTP.FTB_ROWS,AL ;;
358 MOV FTP.FTB_COLS,AL ;;
359 MOV FTP.FTB_X,AL ;;
360 MOV FTP.FTB_Y,AL ;;
361 MOV FTP.FTB_COUNT,AX ;;
362 MOV FTP.FTB_DLEFT,AX ;;
363 MOV FTP.FTB_DLEN,AX ;;
364 MOV FTP.FTB_DALO,AX ;;
365 MOV FTP.FTB_DAHI,AX ;;
366 MOV FTP.TARGET_LO,AX ;;
367 MOV FTP.TARGET_HI,AX ;;
368 ;;
369 ADD BX, TYPE FTBLK ;;
370 ;;
371 DEC DX ;;
372 AND DX,DX ;;
373 JNZ RESET_FTB ;;
374 ;;
375 POP BX ;;
376NO_RESTART : ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
377 ;; any FTBLKs have their data all
378 ;; returned ? if so set their status
379 ;; from FOUND to COMPLETE
380 PUSH BX ;;
381 ADD BX,TYPE FBUFS ;; FTP = FONT BLOCK
382 ;;
383 MOV DX,cs:num_ftb ;;
384 ;;
385SET_COMPLETE : ;;
386 MOV AX,FTP.FTB_STATUS ;;
387 CMP AX,FSTAT_FONT ;;
388 JNE SET_NEXT ;;
389 ;;
390 MOV AX,FTP.FTB_DLEFT ;;
391 AND AX,AX ;;
392 JNZ SET_NEXT ;;
393 ;;
394 MOV FTP.FTB_STATUS,FSTAT_COMPLETE
395 ;;
396SET_NEXT : ;;
397 ;;
398 ADD BX,TYPE FTBLK ;;
399 ;;
400 DEC DX ;;
401 AND DX,DX ;;
402 JNZ SET_COMPLETE ;;
403 ;;
404 POP BX ;;
405 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
406 ADD BX,TYPE FBUFS ;; FTP = FONT BLOCK
407 ;;
408 PUSH CX ;; STACK 1 = CX
409;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
410;;
411;; DO WHILE CX is not zero :
412;;
413;; -- on each loop, the CX, COUNTs are updated
414;;
415;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
416 ;;
417 ;;
418FTB_LOOP : ;;
419 POP AX ;; STACK -1
420 SUB AX,CX ;;
421 ADD cs:count_lo,AX ;;
422 JNC NO_CARRY ;;
423 ADD cs:count_hi,1000H ;;
424NO_CARRY : ;;
425 PUSH CX ;; STACK 1 = CX
426 AND CX,CX ;;
427 JNZ FTB_CONT ;;
428 JMP FTB_LPEND ;;
429 ;; DO CASES :
430FTB_CONT : ;; ==========
431 ;;
432 MOV AX,cs:stage ;;
433 ;;
434 CMP AX,STAGE_MAX ;;
435 JNE FTB_010 ;;
436 JMP START_CASE ;; ** RESTART **
437 ;;
438FTB_010 : ;;
439 CMP AX,MATCHX ;;
440 JAE FTB_020 ;;
441 JMP SEARCH_CASE ;; ** SEARCH **
442 ;;
443FTB_020 : ;;
444 CMP AX,MATCHX ;;
445 JNE FTB_030 ;;
446 JMP MATCH_CASE ;; ** MATCH **
447 ;;
448FTB_030 : ;;
449 CMP AX,SCANX ;;
450 JNE FTB_040 ;;
451 JMP SCAN_CASE ;; ** SCAN **
452 ;;
453FTB_040 : ;;
454 CMP AX,FOUNDX ;;
455 JAE FTB_050 ;;
456 JMP PRE_FOUND_CASE ;; ** PRE-FOUND **
457 ;;
458FTB_050 : ;;
459 CMP AX,FOUNDX ;;
460 JNE FTB_060 ;;
461 JMP FOUND_CASE ;; ** FOUND **
462 ;;
463FTB_060 : ;;
464 CMP AX,GET_FX ;;
465 JNE FTB_070 ;;
466 JMP GETFONT_CASE ;; ** GET_FONT **
467 ;;
468FTB_070 : ;;
469 CMP AX,PASSX ;;
470 JNE FTB_080 ;;
471 JMP PASS ;; ** PASS **
472 ;;
473FTB_080 : ;;
474 CMP AX,FPTR_SKIPX ;;
475 JAE FTB_090 ;;
476 JMP SEARCH_CASE ;; ** SEARCH **
477 ;;
478FTB_090 : ;;
479 CMP AX,FPTR_SKIPX ;;
480 JNE FTB_FFF ;;
481 JMP FPTR_SKIP_CASE ;; ** SEARCH **
482 ;;
483FTB_FFF : ;;
484 MOV FTP.FTB_STATUS,STAT_DEVERR
485 JMP FTB_LPEND ;; ** DEVICE ERROR **
486 ;;
487;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
488;;
489;; at the entry of each STAGES /CASES
490;;
491;; -- DS:[SI] (FPKT) points to PACKET, of DOS's buffer
492;; -- CX remaining packet length
493;; -- ES:[BX] points to the first FTBLK
494;; -- COUNT_LO, COUNT_HI, upto but and including the address pointed by FPKT
495;;
496;;
497;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
498 ;;
499;============================================================================
500START_CASE : ;; pass the FILE leading bytes
501 ;;
502 MOV cs:ftag_count,0 ;;
503 MOV cs:stage,ftagx ;;
504 JMP FTB_LOOP ;;
505 ;;
506;=============================================================================
507FPTR_SKIP_CASE : ;; skip until the ENTRY pointed by
508 ;; POINTER (in FPTR) is reached.
509 ;;
510 ;; **************
511 MOV AX,cs:fptr_low ;; * HIT = FPTR *
512 MOV cs:hit_lo,AX ;; **************
513 MOV DX,cs:fptr_high ;;
514 MOV cs:hit_hi,DX ;;
515 ;;
516 CMP AX,0FFFFH ;;
517 JNE FPTR_SKIP_VALID ;;
518 CMP DX,0FFFFH ;;
519 JNE FPTR_SKIP_VALID ;;
520 ;;
521 MOV FTP.FTB_STATUS,STAT_BADATA ;; returned at the first FTBLK
522 JMP FPTR_SKIP_MORE ;;
523 ;;
524FPTR_SKIP_VALID : ;;
525 ;; normalised HIT_HI, HIT_LO
526 MOV AX,DX ;;
527 AND AX,00FFFH ;;
528 PUSH CX ;;
529 MOV CX,4 ;;
530 SHL AX,CL ;;
531 POP CX ;;
532 AND DX,0F000H ;;
533 ADD AX,cs:hit_lo ;;
534 JNC NO_CARRY10 ;;
535 ADD DX,01000H ;;
536NO_CARRY10: ;;
537 MOV cs:hit_lo,AX ;;
538 MOV cs:hit_hi,DX ;;
539 ;; **************************
540 ;; * compare FPTR and COUNT *
541 ;; **************************
542 ;; DX:AX = HIT_HI:HIT_LO (normalised)
543 ;;
544 SUB AX,cs:count_lo ;;
545 Jnc more_fptrlo ;;
546 sub dx,01000h ;;
547 jc fptr_bad ;;
548 ;;
549more_fptrlo : ;;
550 SUB DX,cs:count_hi ;;
551 JC fptr_BAD ;;
552 ;;
553 INC AX ;; COUNT can be at the HIT, then AX=0
554 JNC NO_CARRY11 ;; INC AX to make AX comparable to CX
555 ADD DX,01000H ;; i.e. AX = offset + 1
556 ;;
557NO_CARRY11: ;;
558 CMP AX,CX ;;
559 JA fptr_skip_more ;; AX > CX, whole CX to be skipped
560 ;;
561 PUSH DX ;; normalise dx:ax
562 AND DX,00FFFH ;;
563 PUSH CX ;;
564 MOV CX,4 ;;
565 SHL DX,CL ;;
566 POP CX ;;
567 ADD AX,DX ;;
568 POP DX ;;
569 JNC NO_CARRY13 ;;
570 ADD DX,01000H ;;
571NO_CARRY13: ;;
572 AND DX,0F000H ;;
573 ;;
574 PUSH AX ;;
575 PUSH DX ;; STACK +1 : normalosed DX:AX
576 SUB AX,CX ;;
577 JNC NO_BORROW11 ;;
578 SUB DX,1000H ;;
579 JC fptr_MORE_CXp ;; dx:ax < cx
580NO_BORROW11: ;;
581 ;; dx:ax >= cx
582 AND AX,AX ;;
583 JNE fptr_skip_MOREP ;;
584 AND DX,DX ;;
585 JNE fptr_skip_MOREP ;;
586 ;; dx:ax = cx, or
587 ;; offset + 1 = CX
588 ;;
589 ;; ************************************
590 ;; * POINTER is within the current CX *
591 ;; ************************************
592fptr_MORE_CXP : ;;
593 POP DX ;;
594 POP AX ;; STACK -1
595 ;;
596fptr_MORE_CX : ;; DX = 0,to have more CX than offset+1
597 DEC AX ;; = offset : 0 and above
598 SUB CX,AX ;;
599 ADD SI,AX ;; where the first byte is
600 ;;
601 MOV cs:stage,entry_lox ;; ENTRIES in the font file
602 ;;
603 JMP FTB_LOOP ;; ****** RETURN *******
604 ;;
605 ;; ***********************************
606 ;; * more to skip ==> FPTR_SKIP_CASE *
607 ;; ***********************************
608fptr_skip_morep: ;;
609 POP DX ;;
610 POP AX ;; STACK -1
611 ;;
612fptr_skip_more : ;;
613 ADD SI,CX ;;
614 SUB CX,CX ;;
615 JMP FTB_LOOP ;; ****** RETURN *****
616 ;;
617 ;; ***********************************
618 ;; * bad POINTER in font file header *
619 ;; ***********************************
620 ;;
621fptr_bad : ;;
622 MOV cs:fptr_low,0FFFFH ;;
623 MOV cs:fptr_high,0FFFFH ;;
624 ;;
625 MOV FTP.FTB_STATUS,STAT_BADATA ;; returned at the first FTBLK
626 ;;
627 JMP FPTR_SKIP_MORE ;;
628 ;;
629;=============================================================================
630SEARCH_CASE : ;;
631 ;; still looking for header to match
632 ;; the input : codepage and typeid
633 ;;
634 MOV DI,cs:stage ;;
635 ;;
636 ADD DI,DI ;; double to index to WORD-offset
637 ;;
638 JMP CS:STAGE_CASES[DI] ;; call routine to process the stage
639 ;;
640 ;;
641;===========================================================================
642MATCH_CASE : ;;
643 ;;
644 PUSH BX ;;
645 MOV DX,cs:num_ftb ;;
646 ;;
647 ;;
648MATCH_LOOP : ;;
649 MOV AX,FTP.FTB_STATUS ;;
650 CMP AX,FSTAT_SEARCH ;;
651 JE MATCH_SEARCH ;;
652 JMP MATCH_NEXT ;;
653 ;;
654MATCH_SEARCH : ;;
655 MOV AX,FTP.FTB_CP ;; check the FTB with SEARCH status
656 CMP AX,cs:cpg_word ;;
657 JNE MATCH_MORE ;;
658 PUSH DS ;; code page matched
659 PUSH SI ;;
660 PUSH CX ;;
661 ;;
662 PUSH CS ;;
663 POP DS ;;
664 MOV SI,OFFSET TYPE_ID ;;
665 LEA DI,[BX].FTB_TID ;;
666 MOV CX,8 ;;
667 REPE CMPSB ;;
668 ;;
669 POP CX ;;
670 POP SI ;;
671 POP DS ;;
672 ;;
673 JNE MATCH_MORE ;;
674 ;; MATCH !!!!! (type_id matched)
675 MOV FTP.FTB_STATUS,FSTAT_MATCH
676 MOV AX,cs:type_word ;;
677 MOV FTP.FTB_TYPE,AX ;;
678 MOV AX,cs:font_low ;;
679 MOV FTP.TARGET_LO,AX ;;
680 MOV AX,cs:font_high ;;
681 MOV FTP.TARGET_HI,AX ;;
682 ;;
683 JMP MATCH_NEXT ;;
684 ;;
685MATCH_MORE : ;; if this is the last rounf ?
686 ;;
687 MOV AX,cs:next_low ;; NEXT = FFFF:FFFF means no more
688 CMP AX,-1 ;; header to come.
689 JNE MATCH_NEXT ;;
690 ;;
691 MOV AX,cs:next_high ;;
692 CMP AX,-1 ;;
693 JNE MATCH_NEXT ;;
694 ;;
695 MOV FTP.FTB_STATUS,STAT_NOFIND ;; ERROR : no match
696 ;;
697MATCH_NEXT : ;;
698 ADD BX,FTP.FTB_LENGTH ;;
699 DEC DX ;;
700 AND DX,DX ;;
701 JZ MATCH_ALL ;;
702 JMP MATCH_LOOP ;;
703 ;;
704MATCH_ALL : ;;
705 MOV cs:stage,SCANX ;;
706 ;;
707MATCH_DONE : ;;
708 POP BX ;;
709 JMP FTB_LOOP ;;
710 ;;
711;===========================================================================
712SCAN_CASE : ;;
713 ;; **********************************
714 ;; * determine whether it the font *
715 ;; * data(TARGET),or the next font *
716 ;; * header(NEXT) that is approaching
717 ;; **********************************
718 ;;
719 MOV AX,cs:next_low ;;
720 MOV cs:hit_lo,AX ;;
721 MOV AX,cs:next_high ;;
722 MOV cs:hit_hi,AX ;;
723 XOR AX,AX ;;
724 MOV cs:hit_flag,AX ;;
725 ;;
726 MOV DI,cs:hit_hi ;; normalised HIT_HI, HIT_LO
727 MOV AX,DI ;;
728 AND AX,00FFFH ;;
729 PUSH CX ;;
730 MOV CX,4 ;;
731 SHL AX,CL ;;
732 POP CX ;;
733 AND DI,0F000H ;;
734 ADD AX,cs:hit_lo ;;
735 JNC NO_CARRY2 ;;
736 ADD DI,01000H ;;
737NO_CARRY2 : ;;
738 MOV cs:hit_lo,AX ;;
739 MOV cs:hit_hi,DI ;;
740 ;;
741 MOV DX,cs:num_ftb ;;
742 ;;
743 PUSH BX ;;
744SCAN_LOOP : ;;
745 MOV AX,FTP.FTB_STATUS ;;
746 CMP AX,FSTAT_MATCH ;;
747 JNE SCAN_NEXT ;;
748 ;;
749 ;;
750 MOV DI,FTP.TARGET_HI ;; NORMALISED TARGET
751 MOV AX,DI ;;
752 AND AX,00FFFH ;;
753 PUSH CX ;;
754 MOV CX,4 ;;
755 SHL AX,CL ;;
756 POP CX ;;
757 AND DI,0F000H ;;
758 ADD AX,FTP.TARGET_LO ;;
759 JNC NO_CARRY1 ;;
760 ADD DI,01000H ;;
761NO_CARRY1 : ;; DI:AX = NORMALISED TARGET
762 ;;
763 ;; ** compare the TARGET and the NEXT
764 ;;
765 CMP DI,cs:hit_hi ;;
766 JA SCAN_NEXT ;;
767 ;;
768 JE SCAN_EQU ;;
769 JMP NEAR_FONT ;;
770 ;;
771SCAN_EQU : ;;
772 CMP AX,cs:hit_lo ;;
773 JA SCAN_NEXT ;;
774 JE SCAN_ERROR_CHK ;;
775 ;; **********************************
776 ;; * the font data is approaching *
777 ;; **********************************
778NEAR_FONT : ;;
779 MOV cs:hit_flag,-1 ;;
780 MOV cs:hit_lo,AX ;;
781 MOV cs:hit_hi,DI ;;
782 MOV cs:hit_bx,BX ;; used for BAD_BX and in FOUND_CASE
783 JMP SCAN_NEXT ;;
784 ;;
785 ;; **********************************
786 ;; * the NEXT header is approaching *
787 ;; **********************************
788SCAN_ERROR_CHK : ;;
789 MOV AX,cs:hit_flag ;;
790 AND AX,AX ;;
791 JNZ SCAN_NEXT ;;
792 MOV FTP.FTB_STATUS,STAT_BADATA ;; next header and font cannot be the
793 ;; same
794 ;;
795SCAN_NEXT : ;;
796 DEC DX ;;
797 AND DX,DX ;;
798 JZ SCAN_DONE ;;
799 ;;
800 ADD BX,FTP.FTB_LENGTH ;;
801 JMP SCAN_LOOP ;; ** is there any closer font data ?
802 ;;
803 ;; ************************************
804 ;; * the HIT is either font data(TARGET
805 ;; * or the font block (NEXT). *
806 ;; ************************************
807SCAN_DONE : ;;
808 POP BX ;;
809 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
810 MOV DX,cs:hit_hi ;; HIT_FLAG, HIT_LO, HIT_HI defined
811 MOV AX,cs:hit_lo ;;
812 ;;
813 CMP AX,0FFFFH ;;
814 JNE NOT_FFFF_HIT ;;
815 CMP DX,0FFFFH ;;
816 JNE NOT_FFFF_HIT ;;
817 JMP SCAN_MORE ;; stage remained as SCAN, discard data
818 ;;
819NOT_FFFF_HIT : ;;
820 ;; DX:AX = HIT_HI:HIT_LO (normalised)
821 SUB AX,cs:count_lo ;;
822 JNC NO_BORROW ;;
823 SUB DX,01000H ;;
824 JC SCAN_BAD ;;
825NO_BORROW: ;;
826 SUB DX,cs:count_hi ;;
827 JC SCAN_BAD ;;
828 ;;
829 INC AX ;; COUNT can be at the HIT, then AX=0
830 JNC NO_CARRYX ;; INC AX to make AX comparable to CX
831 ADD DX,01000H ;; i.e. AX = offset + 1
832 ;;
833NO_CARRYX : ;;
834 CMP AX,CX ;;
835 JA SCAN_MORE ;;
836 ;;
837 PUSH DX ;;
838 AND DX,00FFFH ;;
839 PUSH CX ;;
840 MOV CX,4 ;;
841 SHL DX,CL ;;
842 POP CX ;;
843 ADD AX,DX ;;
844 POP DX ;;
845 JNC NO_CARRY3 ;;
846 ADD DX,01000H ;;
847NO_CARRY3 : ;;
848 AND DX,0F000H ;;
849 ;;
850 ;;
851 PUSH AX ;;
852 PUSH DX ;;
853 SUB AX,CX ;;
854 JNC NO_BORROW1 ;;
855 SUB DX,1000H ;;
856 JC MORE_CXp ;;
857NO_BORROW1 : ;;
858 ;; dx:ax >= cx
859 AND AX,AX ;;
860 JNE SCAN_MOREP ;;
861 AND DX,DX ;;
862 JNE SCAN_MOREP ;;
863 ;;
864 ;; offset + 1 = CX
865 ;;
866MORE_CXP : ;;
867 POP DX ;;
868 POP AX ;;
869 ;;
870MORE_CX : ;; DX = 0,to have more CX than offset+1
871 DEC AX ;; = offset : 0 and above
872 SUB CX,AX ;;
873 ADD SI,AX ;; where the first byte is
874 MOV AX,cs:hit_flag ;;
875 AND AX,AX ;;
876 JE NEXT_REACHED ;;
877 ;;
878 MOV cs:stage,MOD_LOBX ;; font-data reached,
879 ;;
880 JMP FTB_LOOP ;; ****** RETURN *******
881 ;;
882NEXT_REACHED : ;;
883 MOV cs:stage,PASSX ;;
884 MOV cs:pass_postx,next_lolX ;;
885 MOV cs:pass_cnt,FILE_OFFSET ;;
886 ;;
887 ;;
888 JMP FTB_LOOP ;; ****** RETURN *******
889 ;;
890 ;; ***********************************
891SCAN_MOREP : ;; * scan more FTBLK for the nearest *
892 ;; * font data *
893 ;; ***********************************
894 POP DX ;;
895 POP AX ;;
896 ;;
897SCAN_MORE : ;;
898 ADD SI,CX ;;
899 SUB CX,CX ;;
900 JMP FTB_LOOP ;; more SCAN stage
901 ;;
902SCAN_BAD: ;; *************************
903 MOV AX,cs:hit_flag ;; * scan is bad *
904 AND AX,AX ;; *************************
905 JNZ BAD_BX ;;
906 MOV AX,-1 ;; NEXT is pointing backwards
907 MOV cs:next_low,AX ;;
908 MOV cs:next_high,AX ;; no more NEXT
909 MOV FTP.FTB_STATUS,STAT_BADATA ;; returned at the first FTBLK
910 JMP FTB_LOOP ;;
911 ;;
912BAD_BX : ;;
913 PUSH BX ;; FONT is pointing backwards
914 MOV BX,cs:hit_bx ;;
915 MOV FTP.FTB_STATUS,STAT_BADATA
916 POP BX ;;
917 JMP FTB_LOOP ;;
918 ;;
919;===========================================================================
920PRE_FOUND_CASE : ;;
921 ;; extract informations from the font
922 ;; block until font_length is defined
923 ;;
924 MOV DI,cs:stage ;;
925 ;;
926 ADD DI,DI ;; double to index to WORD-offset
927 ;;
928 JMP CS:STAGE_CASES[DI] ;; call routine to process the stage
929 ;;
930;===========================================================================
931FOUND_CASE : ;;
932 MOV DI,OFFSET FTB_LOOP ;; as FOUND has two places to return to
933 PUSH DI ;;
934;===========================================================================
935FOUND_DO : ;;
936 ;; define informations into FTBLK of
937 ;; HIT_BX defined in the SCAN case
938 PUSH BX ;;
939 MOV BX,cs:hit_bx ;;
940 ;; FTBLK :
941 MOV AX,cs:mod_word ;;
942 MOV FTP.FTB_MOD,AX ;;
943 MOV AX,cs:fonts_word ;;
944 MOV FTP.FTB_FONTS,AX ;;
945 ;;
946 MOV AX,cs:fdlen_word ;;
947 MOV FTP.FTB_DLEFT,AX ;;
948 MOV FTP.FTB_DLEN,0 ;;
949 MOV FTP.FTB_DALO,0 ;;
950 MOV FTP.FTB_DAHI,0 ;;
951 ;;
952 MOV FTP.FTB_STATUS,FSTAT_FOUND
953 ;;
954 CMP FTP.FTB_TYPE,TYPE_DISPLAY;
955 JNE CHECK_PTR_TYPE ;;
956 CMP cs:pre_font_len,PRE_FONT_D ;;
957 JNE DISPLAY_BAD ;;
958 JMP DISPLAY_DONE ;;
959 ;;
960CHECK_PTR_TYPE : ;;
961 CMP FTP.FTB_TYPE,TYPE_PRINTER;
962 JNE SET_STAGE ;;
963 CMP cs:ptr_sel_word,0 ;;
964 JNE PRINTER_HAS_SEL ;;
965 CMP cs:pre_font_len,PRE_FONT_P0;;
966 JNE PRINTER_BAD ;;
967 JMP PRINTER_DONE ;;
968 ;;
969PRINTER_HAS_SEL : ;;
970 CMP cs:pre_font_len,PRE_FONT_P ;;
971 JNE PRINTER_BAD ;;
972 JMP PRINTER_DONE ;;
973 ;;
974DISPLAY_BAD : ;;
975 ;;
976 MOV FTP.FTB_STATUS,STAT_BADATA ;the FDLEN_WORD should be 0.
977 ;;
978DISPLAY_DONE : ;;
979 MOV AL,cs:disp_rows ;;
980 MOV FTP.FTB_ROWS,AL ;;
981 MOV AL,cs:disp_cols ;;
982 MOV FTP.FTB_COLS,AL ;;
983 MOV AL,cs:disp_x ;;
984 MOV FTP.FTB_X,AL ;;
985 MOV AL,cs:disp_y ;;
986 MOV FTP.FTB_Y,AL ;;
987 MOV AX,cs:count_word ;;
988 MOV FTP.FTB_COUNT,AX ;;
989 JMP SET_STAGE ;;
990 ;;
991PRINTER_BAD : ;;
992 ;;
993 MOV FTP.FTB_STATUS,STAT_BADATA ;the FDLEN_WORD should be 0.
994 ;;
995PRINTER_DONE : ;;
996 MOV AX,cs:ptr_sel_word ;;
997 MOV FTP.FTB_SELECT,AX ;;
998 MOV AX,cs:ptr_len_word ;;
999 MOV FTP.FTB_SELLEN,AX ;;
1000 ;;
1001SET_STAGE : ;; STAGE :
1002 MOV AX,cs:fdlen_word ;; if no font data to follow
1003 AND AX,AX ;;
1004 JNZ GET_FDATA ;;
1005 MOV cs:stage,SCANX ;; then scan for next header or font
1006 JMP FONT_RET ;;
1007 ;;
1008GET_FDATA : ;; update the moving target
1009 MOV cs:stage,GET_FX ;;
1010 MOV AX,cs:pre_font_len ;;
1011 ADD FTP.TARGET_LO,AX ;;
1012 JNC FONT_RET ;;
1013 ADD FTP.TARGET_HI,01000H ;;
1014 ;;
1015FONT_RET : ;;
1016 POP BX ;;
1017 RET ;;
1018 ;;
1019;===========================================================================
1020GETFONT_CASE : ;; as ES:[SI], at COUNT, there is font
1021 ;; data
1022 MOV DX,cs:num_ftb ;;
1023 PUSH BX ;;
1024 ;;
1025 MOV cs:hit_hi,0 ;; temp. register
1026 MOV cs:hit_flag,0 ;; assumed can be changed to SCAN stage
1027 ;;
1028 MOV DI,cs:count_hi ;; normalised COUNT_HI,COUNT_LO
1029 MOV AX,DI ;;
1030 AND AX,00FFFH ;;
1031 PUSH CX ;;
1032 MOV CX,4 ;;
1033 SHL AX,CL ;;
1034 POP CX ;;
1035 AND DI,0F000H ;;
1036 ADD AX,cs:count_lo ;;
1037 JNC NO_CARRY4 ;;
1038 ADD DI,01000H ;;
1039NO_CARRY4 : ;;
1040 MOV cs:count_lo,AX ;;
1041 MOV cs:count_hi,DI ;;
1042 ;;
1043 ;;
1044GETFONT_LOOP : ;;
1045 MOV AX,FTP.FTB_STATUS ;;
1046 CMP AX,FSTAT_FONT ;;
1047 JE GETFONT_CONT ;;
1048 ;;
1049 CMP AX,FSTAT_FOUND ;;
1050 JE GETFONT_FOUND ;;
1051 ;;
1052 JMP NEXT_GETFONT ;;
1053 ;;
1054GETFONT_FOUND : ;;
1055 MOV AX,FTP.FTB_DLEFT ;;
1056 AND AX,AX ;;
1057 JZ NEXT_GF ;;
1058 MOV FTP.FTB_STATUS,FSTAT_FONT;
1059 JMP GETFONT_CONT1 ;;
1060 ;;
1061 ;;
1062GETFONT_CONT : ;;
1063 MOV AX,FTP.FTB_DLEFT ;;
1064 AND AX,AX ;;
1065 JNZ GETFONT_CONT1 ;;
1066NEXT_GF : ;;
1067 JMP NEXT_GETFONT ;;
1068 ;; only on FOUND and DLEFT <> 0
1069GETFONT_CONT1: ;;
1070 MOV DI,FTP.TARGET_HI ;; normalised TARGET
1071 MOV AX,DI ;;
1072 AND AX,00FFFH ;;
1073 PUSH CX ;;
1074 MOV CX,4 ;;
1075 SHL AX,CL ;;
1076 POP CX ;;
1077 AND DI,0F000H ;;
1078 ADD AX,FTP.TARGET_LO ;;
1079 JNC NO_CARRY5 ;;
1080 ADD DI,01000H ;;
1081NO_CARRY5 : ;; DI:AX = TARGET (normalised)
1082 ;;
1083 CMP DI,cs:count_hi ;;
1084 JB GETFONT_BAD ;;
1085 JNE NEXT_GETFONT ;;
1086 CMP AX,cs:count_lo ;;
1087 JB GETFONT_BAD ;;
1088 JNE NEXT_GETFONT ;;
1089 ;;
1090 MOV FTP.FTB_DALO,SI ;; where the font data is in the packet
1091 MOV FTP.FTB_DAHI,DS ;;
1092 ;;
1093 MOV AX,FTP.FTB_DLEFT ;;
1094 CMP AX,CX ;;
1095 JAE UPTO_CX ;;
1096 ;; upto FDLEFT
1097 MOV FTP.FTB_DLEFT,0 ;;
1098 MOV FTP.FTB_DLEN,AX ;;
1099 CMP cs:hit_hi,AX ;;
1100 JNB NOT_HIGHER0 ;;
1101 MOV cs:hit_hi,AX ;;
1102NOT_HIGHER0 : ;;
1103 ADD FTP.TARGET_LO,AX ;;
1104 JNC NEXT_GETFONT ;;
1105 ADD FTP.TARGET_HI,01000H ;;
1106 JMP NEXT_GETFONT ;;
1107 ;;
1108GETFONT_BAD : ;;
1109 MOV FTP.FTB_STATUS,STAT_BADATA ;; pointing backwards
1110 JMP NEXT_GETFONT ;;
1111 ;;
1112UPTO_CX : ;;
1113 SUB AX,CX ;;
1114 MOV FTP.FTB_DLEFT,AX ;;
1115 MOV FTP.FTB_DLEN,CX ;;
1116 MOV cs:hit_hi,CX ;;
1117 ADD FTP.TARGET_LO,CX ;;
1118 JNC NO_CARRYOVER ;;
1119 ADD FTP.TARGET_HI,01000H ;;
1120NO_CARRYOVER : ;;
1121 AND AX,AX ;; all data have been returned ?
1122 JZ NEXT_GETFONT ;;
1123 ;;
1124 MOV cs:hit_flag,-1 ;; no ! stay in the GET_FONT stage
1125 ;;
1126NEXT_GETFONT : ;;
1127 ADD BX,FTP.FTB_LENGTH ;;
1128 DEC DX ;;
1129 AND DX,DX ;;
1130 JZ GETFONT_END ;;
1131 JMP GETFONT_LOOP ;;
1132 ;;
1133GETFONT_END : ;;
1134 MOV AX,cs:hit_hi ;;
1135 ADD SI,AX ;;
1136 SUB CX,AX ;;
1137 ;;
1138 CMP cs:hit_flag,0 ;;
1139 Jne GETFONT_DONE ;;
1140 MOV cs:stage,SCANX ;; no more in the GET_FONT stage
1141 ;;
1142 ;;
1143GETFONT_DONE : ;;
1144 POP BX ;;
1145 JMP FTB_LOOP ;;
1146 ;;
1147;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1148;;
1149;; STAGES -- "called by" SERACH_CASE
1150;;
1151;; -- DS:[SI] (FPKT) points to PACKET, of DOS's buffer
1152;; -- CX remaining packet length
1153;; -- ES:[BX] points to the first FTBLK
1154;; -- COUNT_LO, COUNT_HI, upto but not including the address pointed by FPKT
1155;;
1156;;
1157;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1158 ;;+++++++++++++++++++++++++++++++++
1159filetag : ;;
1160 ;;
1161; mov ax,ftag_len ;;
1162 cmp cs:ftag_count,ftag_len ;;
1163 jB valid_ftag ;;
1164 JE FTAG_FAILED ;;
1165 ;;
1166 mov ftp.ftb_status,stat_deverr
1167 mov cs:fp_error,00022H ;; ERROR 0022H
1168 ;;
1169FTAG_FAILED : ;; discard all the bytes, while
1170 ADD SI,CX ;; stage stays as FTAGX
1171 SUB CX,CX ;;
1172 JMP FTB_LOOP ;; **** RETURN (bytes discarded) ****
1173 ;;
1174VALID_FTAG : ;;
1175 MOV AX,FPKT ;;
1176 INC SI ;;
1177 DEC CX ;;
1178 ;;
1179 MOV DI,cs:ftag_count ;;
1180 CMP AL,cs:ftag_pattern[DI] ;;
1181 JE FTAG_NEXTB ;;
1182 ;;
1183 mov ftp.ftb_status,stat_badata
1184 MOV ax,ftag_len ;; stays in FTAGX to consume all bytes
1185 MOV cs:ftag_count,ax ;; stays in FTAGX to consume all bytes
1186 JMP FTB_LOOP ;; **** RETURN (FAILED !) ****
1187 ;;
1188FTAG_NEXTB : ;;
1189 INC DI ;;
1190 MOV cs:ftag_count,DI ;;
1191 ;;
1192 CMP DI,ftag_len ;;
1193 JE FTAG_DONE ;;
1194 ;;
1195 JMP FTB_LOOP ;; **** RETURN ( MORE TO COME) ****
1196 ;;
1197FTAG_DONE : ;;
1198 MOV cs:pass_cnt,0 ;;
1199 MOV cs:stage,PASSX ;;
1200 MOV cs:pass_postx,fptr_lolx ;;
1201 ;;
1202 JMP FTB_LOOP ;; **** NEXT STAGE ****
1203 ;;
1204 ;;+++++++++++++++++++++++++++++++++
1205fptrLOL : ;; STAGE the low byte of the low fptr
1206 MOV AX,FPKT ;;
1207 INC SI ;; byte by byte
1208 DEC CX ;;
1209 AND CX,CX ;;
1210 JNZ WORD_fptrLO ;;
1211 MOV cs:fptr_lol,AL ;;
1212 MOV cs:stage,fptr_lohX ;;
1213 JMP FTB_LOOP ;;
1214WORD_fptrLO : ;;
1215 INC SI ;;
1216 DEC CX ;;
1217 MOV cs:fptr_low,AX ;;
1218 MOV cs:stage,fptr_HILX ;;
1219 JMP FTB_LOOP ;;
1220 ;;+++++++++++++++++++++++++++++++++
1221fptrLOH : ;; STAGE the high byte of the low fptr
1222 MOV AX,FPKT ;;
1223 INC SI ;; byte by byte
1224 DEC CX ;;
1225 MOV cs:fptr_loh,AL ;;
1226 MOV cs:stage,fptr_HILX ;;
1227 JMP FTB_LOOP ;;
1228 ;;+++++++++++++++++++++++++++++++++
1229fptrHIL : ;; STAGE the low byte of the high fptr
1230 MOV AX,FPKT ;;
1231 INC SI ;; byte by byte
1232 DEC CX ;;
1233 AND CX,CX ;;
1234 JNZ WORD_fptrHI ;;
1235 MOV cs:fptr_hil,AL ;;
1236 MOV cs:stage,fptr_hihX ;;
1237 JMP FTB_LOOP ;;
1238WORD_fptrHI : ;;
1239 INC SI ;;
1240 DEC CX ;;
1241 MOV cs:fptr_high,AX ;;
1242 MOV cs:stage,FPTR_SKIPX ;;
1243 JMP FTB_LOOP ;;
1244 ;;+++++++++++++++++++++++++++++++++
1245fptrHIH : ;; STAGE the high byte of the high fptr
1246 MOV AX,FPKT ;;
1247 INC SI ;; byte by byte
1248 DEC CX ;;
1249 MOV cs:fptr_hih,AL ;;
1250 MOV cs:stage,FPTR_SKIPX ;;
1251 JMP FTB_LOOP ;;
1252 ;;+++++++++++++++++++++++++++++++++
1253ENTRYLO : ;; STAGE - ENTRY LOW BYTE
1254 MOV AX,FPKT ;;
1255 INC SI ;; byte by byte
1256 DEC CX ;;
1257 AND CX,CX ;;
1258 JNZ WORD_ENTRY ;;
1259 MOV cs:entry_lob,AL ;;
1260 MOV cs:stage,ENTRY_HIX ;;
1261 JMP FTB_LOOP ;;
1262WORD_ENTRY : ;;
1263 INC SI ;;
1264 DEC CX ;;
1265 MOV cs:entry_word,AX ;;
1266 MOV cs:stage,PASSX ;; 2 bytes to be passed
1267 MOV cs:pass_postx,NEXT_LOLX ;;
1268 JMP FTB_LOOP ;;
1269 ;;+++++++++++++++++++++++++++++++++
1270ENTRYHI : ;; stage - ENTRY HIGN BYTE
1271 MOV AX,FPKT ;;
1272 INC SI ;; byte by byte
1273 DEC CX ;;
1274 MOV cs:entry_hib,AL ;;
1275 MOV cs:stage,PASSX ;; 2 bytes to be passed
1276 MOV cs:pass_postx,NEXT_LOLX ;;
1277 AND CX,CX ;;
1278 JNZ ENTHI_PASS1 ;;
1279 JMP FTB_LOOP ;;
1280ENTHI_PASS1 : ;;
1281 INC SI ;;
1282 INC cs:pass_cnt ;;
1283 DEC CX ;;
1284 AND CX,CX ;;
1285 JNZ ENTHI_PASS2 ;;
1286 JMP FTB_LOOP ;;
1287ENTHI_PASS2 : ;;
1288 INC SI ;;
1289 INC cs:pass_cnt ;;
1290 DEC CX ;;
1291 MOV cs:stage,NEXT_LOLX ;;
1292 JMP FTB_LOOP ;;
1293 ;;+++++++++++++++++++++++++++++++++
1294NEXTLOL : ;; STAGE the low byte of the low NEXT
1295 MOV AX,FPKT ;;
1296 INC SI ;; byte by byte
1297 DEC CX ;;
1298 AND CX,CX ;;
1299 JNZ WORD_NEXTLO ;;
1300 MOV cs:next_lol,AL ;;
1301 MOV cs:stage,NEXT_LOHX ;;
1302 JMP FTB_LOOP ;;
1303WORD_NEXTLO : ;;
1304 INC SI ;;
1305 DEC CX ;;
1306 MOV cs:next_low,AX ;;
1307 MOV cs:stage,next_hilX ;;
1308 JMP FTB_LOOP ;;
1309 ;;+++++++++++++++++++++++++++++++++
1310NEXTLOH : ;; STAGE the high byte of the low NEXT
1311 MOV AX,FPKT ;;
1312 INC SI ;; byte by byte
1313 DEC CX ;;
1314 MOV cs:next_loh,AL ;;
1315 MOV cs:stage,next_hilX ;;
1316 JMP FTB_LOOP ;;
1317 ;;+++++++++++++++++++++++++++++++++
1318NEXTHIL : ;; STAGE the low byte of the high NEXT
1319 MOV AX,FPKT ;;
1320 INC SI ;; byte by byte
1321 DEC CX ;;
1322 AND CX,CX ;;
1323 JNZ WORD_NEXTHI ;;
1324 MOV cs:next_hil,AL ;;
1325 MOV cs:stage,NEXT_HIHX ;;
1326 JMP FTB_LOOP ;;
1327WORD_NEXTHI : ;;
1328 INC SI ;;
1329 DEC CX ;;
1330 MOV cs:next_high,AX ;;
1331 MOV cs:stage,type_lobX ;;
1332 JMP FTB_LOOP ;;
1333 ;;+++++++++++++++++++++++++++++++++
1334NEXTHIH : ;; STAGE the high byte of the high NEXT
1335 MOV AX,FPKT ;;
1336 INC SI ;; byte by byte
1337 DEC CX ;;
1338 MOV cs:next_hih,AL ;;
1339 MOV cs:stage,type_lobX ;;
1340 JMP FTB_LOOP ;;
1341 ;;+++++++++++++++++++++++++++++++++
1342TYPELO : ;; STAGE the low byte of the TYPE
1343 MOV AX,FPKT ;;
1344 INC SI ;; byte by byte
1345 DEC CX ;;
1346 AND CX,CX ;;
1347 JNZ WORD_TYPE ;;
1348 MOV cs:type_lob,AL ;;
1349 MOV cs:stage,type_hibX ;;
1350 JMP FTB_LOOP ;;
1351WORD_TYPE : ;;
1352 INC SI ;;
1353 DEC CX ;;
1354 MOV cs:type_word,AX ;;
1355 MOV cs:stage,type_idX ;;
1356 MOV cs:tid_cnt,0 ;;
1357 JMP FTB_LOOP ;;
1358 ;;+++++++++++++++++++++++++++++++++
1359TYPEHI : ;; STAGE the high byte of the TYPE
1360 MOV AX,FPKT ;;
1361 INC SI ;; byte by byte
1362 DEC CX ;;
1363 MOV cs:type_hib,AL ;;
1364 MOV cs:stage,TYPE_IDX ;;
1365 MOV cs:tid_cnt,0 ;;
1366 JMP FTB_LOOP ;;
1367 ;;+++++++++++++++++++++++++++++++++
1368TYPEIDS : ;; STAGE the type id
1369 CMP cs:tid_cnt,8 ;;
1370 JNA VALID_TID ;;
1371 MOV FTP.FTB_STATUS,STAT_DEVERR
1372 MOV cs:fp_error,00021H ;; ERROR 0021H
1373 ADD SI,CX ;;
1374 SUB CX,CX ;;
1375 JMP FTB_LOOP ;;
1376 ;;
1377VALID_TID : ;;
1378 MOV AX,8 ;;
1379 SUB AX,cs:tid_cnt ;;
1380 CMP CX,AX ;;
1381 JNB TID_ALL ;;
1382 ;; all data in FPKT are stored
1383 PUSH ES ;;
1384 PUSH CS ;;
1385 POP ES ;;
1386 ;;
1387 MOV DI,OFFSET TYPE_ID ;;
1388 ADD DI,cs:tid_cnt ;;
1389 ADD cs:tid_cnt,CX ;;
1390 REP MOVSB ;; SI is incremented accordingly
1391 POP ES ;;
1392 ;;
1393 MOV CX,0 ;; STAGE remained
1394 JMP FTB_LOOP ;;
1395TID_ALL : ;;
1396 PUSH CX ;;
1397 ;;
1398 PUSH ES ;;
1399 PUSH CS ;;
1400 POP ES ;;
1401 ;;
1402 MOV DI,OFFSET TYPE_ID ;;
1403 ADD DI,cs:tid_cnt ;;
1404 MOV CX,AX ;;
1405 REP MOVSB ;; SI is incremented accordingly
1406 POP ES ;;
1407 ;;
1408 ADD cs:tid_cnt,AX ;;
1409 POP CX ;;
1410 SUB CX,AX ;;
1411 ;;
1412 MOV cs:stage,CPG_LOBX ;;
1413 JMP FTB_LOOP ;;
1414 ;;+++++++++++++++++++++++++++++++++
1415CPGLO : ;; STAGE the low byte of the CODE PAGE
1416 MOV AX,FPKT ;;
1417 INC SI ;; byte by byte
1418 DEC CX ;;
1419 AND CX,CX ;;
1420 JNZ WORD_CPG ;;
1421 MOV cs:cpg_lob,AL ;;
1422 MOV cs:stage,CPG_HIBX ;;
1423 JMP FTB_LOOP ;;
1424WORD_CPG : ;;
1425 INC SI ;;
1426 DEC CX ;;
1427 MOV cs:cpg_word,AX ;;
1428 MOV cs:stage,PASSX ;;
1429 MOV cs:pass_postx,font_lolX ;;
1430 JMP FTB_LOOP ;;
1431 ;;+++++++++++++++++++++++++++++++++
1432CPGHI : ;; STAGE the high byte of the CODE PAGE
1433 MOV AX,FPKT ;;
1434 INC SI ;; byte by byte
1435 DEC CX ;;
1436 MOV cs:cpg_hib,AL ;;
1437 MOV cs:stage,PASSX ;;
1438 MOV cs:pass_postx,font_lolX ;;
1439 JMP FTB_LOOP ;;
1440 ;;+++++++++++++++++++++++++++++++++
1441FONTLOL : ;; STAGE the low byte of the low FONT
1442 MOV AX,FPKT ;;
1443 INC SI ;; byte by byte
1444 DEC CX ;;
1445 AND CX,CX ;;
1446 JNZ WORD_FONTLO ;;
1447 MOV cs:font_lol,AL ;;
1448 MOV cs:stage,FONT_LOHX ;;
1449 JMP FTB_LOOP ;;
1450WORD_FONTLO : ;;
1451 INC SI ;;
1452 DEC CX ;;
1453 MOV cs:font_low,AX ;;
1454 MOV cs:stage,FONT_HILX ;;
1455 JMP FTB_LOOP ;;
1456 ;;+++++++++++++++++++++++++++++++++
1457FONTLOH : ;; STAGE the high byte of the low FONT
1458 MOV AX,FPKT ;;
1459 INC SI ;; byte by byte
1460 DEC CX ;;
1461 MOV cs:font_loh,AL ;;
1462 MOV cs:stage,FONT_HILX ;;
1463 JMP FTB_LOOP ;;
1464 ;;+++++++++++++++++++++++++++++++++
1465FONTHIL : ;; STAGE the low byte of the high FONT
1466 MOV AX,FPKT ;;
1467 INC SI ;; byte by byte
1468 DEC CX ;;
1469 AND CX,CX ;;
1470 JNZ WORD_FONTHI ;;
1471 MOV cs:font_hil,AL ;;
1472 MOV cs:stage,FONT_HIHX ;;
1473 JMP FTB_LOOP ;;
1474WORD_FONTHI : ;;
1475 INC SI ;;
1476 DEC CX ;;
1477 MOV cs:font_high,AX ;;
1478;;;;;; MOV cs:stage,MOD_LOBX ;; end of SCAN
1479 ;; anymore headers to be processed ?
1480 MOV cs:stage,MATCHX ;;
1481 MOV AX,cs:entry_word ;;
1482 DEC AX ;;
1483 MOV cs:entry_word,AX ;;
1484 AND AX,AX ;;
1485 JNZ CHECK_NEXT ;;
1486 ;; no more header to be processed !
1487 MOV AX,-1 ;;
1488 MOV cs:next_low,AX ;;
1489 MOV cs:next_high,AX ;; as ENTRY has been consumed
1490 JMP FTB_LOOP ;;
1491 ;;
1492CHECK_NEXT : ;;
1493 MOV AX,cs:next_low ;;
1494 AND AX,AX ;;
1495 JNZ MORE_HEADER ;;
1496 MOV AX,cs:next_high ;;
1497 AND AX,AX ;;
1498 JNZ MORE_HEADER ;;
1499 ;; no more header to be processed !
1500 MOV AX,-1 ;;
1501 MOV cs:next_low,AX ;; as NEXT is nil
1502 MOV cs:next_high,AX ;;
1503 ;;
1504MORE_HEADER : ;;
1505 JMP FTB_LOOP ;;
1506 ;;+++++++++++++++++++++++++++++++++
1507FONTHIH : ;; STAGE the high byte of the high FONT
1508 MOV AX,FPKT ;;
1509 INC SI ;; byte by byte
1510 DEC CX ;;
1511 MOV cs:font_hih,AL ;;
1512;;;;; MOV cs:stage,MOD_LOBX ;; end of SCAN
1513 ;;
1514 MOV cs:stage,MATCHX ;;
1515 ;; anymore headers to be processed ?
1516 MOV AX,cs:entry_word ;;
1517 DEC AX ;;
1518 MOV cs:entry_word,AX ;;
1519 AND AX,AX ;;
1520 JNZ CHECK_NEXT0 ;;
1521 ;; no more header to be processed !
1522 MOV AX,-1 ;;
1523 MOV cs:next_low,AX ;;
1524 MOV cs:next_high,AX ;; as ENTRY has been consumed
1525 JMP FTB_LOOP ;;
1526 ;;
1527CHECK_NEXT0 : ;;
1528 MOV AX,cs:next_low ;;
1529 AND AX,AX ;;
1530 JNZ MORE_HEADER0 ;;
1531 MOV AX,cs:next_high ;;
1532 AND AX,AX ;;
1533 JNZ MORE_HEADER0 ;;
1534 ;; no more header to be processed !
1535 MOV AX,-1 ;;
1536 MOV cs:next_low,AX ;; as NEXT is nil
1537 MOV cs:next_high,AX ;;
1538 ;;
1539MORE_HEADER0 : ;;
1540 JMP FTB_LOOP ;;
1541 ;;
1542 ;;+++++++++++++++++++++++++++++++++
1543MODLO : ;; STAGE the low byte of the MODIFIER
1544 MOV AX,FPKT ;;
1545 INC SI ;; byte by byte
1546 DEC CX ;;
1547 AND CX,CX ;;
1548 JNZ WORD_MOD ;;
1549 MOV MOD_LOB,AL ;;
1550 MOV cs:stage,MOD_HIBX ;;
1551 JMP FTB_LOOP ;;
1552WORD_MOD : ;;
1553 INC SI ;;
1554 DEC CX ;;
1555 MOV cs:mod_word,AX ;;
1556 MOV cs:stage,fonts_lobX ;;
1557 JMP FTB_LOOP ;;
1558 ;;+++++++++++++++++++++++++++++++++
1559MODHI : ;; STAGE the high byte of the MODIFIER
1560 MOV AX,FPKT ;;
1561 INC SI ;; byte by byte
1562 DEC CX ;;
1563 MOV cs:mod_hib,AL ;;
1564 MOV cs:stage,FONTS_LOBX ;;
1565 JMP FTB_LOOP ;;
1566 ;;+++++++++++++++++++++++++++++++++
1567FONTSLO : ;; STAGE the low byte of the FONTS
1568 MOV AX,FPKT ;;
1569 INC SI ;; byte by byte
1570 DEC CX ;;
1571 AND CX,CX ;;
1572 JNZ WORD_FONTS ;;
1573 MOV cs:fonts_lob,AL ;;
1574 MOV cs:stage,FONTS_HIBX ;;
1575 JMP FTB_LOOP ;;
1576WORD_FONTS : ;;
1577 INC SI ;;
1578 DEC CX ;;
1579 MOV cs:fonts_word,AX ;;
1580 MOV cs:stage,FDLEN_LOBX ;;
1581 JMP FTB_LOOP ;;
1582 ;;+++++++++++++++++++++++++++++++++
1583FONTSHI : ;; STAGE the high byte of the FONTS
1584 MOV AX,FPKT ;;
1585 INC SI ;; byte by byte
1586 DEC CX ;;
1587 MOV cs:fonts_hib,AL ;;
1588 MOV cs:stage,FDLEN_LOBX ;;
1589 JMP FTB_LOOP ;;
1590 ;;+++++++++++++++++++++++++++++++++
1591FDLENLO : ;; the low byte of the FONT-LENGTH
1592 MOV AX,FPKT ;;
1593 INC SI ;; byte by byte
1594 DEC CX ;;
1595 AND CX,CX ;;
1596 JNZ WORD_FDLEN ;;
1597 MOV cs:fdlen_lob,AL ;;
1598 MOV cs:stage,FDLEN_HIBX ;;
1599 JMP FTB_LOOP ;;
1600WORD_FDLEN : ;;
1601 INC SI ;;
1602 DEC CX ;;
1603 MOV cs:pre_font_len,PRE_FONT_ND;;
1604 MOV cs:fdlen_word,AX ;;
1605 AND AX,AX ;;
1606 JZ NO_DISP_PTR ;;
1607 CMP cs:type_word,TYPE_DISPLAY ;;
1608 JE DISPLAY_TYPE1 ;;
1609 CMP cs:type_word,TYPE_PRINTER ;;
1610 JE PRINTER_TYPE1 ;;
1611 ;;
1612NO_DISP_PTR : ;;
1613 MOV cs:stage,FOUNDX ;; FSTAT is to be changed
1614 JMP FTB_LOOP ;;
1615DISPLAY_TYPE1 : ;;
1616 MOV cs:stage,DISP_ROWSX ;;
1617 JMP FTB_LOOP ;;
1618PRINTER_TYPE1 : ;;
1619 MOV cs:stage,PTRSELLOX ;;
1620 JMP FTB_LOOP ;;
1621 ;;
1622 ;;+++++++++++++++++++++++++++++++++
1623FDLENHI : ;; STAGE the high byte of the F-LENGTH
1624 MOV cs:pre_font_len,PRE_FONT_ND
1625 MOV AX,FPKT ;;
1626 INC SI ;; byte by byte
1627 DEC CX ;;
1628 MOV cs:fdlen_hib,AL ;;
1629 MOV AX,cs:fdlen_word ;;
1630 AND AX,AX ;;
1631 JZ NO_DISP_PTR2 ;;
1632 CMP cs:type_word,TYPE_DISPLAY ;;
1633 JE DISPLAY_TYPE2 ;;
1634 CMP cs:type_word,TYPE_PRINTER ;;
1635 JE PRINTER_TYPE2 ;;
1636NO_DISP_PTR2: ;;
1637 MOV cs:stage,FOUNDX ;; FSTAT is to be changed
1638 JMP FTB_LOOP ;;
1639DISPLAY_TYPE2 : ;;
1640 MOV cs:stage,DISP_ROWSX ;;
1641 JMP FTB_LOOP ;;
1642PRINTER_TYPE2 : ;;
1643 MOV cs:stage,PTRSELLOX ;;
1644 JMP FTB_LOOP ;;
1645 ;;
1646 ;;+++++++++++++++++++++++++++++++++
1647DSPROWS : ;; STAGE : get the rows
1648 XOR AX,AX ;;
1649 MOV cs:disp_rows,AL ;;
1650 MOV cs:disp_cols,AL ;;
1651 MOV cs:DISP_X,AL ;;
1652 MOV cs:disp_y,AL ;;
1653 MOV cs:count_word,AX ;;
1654 ;;
1655 INC cs:pre_font_len ;;
1656 MOV AX,FPKT ;;
1657 INC SI ;;
1658 DEC CX ;;
1659 MOV cs:disp_rows,AL ;;
1660 MOV AX,cs:fdlen_word ;;
1661 DEC AX ;;
1662 MOV cs:fdlen_word,AX ;;
1663 JZ NO_DISP_FONT3 ;;
1664 MOV cs:stage,disp_colsX ;;
1665 JMP FTB_LOOP ;;
1666NO_DISP_FONT3 : ;;
1667 MOV cs:stage,FOUNDX ;; FSTAT is to be changed
1668 JMP FTB_LOOP ;;
1669 ;;+++++++++++++++++++++++++++++++++
1670DSPCOLS : ;; STAGE : get the COLS
1671 INC cs:pre_font_len ;;
1672 MOV AX,FPKT ;;
1673 INC SI ;;
1674 DEC CX ;;
1675 MOV cs:disp_cols,AL ;;
1676 MOV AX,cs:fdlen_word ;;
1677 DEC AX ;;
1678 MOV cs:fdlen_word,AX ;;
1679 JZ NO_DISP_FONT3 ;;
1680 MOV cs:stage,DISP_XX ;;
1681 JMP FTB_LOOP ;;
1682 ;;+++++++++++++++++++++++++++++++++
1683DSPX : ;; STAGE : get the aspect X
1684 INC cs:pre_font_len ;;
1685 MOV AX,FPKT ;;
1686 INC SI ;;
1687 DEC CX ;;
1688 MOV DISP_X,AL ;;
1689 MOV AX,cs:fdlen_word ;;
1690 DEC AX ;;
1691 MOV cs:fdlen_word,AX ;;
1692 JZ NO_DISP_FONT3 ;;
1693 MOV cs:stage,DISP_YX ;;
1694 JMP FTB_LOOP ;;
1695 ;;+++++++++++++++++++++++++++++++++
1696DSPY : ;; STAGE : get the aspect Y
1697 INC cs:pre_font_len ;;
1698 MOV AX,FPKT ;;
1699 INC SI ;;
1700 DEC CX ;;
1701 MOV cs:disp_y,AL ;;
1702 MOV AX,cs:fdlen_word ;;
1703 DEC AX ;;
1704 MOV cs:fdlen_word,AX ;;
1705 JZ NO_DISP_FONT3 ;;
1706 MOV cs:stage,COUNT_LOBX ;;
1707 JMP FTB_LOOP ;;
1708 ;;
1709 ;;+++++++++++++++++++++++++++++++++
1710DSPCOUNTLO : ;; the low byte of the FONT-LENGTH
1711 INC cs:pre_font_len ;;
1712 MOV AX,FPKT ;;
1713 INC SI ;; byte by byte
1714 DEC CX ;;
1715 PUSH AX ;; check if length is enough
1716 MOV AX,cs:fdlen_word ;;
1717 DEC AX ;;
1718 MOV cs:fdlen_word,AX ;;
1719 POP AX ;;
1720 JNZ A_WORD_COUNT ;;
1721 JMP NO_DISP_FONT3 ;;
1722A_WORD_COUNT : ;;
1723 AND CX,CX ;;
1724 JNZ WORD_COUNT ;;
1725 MOV cs:count_lob,AL ;;
1726 MOV cs:stage,COUNT_HIBX ;;
1727 JMP FTB_LOOP ;;
1728WORD_COUNT : ;;
1729 INC cs:pre_font_len ;;
1730 INC SI ;;
1731 DEC CX ;;
1732 MOV cs:count_word,AX ;;
1733; MOV cs:pre_font_len,PRE_FONT_D;
1734 ;;
1735 MOV AX,cs:fdlen_word ;;
1736 DEC AX ;;
1737 MOV cs:fdlen_word,AX ;;
1738 MOV cs:stage,FOUNDX ;; FSTAT is to be changed
1739 JMP FTB_LOOP ;;
1740 ;;
1741 ;;+++++++++++++++++++++++++++++++++
1742DSPCOUNTHI : ;; STAGE the high byte of the F-LENGTH
1743 INC cs:pre_font_len ;;
1744 MOV AX,FPKT ;;
1745 INC SI ;; byte by byte
1746 DEC CX ;;
1747 MOV cs:count_hib,AL ;;
1748; MOV cs:pre_font_len,PRE_FONT_D;
1749 ;;
1750 MOV AX,cs:fdlen_word ;;
1751 DEC AX ;;
1752 MOV cs:fdlen_word,AX ;;
1753 MOV cs:stage,FOUNDX ;; FSTAT is to be changed
1754 JMP FTB_LOOP ;;
1755 ;;
1756 ;;
1757 ;;+++++++++++++++++++++++++++++++++
1758PTRSELLO : ;; the low byte of the SELECTION_TYPE
1759 INC cs:pre_font_len ;;
1760 MOV AX,FPKT ;;
1761 INC SI ;; byte by byte
1762 DEC CX ;;
1763 PUSH AX ;; check if length is enough
1764 MOV AX,cs:fdlen_word ;;
1765 DEC AX ;;
1766 MOV cs:fdlen_word,AX ;;
1767 POP AX ;;
1768 JNZ A_WORD_SEL ;;
1769 JMP NO_PTR_FONT3 ;;
1770A_WORD_SEL : ;;
1771 AND CX,CX ;;
1772 JNZ WORD_SEL ;;
1773 MOV cs:ptr_selob,AL ;;
1774 MOV cs:stage,PTRSELHIX ;;
1775 JMP FTB_LOOP ;;
1776WORD_SEL : ;;
1777 INC cs:pre_font_len ;;
1778 INC SI ;;
1779 DEC CX ;;
1780 MOV cs:ptr_sel_word,AX ;;
1781 ;;
1782 MOV AX,cs:fdlen_word ;;
1783 DEC AX ;;
1784 MOV cs:fdlen_word,AX ;;
1785 ;;
1786 CMP cs:ptr_sel_word,0 ;;
1787 JNE PTR_SEL_NOT0 ;;
1788 ;;
1789 ;;
1790 MOV cs:stage,FOUNDX ;; FSTAT is to be changed
1791 JMP FTB_LOOP ;;
1792 ;;
1793PTR_SEL_NOT0 : ;;
1794 MOV cs:stage,PTRLENLOX ;;
1795 JMP FTB_LOOP ;;
1796 ;;
1797 ;;+++++++++++++++++++++++++++++++++
1798PTRSELHI: ;; STAGE the high byte of SELECT_TYPE
1799 INC cs:pre_font_len ;;
1800 MOV AX,FPKT ;;
1801 INC SI ;; byte by byte
1802 DEC CX ;;
1803 MOV cs:ptr_sehib,AL ;;
1804 ;;
1805 MOV AX,cs:fdlen_word ;;
1806 DEC AX ;;
1807 MOV cs:fdlen_word,AX ;;
1808 ;;
1809 CMP cs:ptr_sel_word,0 ;;
1810 JNE PTR_SEL_NOT0 ;;
1811 ;;
1812 ;;
1813 MOV cs:stage,FOUNDX ;; FSTAT is to be changed
1814 JMP FTB_LOOP ;;
1815 ;;
1816 ;;
1817 ;;+++++++++++++++++++++++++++++++++
1818PTRLENLO : ;; the low byte of SELECTION_LENGTH
1819 INC cs:pre_font_len ;;
1820 MOV AX,FPKT ;;
1821 INC SI ;; byte by byte
1822 DEC CX ;;
1823 PUSH AX ;; check if length is enough
1824 MOV AX,cs:fdlen_word ;;
1825 DEC AX ;;
1826 MOV cs:fdlen_word,AX ;;
1827 POP AX ;;
1828 JNZ A_WORD_SELEN ;;
1829 JMP NO_PTR_FONT3 ;;
1830A_WORD_SELEN : ;;
1831 AND CX,CX ;;
1832 JNZ WORD_SELEN ;;
1833 MOV cs:ptr_lnlob,AL ;;
1834 MOV cs:stage,PTRLENHIX ;;
1835 JMP FTB_LOOP ;;
1836WORD_SELEN : ;;
1837 INC cs:pre_font_len ;;
1838 INC SI ;;
1839 DEC CX ;;
1840 MOV cs:ptr_len_word,AX ;;
1841 ;;
1842 MOV AX,cs:fdlen_word ;;
1843 DEC AX ;;
1844 MOV cs:fdlen_word,AX ;;
1845 MOV cs:stage,FOUNDX ;; FSTAT is to be changed
1846 JMP FTB_LOOP ;;
1847 ;;
1848 ;;+++++++++++++++++++++++++++++++++
1849PTRLENHI : ;; STAGE the high byte of SELECT_LENGTH
1850 INC cs:pre_font_len ;;
1851 MOV AX,FPKT ;;
1852 INC SI ;; byte by byte
1853 DEC CX ;;
1854 MOV cs:ptr_lnhib,AL ;;
1855 ;;
1856 MOV AX,cs:fdlen_word ;;
1857 DEC AX ;;
1858 MOV cs:fdlen_word,AX ;;
1859 MOV cs:stage,FOUNDX ;; FSTAT is to be changed
1860 JMP FTB_LOOP ;;
1861 ;;
1862NO_PTR_FONT3 : ;;
1863 MOV cs:stage,FOUNDX ;; FSTAT is to be changed
1864 JMP FTB_LOOP ;;
1865 ;;+++++++++++++++++++++++++++++++++
1866PASS : ;; STAGE - PASS DUMMY BYTES
1867 ;;
1868 PUSH DX ;;
1869 PUSH ES ;;
1870 PUSH DI ;;
1871 ;;
1872 PUSH CS ;;
1873 POP ES ;;
1874 MOV DI,OFFSET PASS_BRK ;;
1875 MOV DX,PASS_INDX ;;
1876 MOV AX,cs:pass_cnt ;;
1877 ;;
1878NEXT_BRK: ;; find the next pass-break
1879 CMP AX,ES:[DI] ;;
1880 ;;
1881 JB UPTO_BRK ;;
1882 ;;
1883 DEC DX ;;
1884 JZ PASS_ERR ;;
1885 INC DI ;;
1886 INC DI ;;
1887 JMP NEXT_BRK ;;
1888 ;;
1889UPTO_BRK : ;; next break point found
1890 MOV DX,ES:[DI] ;;
1891 SUB DX,AX ;; bytes to be skipped
1892 CMP CX,DX ;; all to be skipped ?
1893 JAE PASS_ALL ;;
1894 ;;
1895 ADD cs:pass_cnt,CX ;;
1896 ADD SI,CX ;;
1897 SUB CX,CX ;;
1898 JMP PASS_END ;;
1899 ;;
1900PASS_ALL : ;;
1901 ADD cs:pass_cnt,DX ;;
1902 ADD SI,DX ;;
1903 SUB CX,DX ;;
1904 ;;
1905 MOV AX,cs:pass_postx ;;
1906 MOV cs:stage,AX ;;
1907 ;;
1908; cmp ax,passx ;; is the next stage a pass-stage ?
1909; jne not_passx ;;
1910; mov ax,pass_postxx ;;
1911; mov pass_postx,ax ;;
1912; mov pass_postxx,stage_max ;; can support only 2 consecutive pass
1913 ;;
1914;not_passx : ;;
1915 ;;
1916 JMP PASS_END ;;
1917 ;;
1918PASS_ERR : ;; DEVICE ERROR, wrong stage
1919 POP DI ;;
1920 POP ES ;;
1921 POP DX ;;
1922 MOV FTP.FTB_STATUS,STAT_DEVERR
1923 SUB CX,CX ;; ignore all the input string
1924 JMP PASS_DONE ;;
1925 ;;
1926PASS_END : ;;
1927 POP DI ;;
1928 POP ES ;;
1929 POP DX ;;
1930PASS_DONE : ;;
1931 JMP FTB_LOOP ;;
1932 ;;
1933;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1934 ;;
1935FTB_LPEND : ;;
1936 ;;
1937 CMP cs:stage,FOUNDX ;;
1938 JNE NOT_FOUNDX ;;
1939 ;;
1940 CALL FOUND_DO ;;
1941 ;;
1942NOT_FOUNDX : ;;
1943 ;;
1944 POP CX ;; STACK -1
1945 ;;
1946FP_RET : ;;
1947 POP SI ;; restore registers
1948 POP DI ;;
1949 POP DX ;;
1950 POP CX ;;
1951 POP BX ;;
1952 POP AX ;;
1953 POP ES ;;
1954 POP DS ;;
1955 ;;
1956 RET ;;
1957FONT_PARSER ENDP ;;
1958 ;;
1959;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1960CSEG ENDS
1961 END