7 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
9 ;; FILENAME: CPS Device Driver -- Font Parser
10 ;; MODULE NAME: CPSFONT
11 ;; TYPE: Font Parser Module
12 ;; LINK PROCEDURE: Link CPSPMnn+CPSFONTn+PTRMSGn+CPSPInn into .EXE format.
13 ;; CPSPM must be first. CPSPInn must be last. Everything
14 ;; before CPSPInn will be resident.
19 ;; changes are made in stages : PTRSELLO, PTRSELHI, PTRLENLO, PTRLENHI
20 ;; as for Display-type of DEVICE_ID, there will be no printer-type of
21 ;; of DEVICE_TYPE. And these four stages are for the DEVICE_TYPE with
22 ;; the value of printer-type.
24 ;; (most codes in the four stages are masked out as comments than real
25 ;; codes to save spaces. Also mask out lines that contain the
26 ;; following varaibles :
39 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
41 ;INCLUDE CPSPEQU.INC ;;
43 STAT_DELETE EQU 08000H ; previous degignate deleted (DST)
44 ; STAT_DELETE : only for FIFO
45 STAT_NOFIND EQU 08008H ; codepage,device not found (DST)
46 STAT_DEVERR EQU 0800AH ; Device error (DST, IVK, QIV, QLS)
47 STAT_BADATA EQU 0800CH ; bad font file (DST)
48 STAT_BADDEN EQU 0800CH ; no DST (DEN)
49 STAT_TOMANY EQU 0800CH ; too manay codepages (DST)
50 STAT_DUPLCP EQU 0800CH ; too manay codepages (DST)
51 STAT_NOCPIV EQU 08007H ; no codepage designated/invoked
52 STAT_NOCP EQU 08007H ; no codepage designated/invoked
54 TYPE_DISPLAY EQU 01H ;; display type device
55 FLAG_RESTART EQU 000001H ;; bit 1 = restart the parsing
59 ; ( I=Input O=Output )
61 FTB_LENGTH DW TYPE FTBLK ; (NOT TO BE CHANGED)
62 FTB_STATUS DW 0FFFFH ; (O) parsing compelte
64 FTB_TID DB '........' ; (I)
65 FTB_CP DW 0FFFFH ; (I)
68 FTB_ROWS DB 0 ;; (O) DISPLAY TYPE DEVICE
69 FTB_COLS DB 0 ;; (O) DISPLAY TYPE DEVICE
70 FTB_X DB 0 ;; (O) DISPLAY TYPE DEVICE
71 FTB_Y DB 0 ;; (O) DISPLAY TYPE DEVICE
72 FTB_COUNT DW 0 ;; (O) DISPLAY TYPE DEVICE
73 FTB_DLEFT DW 0 ; (O) =0, none to come
74 FTB_DLEN DW 0 ; (O) =0, not in this packet
75 FTB_DALO DW 0 ; (O) in the DOS "packet" buffer
76 FTB_DAHI DW 0 ; (O) " " " " "
77 TARGET_LO DW 0 ; internal registers
78 TARGET_HI DW 0 ; internal registers
85 NUM_FTBLK DW 0 ; no. of FTBKL entries
87 ; STATUS : (in FTB_STATUS)
88 FSTAT_COMPLETE EQU 0FFFFH ; parsing compeleted. (good status)
89 FSTAT_FONT EQU 0FFFEH ; font data is defined and returned
90 FSTAT_FOUND EQU 0FFFDH ; informations including font-length
91 FSTAT_MATCH EQU 0FFFCH ; font header matches FTBLK
92 FSTAT_SEARCH EQU 0FFFBH ; seraching for header & font
93 FSTAT_BOTTOM EQU 0FFF0H ; below this are the DOS_STATUS.
95 ;; the FSTAT with value lower than 0FFF0H is to be returned to the DOS
96 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
98 PUBLIC FTABLE,FONT_PARSER ;;
100 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
102 ;; ************************************
104 ;; ** Resident Code **
106 ;; ************************************
108 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
110 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
114 ;; -- Interface table : FTABLE
116 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
117 FTABLE: FBUFS <0FFFFH,,,> ;; for temporary testing
118 FTB1 FTBLK <,,,,,,,,,,,,> ;; -- at most 12 entries
119 FTB2 FTBLK <,,,,,,,,,,,,> ;;
120 FTB3 FTBLK <,,,,,,,,,,,,> ;;
121 FTB4 FTBLK <,,,,,,,,,,,,> ;;
122 FTB5 FTBLK <,,,,,,,,,,,,> ;;
123 FTB6 FTBLK <,,,,,,,,,,,,> ;;
124 FTB7 FTBLK <,,,,,,,,,,,,> ;;
125 FTB8 FTBLK <,,,,,,,,,,,,> ;;
126 FTB9 FTBLK <,,,,,,,,,,,,> ;;
127 FTBa FTBLK <,,,,,,,,,,,,> ;;
128 FTBb FTBLK <,,,,,,,,,,,,> ;;
129 FTBc FTBLK <,,,,,,,,,,,,> ;;
131 FP_ERROR DW 0000H ;; internal error register
133 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
134 ;; the followings are bytes accumulated
135 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
136 FTAG_LEN EQU 8 ;; FILE TAGE in the font file header
137 FTAG_COUNT DW 0000H ;;
139 FTAG_PATTERN LABEL BYTE ;;
144 ;; POINTER in the font file header
145 fptr_LOW LABEL WORD ;;
146 fptr_LOL DB 00H ;; NEXT
148 fptr_HIGH LABEL WORD ;;
154 ENTRY_WORD LABEL WORD ;;
155 ENTRY_LOB DB 00H ;; ENTRY COUNT
157 NEXT_LOW LABEL WORD ;;
158 NEXT_LOL DB 00H ;; NEXT
160 NEXT_HIGH LABEL WORD ;;
163 TYPE_WORD LABEL WORD ;;
164 TYPE_LOB DB 00H ;; TYPE
166 TID_CNT DW 00000H ;; TYPEID COUNT(0 to 8)
167 TYPE_ID : DB ' ' ;; TYPEID
168 CPG_WORD LABEL WORD ;;
169 CPG_LOB DB 00H ;; CODE PAGE
171 FONT_LOW LABEL WORD ;;
172 FONT_LOL DB 00H ;; FONT ADDRESS
174 FONT_HIGH LABEL WORD ;;
177 ;; the followings are contained in the font-block in the exact order & length
178 MOD_WORD LABEL WORD ;;
179 MOD_LOB DB 00H ;; MODIFIER
181 FONTS_WORD LABEL WORD ;;
182 FONTS_LOB DB 00H ;; FONTS
184 FDLEN_WORD LABEL WORD ;;
185 FDLEN_LOB DB 00H ;; FONT DATA LENGTH
187 PRE_FONT_ND EQU ($-MOD_WORD) ;; used to update target for font data
188 ;; to follow. -- for NON-DISPLAY
189 ;DISP_ROWS DB 00H ;; DISPLAY's parameters :
190 ;DISP_COLS DB 00H ;; BOX SIZE
191 ;DISP_X DB 00H ;; ASPECT RATIO
193 ;COUNT_WORD LABEL WORD ;; NO. OF DISPLAY CHARACTERS
196 ;PRE_FONT_D EQU ($-MOD_WORD) ;; used to update target for font data
197 ;; to follow. -- for DISPLAY
199 ;PTR_SEL_WORD LABEL WORD ;;
202 ;PRE_FONT_P0 EQU ($-PTR_SELOB+PRE_FONT_ND) ;; to update target for font data
203 ;; to follow -- for PRINTER with
204 ;; selection type = 0.
206 ;PTR_LEN_WORD LABEL WORD ;;
209 ;PRE_FONT_P EQU ($-PTR_SELOB+PRE_FONT_ND) ;; to update target for font data
210 ;; to follow -- for PRINTER with
211 ;; selection type <> 0.
214 ;; also update STAGE_CASES and indexing constants
215 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
216 ;; the stage the parsing is in : ;;;;;
217 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
219 STAGE_CASES LABEL WORD ;; the stage the parsing is in :
221 ;; *** INDEXED BY STAGE-INDEX
223 DW OFFSET ENTRYLO ;; 0
224 DW OFFSET ENTRYHI ;; 1
225 DW OFFSET NEXTLOL ;; 2
226 DW OFFSET NEXTLOH ;; 3
227 DW OFFSET NEXTHIL ;; 4
228 DW OFFSET NEXTHIH ;; 5
229 DW OFFSET TYPELO ;; 6
230 DW OFFSET TYPEHI ;; 7
231 DW OFFSET TYPEIDS ;; 8
234 DW OFFSET FONTLOL ;; B
235 DW OFFSET FONTLOH ;; C
236 DW OFFSET FONTHIL ;; D
237 DW OFFSET FONTHIH ;; E
238 DW 00H ;; MATCH case -- end of SEARCH stages
239 DW 00H ;; SCAN case -- before PRE-FOUND stage
240 DW OFFSET MODLO ;; 11
241 DW OFFSET MODHI ;; 12
242 DW OFFSET FONTSLO ;; 13
243 DW OFFSET FONTSHI ;; 14
244 DW OFFSET FDLENLO ;; 15
245 DW OFFSET FDLENHI ;; 16 -- lead to FONT case,NON- DISPLAY
246 DW OFFSET DSPROWS ;; 17 -- DISPLAY only
247 DW OFFSET DSPCOLS ;; 18
250 DW OFFSET DSPCOUNTLO ;; 1B
251 DW OFFSET DSPCOUNTHI ;; 1C -- lead to FONT case, DISPLAY
252 DW OFFSET PTRSELLO ;; 1D -- PRINTER only
253 DW OFFSET PTRSELHI ;; 1E
254 DW OFFSET PTRLENLO ;; 1F
255 DW OFFSET PTRLENHI ;; 20 -- lead to FONT case, PRINTER
257 DW 00H ;; GET_FONT case
258 DW 00H ;; PASS special stage
259 DW OFFSET FILETAG ;; 24
260 DW OFFSET fptrLOL ;; 25
261 DW OFFSET fptrLOH ;; 26
262 DW OFFSET fptrHIL ;; 27
263 DW OFFSET fptrHIH ;; 28
264 DW 00H ;; FPTR_SKIP_CASE
266 ;; The followings are individual stage
267 STAGE_MAX EQU ($-STAGE_CASES)/2 ;; number of stages
271 ;; **** INDEX TO STAGE_CASES ****
274 NEXT_LOLX EQU 02H ;; NEXT
278 TYPE_LOBX EQU 06H ;; TYPE
280 TYPE_IDX EQU 08H ;; TYPEID
281 CPG_LOBX EQU 09H ;; CODE PAGE
283 FONT_LOLX EQU 0BH ;; FONT ADDRESS
287 ;; ------------------------------
288 MATCHX EQU 0FH ;; MATCH is the end of SEARCH's stages
289 SCANX EQU 10H ;; SCANX is before the PRE-FOUND stages
290 ;; ------------------------------
291 MOD_LOBX EQU 11H ;; MODIFIER
293 FONTS_LOBX EQU 13H ;; FONTS
294 FONTS_HIBX EQU 14H ;;
295 FDLEN_LOBX EQU 15H ;; FONT DATA LENGTH
296 FDLEN_HIBX EQU 16H ;;
297 DISP_ROWSX EQU 17H ;; DISPLAY -- CHAR. SIZE
298 DISP_COLSX EQU 18H ;;
299 DISP_XX EQU 19H ;; DISPLAY -- ASPECT RATIO
301 COUNT_LOBX EQU 1BH ;; DISPLAY -- COUNT
302 COUNT_HIBX EQU 1CH ;;
308 ;; ------------------------------
309 FOUNDX EQU 21H ;; GET_FX is the end of PRE-FOUND stage
311 ;; ------------------------------
312 PASSX EQU 23H ;; see pass_brk table
313 ;; ------------------------------
314 FTAGX EQU 24H ;; RESTART ==> FILE TAG
316 fptr_LOLX EQU 25H ;; POINTER in font file header
319 fptr_HIHX EQU 28H ;; ---------------------------------
321 fptr_SKIPX EQU 29H ;; ==> ENTRY_LOX
322 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
323 ;; PASS -- to skip some bytes ;;;;;;
324 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
325 ;; the PASS mechanism is used to skip
326 ;; a number of bytes between two fields
327 ;; The numbers are tabulated in
328 ;; PASS_BRK table in the accumulative
329 ;; sum. The PASS_POSTX(and PASS_POSTXX)
330 ;; are used to tell what is the stage
331 ;; after all the bytes have skipped.
333 PASS_POSTX DW STAGE_MAX ;; the stage after pass-stage
335 FILE_OFFSET EQU 0BH ;; spaces to be skipped in font file :
336 ;; ( after TAG, before POINTER)
339 PASS_BRK LABEL WORD ;;
340 DW FILE_OFFSET ;; skip in the font file header
341 DW FILE_OFFSET+2 ;; pass header-length, needs to reset
342 ;; PASS_CNT for each of the font_header
343 DW FILE_OFFSET+8 ;; pass header-reserved bytes
344 PASS_INDX EQU ($-PASS_BRK)/2 ;;
345 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
346 ;; the control variables : ;;;;;;;;
347 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
348 STAGE DW STAGE_MAX ;; of the STAGE-INDEX
350 Pre_font_len DW 00000H ;; no. of bytes before the FONT DATA
353 COUNT_LO DW 00000H ;; no. of bytes parsed so far
354 COUNT_hI DW 00000H ;;
356 HIT_LO DW 00000H ;; the next byte that is addressed by :
357 HIT_HI DW 00000H ;; either NEXT or TARGET in FTBLK.
359 HIT_FLAG DW 00000H ;; IF ZERO, the NEXT is approaching
360 HIT_BX DW 00000H ;; where FTB is found for nearest hit
362 NUM_FTB DW 00000H ;; as defined in the FP_BUFFER
364 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
366 ;; FONT_PARSER routine
368 ;; -- to be called at every packet received to extract informations
369 ;; from Font File on byte basis.
371 ;; -- Interface though FTABLE
373 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
376 PUSH DS ;; save all registers Revised
384 ;; BP isn't used, so it isn't saved
388 LDS SI,FTP.BUFFER_ADDR ;; DS:[SI]
389 MOV CX,FTP.BUFFER_LEN ;; CX = length of packet
390 MOV DX,FTP.NUM_FTBLK ;; DX = number of FTB
394 MOV cs:fp_error,0020H ;; ERROR 0020H
398 AND AX,FLAG_RESTART ;;
402 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
404 PUSH BX ;; reset all the output fields
405 ADD BX,TYPE FBUFS ;; FTP = FONT BLOCK
408 MOV cs:ftag_count,AX ;;
409 MOV cs:fptr_low,AX ;;
410 MOV cs:fptr_high,AX ;;
411 MOV cs:pre_font_len,AX ;;
412 MOV cs:count_lo,AX ;;
413 MOV cs:count_hi,AX ;;
414 MOV cs:next_low,AX ;;
415 MOV cs:next_high,AX ;;
418 MOV cs:hit_flag,AX ;;
419 MOV cs:pass_cnt,AX ;;
420 MOV cs:pass_postx,STAGE_MAX ;;
422 MOV cs:stage,STAGE_MAX ;;
425 MOV FTP.FTB_STATUS,FSTAT_SEARCH
426 MOV FTP.FTB_TYPE,AX ;;
427 MOV FTP.FTB_MOD,AX ;;
428 MOV FTP.FTB_FONTS,AX ;;
429 MOV FTP.FTB_ROWS,AL ;;
430 MOV FTP.FTB_COLS,AL ;;
433 MOV FTP.FTB_COUNT,AX ;;
434 MOV FTP.FTB_DLEFT,AX ;;
435 MOV FTP.FTB_DLEN,AX ;;
436 MOV FTP.FTB_DALO,AX ;;
437 MOV FTP.FTB_DAHI,AX ;;
438 MOV FTP.TARGET_LO,AX ;;
439 MOV FTP.TARGET_HI,AX ;;
441 ADD BX, TYPE FTBLK ;;
448 NO_RESTART : ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
449 ;; any FTBLKs have their data all
450 ;; returned ? if so set their status
451 ;; from FOUND to COMPLETE
453 ADD BX,TYPE FBUFS ;; FTP = FONT BLOCK
458 MOV AX,FTP.FTB_STATUS ;;
462 MOV AX,FTP.FTB_DLEFT ;;
466 MOV FTP.FTB_STATUS,FSTAT_COMPLETE
477 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
478 ADD BX,TYPE FBUFS ;; FTP = FONT BLOCK
480 PUSH CX ;; STACK 1 = CX
481 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
483 ;; DO WHILE CX is not zero :
485 ;; -- on each loop, the CX, COUNTs are updated
487 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
493 ADD cs:count_lo,AX ;;
495 ADD cs:count_hi,1000H ;;
497 PUSH CX ;; STACK 1 = CX
502 FTB_CONT : ;; ==========
508 JMP START_CASE ;; ** RESTART **
513 JMP SEARCH_CASE ;; ** SEARCH **
518 JMP MATCH_CASE ;; ** MATCH **
523 JMP SCAN_CASE ;; ** SCAN **
528 JMP PRE_FOUND_CASE ;; ** PRE-FOUND **
533 JMP FOUND_CASE ;; ** FOUND **
538 JMP GETFONT_CASE ;; ** GET_FONT **
543 JMP PASS ;; ** PASS **
548 JMP SEARCH_CASE ;; ** SEARCH **
553 JMP FPTR_SKIP_CASE ;; ** SEARCH **
556 MOV FTP.FTB_STATUS,STAT_DEVERR
557 JMP FTB_LPEND ;; ** DEVICE ERROR **
559 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
561 ;; at the entry of each STAGES /CASES
563 ;; -- DS:[SI] (FPKT) points to PACKET, of DOS's buffer
564 ;; -- CX remaining packet length
565 ;; -- ES:[BX] points to the first FTBLK
566 ;; -- COUNT_LO, COUNT_HI, upto but and including the address pointed by FPKT
569 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
571 ;============================================================================
572 START_CASE : ;; pass the FILE leading bytes
574 MOV cs:ftag_count,0 ;;
575 MOV cs:stage,ftagx ;;
578 ;=============================================================================
579 FPTR_SKIP_CASE : ;; skip until the ENTRY pointed by
580 ;; POINTER (in FPTR) is reached.
583 MOV AX,cs:fptr_low ;; * HIT = FPTR *
584 MOV cs:hit_lo,AX ;; **************
585 MOV DX,cs:fptr_high ;;
589 JNE FPTR_SKIP_VALID ;;
591 JNE FPTR_SKIP_VALID ;;
593 MOV FTP.FTB_STATUS,STAT_BADATA ;; returned at the first FTBLK
594 JMP FPTR_SKIP_MORE ;;
597 ;; normalised HIT_HI, HIT_LO
611 ;; **************************
612 ;; * compare FPTR and COUNT *
613 ;; **************************
614 ;; DX:AX = HIT_HI:HIT_LO (normalised)
616 SUB AX,cs:count_lo ;;
622 SUB DX,cs:count_hi ;;
625 INC AX ;; COUNT can be at the HIT, then AX=0
626 JNC NO_CARRY11 ;; INC AX to make AX comparable to CX
627 ADD DX,01000H ;; i.e. AX = offset + 1
631 JA fptr_skip_more ;; AX > CX, whole CX to be skipped
633 PUSH DX ;; normalise dx:ax
647 PUSH DX ;; STACK +1 : normalosed DX:AX
651 JC fptr_MORE_CXp ;; dx:ax < cx
655 JNE fptr_skip_MOREP ;;
657 JNE fptr_skip_MOREP ;;
661 ;; ************************************
662 ;; * POINTER is within the current CX *
663 ;; ************************************
668 fptr_MORE_CX : ;; DX = 0,to have more CX than offset+1
669 DEC AX ;; = offset : 0 and above
671 ADD SI,AX ;; where the first byte is
673 MOV cs:stage,entry_lox ;; ENTRIES in the font file
675 JMP FTB_LOOP ;; ****** RETURN *******
677 ;; ***********************************
678 ;; * more to skip ==> FPTR_SKIP_CASE *
679 ;; ***********************************
687 JMP FTB_LOOP ;; ****** RETURN *****
689 ;; ***********************************
690 ;; * bad POINTER in font file header *
691 ;; ***********************************
694 MOV cs:fptr_low,0FFFFH ;;
695 MOV cs:fptr_high,0FFFFH ;;
697 MOV FTP.FTB_STATUS,STAT_BADATA ;; returned at the first FTBLK
699 JMP FPTR_SKIP_MORE ;;
701 ;=============================================================================
703 ;; still looking for header to match
704 ;; the input : codepage and typeid
708 ADD DI,DI ;; double to index to WORD-offset
710 JMP CS:STAGE_CASES[DI] ;; call routine to process the stage
713 ;===========================================================================
721 MOV AX,FTP.FTB_STATUS ;;
722 CMP AX,FSTAT_SEARCH ;;
727 MOV AX,FTP.FTB_CP ;; check the FTB with SEARCH status
728 CMP AX,cs:cpg_word ;;
730 PUSH DS ;; code page matched
736 MOV SI,OFFSET TYPE_ID ;;
737 LEA DI,[BX].FTB_TID ;;
746 ;; MATCH !!!!! (type_id matched)
747 MOV FTP.FTB_STATUS,FSTAT_MATCH
748 MOV AX,cs:type_word ;;
749 MOV FTP.FTB_TYPE,AX ;;
750 MOV AX,cs:font_low ;;
751 MOV FTP.TARGET_LO,AX ;;
752 MOV AX,cs:font_high ;;
753 MOV FTP.TARGET_HI,AX ;;
757 MATCH_MORE : ;; if this is the last rounf ?
759 MOV AX,cs:next_low ;; NEXT = FFFF:FFFF means no more
760 CMP AX,-1 ;; header to come.
763 MOV AX,cs:next_high ;;
767 MOV FTP.FTB_STATUS,STAT_NOFIND ;; ERROR : no match
770 ADD BX,FTP.FTB_LENGTH ;;
777 MOV cs:stage,SCANX ;;
783 ;===========================================================================
785 ;; **********************************
786 ;; * determine whether it the font *
787 ;; * data(TARGET),or the next font *
788 ;; * header(NEXT) that is approaching
789 ;; **********************************
791 MOV AX,cs:next_low ;;
793 MOV AX,cs:next_high ;;
796 MOV cs:hit_flag,AX ;;
798 MOV DI,cs:hit_hi ;; normalised HIT_HI, HIT_LO
817 MOV AX,FTP.FTB_STATUS ;;
818 CMP AX,FSTAT_MATCH ;;
822 MOV DI,FTP.TARGET_HI ;; NORMALISED TARGET
830 ADD AX,FTP.TARGET_LO ;;
833 NO_CARRY1 : ;; DI:AX = NORMALISED TARGET
835 ;; ** compare the TARGET and the NEXT
847 ;; **********************************
848 ;; * the font data is approaching *
849 ;; **********************************
851 MOV cs:hit_flag,-1 ;;
854 MOV cs:hit_bx,BX ;; used for BAD_BX and in FOUND_CASE
857 ;; **********************************
858 ;; * the NEXT header is approaching *
859 ;; **********************************
861 MOV AX,cs:hit_flag ;;
864 MOV FTP.FTB_STATUS,STAT_BADATA ;; next header and font cannot be the
872 ADD BX,FTP.FTB_LENGTH ;;
873 JMP SCAN_LOOP ;; ** is there any closer font data ?
875 ;; ************************************
876 ;; * the HIT is either font data(TARGET
877 ;; * or the font block (NEXT). *
878 ;; ************************************
881 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
882 MOV DX,cs:hit_hi ;; HIT_FLAG, HIT_LO, HIT_HI defined
889 JMP SCAN_MORE ;; stage remained as SCAN, discard data
892 ;; DX:AX = HIT_HI:HIT_LO (normalised)
893 SUB AX,cs:count_lo ;;
898 SUB DX,cs:count_hi ;;
901 INC AX ;; COUNT can be at the HIT, then AX=0
902 JNC NO_CARRYX ;; INC AX to make AX comparable to CX
903 ADD DX,01000H ;; i.e. AX = offset + 1
942 MORE_CX : ;; DX = 0,to have more CX than offset+1
943 DEC AX ;; = offset : 0 and above
945 ADD SI,AX ;; where the first byte is
946 MOV AX,cs:hit_flag ;;
950 MOV cs:stage,MOD_LOBX ;; font-data reached,
952 JMP FTB_LOOP ;; ****** RETURN *******
955 MOV cs:stage,PASSX ;;
956 MOV cs:pass_postx,next_lolX ;;
957 MOV cs:pass_cnt,FILE_OFFSET ;;
960 JMP FTB_LOOP ;; ****** RETURN *******
962 ;; ***********************************
963 SCAN_MOREP : ;; * scan more FTBLK for the nearest *
965 ;; ***********************************
972 JMP FTB_LOOP ;; more SCAN stage
974 SCAN_BAD: ;; *************************
975 MOV AX,cs:hit_flag ;; * scan is bad *
976 AND AX,AX ;; *************************
978 MOV AX,-1 ;; NEXT is pointing backwards
979 MOV cs:next_low,AX ;;
980 MOV cs:next_high,AX ;; no more NEXT
981 MOV FTP.FTB_STATUS,STAT_BADATA ;; returned at the first FTBLK
985 PUSH BX ;; FONT is pointing backwards
987 MOV FTP.FTB_STATUS,STAT_BADATA
991 ;===========================================================================
993 ;; extract informations from the font
994 ;; block until font_length is defined
998 ADD DI,DI ;; double to index to WORD-offset
1000 JMP CS:STAGE_CASES[DI] ;; call routine to process the stage
1002 ;===========================================================================
1004 MOV DI,OFFSET FTB_LOOP ;; as FOUND has two places to return to
1006 ;===========================================================================
1008 ;; define informations into FTBLK of
1009 ;; HIT_BX defined in the SCAN case
1013 MOV AX,cs:mod_word ;;
1014 MOV FTP.FTB_MOD,AX ;;
1015 MOV AX,cs:fonts_word ;;
1016 MOV FTP.FTB_FONTS,AX ;;
1018 MOV AX,cs:fdlen_word ;;
1019 MOV FTP.FTB_DLEFT,AX ;;
1020 MOV FTP.FTB_DLEN,0 ;;
1021 MOV FTP.FTB_DALO,0 ;;
1022 MOV FTP.FTB_DAHI,0 ;;
1024 MOV FTP.FTB_STATUS,FSTAT_FOUND
1026 ; CMP FTP.FTB_TYPE,TYPE_DISPLAY;
1027 ; JNE CHECK_PTR_TYPE ;;
1028 ; CMP cs:pre_font_len,PRE_FONT_D ;;
1029 ; JNE DISPLAY_BAD ;;
1030 ; JMP DISPLAY_DONE ;;
1032 ;CHECK_PTR_TYPE : ;;
1033 ; CMP FTP.FTB_TYPE,TYPE_PRINTER;
1035 ; CMP cs:ptr_sel_word,0 ;;
1036 ; JNE PRINTER_HAS_SEL ;;
1037 ; CMP cs:pre_font_len,PRE_FONT_P0;;
1038 ; JNE PRINTER_BAD ;;
1039 ; JMP PRINTER_DONE ;;
1041 ;PRINTER_HAS_SEL : ;;
1042 ; CMP cs:pre_font_len,PRE_FONT_P ;;
1043 ; JNE PRINTER_BAD ;;
1044 ; JMP PRINTER_DONE ;;
1048 ; MOV FTP.FTB_STATUS,STAT_BADATA ;the FDLEN_WORD should be 0.
1051 ; MOV AL,cs:disp_rows ;;
1052 ; MOV FTP.FTB_ROWS,AL ;;
1053 ; MOV AL,cs:disp_cols ;;
1054 ; MOV FTP.FTB_COLS,AL ;;
1055 ; MOV AL,cs:disp_x ;;
1056 ; MOV FTP.FTB_X,AL ;;
1057 ; MOV AL,cs:disp_y ;;
1058 ; MOV FTP.FTB_Y,AL ;;
1059 ; MOV AX,cs:count_word ;;
1060 ; MOV FTP.FTB_COUNT,AX ;;
1065 ; MOV FTP.FTB_STATUS,STAT_BADATA ;the FDLEN_WORD should be 0.
1068 ; MOV AX,cs:ptr_sel_word ;;
1069 ; MOV FTP.FTB_SELECT,AX ;;
1070 ; MOV AX,cs:ptr_len_word ;;
1071 ; MOV FTP.FTB_SELLEN,AX ;;
1073 ;SET_STAGE : ;; STAGE :
1074 MOV AX,cs:fdlen_word ;; if no font data to follow
1077 MOV cs:stage,SCANX ;; then scan for next header or font
1080 GET_FDATA : ;; update the moving target
1081 MOV cs:stage,GET_FX ;;
1082 MOV AX,cs:pre_font_len ;;
1083 ADD FTP.TARGET_LO,AX ;;
1085 ADD FTP.TARGET_HI,01000H ;;
1091 ;===========================================================================
1092 GETFONT_CASE : ;; as ES:[SI], at COUNT, there is font
1094 MOV DX,cs:num_ftb ;;
1097 MOV cs:hit_hi,0 ;; temp. register
1098 MOV cs:hit_flag,0 ;; assumed can be changed to SCAN stage
1100 MOV DI,cs:count_hi ;; normalised COUNT_HI,COUNT_LO
1108 ADD AX,cs:count_lo ;;
1112 MOV cs:count_lo,AX ;;
1113 MOV cs:count_hi,DI ;;
1117 MOV AX,FTP.FTB_STATUS ;;
1118 CMP AX,FSTAT_FONT ;;
1121 CMP AX,FSTAT_FOUND ;;
1127 MOV AX,FTP.FTB_DLEFT ;;
1130 MOV FTP.FTB_STATUS,FSTAT_FONT;
1131 JMP GETFONT_CONT1 ;;
1135 MOV AX,FTP.FTB_DLEFT ;;
1137 JNZ GETFONT_CONT1 ;;
1140 ;; only on FOUND and DLEFT <> 0
1142 MOV DI,FTP.TARGET_HI ;; normalised TARGET
1150 ADD AX,FTP.TARGET_LO ;;
1153 NO_CARRY5 : ;; DI:AX = TARGET (normalised)
1155 CMP DI,cs:count_hi ;;
1158 CMP AX,cs:count_lo ;;
1162 MOV FTP.FTB_DALO,SI ;; where the font data is in the packet
1163 MOV FTP.FTB_DAHI,DS ;;
1165 MOV AX,FTP.FTB_DLEFT ;;
1169 MOV FTP.FTB_DLEFT,0 ;;
1170 MOV FTP.FTB_DLEN,AX ;;
1175 ADD FTP.TARGET_LO,AX ;;
1177 ADD FTP.TARGET_HI,01000H ;;
1181 MOV FTP.FTB_STATUS,STAT_BADATA ;; pointing backwards
1186 MOV FTP.FTB_DLEFT,AX ;;
1187 MOV FTP.FTB_DLEN,CX ;;
1189 ADD FTP.TARGET_LO,CX ;;
1191 ADD FTP.TARGET_HI,01000H ;;
1193 AND AX,AX ;; all data have been returned ?
1196 MOV cs:hit_flag,-1 ;; no ! stay in the GET_FONT stage
1199 ADD BX,FTP.FTB_LENGTH ;;
1210 CMP cs:hit_flag,0 ;;
1212 MOV cs:stage,SCANX ;; no more in the GET_FONT stage
1219 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1221 ;; STAGES -- "called by" SERACH_CASE
1223 ;; -- DS:[SI] (FPKT) points to PACKET, of DOS's buffer
1224 ;; -- CX remaining packet length
1225 ;; -- ES:[BX] points to the first FTBLK
1226 ;; -- COUNT_LO, COUNT_HI, upto but not including the address pointed by FPKT
1229 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1230 ;;+++++++++++++++++++++++++++++++++
1233 ; mov ax,ftag_len ;;
1234 cmp cs:ftag_count,ftag_len ;;
1238 mov ftp.ftb_status,stat_deverr
1239 mov cs:fp_error,00022H ;; ERROR 0022H
1241 FTAG_FAILED : ;; discard all the bytes, while
1242 ADD SI,CX ;; stage stays as FTAGX
1244 JMP FTB_LOOP ;; **** RETURN (bytes discarded) ****
1251 MOV DI,cs:ftag_count ;;
1252 CMP AL,cs:ftag_pattern[DI] ;;
1255 mov ftp.ftb_status,stat_badata
1256 MOV ax,ftag_len ;; stays in FTAGX to consume all bytes
1257 MOV cs:ftag_count,ax ;; stays in FTAGX to consume all bytes
1258 JMP FTB_LOOP ;; **** RETURN (FAILED !) ****
1262 MOV cs:ftag_count,DI ;;
1267 JMP FTB_LOOP ;; **** RETURN ( MORE TO COME) ****
1270 MOV cs:pass_cnt,0 ;;
1271 MOV cs:stage,PASSX ;;
1272 MOV cs:pass_postx,fptr_lolx ;;
1274 JMP FTB_LOOP ;; **** NEXT STAGE ****
1276 ;;+++++++++++++++++++++++++++++++++
1277 fptrLOL : ;; STAGE the low byte of the low fptr
1279 INC SI ;; byte by byte
1283 MOV cs:fptr_lol,AL ;;
1284 MOV cs:stage,fptr_lohX ;;
1289 MOV cs:fptr_low,AX ;;
1290 MOV cs:stage,fptr_HILX ;;
1292 ;;+++++++++++++++++++++++++++++++++
1293 fptrLOH : ;; STAGE the high byte of the low fptr
1295 INC SI ;; byte by byte
1297 MOV cs:fptr_loh,AL ;;
1298 MOV cs:stage,fptr_HILX ;;
1300 ;;+++++++++++++++++++++++++++++++++
1301 fptrHIL : ;; STAGE the low byte of the high fptr
1303 INC SI ;; byte by byte
1307 MOV cs:fptr_hil,AL ;;
1308 MOV cs:stage,fptr_hihX ;;
1313 MOV cs:fptr_high,AX ;;
1314 MOV cs:stage,FPTR_SKIPX ;;
1316 ;;+++++++++++++++++++++++++++++++++
1317 fptrHIH : ;; STAGE the high byte of the high fptr
1319 INC SI ;; byte by byte
1321 MOV cs:fptr_hih,AL ;;
1322 MOV cs:stage,FPTR_SKIPX ;;
1324 ;;+++++++++++++++++++++++++++++++++
1325 ENTRYLO : ;; STAGE - ENTRY LOW BYTE
1327 INC SI ;; byte by byte
1331 MOV cs:entry_lob,AL ;;
1332 MOV cs:stage,ENTRY_HIX ;;
1337 MOV cs:entry_word,AX ;;
1338 MOV cs:stage,PASSX ;; 2 bytes to be passed
1339 MOV cs:pass_postx,NEXT_LOLX ;;
1341 ;;+++++++++++++++++++++++++++++++++
1342 ENTRYHI : ;; stage - ENTRY HIGN BYTE
1344 INC SI ;; byte by byte
1346 MOV cs:entry_hib,AL ;;
1347 MOV cs:stage,PASSX ;; 2 bytes to be passed
1348 MOV cs:pass_postx,NEXT_LOLX ;;
1363 MOV cs:stage,NEXT_LOLX ;;
1365 ;;+++++++++++++++++++++++++++++++++
1366 NEXTLOL : ;; STAGE the low byte of the low NEXT
1368 INC SI ;; byte by byte
1372 MOV cs:next_lol,AL ;;
1373 MOV cs:stage,NEXT_LOHX ;;
1378 MOV cs:next_low,AX ;;
1379 MOV cs:stage,next_hilX ;;
1381 ;;+++++++++++++++++++++++++++++++++
1382 NEXTLOH : ;; STAGE the high byte of the low NEXT
1384 INC SI ;; byte by byte
1386 MOV cs:next_loh,AL ;;
1387 MOV cs:stage,next_hilX ;;
1389 ;;+++++++++++++++++++++++++++++++++
1390 NEXTHIL : ;; STAGE the low byte of the high NEXT
1392 INC SI ;; byte by byte
1396 MOV cs:next_hil,AL ;;
1397 MOV cs:stage,NEXT_HIHX ;;
1402 MOV cs:next_high,AX ;;
1403 MOV cs:stage,type_lobX ;;
1405 ;;+++++++++++++++++++++++++++++++++
1406 NEXTHIH : ;; STAGE the high byte of the high NEXT
1408 INC SI ;; byte by byte
1410 MOV cs:next_hih,AL ;;
1411 MOV cs:stage,type_lobX ;;
1413 ;;+++++++++++++++++++++++++++++++++
1414 TYPELO : ;; STAGE the low byte of the TYPE
1416 INC SI ;; byte by byte
1420 MOV cs:type_lob,AL ;;
1421 MOV cs:stage,type_hibX ;;
1426 MOV cs:type_word,AX ;;
1427 MOV cs:stage,type_idX ;;
1430 ;;+++++++++++++++++++++++++++++++++
1431 TYPEHI : ;; STAGE the high byte of the TYPE
1433 INC SI ;; byte by byte
1435 MOV cs:type_hib,AL ;;
1436 MOV cs:stage,TYPE_IDX ;;
1439 ;;+++++++++++++++++++++++++++++++++
1440 TYPEIDS : ;; STAGE the type id
1443 MOV FTP.FTB_STATUS,STAT_DEVERR
1444 MOV cs:fp_error,00021H ;; ERROR 0021H
1451 SUB AX,cs:tid_cnt ;;
1454 ;; all data in FPKT are stored
1459 MOV DI,OFFSET TYPE_ID ;;
1460 ADD DI,cs:tid_cnt ;;
1461 ADD cs:tid_cnt,CX ;;
1462 REP MOVSB ;; SI is incremented accordingly
1465 MOV CX,0 ;; STAGE remained
1474 MOV DI,OFFSET TYPE_ID ;;
1475 ADD DI,cs:tid_cnt ;;
1477 REP MOVSB ;; SI is incremented accordingly
1480 ADD cs:tid_cnt,AX ;;
1484 MOV cs:stage,CPG_LOBX ;;
1486 ;;+++++++++++++++++++++++++++++++++
1487 CPGLO : ;; STAGE the low byte of the CODE PAGE
1489 INC SI ;; byte by byte
1493 MOV cs:cpg_lob,AL ;;
1494 MOV cs:stage,CPG_HIBX ;;
1499 MOV cs:cpg_word,AX ;;
1500 MOV cs:stage,PASSX ;;
1501 MOV cs:pass_postx,font_lolX ;;
1503 ;;+++++++++++++++++++++++++++++++++
1504 CPGHI : ;; STAGE the high byte of the CODE PAGE
1506 INC SI ;; byte by byte
1508 MOV cs:cpg_hib,AL ;;
1509 MOV cs:stage,PASSX ;;
1510 MOV cs:pass_postx,font_lolX ;;
1512 ;;+++++++++++++++++++++++++++++++++
1513 FONTLOL : ;; STAGE the low byte of the low FONT
1515 INC SI ;; byte by byte
1519 MOV cs:font_lol,AL ;;
1520 MOV cs:stage,FONT_LOHX ;;
1525 MOV cs:font_low,AX ;;
1526 MOV cs:stage,FONT_HILX ;;
1528 ;;+++++++++++++++++++++++++++++++++
1529 FONTLOH : ;; STAGE the high byte of the low FONT
1531 INC SI ;; byte by byte
1533 MOV cs:font_loh,AL ;;
1534 MOV cs:stage,FONT_HILX ;;
1536 ;;+++++++++++++++++++++++++++++++++
1537 FONTHIL : ;; STAGE the low byte of the high FONT
1539 INC SI ;; byte by byte
1543 MOV cs:font_hil,AL ;;
1544 MOV cs:stage,FONT_HIHX ;;
1549 MOV cs:font_high,AX ;;
1550 ;;;;;; MOV cs:stage,MOD_LOBX ;; end of SCAN
1551 ;; anymore headers to be processed ?
1552 MOV cs:stage,MATCHX ;;
1553 MOV AX,cs:entry_word ;;
1555 MOV cs:entry_word,AX ;;
1558 ;; no more header to be processed !
1560 MOV cs:next_low,AX ;;
1561 MOV cs:next_high,AX ;; as ENTRY has been consumed
1565 MOV AX,cs:next_low ;;
1568 MOV AX,cs:next_high ;;
1571 ;; no more header to be processed !
1573 MOV cs:next_low,AX ;; as NEXT is nil
1574 MOV cs:next_high,AX ;;
1578 ;;+++++++++++++++++++++++++++++++++
1579 FONTHIH : ;; STAGE the high byte of the high FONT
1581 INC SI ;; byte by byte
1583 MOV cs:font_hih,AL ;;
1584 ;;;;; MOV cs:stage,MOD_LOBX ;; end of SCAN
1586 MOV cs:stage,MATCHX ;;
1587 ;; anymore headers to be processed ?
1588 MOV AX,cs:entry_word ;;
1590 MOV cs:entry_word,AX ;;
1593 ;; no more header to be processed !
1595 MOV cs:next_low,AX ;;
1596 MOV cs:next_high,AX ;; as ENTRY has been consumed
1600 MOV AX,cs:next_low ;;
1603 MOV AX,cs:next_high ;;
1606 ;; no more header to be processed !
1608 MOV cs:next_low,AX ;; as NEXT is nil
1609 MOV cs:next_high,AX ;;
1614 ;;+++++++++++++++++++++++++++++++++
1615 MODLO : ;; STAGE the low byte of the MODIFIER
1617 INC SI ;; byte by byte
1622 MOV cs:stage,MOD_HIBX ;;
1627 MOV cs:mod_word,AX ;;
1628 MOV cs:stage,fonts_lobX ;;
1630 ;;+++++++++++++++++++++++++++++++++
1631 MODHI : ;; STAGE the high byte of the MODIFIER
1633 INC SI ;; byte by byte
1635 MOV cs:mod_hib,AL ;;
1636 MOV cs:stage,FONTS_LOBX ;;
1638 ;;+++++++++++++++++++++++++++++++++
1639 FONTSLO : ;; STAGE the low byte of the FONTS
1641 INC SI ;; byte by byte
1645 MOV cs:fonts_lob,AL ;;
1646 MOV cs:stage,FONTS_HIBX ;;
1651 MOV cs:fonts_word,AX ;;
1652 MOV cs:stage,FDLEN_LOBX ;;
1654 ;;+++++++++++++++++++++++++++++++++
1655 FONTSHI : ;; STAGE the high byte of the FONTS
1657 INC SI ;; byte by byte
1659 MOV cs:fonts_hib,AL ;;
1660 MOV cs:stage,FDLEN_LOBX ;;
1662 ;;+++++++++++++++++++++++++++++++++
1663 FDLENLO : ;; the low byte of the FONT-LENGTH
1665 INC SI ;; byte by byte
1669 MOV cs:fdlen_lob,AL ;;
1670 MOV cs:stage,FDLEN_HIBX ;;
1675 MOV cs:pre_font_len,PRE_FONT_ND;;
1676 MOV cs:fdlen_word,AX ;;
1679 ; CMP cs:type_word,TYPE_DISPLAY ;;
1680 ; JE DISPLAY_TYPE1 ;;
1681 ; CMP cs:type_word,TYPE_PRINTER ;;
1682 ; JE PRINTER_TYPE1 ;;
1685 MOV cs:stage,FOUNDX ;; FSTAT is to be changed
1688 ; MOV cs:stage,DISP_ROWSX ;;
1691 ; MOV cs:stage,PTRSELLOX ;;
1694 ;;+++++++++++++++++++++++++++++++++
1695 FDLENHI : ;; STAGE the high byte of the F-LENGTH
1696 MOV cs:pre_font_len,PRE_FONT_ND
1698 INC SI ;; byte by byte
1700 MOV cs:fdlen_hib,AL ;;
1701 MOV AX,cs:fdlen_word ;;
1703 ; JZ NO_DISP_PTR2 ;;
1704 ; CMP cs:type_word,TYPE_DISPLAY ;;
1705 ; JE DISPLAY_TYPE2 ;;
1706 ; CMP cs:type_word,TYPE_PRINTER ;;
1707 ; JE PRINTER_TYPE2 ;;
1709 MOV cs:stage,FOUNDX ;; FSTAT is to be changed
1712 ; MOV cs:stage,DISP_ROWSX ;;
1715 ; MOV cs:stage,PTRSELLOX ;;
1718 ;;+++++++++++++++++++++++++++++++++
1719 DSPROWS : ;; STAGE : get the rows
1721 ; MOV cs:disp_rows,AL ;;
1722 ; MOV cs:disp_cols,AL ;;
1723 ; MOV cs:DISP_X,AL ;;
1724 ; MOV cs:disp_y,AL ;;
1725 ; MOV cs:count_word,AX ;;
1727 ; INC cs:pre_font_len ;;
1731 ; MOV cs:disp_rows,AL ;;
1732 ; MOV AX,cs:fdlen_word ;;
1734 ; MOV cs:fdlen_word,AX ;;
1735 ; JZ NO_DISP_FONT3 ;;
1736 ; MOV cs:stage,disp_colsX ;;
1739 ; MOV cs:stage,FOUNDX ;; FSTAT is to be changed
1741 ; ;;+++++++++++++++++++++++++++++++++
1742 DSPCOLS : ;; STAGE : get the COLS
1743 ; INC cs:pre_font_len ;;
1747 ; MOV cs:disp_cols,AL ;;
1748 ; MOV AX,cs:fdlen_word ;;
1750 ; MOV cs:fdlen_word,AX ;;
1751 ; JZ NO_DISP_FONT3 ;;
1752 ; MOV cs:stage,DISP_XX ;;
1754 ;;+++++++++++++++++++++++++++++++++
1755 DSPX : ;; STAGE : get the aspect X
1756 ; INC cs:pre_font_len ;;
1761 ; MOV AX,cs:fdlen_word ;;
1763 ; MOV cs:fdlen_word,AX ;;
1764 ; JZ NO_DISP_FONT3 ;;
1765 ; MOV cs:stage,DISP_YX ;;
1767 ; ;;+++++++++++++++++++++++++++++++++
1768 DSPY : ;; STAGE : get the aspect Y
1769 ; INC cs:pre_font_len ;;
1773 ; MOV cs:disp_y,AL ;;
1774 ; MOV AX,cs:fdlen_word ;;
1776 ; MOV cs:fdlen_word,AX ;;
1777 ; JZ NO_DISP_FONT3 ;;
1778 ; MOV cs:stage,COUNT_LOBX ;;
1781 ;;+++++++++++++++++++++++++++++++++
1782 DSPCOUNTLO : ;; the low byte of the FONT-LENGTH
1783 ; INC cs:pre_font_len ;;
1785 ; INC SI ;; byte by byte
1787 ; PUSH AX ;; check if length is enough
1788 ; MOV AX,cs:fdlen_word ;;
1790 ; MOV cs:fdlen_word,AX ;;
1792 ; JNZ A_WORD_COUNT ;;
1793 ; JMP NO_DISP_FONT3 ;;
1797 ; MOV cs:count_lob,AL ;;
1798 ; MOV cs:stage,COUNT_HIBX ;;
1801 ; INC cs:pre_font_len ;;
1804 ; MOV cs:count_word,AX ;;
1805 ; MOV cs:pre_font_len,PRE_FONT_D;
1807 ; MOV AX,cs:fdlen_word ;;
1809 ; MOV cs:fdlen_word,AX ;;
1810 ; MOV cs:stage,FOUNDX ;; FSTAT is to be changed
1813 ; ;;+++++++++++++++++++++++++++++++++
1814 DSPCOUNTHI : ;; STAGE the high byte of the F-LENGTH
1815 ; INC cs:pre_font_len ;;
1817 ; INC SI ;; byte by byte
1819 ; MOV cs:count_hib,AL ;;
1820 ; MOV cs:pre_font_len,PRE_FONT_D;
1822 ; MOV AX,cs:fdlen_word ;;
1824 ; MOV cs:fdlen_word,AX ;;
1825 ; MOV cs:stage,FOUNDX ;; FSTAT is to be changed
1829 ;;+++++++++++++++++++++++++++++++++
1830 PTRSELLO : ;; the low byte of the SELECTION_TYPE
1832 ; INC cs:pre_font_len ;;
1834 ; INC SI ;; byte by byte
1836 ; PUSH AX ;; check if length is enough
1837 ; MOV AX,cs:fdlen_word ;;
1839 ; MOV cs:fdlen_word,AX ;;
1842 ; JMP NO_PTR_FONT3 ;;
1846 ; MOV cs:ptr_selob,AL ;;
1847 ; MOV cs:stage,PTRSELHIX ;;
1850 ; INC cs:pre_font_len ;;
1853 ; MOV cs:ptr_sel_word,AX ;;
1855 ; MOV AX,cs:fdlen_word ;;
1857 ; MOV cs:fdlen_word,AX ;;
1859 ; CMP cs:ptr_sel_word,0 ;;
1860 ; JNE PTR_SEL_NOT0 ;;
1863 ; MOV cs:stage,FOUNDX ;; FSTAT is to be changed
1867 ; MOV cs:stage,PTRLENLOX ;;
1870 ;;+++++++++++++++++++++++++++++++++
1871 PTRSELHI: ;; STAGE the high byte of SELECT_TYPE
1873 ; INC cs:pre_font_len ;;
1875 ; INC SI ;; byte by byte
1877 ; MOV cs:ptr_sehib,AL ;;
1879 ; MOV AX,cs:fdlen_word ;;
1881 ; MOV cs:fdlen_word,AX ;;
1883 ; CMP cs:ptr_sel_word,0 ;;
1884 ; JNE PTR_SEL_NOT0 ;;
1887 ; MOV cs:stage,FOUNDX ;; FSTAT is to be changed
1891 ;;+++++++++++++++++++++++++++++++++
1892 PTRLENLO : ;; the low byte of SELECTION_LENGTH
1894 ; INC cs:pre_font_len ;;
1896 ; INC SI ;; byte by byte
1898 ; PUSH AX ;; check if length is enough
1899 ; MOV AX,cs:fdlen_word ;;
1901 ; MOV cs:fdlen_word,AX ;;
1903 ; JNZ A_WORD_SELEN ;;
1904 ; JMP NO_PTR_FONT3 ;;
1908 ; MOV cs:ptr_lnlob,AL ;;
1909 ; MOV cs:stage,PTRLENHIX ;;
1912 ; INC cs:pre_font_len ;;
1915 ; MOV cs:ptr_len_word,AX ;;
1917 ; MOV AX,cs:fdlen_word ;;
1919 ; MOV cs:fdlen_word,AX ;;
1920 ; MOV cs:stage,FOUNDX ;; FSTAT is to be changed
1923 ;;+++++++++++++++++++++++++++++++++
1924 PTRLENHI : ;; STAGE the high byte of SELECT_LENGTH
1926 SUB CX,CX ;D; added for DISPLAY.SYS version
1927 MOV CS:STAGE,STAGE_MAX+1 ;D; added for DISPLAY.SYS version
1928 JMP FTB_LOOP ;D; added for DISPLAY.SYS version
1931 ; INC cs:pre_font_len ;;
1933 ; INC SI ;; byte by byte
1935 ; MOV cs:ptr_lnhib,AL ;;
1937 ; MOV AX,cs:fdlen_word ;;
1939 ; MOV cs:fdlen_word,AX ;;
1940 ; MOV cs:stage,FOUNDX ;; FSTAT is to be changed
1944 ; MOV cs:stage,FOUNDX ;; FSTAT is to be changed
1946 ;;+++++++++++++++++++++++++++++++++
1947 PASS : ;; STAGE - PASS DUMMY BYTES
1955 MOV DI,OFFSET PASS_BRK ;;
1957 MOV AX,cs:pass_cnt ;;
1959 NEXT_BRK: ;; find the next pass-break
1970 UPTO_BRK : ;; next break point found
1972 SUB DX,AX ;; bytes to be skipped
1973 CMP CX,DX ;; all to be skipped ?
1976 ADD cs:pass_cnt,CX ;;
1982 ADD cs:pass_cnt,DX ;;
1986 MOV AX,cs:pass_postx ;;
1989 ; cmp ax,passx ;; is the next stage a pass-stage ?
1991 ; mov ax,pass_postxx ;;
1992 ; mov pass_postx,ax ;;
1993 ; mov pass_postxx,stage_max ;; can support only 2 consecutive pass
1999 PASS_ERR : ;; DEVICE ERROR, wrong stage
2003 MOV FTP.FTB_STATUS,STAT_DEVERR
2004 SUB CX,CX ;; ignore all the input string
2014 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2018 CMP cs:stage,FOUNDX ;;
2028 POP SI ;; restore registers
2040 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;