Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

2994 lines
87 KiB

  1. ;* ****************************************************************************
  2. ;*
  3. ;* COPYRIGHT (C) 1985-1992 MICROSOFT
  4. ;*
  5. ;* ****************************************************************************
  6. ;
  7. TITLE Format.asm line formatting routines for windows Write
  8. ; Module: format.asm
  9. ; contains native code versions of FormatLine, Justify, FGrowFormatHeap,
  10. ; FFirstIch, DxpFromCh, and ValidateMemoryDC
  11. ;
  12. ;*
  13. ;* REVISION HISTORY
  14. ;*
  15. ;* Date Who Rel Ver Remarks
  16. ;* 5/23/85 bz initial translation from c
  17. ;* 6/21/85 bl Set ?WIN == 0 for windows header
  18. ;* 7/09/85 pnt Call WinFailure() if vhMDC == NULL
  19. ;* 7/16/85 pnt Truncate tabs at right margin
  20. ;* 7/21/85 pnt Treat running heads like normal paragraphs
  21. ;* 7/30/85 bl Fixed bug in FFirstIch -- change scasb to scasw
  22. ;* 8/05/85 pnt Added ValidateMemoryDC()
  23. ;* 8/05/85 pnt DxpFromCh returns dxpSpace if ch < space
  24. ;* 8/07/85 pnt cchCHPUsed changed from 9 to 7
  25. ;* 8/09/85 pnt Ensure there tabs don't back up on the screen
  26. ;* 8/14/85 pnt Map center and right tabs to left tabs
  27. ;* 8/27/85 pnt Single spacing changed to font leading only
  28. ;* 8/29/85 pnt Lines with no breaks can be right, center flush
  29. ;* 10/01/85 pnt Forced section mark to be in stardard font
  30. ;* 10/07/85 pnt DxpFromCh returns dxpSpace iff width unimportant
  31. ;* 10/10/85 pnt Validity of vfli cache depends on flm
  32. ;* 10/10/85 pnt fPrevSpace not set for null runs
  33. ;* 10/30/89 pault set code to use SYSENDMARK code in FORM1.C
  34. ;* (7.23.91) v-dougk changed dxp char arrays to int arrays
  35. SYSENDMARK EQU 1
  36. ;*
  37. ;* ************************************************************************* */
  38. ;* ************************************************************************* */
  39. ; Naming conventions used here
  40. ;
  41. ; rxx_name register variable - reg is xx. This may be a temporary naming
  42. ; of a register (e.g. rax_ichT)
  43. ; c_name defined constant in c program (e.g. c_false)
  44. ;
  45. ;* ************************************************************************* */
  46. subttl Conditional variables and cmacros
  47. page
  48. ; *************** Conditional variables *************************
  49. ; ***** These variables should be defined using the -D command line
  50. ; ***** option in masm. They are only checked for being defined, not
  51. ; ***** for a particular value
  52. ;
  53. ; DEBUG define with -DDEBUG ; ** controls ASSERT code **
  54. ; SCRIBBLE define with -DSCRIBBLE ; ** controls SCRIBBLE code **
  55. ; CASHMERE ; ** code taken out for Write, to be used for Cashmere **
  56. ;
  57. ; *************** End conditional variables *************************
  58. memM = 1 ; medium model for cmacros
  59. ?WIN = 1 ; windows header used here
  60. .xlist
  61. include cmacros.inc
  62. page
  63. .list
  64. ;.sall
  65. createSeg FORM1_TEXT,FORM1_TEXT,BYTE,PUBLIC,CODE
  66. ASSUME CS: FORM1_TEXT, DS: DGROUP, SS: DGROUP, ES: DGROUP
  67. subttl Public definitions
  68. page
  69. ;
  70. ; Public definitions for this module
  71. ;
  72. PUBLIC DxpFromCh
  73. PUBLIC FormatLine
  74. PUBLIC Justify
  75. PUBLIC FGrowFormatHeap
  76. PUBLIC FFirstIch
  77. PUBLIC ValidateMemoryDC
  78. ;
  79. ; External procedures referenced from this module
  80. ;
  81. EXTRN IMAX:FAR
  82. EXTRN CCHDIFFER:FAR
  83. EXTRN CACHESECT:FAR
  84. EXTRN FCHNGSIZEH:FAR
  85. EXTRN CACHEPARA:FAR
  86. EXTRN FORMATGRAPHICS:FAR
  87. EXTRN FFORMATSPECIALS:FAR
  88. EXTRN MULTDIV:FAR
  89. EXTRN FETCHCP:FAR
  90. EXTRN SETTEXTJUSTIFICATION:FAR
  91. EXTRN GETTEXTEXTENT:FAR
  92. EXTRN LOADFONT:FAR
  93. EXTRN WINFAILURE:FAR
  94. EXTRN GETDEVICECAPS:FAR
  95. EXTRN SETBKMODE:FAR
  96. EXTRN SETTEXTCOLOR:FAR
  97. EXTRN CREATECOMPATIBLEDC:FAR
  98. EXTRN GETPRINTERDC:FAR
  99. ; **** Debugging code **********
  100. IFDEF DEBUG
  101. IFDEF SCRIBBLE
  102. EXTRN FNSCRIBBLE:FAR
  103. ENDIF
  104. ENDIF
  105. subttl External definitions
  106. page
  107. ;
  108. ; External definitions referenced from this module
  109. ;
  110. sBegin DATA
  111. EXTRN PLOCALHEAP:WORD
  112. ;EXTRN DOCHELP:WORD
  113. EXTRN VFLI:BYTE
  114. EXTRN VHGCHPFORMAT:WORD
  115. EXTRN ICHPMACFORMAT:WORD
  116. EXTRN VCHPABS:BYTE
  117. EXTRN VPAPABS:BYTE
  118. EXTRN VSEPABS:BYTE
  119. EXTRN VSEPPAGE:BYTE
  120. EXTRN VCHPNORMAL:BYTE
  121. EXTRN VCPFIRSTPARACACHE:DWORD
  122. EXTRN VCPFETCH:DWORD
  123. EXTRN YPSUBSUPER:WORD
  124. EXTRN VPCHFETCH:WORD
  125. EXTRN VCCHFETCH:WORD
  126. EXTRN YPSUBSUPERPR:WORD
  127. EXTRN VHMDC:WORD
  128. EXTRN VHDCPRINTER:WORD
  129. EXTRN DXPLOGINCH:WORD
  130. EXTRN DYPLOGINCH:WORD
  131. EXTRN DXAPRPAGE:WORD
  132. EXTRN DYAPRPAGE:WORD
  133. EXTRN DXPPRPAGE:WORD
  134. EXTRN DYPPRPAGE:WORD
  135. EXTRN DYPMAX:WORD
  136. EXTRN VFMISCREEN:BYTE
  137. EXTRN VFMIPRINT:BYTE
  138. EXTRN VFOUTOFMEMORY:WORD
  139. EXTRN VFMONOCHROME:WORD
  140. EXTRN RGBTEXT:DWORD
  141. EXTRN PWWDCUR:WORD
  142. EXTRN VCHDECIMAL:BYTE
  143. EXTRN VZATABDFLT:BYTE
  144. sEnd DATA
  145. ;sBegin BSS
  146. sBegin DATA
  147. $S784_ichpFormat DB 02H DUP (?)
  148. EVEN
  149. sEnd DAT
  150. ;sEnd BSS
  151. subttl Macros
  152. page
  153. ; ********************************************************************
  154. ; macros done here for speed, rather than doing far procedure call
  155. ;-----------------------------------------------------------------------------
  156. ; bltc (pTo, wFill, cw) - fills cw words of memory starting at pTo with wFill.
  157. ;-----------------------------------------------------------------------------
  158. ; macro bltc destroys ax,es,cx
  159. bltc MACRO pTo,wFill,cw
  160. push di
  161. mov ax,ds ; we are filling in the data segment
  162. mov es,ax
  163. mov di,pTo ; get the destination, constant, and count
  164. mov ax,wFill
  165. mov cx,cw
  166. cld ; the operation is forward
  167. rep stosw ; fill memory
  168. pop di
  169. ENDM
  170. ;-----------------------------------------------------------------------------
  171. ; bltbc (pTo, bFill, cb) - fills cb bytes of memory starting at pTo with
  172. ; bFill.
  173. ;-----------------------------------------------------------------------------
  174. ; macro bltbc destroys ax,es,cx
  175. bltbc MACRO pTo,bFill,cb
  176. push di
  177. mov ax,ds ; we are filling in the data segment
  178. mov es,ax
  179. mov di,pTo ; get the destination, constant, and count
  180. mov al,bFill
  181. mov cx,cb
  182. cld ; the operation is forward
  183. rep stosb ; fill memory
  184. pop di
  185. ENDM
  186. ;------------------------------------------------------------------------------
  187. ; blt (pFrom, pTo, cw) - a block transfer of wFills from pFrom to pTo;
  188. ; The size of the block is cw wFills. This blt() handles the case of
  189. ; overlapping source and destination. blt() returns a pointer to the
  190. ; end of the destination buffer (pTo + cw). NOTE - use this blt() to
  191. ; to transfer within the current DS only--use the bltx for FAR blts.
  192. ;-----------------------------------------------------------------------------
  193. ; macro blt destroys ax,bx,cx,es
  194. blt MACRO pFrom,pTo,cw
  195. local blt1
  196. push si
  197. push di
  198. mov si,pFrom ; get pointers and length of blt
  199. mov di,pTo
  200. mov cx,cw
  201. mov ax,ds ; set up segment registers
  202. mov es,ax
  203. mov ax,di ; calculate return value
  204. mov bx,cx
  205. shl bx,1
  206. add ax,bx
  207. cmp si,di ; reverse direction of the blt if
  208. jae blt1 ; necessary
  209. dec bx
  210. dec bx
  211. add si,bx
  212. add di,bx
  213. std
  214. blt1:
  215. rep movsw
  216. cld
  217. pop di
  218. pop si
  219. ENDM
  220. subttl C structures Used in this module
  221. page
  222. ;
  223. ; *** The following structure definitions were used when this module
  224. ; *** was being developed:
  225. ;
  226. ;struct IFI
  227. ;{
  228. ;int xp;
  229. ;int xpLeft;
  230. ;int xpRight;
  231. ;int xpReal;
  232. ;int xpPr;
  233. ;int xpPrRight;
  234. ;int ich;
  235. ;int ichLeft;
  236. ;int ichPrev;
  237. ;int ichFetch;
  238. ;int dypLineSize;
  239. ;int cchSpace;
  240. ;int cBreak;
  241. ;int chBreak;
  242. ;int jc;
  243. ;#ifdef CASHMERE
  244. ;int tlc;
  245. ;#endif /* CASHMERE */
  246. ;int fPrevSpace;
  247. ;};
  248. ; ***************************************************************************
  249. ; ***** Equates for IFI structure ifi offsets ****************
  250. IFI_STRUC STRUC
  251. xp DW ?
  252. xpLeft_Ifi DW ?
  253. xpRight_Ifi DW ?
  254. xpReal_Ifi DW ?
  255. xpPr DW ?
  256. xpPrRight DW ?
  257. ich_Ifi DW ?
  258. ichLeft DW ?
  259. ichPrev DW ?
  260. ichFetch DW ?
  261. dypLineSize DW ?
  262. cchSpace DW ?
  263. cBreak_Ifi DW ?
  264. chBreak DW ?
  265. _jc DW ? ; (2.27.91) D. Kent
  266. fPrevSpace DW ?
  267. IFI_STRUC ENDS
  268. oIfi_xp EQU 0
  269. oIfi_xpLeft EQU 2
  270. oIfi_xpRight EQU 4
  271. oIfi_xpReal EQU 6
  272. oIfi_xpPr EQU 8
  273. oIfi_xpPrRight EQU 10
  274. oIfi_ich EQU 12
  275. oIfi_ichLeft EQU 14
  276. oIfi_ichPrev EQU 16
  277. oIfi_ichFetch EQU 18
  278. oIfi_dypLineSize EQU 20
  279. oIfi_cchSpace EQU 22
  280. oIfi_cBreak EQU 24
  281. oIfi_chBreak EQU 26
  282. oIfi_jc EQU 28
  283. oIfi_fPrevSpace EQU 30
  284. page
  285. ; ***************************************************************************
  286. ;/* Formatted line structure.
  287. ;Reorganized KJS, CS Sept 3 */
  288. ;/* booleans in bytes to simplify machine code */
  289. ;struct FLI
  290. ;{
  291. ;typeCP cpMin;
  292. ;int ichCpMin;
  293. ;typeCP cpMac;
  294. ;int ichCpMac;
  295. ;int ichMac;
  296. ;int dcpDepend;
  297. ;unsigned fSplat : 8;
  298. ;/* First character in region where spaces have additional pixel */
  299. ;unsigned ichFirstWide : 8;
  300. ;/* ichMac, with trailing blanks excluded */
  301. ;int ichReal;
  302. ;int doc;
  303. ;int xpLeft;
  304. ;int xpRight;
  305. ;/* xpRight, with trailing blanks excluded */
  306. ;int xpReal;
  307. ;/* the right margin where insert will have to break the line */
  308. ;int xpMarg;
  309. ;
  310. ;unsigned fGraphics : 8;
  311. ;unsigned fAdjSpace : 8; /* Whether you adjust the spaces */
  312. ;unsigned dxpExtra;
  313. ;/* the interesting positions in order from top to bottom are:
  314. ;top: yp+dypLine
  315. ;top of ascenders: yp+dypAfter+dypFont
  316. ;base line: yp+dypBase
  317. ;bottom of descenders: yp+dypAfter
  318. ;bottom of line: yp
  319. ;distances between the points can be determined by algebraic subtraction.
  320. ;e.g. space before = yp+dypLine - (yp+dypAfter+dypFont)
  321. ;*/
  322. ;int dypLine;
  323. ;int dypAfter;
  324. ;int dypFont;
  325. ;int dypBase;
  326. ;int ichLastTab;
  327. ;int rgdxp[ichMaxLine];
  328. ;CHAR rgch[ichMaxLine];
  329. ;};
  330. ; ***************************************************************************
  331. ichMaxLine EQU 255
  332. dxpNil EQU 0FFFFH
  333. FLI STRUC
  334. cpMin_OFF DW ?
  335. cpMin_SEG DW ?
  336. ichCpMin DW ?
  337. cpMac_OFF DW ?
  338. cpMac_SEG DW ?
  339. ichCpMac DW ?
  340. ichMac DW ?
  341. dcpDepend DW ?
  342. fSplat DB ?
  343. ichFirstWide DB ?
  344. ichReal DW ?
  345. doc_Fli DW ?
  346. xpLeft_Fli DW ?
  347. xpRight DW ?
  348. xpReal_Fli DW ?
  349. xpMarg DW ?
  350. fGraphics_Fli DB ?
  351. fAdjSpace DB ?
  352. dxpExtra DW ?
  353. dypLine DW ?
  354. dypAfter DW ?
  355. dypFont DW ?
  356. dypBase DW ?
  357. fSplatNext DW ?
  358. ichLastTab DW ?
  359. flm_Fli DW ?
  360. rgdxp DW ichMaxLine DUP (?)
  361. rgch DB ichMaxLine DUP (?)
  362. FLI ENDS
  363. page
  364. ; **************************************************************************
  365. ;struct TBD /* Tab Descriptor */
  366. ;{
  367. ;unsigned dxa; /* distance from left margin of tab stop */
  368. ;unsigned char jc : 3; /* justification code */
  369. ;unsigned char tlc : 3; /* leader dot code */
  370. ;unsigned char opcode : 2; /* operation code for Format Tabs */
  371. ;CHAR chAlign; /* ASCII code of char to align on
  372. ;if jcTab=3, or 0 to align on '.' */
  373. ;};
  374. ; ***************************************************************************
  375. ; ***** Equates for TBD structure offsets ****************
  376. TBD STRUC
  377. dxa DW ?
  378. jc_Tbd DB ? ; 3 bits
  379. chAlign DB ? ;char
  380. TBD ENDS
  381. ;/* bit field equates in TBD structure */
  382. tlc EQU jc_Tbd ; 3 bits
  383. opcode EQU jc_Tbd ; 2 bits
  384. page
  385. ; **************************************************************************
  386. ;struct PAP /* Paragraph properties */
  387. ;{
  388. ;unsigned fStyled : 1; /* BYTE 0 */
  389. ;unsigned stc : 7;
  390. ;unsigned jc : 2; /* BYTE 1 */
  391. ;unsigned fKeep : 1;
  392. ;unsigned fKeepFollow : 1;
  393. ;unsigned : 4;
  394. ;unsigned stcNormChp : 7; /* BYTE 2 */
  395. ;unsigned : 9; /* BYTE 3 */
  396. ;unsigned dxaRight; /* BYTE 4-5 */
  397. ;unsigned dxaLeft; /* BYTE 6-7 */
  398. ;unsigned dxaLeft1; /* BYTE 8-9 */
  399. ;unsigned dyaLine; /* 10-11 */
  400. ;unsigned dyaBefore; /* 12-13 */
  401. ;unsigned dyaAfter; /* 14-15 */
  402. ;unsigned rhc : 4; /* Running hd code */
  403. ;unsigned fGraphics : 1; /* Graphics bit */
  404. ;unsigned wUnused1 : 11;
  405. ;int wUnused2;
  406. ;int wUnused3;
  407. ;struct TBD rgtbd[itbdMaxWord];
  408. ;};
  409. ; ***************************************************************************
  410. ; ***** Equates for PAP structure offsets ****************
  411. PAP STRUC
  412. fStyled DB ? ;1 bit /* BYTE 0 */
  413. jc_Pap DB ? ;2 bits /* BYTE 1 */
  414. rmChp DB ? ;7 bits /* BYTE 2 */
  415. unused9 DB ? ;9 bits /* BYTE 3 */
  416. dxaRight DW ? ;/* BYTE 4-5 */
  417. dxaLeft DW ? ;/* BYTE 6-7 */
  418. dxaLeft1 DW ? ;/* BYTE 8-9 */
  419. dyaLine DW ? ;/* 10-11 */
  420. dyaBefore DW ? ;/* 12-13 */
  421. dyaAfter DW ? ;/* 14-15 */
  422. ;/* BYTE 16-17 */
  423. rhc DW ? ;4 bits /* Running hd code */
  424. wUnused2 DW ? ;/* BYTE 18-19 */
  425. wUnused3 DW ? ;/* BYTE 20-21 */
  426. rgtbd DW ? ;/* BYTE 23-23 */
  427. PAP ENDS
  428. ;/* bit field equates in PAP structure */
  429. stc_Pap EQU fStyled ;7 bits
  430. fKeep EQU jc_Pap ;1 bit
  431. fKeepFollow EQU jc_Pap ;1 bit
  432. unused4 EQU jc_Pap ;4 bits
  433. fGraphics_Pap EQU rhc ;1 bits /* Graphics bit */
  434. wUnused1 EQU rhc ;11 bits
  435. page
  436. ; **************************************************************************
  437. ;struct SEP
  438. ; { /* Section properties */
  439. ; unsigned fStyled : 1; /* BYTE 0 */
  440. ; unsigned stc : 7;
  441. ; unsigned bkc : 3; /* Break code */ /* BYTE 1 */
  442. ; unsigned nfcPgn : 3; /* Pgn format code */
  443. ; unsigned :2;
  444. ; unsigned yaMac; /* Page height */ /* BYTE 2-3 */
  445. ; unsigned xaMac; /* Page width */ /* BYTE 4-5 */
  446. ; unsigned pgnStart; /* Starting pgn */ /* BYTE 6-7 */
  447. ; unsigned yaTop; /* Start of text */ /* BYTE 8-9 */
  448. ; unsigned dyaText; /* Height of text */ /* 10-11 */
  449. ; unsigned xaLeft; /* Left text margin */ /* 12-13 */
  450. ; unsigned dxaText; /* Width of text */ /* 14-15 */
  451. ; unsigned rhc : 4; /* *** RESERVED *** */ /* 16 */
  452. ; /* (Must be same as PAP) */
  453. ; unsigned : 2;
  454. ; unsigned fAutoPgn : 1; /* Print pgns without hdr */
  455. ; unsigned fEndFtns : 1; /* Footnotes at end of doc */
  456. ; unsigned cColumns : 8; /* # of columns */ /* BYTE 17 */
  457. ; unsigned yaRH1; /* Pos of top hdr */ /* 18-19 */
  458. ; unsigned yaRH2; /* Pos of bottom hdr */ /* 20-21 */
  459. ; unsigned dxaColumns; /* Intercolumn gap */ /* 22-23 */
  460. ; unsigned dxaGutter; /* Gutter width */ /* 24-25 */
  461. ; unsigned yaPgn; /* Y pos of page nos */ /* 26-27 */
  462. ; unsigned xaPgn; /* X pos of page nos */ /* 28-29 */
  463. ; CHAR rgbJunk[cchPAP - 30]; /* Pad to cchPAP */
  464. ; };
  465. ; ***************************************************************************
  466. ; ***** Equates for SEP structure offsets ****************
  467. SEP STRUC
  468. fStyled_Sep DB ? ;1 bit /* BYTE 0 */
  469. bkc DB ? ;3 bits /* BYTE 1 */
  470. yaMac DW ? ; /* Page height */ /* BYTE 2-3 */
  471. xaMac DW ? ;/* Page width */ /* BYTE 4-5 */
  472. pgnStart DW ? ; /* Starting pgn */ /* BYTE 6-7 */
  473. yaTop DW ? ; /* Start of text */ /* BYTE 8-9 */
  474. dyaText DW ? ; /* Height of text */ /* 10-11 */
  475. xaLeft_Sep DW ? ; /* Left text margin */ /* 12-13 */
  476. dxaText DW ? ; /* Width of text */ /* 14-15 */
  477. rhc_Sep DB ? ;4 bits /* 16 */
  478. ; /* (Must be same as PAP) */
  479. cColumns DB ? ; /* # of columns */ /* BYTE 17 */
  480. yaRH1 DW ? ; /* Pos of top hdr */ /* 18-19 */
  481. yaRH2 DW ? ; /* Pos of bottom hdr */ /* 20-21 */
  482. dxaColumns DW ? ;/* Intercolumn gap */ /* 22-23 */
  483. dxaGutter DW ? ; /* Gutter width */ /* 24-25 */
  484. yaPgn DW ? ; /* Y pos of page nos */ /* 26-27 */
  485. xaPgn DW ? ; /* X pos of page nos */ /* 28-29 */
  486. rgbJunk DW ? ; /* Pad to cchPAP */
  487. SEP ENDS
  488. ;/* bit field equates in SEP structure */
  489. stc_Sep EQU fStyled_Sep ;7 bits
  490. nfcPgn EQU bkc ; 3 bits /* Pgn format code */
  491. junk1_Sep EQU bkc ; 2 bits
  492. junk2_Sep EQU rhc_Sep ;2 bits
  493. fAutoPgn EQU rhc_Sep ;1 bit /* Print pgns without hdr */
  494. fEndFtns EQU rhc_Sep ;1 bit /* Footnotes at end of doc */
  495. page
  496. ; **************************************************************************
  497. ;typedef struct FMI /* font metric information */
  498. ;{
  499. ;int *mpchdxp; /* pointer to width table */
  500. ;/* NOTE - we actually point chDxpMin entries
  501. ;before the start of the table, so
  502. ;that the valid range begins at the
  503. ;start of the actual table */
  504. ;int dxpSpace; /* width of a space */
  505. ;int dxpOverhang; /* overhang for italic/bold chars */
  506. ;int dypAscent; /* ascent */
  507. ;int dypDescent; /* descent */
  508. ;int dypBaseline; /* difference from top of cell to baseline */
  509. ;int dypLeading; /* accent space plus recommended leading */
  510. ;};
  511. ; ***************************************************************************
  512. ; ***** Equates for FMI structure offsets ****************
  513. FMI STRUC
  514. mpchdxp DW ?
  515. dxpSpace DW ?
  516. dxpOverhang DW ?
  517. dypAscent_Fmi DW ?
  518. dypDescent_Fmi DW ?
  519. dypBaseline DW ?
  520. dypLeading DW ?
  521. FMI ENDS
  522. page
  523. ; **************************************************************************
  524. ;struct CHP /* Character properties */
  525. ;{
  526. ;unsigned fStyled : 1; /* BYTE 0 */
  527. ;unsigned stc : 7; /* style */
  528. ;unsigned fBold : 1; /* BYTE 1 */
  529. ;unsigned fItalic : 1;
  530. ;unsigned ftc : 6; /* Font code */
  531. ;unsigned hps : 8; /* Size in half pts */ /* BYTE 2 */
  532. ;unsigned fUline : 1; /* BYTE 3 */
  533. ;unsigned fStrike : 1;
  534. ;unsigned fDline: 1;
  535. ;unsigned fOverset : 1;
  536. ;unsigned csm : 2; /* Case modifier */
  537. ;unsigned fSpecial : 1;
  538. ;unsigned : 1;
  539. ;unsigned ftcXtra : 3; /* BYTE 4 */
  540. ;unsigned fOutline : 1;
  541. ;unsigned fShadow : 1;
  542. ;unsigned : 3;
  543. ;unsigned hpsPos : 8; /* BYTE 5 */
  544. ;unsigned fFixedPitch : 8; /* used internally only */
  545. ;unsigned chLeader : 8;
  546. ;unsigned ichRun : 8;
  547. ;unsigned cchRun : 8;
  548. ;};
  549. ; ***************************************************************************
  550. ; ***** Equates for CHP structure offsets ****************
  551. CHP STRUC
  552. fStyled_Chp DB ? ;1 bit /* BYTE 0 */
  553. fBold DB ? ;1 bit /* BYTE 1 */
  554. hps DB ? ;8 bits /* BYTE 2 */
  555. fUline DB ? ;1 bit /* BYTE 3 */
  556. ftcXtra DB ? ;3 bits /* BYTE 4 */
  557. hpsPos DB ? ;8 bits /* BYTE 5 */
  558. fFixedPitch DB ? ;8 bits /* BYTE 6 */
  559. chLeader DB ? ;8 bits /* BYTE 7 */
  560. ichRun DB ? ;8 bits /* BYTE 8 */
  561. cchRun DB ? ;8 bits /* BYTE 9 */
  562. CHP ENDS
  563. ;/* bit field equates in CHP structure */
  564. stc_Chp EQU fStyled_Chp ;7 bits /* style */
  565. fItalic EQU fBold ;1 bit
  566. ftc EQU fBold ;6 bits
  567. fStrike EQU fUline ;1 bit
  568. fDline EQU fUline ;1 bit
  569. fOverset EQU fUline ;1 bit
  570. csm EQU fUline ;2 bits /* Case modifier */
  571. fSpecial EQU fUline ;1 bit
  572. chp_unused1 EQU fUline ;1 bit
  573. fOutline EQU ftcXtra ;1 bit
  574. fShadow EQU ftcXtra ;1 bit
  575. chp_unused2 EQU ftcXtra ;3 bits
  576. ; **************************************************************************
  577. subttl Bit masks
  578. page
  579. mask_0001 EQU 1
  580. mask_0010 EQU 2
  581. mask_0011 EQU 3
  582. mask_0100 EQU 4
  583. mask_0101 EQU 5
  584. mask_0110 EQU 6
  585. mask_0111 EQU 7
  586. mask_1000 EQU 8
  587. mask_1001 EQU 9
  588. mask_1010 EQU 10
  589. mask_1011 EQU 11
  590. mask_1100 EQU 12
  591. mask_1101 EQU 13
  592. mask_1110 EQU 14
  593. mask_1111 EQU 15
  594. mask_0001_0000 EQU 16
  595. mask_1111_1111 EQU 65535
  596. mask_0100_0000 EQU 64
  597. subttl Defined C Constants
  598. c_True EQU 1
  599. c_False EQU 0
  600. c_hpsDefault EQU 20
  601. c_cwFLIBase EQU 22
  602. c_cwIFI EQU 16
  603. c_cwCHP EQU 5
  604. c_docNil EQU -1
  605. c_cpNil EQU -1
  606. c_czaInch EQU 1440
  607. c_czaLine EQU 240
  608. c_xaRightMax EQU 31680
  609. c_hpsNegMin EQU 128
  610. ;/* Justification codes: must agree with menu.mod */
  611. c_jcLeft EQU 0
  612. c_jcCenter EQU 1
  613. c_jcRight EQU 2
  614. c_jcBoth EQU 3
  615. c_jcTabMin EQU 4
  616. c_jcTabLeft EQU 4
  617. c_jcTabCenter EQU 5
  618. c_jcTabRight EQU 6
  619. c_jcTabDecimal EQU 7
  620. ;/* Tab leader codes: must agree with menu.mod */
  621. c_tlcWhite EQU 0
  622. c_tlcDot EQU 1
  623. c_tlcHyphen EQU 2
  624. c_tlcUline EQU 3
  625. c_chEmark EQU 164
  626. c_chNil EQU -1
  627. c_chDelPrev EQU 8
  628. c_chTab EQU 9
  629. c_chEol EQU 10
  630. c_chNewLine EQU 11
  631. c_chSect EQU 12
  632. c_chReturn EQU 13
  633. c_chNRHFile EQU 31
  634. c_chSpace EQU 32
  635. c_chSplat EQU 46
  636. c_chHyphen EQU 45
  637. subttl FormatLine()
  638. page
  639. ; **************************************************************************
  640. sBegin FORM1_TEXT
  641. ;***
  642. ;
  643. ; FormatLine(doc, cp, ichCp, cpMac, flm)
  644. ; int doc;
  645. ; typeCP cp;
  646. ; int ichCp;
  647. ; typeCP cpMac;
  648. ; int flm;
  649. ;
  650. ; This procedure fills up vfli with a line of text. It is very large
  651. ; and called often - each time a character is typed, at least.
  652. ;
  653. ;***
  654. cProc FormatLine,<PUBLIC,FAR>,<di,si>
  655. parmW doc
  656. parmD cp
  657. parmW ichCp
  658. parmD cpMac
  659. parmW flm
  660. ; Line 79
  661. localW dyaFormat
  662. localW fFlmPrinting
  663. localDP psep
  664. localW xaRight
  665. localW dypAscentMac
  666. localW ichpNRH
  667. localW ypSubSuperFormat
  668. localW dxpFormat
  669. localW dypFormat
  670. localDP ppap
  671. localW dypAscent
  672. localV ifi,%(size IFI_STRUC)
  673. localW xpTab
  674. localW fTruncated
  675. localW xaLeft
  676. localW dypDescentMac
  677. localDP ptbd
  678. localW dypDescent
  679. localW dxaFormat
  680. localW dxp
  681. localW cch
  682. localDP pch
  683. localW xpPrev
  684. localW iichNew
  685. localW dxpPr
  686. localW cchUsed
  687. localW dich
  688. localW fSizeChanged
  689. localW chT
  690. localW cch2
  691. localW dxpCh
  692. localW xaTab
  693. localW xaPr
  694. localW chT2
  695. localW dxpNew
  696. localV chpLocal,%(size CHP)
  697. cBegin FormatLine
  698. ; Line 107
  699. mov ax,flm
  700. and ax,1
  701. mov fFlmPrinting,ax
  702. ; Line 113
  703. mov fTruncated,0
  704. ;** Check for fli current */
  705. ; Line 122
  706. mov ax,WORD PTR VFLI.doc_Fli
  707. cmp doc,ax
  708. jne $I845
  709. mov ax,WORD PTR VFLI.cpMin_OFF
  710. mov dx,WORD PTR VFLI.cpMin_SEG
  711. cmp SEG_cp,dx
  712. jne $I845
  713. cmp OFF_cp,ax
  714. jne $I845
  715. mov ax,WORD PTR VFLI.ichCpMin
  716. cmp ichCp,ax
  717. jne $I845
  718. mov ax,WORD PTR VFLI.flm_Fli
  719. cmp flm,ax
  720. jne $I845
  721. ;* Just did this one */
  722. jmp $RetFormat ; *** return ****
  723. ; Line 125
  724. $I845:
  725. IFDEF DEBUG
  726. IFDEF SCRIBBLE
  727. mov ax,5
  728. push ax
  729. mov ax,70
  730. push ax
  731. call FAR PTR FNSCRIBBLE
  732. ENDIF
  733. ENDIF
  734. ; Line 129
  735. ;*
  736. ;* This means:
  737. ;* vfli.fSplat = false;
  738. ;* vfli.dcpDepend = 0;
  739. ;* vfli.ichCpMac = 0;
  740. ;* vfli.dypLine = 0;
  741. ;* vfli.dypAfter = 0;
  742. ;* vfli.dypFont = 0;
  743. ;* vfli.dypBase = 0;
  744. ;*
  745. ; *** macro bltc destroys ax,es,cx
  746. bltc <OFFSET VFLI>,0,c_cwFLIBase
  747. mov WORD PTR VFLI.fSplatNext, 0
  748. ; Line 141
  749. ;* Rest of FormatLine loads up cache with current data *****
  750. mov ax,doc
  751. mov WORD PTR VFLI.doc_Fli,ax
  752. mov ax,flm
  753. mov WORD PTR VFLI.flm_Fli,ax
  754. ; Line 142
  755. ; *********** Register variables ********************
  756. rax_OFF_cp EQU ax
  757. rdx_SEG_cp EQU dx
  758. ; ****************************************************
  759. mov rax_OFF_cp,OFF_cp
  760. mov rdx_SEG_cp,SEG_cp
  761. mov WORD PTR VFLI.cpMin_OFF,rax_OFF_cp
  762. mov WORD PTR VFLI.cpMin_SEG,rdx_SEG_cp
  763. ; Line 143
  764. mov cx,ichCp
  765. mov WORD PTR VFLI.ichCpMin,cx
  766. ; Line 145
  767. ; *** if (cp > cpMac)
  768. cmp rdx_SEG_cp,SEG_cpMac
  769. jl $initRunTbl
  770. jg $spAftEnd
  771. cmp rax_OFF_cp,OFF_cpMac
  772. jbe $initRunTbl
  773. $spAftEnd:
  774. ;/* Space after the endmark. Reset the cache because the footnotes come
  775. ;at the same cp in the footnote window */
  776. ; Line 149
  777. mov WORD PTR VFLI.doc_Fli,c_docNil
  778. ; Line 150
  779. mov WORD PTR VFLI.cpMac_OFF,rax_OFF_cp
  780. mov WORD PTR VFLI.cpMac_SEG,rdx_SEG_cp
  781. ; Line 151
  782. mov WORD PTR VFLI.rgdxp,0
  783. ; Line 159
  784. ; /* Line after end mark is taller than screen */
  785. mov ax,DYPMAX
  786. mov WORD PTR VFLI.dypLine,ax
  787. sar ax,1
  788. mov WORD PTR VFLI.dypFont,ax
  789. mov WORD PTR VFLI.dypBase,ax
  790. jmp $ScribRet ; Scribble and return
  791. ;
  792. ; *************** EXIT POINT **********************************************
  793. ;
  794. $initRunTbl:
  795. ;/* Initialize run tables */
  796. mov WORD PTR $S784_ichpFormat,0
  797. ; Line 185
  798. ;/* Cache section and paragraph properties */
  799. push doc
  800. push SEG_cp
  801. push OFF_cp
  802. call FAR PTR CACHESECT
  803. ; Line 188
  804. mov psep,OFFSET VSEPABS
  805. ; Line 190
  806. push doc
  807. push SEG_cp
  808. push OFF_cp
  809. call FAR PTR CACHEPARA
  810. ; Line 191
  811. mov ppap,OFFSET VPAPABS
  812. ;/* Now we have:
  813. ;ppap paragraph properties
  814. ;psep division properties
  815. ;*/
  816. ; Line 198
  817. ; *** if (ppap->fGraphics)
  818. mov bx,ppap
  819. test WORD PTR [bx].fGraphics_Pap,mask_0001_0000
  820. je $I851
  821. ; Line 201
  822. ;*** Format a picture paragraph in a special way (see picture.c)
  823. push doc
  824. push SEG_cp
  825. push OFF_cp
  826. push ichCp
  827. push SEG_cpMac
  828. push OFF_cpMac
  829. push flm
  830. call FAR PTR FORMATGRAPHICS
  831. jmp $ScribRet ; Scribble and return
  832. ;
  833. ; *************** EXIT POINT **********************************************
  834. ;
  835. $I851:
  836. ; *** /* Assure we have a good memory DC for font stuff */
  837. call FAR PTR VALIDATEMEMORYDC
  838. cmp VHMDC,0
  839. je $L20000
  840. cmp VHDCPRINTER,0
  841. jne $L20001
  842. $L20000:
  843. call FAR PTR WINFAILURE
  844. jmp $ScribRet ; Scribble and return
  845. ;
  846. ; *************** EXIT POINT **********************************************
  847. ;
  848. $L20001:
  849. ; Line 216
  850. ; *** bltc(&ifi, 0, cwIFI);
  851. ; ***/* This means:
  852. ; ***ifi.ich = 0;
  853. ; ***ifi.ichPrev = 0;
  854. ; ***ifi.ichFetch = 0;
  855. ; ***ifi.cchSpace = 0;
  856. ; ***ifi.ichLeft = 0;
  857. ; ****/
  858. ; *** macro bltc destroys ax,es,cx
  859. lea dx,ifi
  860. bltc dx,0,c_cwIFI
  861. ; Line 225
  862. mov ifi._jc,c_jcTabLeft
  863. ; Line 226
  864. mov ifi.fPrevSpace,c_True
  865. ; Line 230
  866. ; *** /* Set up some variables that have different value depending on
  867. ; *** whether we are printing or not */
  868. ; *** if (fFlmPrinting)
  869. cmp fFlmPrinting,0
  870. je $NoPrint
  871. ; Line 232
  872. mov ax,DXAPRPAGE
  873. mov dxaFormat,ax
  874. ; Line 233
  875. mov ax,DYAPRPAGE
  876. mov dyaFormat,ax
  877. ; Line 234
  878. mov ax,DXPPRPAGE
  879. mov dxpFormat,ax
  880. ; Line 235
  881. mov ax,DYPPRPAGE
  882. mov dypFormat,ax
  883. ; Line 236
  884. mov ax,YPSUBSUPERPR
  885. jmp SHORT $CalcHgt
  886. $NoPrint:
  887. ; Line 240
  888. mov ax,c_czaInch
  889. mov dyaFormat,ax
  890. mov dxaFormat,ax
  891. ; Line 241
  892. mov ax,DXPLOGINCH
  893. mov dxpFormat,ax
  894. ; Line 242
  895. mov ax,DYPLOGINCH
  896. mov dypFormat,ax
  897. ; Line 243
  898. mov ax,YPSUBSUPER
  899. $CalcHgt:
  900. mov ypSubSuperFormat,ax
  901. ; *** /* Calculate line height and width measures. Compute
  902. ; *** xaLeft left indent 0 means at left margin
  903. ; *** xaRight width of column measured from left
  904. ; *** margin (not from left indent).
  905. ; *** */
  906. ; *** xaLeft = ppap->dxaLeft;
  907. ; Line 251
  908. ; *********** Register variables ********************
  909. rbx_ppap EQU bx
  910. ; ****************************************************
  911. mov rbx_ppap,ppap
  912. mov ax,[rbx_ppap].dxaLeft
  913. mov xaLeft,ax
  914. ; Line 255
  915. ; *** /* If this is the first line of a paragraph,
  916. ; *** adjust xaLeft for the first
  917. ; *** line indent. (Also, set dypBefore, since its handy.) */
  918. ; *** if (cp == vcpFirstParaCache)
  919. mov ax,WORD PTR VCPFIRSTPARACACHE
  920. mov dx,WORD PTR VCPFIRSTPARACACHE+2
  921. cmp SEG_cp,dx
  922. jne $setMargins
  923. cmp OFF_cp,ax
  924. jne $setMargins
  925. ; Line 257
  926. mov ax,[rbx_ppap].dxaLeft1
  927. add xaLeft,ax
  928. ; Line 273
  929. $setMargins:
  930. ; Line 274
  931. ; *** /* Now, set xaRight (width measured in twips). */
  932. IFDEF CASHMERE
  933. test WORD PTR [rbx_ppap].rhc,15
  934. je $L20005
  935. mov ax,WORD PTR VSEPPAGE.xaMac
  936. sub ax,WORD PTR VSEPPAGE.dxaGutter
  937. jmp SHORT $L20006
  938. $L20005:
  939. ENDIF
  940. mov si,psep
  941. mov ax,[si].dxaText
  942. $L20006:
  943. sub ax,[rbx_ppap].dxaRight
  944. mov xaRight,ax
  945. ; Line 277
  946. ; *** /* Do necessary checks on xaLeft and xaRight */
  947. ; *********** Register variables ********************
  948. rcx_xaRightMax EQU cx
  949. ; ****************************************************
  950. mov rcx_xaRightMax,c_xaRightMax
  951. cmp ax,rcx_xaRightMax
  952. jbe $I859
  953. ; Line 279
  954. mov xaRight,rcx_xaRightMax
  955. ; Line 281
  956. $I859:
  957. ; *********** Register variables ********************
  958. rax_xaLeft EQU ax
  959. ; ****************************************************
  960. mov rax_xaLeft,xaLeft
  961. cmp rax_xaLeft,rcx_xaRightMax
  962. jbe $I861
  963. ; Line 283
  964. mov xaLeft,rcx_xaRightMax
  965. ; Line 285
  966. $I861:
  967. cmp rax_xaLeft,0
  968. jge $I863
  969. ; Line 287
  970. xor rax_xaLeft,rax_xaLeft
  971. mov xaLeft,rax_xaLeft
  972. ; Line 289
  973. $I863:
  974. cmp xaRight,rax_xaLeft
  975. jae $I865
  976. ; Line 291
  977. inc rax_xaLeft
  978. mov xaRight,rax_xaLeft
  979. ; Line 294
  980. $I865:
  981. push xaLeft
  982. push dxpFormat
  983. push dxaFormat
  984. call FAR PTR MULTDIV
  985. mov ifi.xpLeft_Ifi,ax
  986. mov ifi.xp,ax
  987. mov WORD PTR VFLI.xpLeft_Fli,ax
  988. ; Line 295
  989. push xaLeft
  990. push DXPPRPAGE
  991. push DXAPRPAGE
  992. call FAR PTR MULTDIV
  993. mov ifi.xpPr,ax
  994. ; Line 296
  995. push xaRight
  996. push dxpFormat
  997. push dxaFormat
  998. call FAR PTR MULTDIV
  999. mov ifi.xpRight_Ifi,ax
  1000. mov WORD PTR VFLI.xpMarg,ax
  1001. ; Line 297
  1002. push xaRight
  1003. push DXPPRPAGE
  1004. push DXAPRPAGE
  1005. call FAR PTR MULTDIV
  1006. mov ifi.xpPrRight,ax
  1007. ; Line 300
  1008. ; *** /* Get a pointer to the tab-stop table. */
  1009. mov ax,ppap
  1010. add ax,rgtbd
  1011. mov ptbd,ax
  1012. ; Line 303
  1013. ; *** /* Turn off justification. */
  1014. cmp fFlmPrinting,0
  1015. je $L20007
  1016. mov ax,VHDCPRINTER
  1017. jmp SHORT $L20008
  1018. $L20007:
  1019. mov ax,VHMDC
  1020. $L20008:
  1021. push ax
  1022. xor ax,ax
  1023. push ax
  1024. push ax
  1025. call FAR PTR SETTEXTJUSTIFICATION
  1026. ; Line 306
  1027. ; *** /* Initialize the line height information. */
  1028. xor ax,ax
  1029. mov dypDescentMac,ax
  1030. mov dypAscentMac,ax
  1031. ; Line 309
  1032. ; *** /* To tell if there were any tabs */
  1033. mov ifi.ichLeft,65535
  1034. ; Line 312
  1035. ; *** /* Get the first run, and away we go... */
  1036. push doc
  1037. push SEG_cp
  1038. push OFF_cp
  1039. push ichCp
  1040. jmp SHORT $L20037
  1041. $NullRun:
  1042. ; Line 357
  1043. mov ax,c_cpNil
  1044. push ax
  1045. push ax ; high word of cpNil
  1046. push ax
  1047. xor ax,ax
  1048. push ax
  1049. $L20037:
  1050. mov ax,11
  1051. push ax
  1052. call FAR PTR FETCHCP
  1053. $FirstCps:
  1054. ; Line 360
  1055. mov cchUsed,0
  1056. ; Line 364
  1057. ; *** /* Continue fetching runs until a run is found with a nonzero
  1058. ; *** length */
  1059. mov ax,VCCHFETCH
  1060. mov cch,ax
  1061. or ax,ax
  1062. je $NullRun
  1063. mov ax,VPCHFETCH
  1064. mov pch,ax
  1065. ; Line 371
  1066. mov ax,WORD PTR VCPFETCH
  1067. mov dx,WORD PTR VCPFETCH+2
  1068. cmp SEG_cpMac,dx
  1069. jg $I886
  1070. jl $L20009
  1071. cmp OFF_cpMac,ax
  1072. jbe $L20009
  1073. cmp fFlmPrinting,0
  1074. jne $I886
  1075. mov bx,pch
  1076. cmp BYTE PTR [bx],c_chSect
  1077. jne $I886
  1078. $L20009:
  1079. ; Line 374
  1080. ; *** /* Force end mark to be in standard system font */
  1081. ; *** macro blt destroys ax,bx,cx,es
  1082. blt <OFFSET VCHPNORMAL>,<OFFSET VCHPABS>,c_cwCHP
  1083. ; Line 375
  1084. IFDEF SYSENDMARK
  1085. ; *** vchpAbs.ftc = ftcSystem;
  1086. mov BYTE PTR VCHPABS.ftc,248 ; 0x3e << 2 == 0xF8 == 248
  1087. ELSE
  1088. ; *** vchpAbs.ftc = 0;
  1089. and BYTE PTR VCHPABS.ftc,3
  1090. ENDIF
  1091. ; Line 376
  1092. ; *** vchpAbs.ftcXtra = 0;
  1093. and BYTE PTR VCHPABS.ftcXtra,248
  1094. ; *** vchpAbs.hps = hpsDefault;
  1095. mov BYTE PTR VCHPABS.hps,c_hpsDefault
  1096. ; Line 394
  1097. $I886:
  1098. ; *** not from original c code: copy VCHPABS into chpLocal
  1099. ; *** and use chpLocal hereafter ***********
  1100. ; *** macro blt destroys ax,bx,cx,es
  1101. lea dx,chpLocal
  1102. blt <OFFSET VCHPABS>,dx,c_cwCHP
  1103. ; Line 375
  1104. ; *** vchpAbs.ftc = 0;
  1105. cmp fFlmPrinting,0
  1106. je $I888
  1107. ; Line 396
  1108. push doc
  1109. lea ax,chpLocal
  1110. push ax
  1111. mov ax,3
  1112. push ax
  1113. call FAR PTR LOADFONT
  1114. ; Line 397
  1115. mov ax,WORD PTR VFMIPRINT.dypAscent_Fmi
  1116. add ax,WORD PTR VFMIPRINT.dypLeading
  1117. mov dypAscent,ax
  1118. ; Line 398
  1119. mov ax,WORD PTR VFMIPRINT.dypDescent_Fmi
  1120. jmp SHORT $L20038
  1121. $I888:
  1122. ; Line 402
  1123. push doc
  1124. lea ax,chpLocal
  1125. push ax
  1126. mov ax,2
  1127. push ax
  1128. call FAR PTR LOADFONT
  1129. ; Line 403
  1130. mov ax,WORD PTR VFMISCREEN.dypAscent_Fmi
  1131. add ax,WORD PTR VFMISCREEN.dypLeading
  1132. mov dypAscent,ax
  1133. ; Line 404
  1134. mov ax,WORD PTR VFMISCREEN.dypDescent_Fmi
  1135. $L20038:
  1136. mov dypDescent,ax
  1137. ifdef ENABLE /* BRYANL 8/27/27; see comment in C source */
  1138. ; *** /* Bail out if there is a memory failure. */
  1139. cmp VFOUTOFMEMORY,0
  1140. je $I889
  1141. jmp $DoBreak
  1142. $I889:
  1143. endif ; ENABLE
  1144. ; Line 408
  1145. ; lines 408-417 removed
  1146. ; Line 418
  1147. ; *** /* Floating line size algorithm */
  1148. ; *** if (chpLocal.hpsPos != 0)
  1149. test BYTE PTR chpLocal.hpsPos,-1
  1150. je $I895
  1151. ; Line 421
  1152. ; *** /* Modify font for subscript/superscript */
  1153. ; *** if (chpLocal.hpsPos < hpsNegMin)
  1154. mov al,BYTE PTR chpLocal.hpsPos
  1155. cmp al,c_hpsNegMin
  1156. jae $I894
  1157. ; Line 423
  1158. mov ax,ypSubSuperFormat
  1159. add dypAscent,ax
  1160. ; Line 425
  1161. jmp SHORT $I895
  1162. $I894:
  1163. ; Line 427
  1164. mov ax,ypSubSuperFormat
  1165. add dypDescent,ax
  1166. ; Line 428
  1167. $I895:
  1168. ; *** /* Update the maximum ascent and descent of the line. */
  1169. ; Line 432
  1170. mov fSizeChanged,0
  1171. ; Line 433
  1172. mov ax,dypDescent
  1173. cmp dypDescentMac,ax
  1174. jge $I896
  1175. ; Line 435
  1176. mov dypDescentMac,ax
  1177. ; Line 436
  1178. mov fSizeChanged,1
  1179. ; Line 438
  1180. $I896:
  1181. mov ax,dypAscent
  1182. cmp dypAscentMac,ax
  1183. jge $I897
  1184. ; Line 440
  1185. mov dypAscentMac,ax
  1186. ; Line 441
  1187. mov fSizeChanged,1
  1188. ; Line 444
  1189. ; dypUser EQU bp-88
  1190. ; dypAuto EQU bp-90
  1191. ; *********** Register variables ********************
  1192. rsi_dypAuto EQU si
  1193. rdi_dypUser EQU di
  1194. ; ****************************************************
  1195. $I897:
  1196. cmp fSizeChanged,0
  1197. je $OldRun
  1198. ; Line 485
  1199. mov rsi_dypAuto,dypDescentMac
  1200. add rsi_dypAuto,dypAscentMac
  1201. ; Line 487
  1202. mov bx,ppap
  1203. mov ax,WORD PTR [bx].dyaLine
  1204. cmp ax,c_czaLine
  1205. jle $I898
  1206. push ax
  1207. push dypFormat
  1208. push dyaFormat
  1209. call FAR PTR MULTDIV
  1210. push ax
  1211. mov ax,1
  1212. push ax
  1213. call FAR PTR IMAX
  1214. mov rdi_dypUser,ax
  1215. ; Line 490
  1216. cmp rsi_dypAuto,rdi_dypUser
  1217. jle $L20011
  1218. $I898:
  1219. mov ifi.dypLineSize,rsi_dypAuto
  1220. jmp SHORT $L20012
  1221. $L20011:
  1222. mov ifi.dypLineSize,rdi_dypUser
  1223. $L20012:
  1224. ; Line 496
  1225. $OldRun:
  1226. ; Line 498
  1227. ; *** /* Calculate length of the run but no greater than 256 */
  1228. mov ax,WORD PTR VCPFETCH
  1229. sub ax,WORD PTR VFLI
  1230. ; Line 499
  1231. cmp ax,255
  1232. jl $I902
  1233. ; Line 501
  1234. mov ax,254
  1235. ; Line 503
  1236. $I902:
  1237. mov iichNew,ax
  1238. sub ax,ifi.ich_Ifi
  1239. mov dich,ax
  1240. ; Line 509
  1241. ; *** /* Ensure that all tab and non-required
  1242. ; *** hyphen characters start at
  1243. ; *** beginning of run */
  1244. cmp WORD PTR $S784_ichpFormat,0
  1245. jle $L20013
  1246. or ax,ax
  1247. jg $L20013
  1248. lea ax,chpLocal
  1249. push ax
  1250. mov ax,10
  1251. imul WORD PTR $S784_ichpFormat
  1252. mov bx,VHGCHPFORMAT
  1253. add ax,[bx]
  1254. sub ax,10
  1255. push ax
  1256. mov ax,7
  1257. push ax
  1258. call FAR PTR CCHDIFFER
  1259. or ax,ax
  1260. jne $L20013
  1261. mov bx,pch
  1262. cmp BYTE PTR [bx],9
  1263. je $L20013
  1264. cmp BYTE PTR [bx],31
  1265. je $+5
  1266. jmp $I905
  1267. ; pchp EQU bp-92
  1268. ; register si=pchp
  1269. $L20013:
  1270. ; Line 511
  1271. mov ax,ICHPMACFORMAT
  1272. cmp WORD PTR $S784_ichpFormat,ax
  1273. jne $L20014
  1274. call FGrowFormatHeap
  1275. or ax,ax
  1276. jne $+5
  1277. jmp $I905
  1278. $L20014:
  1279. ; Line 514
  1280. ; *********** Register variables ********************
  1281. rsi_pchp EQU si
  1282. ; ****************************************************
  1283. mov ax,10
  1284. imul WORD PTR $S784_ichpFormat
  1285. mov rsi_pchp,ax
  1286. sub rsi_pchp,10
  1287. mov bx,VHGCHPFORMAT
  1288. add rsi_pchp,[bx] ; si = pch
  1289. ; Line 516
  1290. cmp WORD PTR $S784_ichpFormat,0
  1291. jle $I907
  1292. ; Line 518
  1293. mov ax,ifi.ich_Ifi
  1294. sub ax,ifi.ichPrev
  1295. mov BYTE PTR [rsi_pchp].cchRun,al
  1296. ; Line 519
  1297. mov al,BYTE PTR (ifi.ichPrev)
  1298. mov BYTE PTR [rsi_pchp].ichRun,al
  1299. ; Line 521
  1300. $I907:
  1301. add rsi_pchp,10
  1302. ; *** macro blt destroys ax,bx,cx,es
  1303. mov dx,rsi_pchp
  1304. lea ax,chpLocal ; ax not destroyed in blt until after value used
  1305. blt ax,dx,c_cwCHP
  1306. ; Line 529
  1307. or BYTE PTR [rsi_pchp].cchRun,255
  1308. ; Line 530
  1309. cmp dich,0
  1310. jg $I908
  1311. ; Line 532
  1312. mov al,BYTE PTR (ifi.ich_Ifi)
  1313. jmp SHORT $L20048
  1314. $I908:
  1315. ; Line 537
  1316. ; *** bltc (&vfli.rgdxp[ifi.ich],0,dich)
  1317. mov dx,ifi.ich_Ifi
  1318. shl dx,1
  1319. add dx,OFFSET VFLI.rgdxp
  1320. ; *** macro bltc destroys ax,es,cx
  1321. bltc dx,0,dich
  1322. ; Line 538
  1323. ; *** bltbc (&vfli.rgch[ifi.ich],0,dich)
  1324. mov dx,ifi.ich_Ifi
  1325. add dx,OFFSET VFLI.rgch
  1326. ;*** macro bltbc destroys ax,es,cx
  1327. bltbc dx,0,dich
  1328. ; Line 539
  1329. mov ax,iichNew
  1330. mov ifi.ich_Ifi,ax
  1331. $L20048:
  1332. mov BYTE PTR [rsi_pchp].ichRun,al
  1333. ; Line 541
  1334. mov ax,ifi.ich_Ifi
  1335. mov ifi.ichPrev,ax
  1336. ; Line 542
  1337. inc WORD PTR $S784_ichpFormat
  1338. ; Line 544
  1339. $I905:
  1340. ; Line 546
  1341. mov ax,WORD PTR VCPFETCH
  1342. mov dx,WORD PTR VCPFETCH+2
  1343. cmp SEG_cpMac,dx
  1344. jle $+5
  1345. jmp $I911
  1346. jl $L20016
  1347. cmp OFF_cpMac,ax
  1348. jbe $+5
  1349. jmp $I911
  1350. $L20016:
  1351. ; Line 549
  1352. cmp ifi.fPrevSpace,0
  1353. je $L20015
  1354. ; *** note ax:dx still holds vcpFetch
  1355. cmp SEG_cp,dx
  1356. jne $I912
  1357. cmp OFF_cp,ax
  1358. jne $I912
  1359. $L20015:
  1360. ; Line 551
  1361. mov ax,ifi.ich_Ifi
  1362. mov WORD PTR VFLI.ichReal,ax
  1363. ; Line 552
  1364. mov ax,ifi.xp
  1365. mov ifi.xpReal_Ifi,ax
  1366. mov WORD PTR VFLI.xpReal_Fli,ax
  1367. ; Line 554
  1368. $I912:
  1369. cmp fFlmPrinting,0
  1370. jne $I913
  1371. ;mov ax,DOCHELP
  1372. ;cmp doc,ax
  1373. ;je $I913
  1374. ; Line 556
  1375. mov bx,ifi.ich_Ifi
  1376. mov BYTE PTR VFLI.rgch[bx],c_chEmark
  1377. ; Line 558
  1378. mov ax,c_chEmark
  1379. push ax
  1380. xor ax,ax
  1381. push ax
  1382. call FAR PTR DxpFromCh
  1383. mov bx,ifi.ich_Ifi
  1384. inc ifi.ich_Ifi
  1385. shl bx,1
  1386. mov WORD PTR VFLI.rgdxp[bx],ax
  1387. add WORD PTR VFLI.xpReal_Fli,ax
  1388. ; Line 560
  1389. $I913:
  1390. mov ax,ifi.dypLineSize
  1391. mov WORD PTR VFLI.dypLine,ax
  1392. ; Line 561
  1393. mov ax,dypDescentMac
  1394. mov WORD PTR VFLI.dypBase,ax
  1395. ; Line 562
  1396. mov ax,dypAscentMac
  1397. add ax,dypDescentMac
  1398. mov WORD PTR VFLI.dypFont,ax
  1399. ; Line 563
  1400. mov ax,ifi.ich_Ifi
  1401. mov WORD PTR VFLI.ichReal,ax
  1402. mov WORD PTR VFLI.ichMac,ax
  1403. ; Line 564
  1404. mov ax,OFF_cpMac
  1405. mov dx,SEG_cpMac
  1406. add ax,1
  1407. adc dx,0
  1408. mov WORD PTR VFLI.cpMac_OFF,ax
  1409. mov WORD PTR VFLI.cpMac_SEG,dx
  1410. ; Line 565
  1411. jmp $JustEol
  1412. $I911:
  1413. mov ax,ifi.ich_Ifi
  1414. add ax,cch
  1415. cmp ax,255
  1416. jle $I916
  1417. ; Line 573
  1418. mov ax,255
  1419. sub ax,ifi.ich_Ifi
  1420. mov cch,ax
  1421. ; Line 574
  1422. mov fTruncated,1
  1423. ; Line 577
  1424. $I916:
  1425. mov ifi.ichFetch,0
  1426. ; Line 603
  1427. ; *** if (chpLocal.fSpecial)
  1428. test BYTE PTR chpLocal.fSpecial,mask_0100_0000
  1429. jne $+5
  1430. jmp $GetCh
  1431. ; Line 605
  1432. lea ax,ifi
  1433. push ax
  1434. push flm
  1435. mov ax,WORD PTR VSEPABS
  1436. mov cl,11
  1437. shr ax,cl
  1438. and ax,7
  1439. push ax
  1440. call FAR PTR FFORMATSPECIALS
  1441. or ax,ax
  1442. je $+5
  1443. jmp $GetCh
  1444. ; Line 607
  1445. cmp ifi.chBreak,0
  1446. jne $+5
  1447. jmp $Unbroken
  1448. $I986:
  1449. mov ax,ifi.ichFetch
  1450. sub ax,WORD PTR VFLI.cpMac_OFF
  1451. add ax,WORD PTR VCPFETCH
  1452. mov WORD PTR VFLI.dcpDepend,ax
  1453. ; Line 1026
  1454. $JustBreak:
  1455. ; Line 1027
  1456. cmp WORD PTR ifi.chBreak,31
  1457. je $+5
  1458. jmp $I992
  1459. ; Line 1032
  1460. mov ax,45
  1461. push ax
  1462. push fFlmPrinting
  1463. call FAR PTR DxpFromCh ; *** ax will have width of hyphen
  1464. ; **** up to line 1036 rearranged bz
  1465. mov bx,WORD PTR VFLI.ichReal
  1466. ; Line 1035
  1467. mov WORD PTR VFLI.ichMac,bx ; ** ichMac = ichReal
  1468. dec bx ; ichReal - 1
  1469. mov BYTE PTR VFLI.rgch[bx],45 ; ** rgch[ichReal-1] = "-
  1470. shl bx,1
  1471. mov WORD PTR VFLI.rgdxp[bx],ax
  1472. add ifi.xpReal_Ifi,ax
  1473. ; Line 1033
  1474. mov ax,ifi.xpReal_Ifi
  1475. mov WORD PTR VFLI.xpReal_Fli,ax
  1476. mov WORD PTR VFLI.xpRight,ax
  1477. ; Line 1036
  1478. mov ax,WORD PTR $S784_ichpFormat
  1479. dec ax
  1480. cmp ichpNRH,ax
  1481. jge $I992
  1482. ; pchp EQU bp-112
  1483. ; *********** Register variables ********************
  1484. rdi_pchp EQU di
  1485. ; ****************************************************
  1486. ; register di=pchp
  1487. ; =-114
  1488. ; =-116
  1489. ; Line 1039
  1490. ; ** register struct CHP *pchp=&(**vhgchpFormat)[ichpNRH]
  1491. mov ax,10
  1492. imul ichpNRH
  1493. mov rdi_pchp,ax
  1494. mov bx,VHGCHPFORMAT
  1495. add rdi_pchp,[bx]
  1496. ; Line 1041
  1497. ; ** pchp->cchRun++;
  1498. inc BYTE PTR [rdi_pchp].cchRun
  1499. ; Line 1042
  1500. ; ** if (pchp->ichRun >= vfli.ichMac)
  1501. mov dx,WORD PTR VFLI.ichMac
  1502. cmp BYTE PTR [rdi_pchp].ichRun,dl
  1503. jb $I992
  1504. ; Line 1044
  1505. ; ** pchp->ichRun = vfli.ichMac - 1;
  1506. dec dx
  1507. mov BYTE PTR [rdi_pchp].ichRun,dl
  1508. ; Line 1046
  1509. $I992:
  1510. ; Line 1049
  1511. cmp fFlmPrinting,0
  1512. je $I993
  1513. ; Line 1051
  1514. mov ax,WORD PTR VFLI.ichReal
  1515. mov WORD PTR VFLI.ichMac,ax
  1516. ; Line 1057
  1517. $I993:
  1518. cmp ifi._jc,c_jcTabLeft
  1519. jne $+5
  1520. jmp $I994
  1521. ; Line 1061
  1522. $L20051:
  1523. lea ax,ifi
  1524. push ax
  1525. push xpTab
  1526. jmp $L20046
  1527. ; ch=-94
  1528. ; *********** Register variables ********************
  1529. rsi_ch EQU si
  1530. ; ****************************************************
  1531. ; register si=ch
  1532. $I877:
  1533. ; Line 625
  1534. mov bx,ifi.ichFetch
  1535. inc ifi.ichFetch
  1536. mov di,pch
  1537. mov al,[bx][di]
  1538. sub ah,ah
  1539. mov rsi_ch,ax
  1540. ; Line 627
  1541. $NormChar:
  1542. ; Line 628
  1543. cmp rsi_ch,c_chSpace
  1544. jne $NotSpace
  1545. ; Line 632
  1546. cmp fFlmPrinting,0
  1547. je $L20017
  1548. mov ax,WORD PTR VFMIPRINT+2
  1549. jmp SHORT $L20018
  1550. $L20017:
  1551. mov ax,WORD PTR VFMISCREEN+2
  1552. $L20018:
  1553. mov dxp,ax
  1554. mov bx,ifi.ich_Ifi
  1555. shl bx,1
  1556. mov WORD PTR VFLI.rgdxp[bx],ax
  1557. add ifi.xp,ax
  1558. ; Line 633
  1559. mov ax,WORD PTR VFMIPRINT+2
  1560. mov dxpPr,ax
  1561. add ifi.xpPr,ax
  1562. ; Line 634
  1563. mov bx,ifi.ich_Ifi
  1564. inc ifi.ich_Ifi
  1565. mov BYTE PTR VFLI.rgch[bx],c_chSpace
  1566. ; Line 635
  1567. jmp $BreakOppr
  1568. $NotSpace:
  1569. ; Line 641
  1570. cmp rsi_ch,c_chSpace
  1571. jl $L20019
  1572. cmp rsi_ch,128
  1573. jge $L20019
  1574. mov bx,WORD PTR VFMIPRINT
  1575. shl rsi_ch,1
  1576. mov ax,WORD PTR [bx][rsi_ch]
  1577. shr rsi_ch,1
  1578. mov dxpPr,ax
  1579. cmp ax,dxpNil
  1580. jne $I928
  1581. $L20019:
  1582. ; Line 643
  1583. push rsi_ch
  1584. mov ax,1
  1585. push ax
  1586. call FAR PTR DxpFromCh
  1587. mov dxpPr,ax
  1588. ; Line 646
  1589. $I928:
  1590. cmp fFlmPrinting,0
  1591. je $I929
  1592. ; Line 650
  1593. mov ax,dxpPr
  1594. jmp SHORT $L20045
  1595. $I929:
  1596. ; Line 653
  1597. cmp rsi_ch,c_chSpace
  1598. jl $L20020
  1599. cmp rsi_ch,128
  1600. jge $L20020
  1601. mov bx,WORD PTR VFMISCREEN
  1602. shl rsi_ch,1
  1603. mov ax,WORD PTR [bx][rsi_ch]
  1604. shr rsi_ch,1
  1605. mov dxp,ax
  1606. cmp ax,dxpNil
  1607. jne $I931
  1608. $L20020:
  1609. ; Line 654
  1610. push rsi_ch
  1611. xor ax,ax
  1612. push ax
  1613. call FAR PTR DxpFromCh
  1614. $L20045:
  1615. mov dxp,ax
  1616. ; Line 656
  1617. $I931:
  1618. mov bx,ifi.ich_Ifi
  1619. shl bx,1
  1620. ; *** here ax = dxp from above
  1621. mov WORD PTR VFLI.rgdxp[bx],ax
  1622. add ifi.xp,ax
  1623. ; Line 657
  1624. mov ax,dxpPr
  1625. add ifi.xpPr,ax
  1626. ; Line 658
  1627. mov bx,ifi.ich_Ifi
  1628. inc ifi.ich_Ifi
  1629. mov ax,rsi_ch
  1630. mov BYTE PTR VFLI.rgch[bx],al
  1631. ; Line 662
  1632. cmp rsi_ch,45
  1633. jle $SwitchCh
  1634. ; Line 1001
  1635. $DefaultCh:
  1636. ; Line 1002
  1637. mov ax,ifi.xpPrRight
  1638. cmp ifi.xpPr,ax
  1639. jle $PChar
  1640. ; Line 1003
  1641. $DoBreak:
  1642. ; Line 1005
  1643. cmp ifi.chBreak,0
  1644. je $+5
  1645. jmp $I986
  1646. ; Line 1006
  1647. $Unbroken:
  1648. ; Line 1011
  1649. mov ax,ifi.ich_Ifi
  1650. dec ax
  1651. push ax
  1652. call FFirstIch
  1653. or ax,ax
  1654. jne $+5
  1655. jmp $I987
  1656. cmp ifi.ich_Ifi,255
  1657. jl $+5
  1658. jmp $I987
  1659. ; Line 1013
  1660. $PChar:
  1661. ; Line 1087
  1662. mov ifi.fPrevSpace,0
  1663. ; Line 1089
  1664. jmp SHORT $GetCh
  1665. ; ***** end for default case **************
  1666. $SwitchCh:
  1667. mov ax,rsi_ch
  1668. cmp ax,c_chSect
  1669. jne $+5
  1670. jmp $SC942
  1671. jle $+5
  1672. jmp $L20028
  1673. cmp ax,c_chTab
  1674. jne $+5
  1675. jmp $SC951
  1676. cmp ax,c_chEol
  1677. jl $DefaultCh
  1678. cmp ax,c_chNewLine
  1679. jg $+5
  1680. jmp $SC971
  1681. jmp SHORT $DefaultCh
  1682. $SC938:
  1683. ; Line 671
  1684. dec ifi.ich_Ifi
  1685. ; Line 672
  1686. mov ax,dxp
  1687. sub ifi.xp,ax
  1688. ; Line 673
  1689. mov ax,dxpPr
  1690. sub ifi.xpPr,ax
  1691. page
  1692. ; Line 674
  1693. $GetCh: ; ****** START of main FOR loop ********************
  1694. ; Line 335
  1695. mov ax,cch
  1696. cmp ifi.ichFetch,ax
  1697. je $+5
  1698. jmp $I877
  1699. ; Line 341
  1700. cmp ifi.ich_Ifi,255
  1701. jge $DoBreak
  1702. ; Line 344
  1703. cmp fTruncated,0
  1704. jne $+5
  1705. jmp $NullRun
  1706. ; Line 349
  1707. add cchUsed,ax
  1708. ; Line 350
  1709. mov ax,cchUsed
  1710. add ax,VPCHFETCH
  1711. mov pch,ax
  1712. ; Line 351
  1713. mov ax,VCCHFETCH
  1714. sub ax,cchUsed
  1715. mov cch,ax
  1716. ; Line 352
  1717. mov fTruncated,0
  1718. ; Line 353
  1719. jmp $OldRun
  1720. $SC939:
  1721. ; Line 679
  1722. dec ifi.ich_Ifi
  1723. ; Line 680
  1724. mov ax,dxp
  1725. sub ifi.xp,ax
  1726. ; Line 681
  1727. mov ax,dxpPr
  1728. sub ifi.xpPr,ax
  1729. ; Line 683
  1730. mov ax,WORD PTR $S784_ichpFormat
  1731. dec ax
  1732. mov ichpNRH,ax
  1733. ; Line 684
  1734. mov ax,c_chHyphen
  1735. push ax
  1736. mov ax,1
  1737. push ax
  1738. call FAR PTR DxpFromCh
  1739. add ax,ifi.xpPr
  1740. cmp ax,ifi.xpPrRight
  1741. jle $+5
  1742. jmp $DoBreak
  1743. ; Line 687
  1744. mov ax,ifi.xp
  1745. mov xpPrev,ax
  1746. ; Line 700
  1747. mov bx,ifi.ich_Ifi
  1748. mov BYTE PTR VFLI.rgch[bx],c_chTab
  1749. ; Line 701
  1750. jmp $Tab0
  1751. $SC942:
  1752. ; Line 705
  1753. dec ifi.ich_Ifi
  1754. ; Line 706
  1755. mov ax,dxp
  1756. sub ifi.xp,ax
  1757. ; Line 707
  1758. mov ax,dxpPr
  1759. sub ifi.xpPr,ax
  1760. ; Line 710
  1761. mov ax,dypDescentMac
  1762. mov WORD PTR VFLI.dypBase,ax
  1763. add ax,dypAscentMac
  1764. mov WORD PTR VFLI.dypLine,ax
  1765. mov WORD PTR VFLI.dypFont,ax
  1766. ; Line 711
  1767. mov ax,ifi.ichFetch
  1768. cwd
  1769. add ax,WORD PTR VCPFETCH
  1770. adc dx,WORD PTR VCPFETCH+2
  1771. mov WORD PTR VFLI.cpMac_OFF,ax
  1772. mov WORD PTR VFLI.cpMac_SEG,dx
  1773. ; Line 712
  1774. push ifi.ich_Ifi
  1775. call FFirstIch
  1776. or ax,ax
  1777. jne $+5
  1778. jmp $I943
  1779. ; Line 715
  1780. mov ax,WORD PTR VFLI.fSplat
  1781. mov al,1
  1782. mov WORD PTR VFLI.fSplat,ax
  1783. ; Line 716
  1784. cmp fFlmPrinting,0
  1785. je $+5
  1786. jmp $I944
  1787. ;chT EQU bp-96
  1788. ;cch EQU bp-98
  1789. ;dxpCh EQU bp-100
  1790. ; Line 723
  1791. mov chT,c_chSplat
  1792. ; Line 726
  1793. push chT
  1794. xor ax,ax
  1795. push ax
  1796. call FAR PTR DxpFromCh
  1797. mov dxpCh,ax
  1798. ; Line 730
  1799. mov ax,17
  1800. imul DXPLOGINCH
  1801. cwd
  1802. sub ax,dx
  1803. sar ax,1
  1804. cwd
  1805. mov cx,dxpCh
  1806. idiv cx
  1807. cmp ax,223
  1808. jge $L20021
  1809. jmp SHORT $L20022
  1810. $L20021:
  1811. mov ax,223
  1812. $L20022:
  1813. mov cch2,ax
  1814. ; Line 732
  1815. ; *** bltbc(&vfli.rgch[ifi.ich], chT, cch);
  1816. mov dx,ifi.ich_Ifi
  1817. add dx,OFFSET VFLI.rgch
  1818. ;*** macro bltbc destroys ax,es,cx
  1819. bltbc dx,<BYTE PTR (chT)>,cch2
  1820. ; Line 733
  1821. ; *** bltc(&vfli.rgdxp[ifi.ich], dxpCh, cch);
  1822. mov dx,ifi.ich_Ifi
  1823. shl dx,1
  1824. add dx,OFFSET VFLI.rgdxp
  1825. ; *** macro bltc destroys ax,es,cx
  1826. bltc dx,dxpCH,cch2
  1827. ; Line 734
  1828. mov ax,ifi.ich_Ifi
  1829. add ax,cch2
  1830. mov WORD PTR VFLI.ichMac,ax
  1831. ; Line 736
  1832. push VHMDC
  1833. mov ax,OFFSET VFLI.rgch
  1834. push ds
  1835. push ax
  1836. push cch2
  1837. call FAR PTR GETTEXTEXTENT
  1838. mov WORD PTR VFLI.xpReal_Fli,ax
  1839. ; Line 737
  1840. mov WORD PTR VFLI.xpLeft_Fli,0
  1841. ; Line 739
  1842. jmp $EndFormat
  1843. $I944:
  1844. ; Line 741
  1845. mov WORD PTR VFLI.ichMac,0
  1846. ; Line 743
  1847. jmp $EndFormat
  1848. $I943:
  1849. mov WORD PTR VFLI.fSplatNext, 1
  1850. mov ax,cchUsed
  1851. dec ax
  1852. cwd
  1853. add WORD PTR VFLI.cpMac_OFF,ax
  1854. adc WORD PTR VFLI.cpMac_SEG,dx
  1855. ; Line 749
  1856. mov WORD PTR VFLI.dcpDepend,1
  1857. ; Line 750
  1858. cmp ifi.fPrevSpace,0
  1859. jne $I950
  1860. ; Line 752
  1861. mov ax,ifi.cchSpace
  1862. mov ifi.cBreak_Ifi,ax
  1863. ; Line 753
  1864. mov ax,ifi.ich_Ifi
  1865. mov WORD PTR VFLI.ichReal,ax
  1866. ; Line 754
  1867. mov ax,ifi.xp
  1868. mov ifi.xpReal_Ifi,ax
  1869. mov WORD PTR VFLI.xpReal_Fli,ax
  1870. ; Line 756
  1871. $I950:
  1872. mov ax,ifi.ich_Ifi
  1873. mov WORD PTR VFLI.ichMac,ax
  1874. ; Line 757
  1875. mov ax,ifi.dypLineSize
  1876. mov WORD PTR VFLI.dypLine,ax
  1877. ; Line 758
  1878. jmp $JustBreak
  1879. $SC951:
  1880. ; Line 762
  1881. dec ifi.ich_Ifi
  1882. ; Line 763
  1883. mov ax,dxp
  1884. sub ifi.xp,ax
  1885. ; Line 764
  1886. mov ax,dxpPr
  1887. sub ifi.xpPr,ax
  1888. ;xaTab EQU bp-102
  1889. ;xaPr EQU bp-104
  1890. ; pchp EQU bp-106
  1891. ; register di=pchp
  1892. ; Line 766
  1893. mov ax,ifi.xpPrRight
  1894. cmp ifi.xpPr,ax
  1895. jl $+5
  1896. jmp $I952
  1897. ; Line 772
  1898. cmp ifi.fPrevSpace,0
  1899. jne $I956
  1900. ; Line 776
  1901. mov ax,ifi.cchSpace
  1902. mov ifi.cBreak_Ifi,ax
  1903. ; Line 777
  1904. mov ax,ifi.ich_Ifi
  1905. mov WORD PTR VFLI.ichReal,ax
  1906. ; Line 778
  1907. mov ax,ifi.xp
  1908. mov ifi.xpReal_Ifi,ax
  1909. ; Line 781
  1910. $I956:
  1911. cmp ifi._jc,c_jcTabLeft
  1912. je $I957
  1913. ; Line 783
  1914. lea ax,ifi
  1915. push ax
  1916. push xpTab
  1917. push flm
  1918. call Justify
  1919. ; Line 785
  1920. $I957:
  1921. mov ax,ifi.xp
  1922. mov xpPrev,ax
  1923. ; Line 788
  1924. push ifi.xpPr
  1925. push DXAPRPAGE
  1926. push DXPPRPAGE
  1927. call FAR PTR MULTDIV
  1928. mov xaPr,ax
  1929. ; Line 789
  1930. jmp SHORT $L20041
  1931. $WC958:
  1932. mov ax,xaRight
  1933. cmp xaTab,ax
  1934. jb $I959
  1935. mov xaTab,ax
  1936. $I959:
  1937. ; Line 791
  1938. mov ax,xaPr
  1939. cmp xaTab,ax
  1940. jb $I960
  1941. ; Line 799
  1942. add ptbd,4
  1943. mov al, [bx].jc_Tbd
  1944. sub ah,ah
  1945. and ax,7
  1946. add ax,c_jcTabMin
  1947. ;#ifdef ENABLE /* we do the mapping in HgtbdCreate */
  1948. ; cmp ax,c_jcTabDecimal
  1949. ; je $I1958
  1950. ; mov ax,c_jcTabLeft
  1951. ;#endif
  1952. $I1958:
  1953. mov ifi._jc,ax
  1954. ; Line 800
  1955. jmp SHORT $TabFound
  1956. $I960:
  1957. add ptbd,4
  1958. ; Line 803
  1959. $L20041:
  1960. mov bx,ptbd
  1961. mov ax,[bx]
  1962. mov xaTab,ax
  1963. or ax,ax
  1964. jne $WC958
  1965. ; Line 806
  1966. mov ax,xaPr
  1967. sub dx,dx
  1968. mov cx,WORD PTR VZATABDFLT
  1969. div cx
  1970. mul cx
  1971. add ax,cx
  1972. mov xaTab,ax
  1973. ; Line 812
  1974. mov ifi._jc,c_jcTabLeft
  1975. ; Line 814
  1976. $TabFound:
  1977. ; Line 815
  1978. push xaTab
  1979. push dxpFormat
  1980. push dxaFormat
  1981. call FAR PTR MULTDIV
  1982. cmp ifi.xp,ax
  1983. jle $I1961
  1984. mov ax,ifi.xp
  1985. $I1961:
  1986. mov xpTab,ax
  1987. ; Line 822
  1988. cmp ifi._jc,c_jcTabLeft
  1989. jne $I962
  1990. ; Line 825
  1991. mov ifi.xp,ax
  1992. ; Line 826
  1993. push xaTab
  1994. push DXPPRPAGE
  1995. push DXAPRPAGE
  1996. call FAR PTR MULTDIV
  1997. mov ifi.xpPr,ax
  1998. ; Line 828
  1999. $I962:
  2000. mov ax,ifi.xp
  2001. mov ifi.xpLeft_Ifi,ax
  2002. ; Line 829
  2003. mov ax,ifi.ich_Ifi
  2004. mov ifi.ichLeft,ax
  2005. ; Line 830
  2006. mov ifi.cchSpace,0
  2007. ; Line 831
  2008. mov ifi.chBreak,0
  2009. ; Line 832
  2010. $Tab0:
  2011. ; Line 833
  2012. mov ifi.fPrevSpace,0
  2013. ; Line 834
  2014. mov ax,ifi.ich_Ifi
  2015. mov WORD PTR VFLI.ichMac,ax
  2016. ; Line 835
  2017. mov ax,ifi.xp
  2018. mov WORD PTR VFLI.xpReal_Fli,ax
  2019. ; Line 836
  2020. mov ax,ifi.dypLineSize
  2021. mov WORD PTR VFLI.dypLine,ax
  2022. ; Line 837
  2023. mov ax,dypDescentMac
  2024. mov WORD PTR VFLI.dypBase,ax
  2025. ; Line 838
  2026. mov ax,dypAscentMac
  2027. add ax,dypDescentMac
  2028. mov WORD PTR VFLI.dypFont,ax
  2029. ; Line 841
  2030. cmp ifi.ichFetch,1
  2031. je $I963
  2032. mov ax,ICHPMACFORMAT
  2033. cmp WORD PTR $S784_ichpFormat,ax
  2034. jne $L20023
  2035. call FGrowFormatHeap
  2036. or ax,ax
  2037. je $I963
  2038. $L20023:
  2039. ; Line 845
  2040. ; *********** Register variables ********************
  2041. ; rdi_pchp EQU di
  2042. ; ****************************************************
  2043. ; register di=pchp
  2044. mov ax,10
  2045. imul WORD PTR $S784_ichpFormat
  2046. mov rdi_pchp,ax
  2047. sub rdi_pchp,10
  2048. mov bx,VHGCHPFORMAT
  2049. add rdi_pchp,[bx]
  2050. ; Line 846
  2051. cmp WORD PTR $S784_ichpFormat,0
  2052. jle $I964
  2053. ; Line 849
  2054. mov al,BYTE PTR (ifi.ichPrev)
  2055. mov BYTE PTR [rdi_pchp].ichRun,al
  2056. ; Line 850
  2057. mov ax,ifi.ich_Ifi
  2058. sub ax,ifi.ichPrev
  2059. mov BYTE PTR [rdi_pchp].cchRun,al
  2060. ; Line 853
  2061. $I964:
  2062. add rdi_pchp,10 ; ** ++pchp
  2063. lea ax,chpLocal ; ax not destroyed in blt until after value used
  2064. ;*** macro blt destroys ax,bx,cx,es
  2065. blt ax,rdi_pchp,c_cwCHP
  2066. ; Line 854
  2067. inc WORD PTR $S784_ichpFormat
  2068. ; Line 856
  2069. jmp SHORT $I965
  2070. $I963:
  2071. ; Line 858
  2072. mov ax,10
  2073. imul WORD PTR $S784_ichpFormat
  2074. mov rdi_pchp,ax
  2075. sub rdi_pchp,10
  2076. mov bx,VHGCHPFORMAT
  2077. add rdi_pchp,[bx]
  2078. ; Line 859
  2079. $I965:
  2080. ; Line 860
  2081. mov al,BYTE PTR (ifi.ich_Ifi)
  2082. mov BYTE PTR [rdi_pchp].ichRun,al
  2083. ; Line 861
  2084. or BYTE PTR [rdi_pchp].cchRun,255
  2085. ; Line 867
  2086. mov bx,ifi.ich_Ifi
  2087. inc ifi.ich_Ifi
  2088. mov ifi.ichPrev,bx
  2089. shl bx,1
  2090. mov ax,ifi.xp
  2091. sub ax,xpPrev
  2092. mov WORD PTR VFLI.rgdxp[bx],ax
  2093. ; Line 869
  2094. cmp rsi_ch,c_chTab
  2095. jne $BreakOppr
  2096. jmp $GetCh
  2097. $I952:
  2098. ; Line 878
  2099. mov rsi_ch,160
  2100. ; Line 879
  2101. jmp $NormChar
  2102. $SC968:
  2103. ; Line 883
  2104. mov ax,ifi.xpPrRight
  2105. cmp ifi.xpPr,ax
  2106. jle $+5
  2107. jmp $DoBreak
  2108. ; Line 885
  2109. $BreakOppr:
  2110. ; Line 891
  2111. cmp ifi.ich_Ifi,255
  2112. jl $+5
  2113. jmp $Unbroken
  2114. ; Line 893
  2115. $SC971:
  2116. ; Line 898
  2117. mov ifi.chBreak,rsi_ch
  2118. ; Line 899
  2119. mov ax,ifi.ichFetch
  2120. add ax,cchUsed
  2121. cwd
  2122. add ax,WORD PTR VCPFETCH
  2123. adc dx,WORD PTR VCPFETCH+2
  2124. mov WORD PTR VFLI.cpMac_OFF,ax
  2125. mov WORD PTR VFLI.cpMac_SEG,dx
  2126. ; Line 900
  2127. mov ax,ifi.xp
  2128. mov WORD PTR VFLI.xpReal_Fli,ax
  2129. ; Line 901
  2130. mov ax,ifi.ich_Ifi
  2131. mov WORD PTR VFLI.ichMac,ax
  2132. ; Line 902
  2133. mov ax,ifi.dypLineSize
  2134. mov WORD PTR VFLI.dypLine,ax
  2135. ; Line 904
  2136. mov ax,dypDescentMac
  2137. mov WORD PTR VFLI.dypBase,ax
  2138. add ax,dypAscentMac
  2139. mov WORD PTR VFLI.dypFont,ax
  2140. ; Line 906
  2141. cmp rsi_ch,45
  2142. je $L20024
  2143. cmp rsi_ch,31
  2144. jne $I972
  2145. $L20024:
  2146. ; Line 908
  2147. mov ax,ifi.cchSpace
  2148. mov ifi.cBreak_Ifi,ax
  2149. ; Line 909
  2150. mov ax,ifi.ich_Ifi
  2151. mov WORD PTR VFLI.ichReal,ax
  2152. ; Line 910
  2153. mov ax,ifi.xp
  2154. mov ifi.xpReal_Ifi,ax
  2155. mov WORD PTR VFLI.xpReal_Fli,ax
  2156. ; Line 912
  2157. jmp $GetCh
  2158. $I972:
  2159. ; Line 914
  2160. cmp ifi.fPrevSpace,0
  2161. jne $I974
  2162. ; Line 916
  2163. mov ax,ifi.cchSpace
  2164. mov ifi.cBreak_Ifi,ax
  2165. ; Line 917
  2166. mov ax,ifi.ich_Ifi
  2167. dec ax
  2168. mov WORD PTR VFLI.ichReal,ax
  2169. ; Line 918
  2170. mov ax,ifi.xp
  2171. mov WORD PTR VFLI.xpReal_Fli,ax
  2172. sub ax,dxp
  2173. mov ifi.xpReal_Ifi,ax
  2174. ; Line 920
  2175. ;chT EQU bp-108
  2176. ;dxpNew EQU bp-110
  2177. $I974:
  2178. cmp rsi_ch,10
  2179. je $L20025
  2180. cmp rsi_ch,11
  2181. jne $I975
  2182. $L20025:
  2183. ; Line 943
  2184. mov chT2,c_chSpace
  2185. ; Line 946
  2186. push chT2
  2187. push fFlmPrinting
  2188. call FAR PTR DxpFromCh
  2189. ; *** ax will contain dxpNew at this point ****
  2190. ; Line 948
  2191. mov bx,ifi.ich_Ifi
  2192. mov dl,BYTE PTR (chT2)
  2193. mov BYTE PTR VFLI.rgch[bx-1],dl
  2194. ; Line 950
  2195. shl bx,1
  2196. ;** difference was -1 in c - shifted to get -2
  2197. mov WORD PTR VFLI.rgdxp[bx-2],ax ; ax has dxpNew
  2198. cmp ifi.fPrevSpace,0 ; only reset vfli.xp/ich real if not prev sp
  2199. jne $TestEol
  2200. sub ax,dxp
  2201. add WORD PTR VFLI.xpReal_Fli,ax
  2202. ; Line 956
  2203. mov ax,ifi.ich_Ifi
  2204. dec ax
  2205. mov WORD PTR VFLI.ichReal,ax
  2206. ; Line 961
  2207. $TestEol:
  2208. cmp rsi_ch,10
  2209. je $+5
  2210. jmp $JustBreak
  2211. ; Line 963
  2212. $JustEol:
  2213. ; Line 964
  2214. cmp fFlmPrinting,0
  2215. je $I979
  2216. ; Line 966
  2217. mov ax,WORD PTR VFLI.ichReal
  2218. mov WORD PTR VFLI.ichMac,ax
  2219. ; Line 972
  2220. $I979:
  2221. cmp ifi._jc,c_jcTabLeft
  2222. je $+5
  2223. jmp $L20051
  2224. ; Line 980
  2225. mov bx,ppap
  2226. mov al,BYTE PTR [bx].jc_Pap
  2227. and ax,3 ; pick up low 2 bits in ax
  2228. mov ifi._jc,ax
  2229. cmp ax,3
  2230. je $I996
  2231. jmp SHORT $L20050
  2232. $I975:
  2233. inc ifi.cchSpace
  2234. ; Line 995
  2235. mov ifi.fPrevSpace,1
  2236. ; Line 1093
  2237. jmp $GetCh
  2238. $I987:
  2239. mov ax,ifi.ichFetch
  2240. add ax,cchUsed
  2241. cwd
  2242. add ax,WORD PTR VCPFETCH
  2243. adc dx,WORD PTR VCPFETCH+2
  2244. sub ax,1
  2245. sbb dx,0
  2246. mov WORD PTR VFLI.cpMac_OFF,ax
  2247. mov WORD PTR VFLI.cpMac_SEG,dx
  2248. ; Line 1016
  2249. mov ax,ifi.ich_Ifi
  2250. dec ax
  2251. mov WORD PTR VFLI.ichMac,ax
  2252. mov WORD PTR VFLI.ichReal,ax
  2253. ; Line 1017
  2254. mov ax,ifi.dypLineSize
  2255. mov WORD PTR VFLI.dypLine,ax
  2256. ; Line 1019
  2257. mov ax,dypDescentMac
  2258. mov WORD PTR VFLI.dypBase,ax
  2259. add ax,dypAscentMac
  2260. mov WORD PTR VFLI.dypFont,ax
  2261. ; Line 1020
  2262. mov WORD PTR VFLI.dcpDepend,1
  2263. ; Line 1021
  2264. mov ax,ifi.xp
  2265. sub ax,dxp
  2266. mov ifi.xpReal_Ifi,ax
  2267. mov WORD PTR VFLI.xpReal_Fli,ax
  2268. $I994:
  2269. mov bx,ppap
  2270. mov al,BYTE PTR [bx].jc_Pap
  2271. and ax,3
  2272. mov ifi._jc,ax
  2273. $L20050:
  2274. or ax,ax
  2275. je $I996
  2276. ; Line 1065
  2277. lea ax,ifi
  2278. push ax
  2279. push ifi.xpRight_Ifi
  2280. $L20046:
  2281. push flm
  2282. call Justify
  2283. ; Line 1067
  2284. $I996:
  2285. mov ax,ifi.xpRight_Ifi
  2286. $L20043:
  2287. mov WORD PTR VFLI.xpRight,ax
  2288. ; Line 1068
  2289. $EndFormat:
  2290. ; Line 1069
  2291. mov ax,ifi.ichLeft
  2292. mov WORD PTR VFLI.ichLastTab,ax
  2293. jmp SHORT $ScribRet ; Scribble and return
  2294. $L20028:
  2295. cmp ax,13
  2296. jne $+5
  2297. jmp $SC938
  2298. cmp ax,31
  2299. jne $+5
  2300. jmp $SC939
  2301. cmp ax,45
  2302. jne $+5
  2303. jmp $SC968
  2304. jmp $DefaultCh
  2305. $ScribRet:
  2306. IFDEF DEBUG
  2307. IFDEF SCRIBBLE
  2308. mov ax,5
  2309. push ax
  2310. mov ax,c_chSpace
  2311. push ax
  2312. call FAR PTR FNSCRIBBLE
  2313. ENDIF
  2314. ENDIF
  2315. ; Line 1096
  2316. $RetFormat:
  2317. cEnd FormatLine
  2318. subttl Justify()
  2319. page
  2320. ; ***
  2321. ; Function Justify
  2322. ;
  2323. ; near Justify(pifi, xpTab, flm)
  2324. ; struct IFI *pifi;
  2325. ; unsigned xpTab;
  2326. ; int flm;
  2327. ;
  2328. ; ***
  2329. ; Line 1101
  2330. cProc Justify,<PUBLIC,NEAR>,<di,si>
  2331. parmDP pifi
  2332. parmW xpTab
  2333. parmW flm
  2334. LocalW cWideSpaces
  2335. LocalW cxpQuotient
  2336. ; *********** Register variables ********************
  2337. rbx_pifi EQU bx
  2338. rdx_dxp EQU dx
  2339. ; ****************************************************
  2340. cBegin Justify
  2341. ; Line 1109
  2342. mov rbx_pifi,pifi
  2343. ; Line 1110
  2344. mov ax,[rbx_pifi]._jc
  2345. cmp ax,c_jcBoth
  2346. je $JcBothCase
  2347. cmp ax,c_jcCenter
  2348. je $JcCenterCase
  2349. cmp ax,c_jcRight
  2350. je $JcRightCase
  2351. cmp ax,c_jcTabDecimal
  2352. jne $JustCaseBrk
  2353. ; Line 1130
  2354. JcTabDecCase:
  2355. ; *********** Register variables ********************
  2356. rsi_ichT EQU si
  2357. ; ****************************************************
  2358. mov rdx_dxp,xpTab
  2359. sub rdx_dxp,[rbx_pifi].xpLeft_Ifi
  2360. ; Line 1132
  2361. mov rsi_ichT,[rbx_pifi].ichLeft
  2362. inc rsi_ichT
  2363. $TabDecFor:
  2364. cmp rsi_ichT,WORD PTR VFLI.ichReal
  2365. jge $JustCaseBrk
  2366. mov al,VCHDECIMAL
  2367. cmp BYTE PTR VFLI.rgch[rsi_ichT],al
  2368. je $JustCaseBrk
  2369. ; Line 1134
  2370. shl rsi_ichT,1
  2371. sub rdx_dxp,WORD PTR VFLI.rgdxp[rsi_ichT]
  2372. shr rsi_ichT,1
  2373. ; Line 1135
  2374. inc rsi_ichT
  2375. jmp SHORT $TabDecFor
  2376. $JcCenterCase:
  2377. ; Line 1139
  2378. mov rdx_dxp,xpTab
  2379. sub rdx_dxp,[rbx_pifi].xpReal_Ifi
  2380. or rdx_dxp,rdx_dxp
  2381. jg $+5
  2382. jmp $JustifyRet
  2383. ; **** EXIT POINT *****************************
  2384. ; Line 1141
  2385. sar rdx_dxp,1
  2386. ; Line 1144
  2387. $JustCaseBrk:
  2388. ; Line 1212
  2389. cmp rdx_dxp,0
  2390. jle $+5
  2391. jmp $JustCleanup
  2392. ; Line 1215
  2393. jmp $JustifyRet
  2394. ; **** EXIT POINT *****************************
  2395. $JcRightCase:
  2396. ; Line 1147
  2397. mov rdx_dxp,xpTab
  2398. sub rdx_dxp,[rbx_pifi].xpReal_Ifi
  2399. ; Line 1148
  2400. jmp SHORT $JustCaseBrk
  2401. $JcBothCase:
  2402. ; *********** Register variables ********************
  2403. rdi_pch EQU di
  2404. rsi_pdxp EQU si
  2405. ; ***************************************************
  2406. ; **** NOTE: the only way out of this section of code
  2407. ; **** is through a RETURN of function Justify
  2408. ; Line 1151
  2409. cmp WORD PTR [rbx_pifi].cBreak_Ifi,0
  2410. jne $+5
  2411. jmp $JustifyRet
  2412. ; **** EXIT POINT *****************************
  2413. ; Line 1154
  2414. mov rdx_dxp,xpTab
  2415. sub rdx_dxp,[rbx_pifi].xpReal_Ifi
  2416. or rdx_dxp,rdx_dxp
  2417. jg $+5
  2418. jmp $JustifyRet
  2419. ; **** EXIT POINT *****************************
  2420. ; Line 1160
  2421. add [rbx_pifi].xp,rdx_dxp
  2422. ; Line 1164
  2423. add WORD PTR VFLI.xpReal_Fli,rdx_dxp
  2424. ; Line 1165
  2425. ; Line 1176
  2426. ; register CHAR *pch = &vfli.rgch[vfli.ichReal]
  2427. ; register int *pdxp = &vfli.rgdxp[vfli.ichReal]
  2428. mov rdi_pch,WORD PTR VFLI.ichReal
  2429. mov rsi_pdxp,rdi_pch
  2430. add rdi_pch,OFFSET VFLI.rgch
  2431. shl rsi_pdxp,1
  2432. add rsi_pdxp,OFFSET VFLI.rgdxp
  2433. ; ************ dx /(dxp) will be wiped out and restored here !!!!!!!!!!!!!!!
  2434. push dx ; save for use as dxpT
  2435. mov ax,dx ; ** set up division
  2436. cwd
  2437. mov cx,[rbx_pifi].cBreak_Ifi
  2438. idiv cx
  2439. mov WORD PTR VFLI.dxpExtra,ax
  2440. ; ** at this point:
  2441. ; ** ax = quotient, dx = remainder, cx = cbreak
  2442. inc ax
  2443. ; *********** Register variables ********************
  2444. rdx_dxpT EQU dx
  2445. ; ***************************************************
  2446. mov cxpQuotient,ax
  2447. mov cWideSpaces,dx
  2448. pop dx ; restore for use as dxpT
  2449. ; Line 1183
  2450. mov BYTE PTR VFLI.fAdjSpace,c_True
  2451. ; Line 1185
  2452. ; ***** NOTE: the only way out of this loop is via a RETURN out of
  2453. ; ***** function Justify
  2454. ; * the immediately following loop accomplishes about the same thing as
  2455. ; ** Loop:
  2456. ; dec rdi_pch
  2457. ; sub rsi_pdxp,2
  2458. ; cmp BYTE PTR [rdi_pch],c_chSpace
  2459. ; jne Loop
  2460. ; * it should be faster for strings of > 2 characters.
  2461. dec rdi_pch ; since predecrement to start pch correctly
  2462. mov ax,ds
  2463. mov es,ax ; set up for string instruction
  2464. std ; use reverse direction for decrementing di
  2465. $JstForLoop:
  2466. mov cx,-1 ; counter set up 1 below (trick)
  2467. mov al,c_chSpace ; comparison value
  2468. repnz scasb ; dec di while not = space
  2469. inc cx ; restore from original -1
  2470. shl cx,1 ; si is a word ptr - double offset
  2471. add rsi_pdxp,cx
  2472. ; at this point, pch points 1 below
  2473. ; the character containing the space,
  2474. ; pdxp points to the entry for the space char
  2475. ; Line 1192
  2476. mov ax,cWideSpaces
  2477. dec cWideSpaces
  2478. or ax,ax
  2479. jne $I1032
  2480. ; Line 1194
  2481. dec cxpQuotient
  2482. ; Line 1195
  2483. push rsi_pdxp ; find first nonzero ich after pch
  2484. cld
  2485. $FindIch1:
  2486. inc rsi_pdxp
  2487. inc rsi_pdxp
  2488. cmp WORD PTR [rsi_pdxp],0
  2489. je $FindIch1
  2490. mov ax,rsi_pdxp
  2491. sub ax,OFFSET VFLI + rgdxp
  2492. shr ax,1
  2493. std
  2494. pop rsi_pdxp
  2495. mov BYTE PTR VFLI.ichFirstWide,al
  2496. ; Line 1197
  2497. $I1032:
  2498. mov ax,cxpQuotient
  2499. add [rsi_pdxp],ax
  2500. ; Line 1198
  2501. sub rdx_dxpT,ax
  2502. cmp rdx_dxpT,0
  2503. jg $I1033
  2504. ; Line 1200
  2505. cmp WORD PTR [rbx_pifi].cBreak_Ifi,1
  2506. jle $JustifyRet
  2507. ; **** EXIT POINT *****************************
  2508. ; Line 1202
  2509. push rsi_pdxp ; find first nonzero ich after pch
  2510. cld
  2511. $FindIch2:
  2512. inc rsi_pdxp
  2513. inc rsi_pdxp
  2514. cmp WORD PTR [rsi_pdxp],0
  2515. je $FindIch2
  2516. mov ax,rsi_pdxp
  2517. sub ax,OFFSET VFLI + rgdxp
  2518. shr ax,1
  2519. pop rsi_pdxp
  2520. mov BYTE PTR VFLI.ichFirstWide,al
  2521. ; Line 1204
  2522. jmp SHORT $JustifyRet
  2523. ; **** EXIT POINT *****************************
  2524. $I1033:
  2525. dec WORD PTR [rbx_pifi].cBreak_Ifi
  2526. ; Line 1208
  2527. jmp SHORT $JstForLoop ; *** end of for loop **********
  2528. ; *********** Register variables ********************
  2529. rbx_pifi EQU bx
  2530. rdx_dxp EQU dx
  2531. ; ****************************************************
  2532. $JustCleanup:
  2533. add [rbx_pifi],rdx_dxp
  2534. mov ax,rdx_dxp
  2535. ; Line 1220
  2536. test flm,1 ;* if (flm & flmPrinting)
  2537. jne $L20052
  2538. ; Line 1228
  2539. push rdx_dxp ; save - wiped out by multiply
  2540. push rdx_dxp
  2541. mov ax,c_czaInch
  2542. push ax
  2543. push DXPLOGINCH
  2544. call FAR PTR MULTDIV
  2545. push ax
  2546. push DXPPRPAGE
  2547. push DXAPRPAGE
  2548. call FAR PTR MULTDIV
  2549. mov rbx_pifi,pifi ; restore in case multdiv wipes out bx
  2550. pop rdx_dxp ; restore - wiped out by multdiv
  2551. $L20052:
  2552. add [rbx_pifi].xpPr,ax
  2553. ; Line 1231
  2554. cmp WORD PTR [rbx_pifi].ichLeft,0
  2555. jge $I1038
  2556. ; Line 1234
  2557. add WORD PTR VFLI.xpLeft_Fli,rdx_dxp
  2558. ; Line 1236
  2559. jmp SHORT $I1039
  2560. $I1038:
  2561. ; Line 1239
  2562. mov bx,[rbx_pifi].ichLeft ; *** here, bx is no longer pifi ****
  2563. shl bx,1
  2564. add WORD PTR VFLI.rgdxp[bx],rdx_dxp
  2565. ; Line 1240
  2566. $I1039:
  2567. ; Line 1241
  2568. add WORD PTR VFLI.xpReal_Fli,rdx_dxp
  2569. ; Line 1242
  2570. $JustifyRet:
  2571. cld ; reset to be nice to later routines
  2572. cEnd Justify
  2573. ; Line 1247
  2574. subttl FGrowFormatHeap()
  2575. page
  2576. ; ***
  2577. ; Function FGrowFormatHeap
  2578. ;
  2579. ; int near FGrowFormatHeap()
  2580. ; /* Grow vhgchpFormat by 20% */
  2581. ;
  2582. ; ***
  2583. cProc FGrowFormatHeap,<PUBLIC,NEAR>
  2584. cBegin FGrowFormatHeap
  2585. ; *********** Register variables ********************
  2586. rsi_cchpIncr EQU si
  2587. ; ****************************************************
  2588. ; Line 1249
  2589. mov ax,ICHPMACFORMAT
  2590. cwd
  2591. mov cx,5
  2592. idiv cx
  2593. inc ax
  2594. mov rsi_cchpIncr,ax
  2595. ; Line 1255
  2596. push VHGCHPFORMAT
  2597. add ax,ICHPMACFORMAT
  2598. imul cx
  2599. push ax
  2600. xor ax,ax
  2601. push ax
  2602. call FAR PTR FCHNGSIZEH
  2603. or ax,ax
  2604. jne $I1043
  2605. ; Line 1260
  2606. xor ax,ax
  2607. jmp SHORT $EX1040
  2608. $I1043:
  2609. add ICHPMACFORMAT,rsi_cchpIncr
  2610. ; Line 1263
  2611. mov ax,1
  2612. $EX1040:
  2613. cEnd FGrowFormatHeap
  2614. ; Line 1269
  2615. subttl DxpFromCh()
  2616. page
  2617. ; ***
  2618. ; Function DxpFromCh
  2619. ;
  2620. ; int DxpFromCh(ch, fPrinter)
  2621. ; int ch;
  2622. ; int fPrinter;
  2623. ;
  2624. ; ***
  2625. cProc DxpFromCh,<PUBLIC,FAR>
  2626. parmW chIn
  2627. parmW fPrinter
  2628. LocalW dxpDummy
  2629. LocalW dxp
  2630. cBegin DxpFromCh
  2631. ; *********** Register variables ********************
  2632. rbx_pdxp EQU bx
  2633. ; ****************************************************
  2634. ; Line 1276
  2635. cmp chIn,c_chSpace
  2636. jg $L20029
  2637. cmp chIn,c_chNRHFile
  2638. jge $L20026
  2639. cmp chIn,c_chTab
  2640. jl $L2029A
  2641. cmp chIn,c_chReturn
  2642. jg $L2029A
  2643. $L20026:
  2644. cmp fPrinter,0
  2645. je $L20027
  2646. mov rbx_pdxp,OFFSET VFMIPRINT+2
  2647. jmp SHORT $I1050
  2648. $L20027:
  2649. mov rbx_pdxp,OFFSET VFMISCREEN+2
  2650. jmp SHORT $I1050
  2651. $L20029:
  2652. cmp chIn,256 ; prev 128 (chFmiMax) ..pault
  2653. ; We now make sure the whole character set width
  2654. ; table is queried initially via GetCharWidth()
  2655. jl $I1049
  2656. ; Line 1279
  2657. $L2029A:
  2658. lea rbx_pdxp,dxpDummy
  2659. ; Line 1280
  2660. mov WORD PTR [rbx_pdxp],dxpNil
  2661. ; Line 1282
  2662. jmp SHORT $I1050
  2663. $I1049:
  2664. ; Line 1285
  2665. cmp fPrinter,0
  2666. je $L20030
  2667. mov rbx_pdxp,WORD PTR VFMIPRINT
  2668. jmp SHORT $L20031
  2669. $L20030:
  2670. mov rbx_pdxp,WORD PTR VFMISCREEN
  2671. $L20031:
  2672. mov ax,chIn
  2673. shl ax,1
  2674. add rbx_pdxp,ax
  2675. ; Line 1286
  2676. $I1050:
  2677. ; Line 1288
  2678. cmp WORD PTR [rbx_pdxp],dxpNil
  2679. jne $I1051
  2680. ; Line 1295
  2681. push bx ; save pdxp
  2682. cmp fPrinter,0
  2683. je $L20032
  2684. push VHDCPRINTER
  2685. lea ax,chIn
  2686. push ss
  2687. push ax
  2688. mov ax,1
  2689. push ax
  2690. call FAR PTR GETTEXTEXTENT
  2691. sub ax,WORD PTR VFMIPRINT+4
  2692. jmp SHORT $L20033
  2693. $L20032:
  2694. push VHMDC
  2695. lea ax,chIn
  2696. push ss
  2697. push ax
  2698. mov ax,1
  2699. push ax
  2700. call FAR PTR GETTEXTEXTENT
  2701. sub ax,WORD PTR VFMISCREEN+4
  2702. $L20033:
  2703. pop bx ; restore pdxp
  2704. ; Line 1297
  2705. ;or ax,ax ; ax == dxp
  2706. ;jl $I1053
  2707. ;cmp ax,dxpNil
  2708. ;jge $I1053
  2709. ; Line 1300
  2710. mov [rbx_pdxp],ax
  2711. ; Line 1303
  2712. $I1053:
  2713. jmp SHORT $DxpRet
  2714. $I1051:
  2715. mov ax,WORD PTR [rbx_pdxp]
  2716. $DxpRet:
  2717. cEnd DxpFromCh
  2718. subttl FFirstIch()
  2719. page
  2720. ; Line 1312
  2721. ; ***
  2722. ; Function FFirstIch
  2723. ;
  2724. ; int near FFirstIch(ich)
  2725. ; int ich;
  2726. ; {
  2727. ; /* Returns true iff ich is 0 or preceded only by 0 width characters */
  2728. ;
  2729. ; REGISTER USAGE ******************************
  2730. ; uses and restores: di
  2731. ; uses and destroys: ax, cx, es
  2732. ; ax = temp, return
  2733. ; cx = ich
  2734. ; di = pdxp
  2735. ;
  2736. ; Note: this implements, in a different manner, the c code:
  2737. ;
  2738. ; for (ichT = 0; ichT < ich; ichT++)
  2739. ; {
  2740. ; if (*pdxp++)
  2741. ; return false
  2742. ; }
  2743. ; return true;
  2744. ; ***
  2745. cProc FFirstIch,<PUBLIC,NEAR>,<di>
  2746. parmW ich
  2747. cBegin FFirstIch
  2748. ; *********** Register variables ********************
  2749. rdi_pdxp EQU di
  2750. rcx_ich EQU cx
  2751. ; ****************************************************
  2752. ; Line 1316
  2753. mov ax,ds ; set es=ds for string ops
  2754. mov es,ax
  2755. mov rdi_pdxp,OFFSET VFLI.rgdxp
  2756. mov rcx_ich,ich ; loop count in cx
  2757. cld
  2758. xor ax,ax ; this does 3 things:
  2759. ; - sets up the compare value for scasb
  2760. ; - sets a 0 (false) default return value
  2761. ; - sets the zero flag on. This will allow
  2762. ; a zero value of ich to correctly return
  2763. ; true. This instruction MUST immediately
  2764. ; precede the repz scasw instruction.
  2765. repz scasw ; test *pdxp = 0
  2766. jnz $FFRet ; non zero char found - return false
  2767. inc ax ; return TRUE if all 0 or ich = 0
  2768. $FFRet:
  2769. cEnd FFirstIch
  2770. subttl ValidateMemoryDC()
  2771. page
  2772. ; ValidateMemoryDC()
  2773. cProc ValidateMemoryDC,<PUBLIC,FAR>
  2774. cBegin ValidateMemoryDC
  2775. ; /* Attempt to assure that vhMDC and vhDCPrinter are valid. If we have not
  2776. ; already run out of memory, then vhDCPrinter is guaranteed, but vhMDC may
  2777. ; fail due to out of memory -- it is the callers responsibility to check for
  2778. ; vhMDC == NULL. */
  2779. ; /* If we are out of memory, then we shouldn't try to gobble it up by getting
  2780. ; DC's. */
  2781. cmp VFOUTOFMEMORY,0
  2782. jne $I862
  2783. cmp VHMDC,0
  2784. jne $I858
  2785. mov bx,PWWDCUR
  2786. push WORD PTR [bx+50]
  2787. call FAR PTR CREATECOMPATIBLEDC
  2788. mov VHMDC,ax
  2789. ; /* Callers are responsible for checking for vhMDC == NULL case */
  2790. or ax,ax
  2791. je $I858
  2792. ; /* Put the memory DC in transparent mode. */
  2793. push ax
  2794. mov ax,1
  2795. push ax
  2796. call FAR PTR SETBKMODE
  2797. ; /* If the display is a monochrome device, then set the text color for the
  2798. ; memory DC. Monochrome bitmaps will not be converted to the foreground and
  2799. ; background colors in this case, we must do the conversion. */
  2800. mov bx,PWWDCUR
  2801. push WORD PTR [bx+50]
  2802. mov ax,24
  2803. push ax
  2804. call FAR PTR GETDEVICECAPS
  2805. cmp ax,2
  2806. jne $I854
  2807. mov ax,1
  2808. jmp SHORT $I856
  2809. $I854:
  2810. xor ax,ax
  2811. $I856:
  2812. mov VFMONOCHROME,ax
  2813. or ax,ax
  2814. je $I858
  2815. push VHMDC
  2816. push WORD PTR RGBTEXT+2
  2817. push WORD PTR RGBTEXT
  2818. call FAR PTR SETTEXTCOLOR
  2819. $I858:
  2820. ; /* If the printer DC is NULL then we need to restablish it. */
  2821. cmp VHDCPRINTER,0
  2822. jne $I862
  2823. xor ax,ax
  2824. push ax
  2825. call FAR PTR GETPRINTERDC
  2826. $I862:
  2827. cEnd ValidateMemoryDC
  2828. sEnd FORM1_TEXT
  2829. END
  2830.