home *** CD-ROM | disk | FTP | other *** search
-
-
- INCLUDE BDSYM.EQU
- ; INCLUDE EPSYM.EQU
- INCLUDE EPDATA
-
-
- ; FUNCTION UNDRLN
-
- ;/************************************************/
- ;/* Underline graphics characters by setting */
- ;/* bits under them */
- ;/************************************************/
- ; int uli, strtus, stopus;
-
- ;underline()
- ;{ /* int uli, strtus, stopus;*/
-
-
- underline::
-
- push b
-
- ; strtus = 0;
-
- lxi h,0
- shld strtus
- ; for (uli = 0; uli < outpoint;)
-
- lxi h,0
- shld uli
-
- ;BC = outpoint and DE = *attrbuf throughout routine
- lhld outpoint
- MOV B,H
- MOV C,L
-
- LHLD ATTRBUF
- XCHG
-
- i2e85:
- lhld uli
- CALL CMPBC
- JC i2e93a
- POP B
- RET
-
- ; { /* look for underlined char */
- ; while (uli < outpoint && !(attrbuf[uli] & UNDRLN))
-
- i2e93:
- ;(HL = uli when loop)
- ; lhld uli
- CALL CMPBC
- jnc i2f02
- i2e93a:
- LDAX D
- ANI 40H
- jnz i2f02
-
- ; { if (outbuf[uli] == SOFTHY) uli++;
-
- PUSH D
-
- LHLD OUTBUF
- XCHG
-
- lhld uli
- dad d
- MOV A,M
- cpi 1EH
- JZ i2eff
-
- ; else strtus += widbuf[uli++];
- ; }
-
- LHLD WIDBUF
- XCHG
-
- lhld uli
- dad h
- dad d
-
- MOV E,M
- INX H
- MOV D,M
-
- LHLD STRTUS
- dad d
- shld strtus
- i2eff:
- POP D
- lhld uli
- inx h
- shld uli
- INX D
- INX D
- jmp i2e93
-
-
- ; stopus = strtus;
-
- i2f02: lhld strtus
- shld stopus
-
- ; /* look for non-underlined char */
- ; while (uli < outpoint && (attrbuf[uli] & UNDRLN))
-
- lhld uli
- i2f08:
- ;(HL = uli on loop)
- CALL CMPBC
- jnc i2f77
-
- ; dad h
- ; dad d
- ; mov a,m
- LDAX D
- ANI 40H
- jz i2f77
-
- ; { if (outbuf[uli] == SOFTHY) uli++;
-
- PUSH D
- LHLD OUTBUF
- XCHG
-
- lhld uli
- dad d
- MOV A,M
- cpi 1EH
- JZ i2f74
-
- ; else stopus += widbuf[uli++];
- ; }
-
- i2f54:
-
- LHLD WIDBUF
- XCHG
-
- lhld uli
- dad h
- dad d
-
- MOV E,M
- INX H
- MOV D,M
-
- LHLD STOPUS
- dad d
- shld stopus
-
- i2f74:
- POP D
- lhld uli
- inx h
- shld uli
- INX D
- INX D
- jmp i2f08
-
- ; /* uscore(strtus, stopus); */
- ; uscore();
-
- i2f77:
- PUSH D
- call uscore
- POP D
- ; strtus = stopus;
- ; }
-
- lhld stopus
- shld strtus
- jmp i2e85
- ;}
-
- ;i2f83: pop b
- ; ret
-
-
-
- ;
- ;/************************************************/
- ;/* set bits under a span of underlined */
- ;/* characters */
- ;/************************************************/
- ; int usi, sus, eus, loffs, roffs;
- ;
- ;uscore()
- ; /* uscore(strtus, stopus) */
- ; /* int strtus, stopus; */
- ;{ /* int i, sus, eus, loffs, roffs; */
- ;
-
-
- uscore:
- push b
-
- LHLD STOPUS
- MOV B,H
- MOV C,L
-
- ; sus = strtus;
- lhld strtus
- shld sus
-
- ; while (sus < stopus)
- ; {
- i2f8c: lhld sus
- CALL CMPBC
- ; jnc i30a8
- JC i2f8ca
- POP B
- RET
- i2f8ca:
- ; /* look for white */
- ; while (sus < stopus && (gbuf[sus] & 1)) sus++;
-
- PUSH H
- LXI D,GBUF
- DAD D
- XCHG
- POP H
- ;keep sus in HL and gbuf[sus] in DE for following loop
-
- i2f9a:
- CALL CMPBC
- jnc i2fca
-
- LDAX D
- ANI 1
- jz i2fca
-
- INX D
- inx h
- jmp i2f9a
-
- ; eus = sus;
- i2fca:
- SHLD SUS ;result from previous loop
-
- ;eus kept in HL and gbuf[eus] in DE, for following loop
-
- ; /* look for black */
- ; while (eus < stopus && !(gbuf[eus] & 1)) eus++;
-
- i2fd0:
- CALL CMPBC
- jnc i3000
-
- LDAX D
- ANI 1
- jnz i3000
- INX D
- inx h
- jmp i2fd0
- ; /* 8 vs 6 is 2 dots more clearance on the left */
- ; loffs = (sus == strtus) ? 0 : 8;
-
- i3000:
- SHLD EUS ;computed in previous loop
-
- lhld sus
- XCHG
- lhld strtus
- call eqwel
- LXI H,8
- JNZ i3017
- lxi h,0
- i3017: shld loffs
-
- ; /* 4 is a guess at the right side-bearing */
- ; roffs = (eus == stopus) ? 4 : 6;
-
- lhld eus
- XCHG
- lhld stopus
- call eqwel
- LXI H,6
- jnz i3031
- lxi h,4
- i3031: shld roffs
-
- ; if (eus - sus - loffs - roffs > 3)
-
- LHLD SUS
- XCHG
- LHLD LOFFS
- DAD D
- XCHG
- LHLD ROFFS
- DAD D
- XCHG
- CALL CMD
- LHLD EUS
- DAD D
- MOV A,H
- ORA A
- JM I309Fa
- MOV A,L
- CPI 4
- jc i309fa
-
- ; for (usi = sus + loffs; usi < eus - roffs; usi++)
-
- PUSH B
- ;count of dots to set in BC (usi no longer used)
- MOV B,H
- MOV C,L
-
- lhld sus
- XCHG
- lhld loffs
- dad d
- LXI D,GBUF
- DAD D
- ;keep gbuf[usi] in HL
- i3067:
- DCX B
- MOV A,B
- ORA C
- JZ I309F
-
- ; gbuf[usi] |= 1;
-
- MOV A,M
- ORI 1
- MOV M,A
- INX H
- jmp i3067
-
- ; sus = eus;
- ; }
- i309f:
- POP B
- i309fa:
- lhld eus
- shld sus
- jmp i2f8c
- ;}
- ;
- ;
- ;i30a8: pop b
- ; ret
-
- CMPBC:
- MOV A,H
- CMP B
- RNZ
- MOV A,L
- CMP C
- RET
-
- ;underlin locals
- ; int uli, strtus, stopus;
- uli: dw 0
- strtus: dw 0
- stopus: dw 0
-
- ;uscore locals
- ; int usi, sus, eus, loffs, roffs;
- ;usi: dw 0
- sus: dw 0
- eus: dw 0
- loffs: dw 0
- roffs: dw 0
-
- END
-