• Nie Znaleziono Wyników

THE CHARACTER FONT

W dokumencie AM95C60 (Stron 68-71)

STRING OPERATIONS

10.2 THE CHARACTER FONT

Any number of character fonts can be stored in the display memory and two character fonts can be used concurrently, providing the capability of accessing 8192 characters from a single String instruction. Each character font describes up to 4096 characters and each character can be as large as 63 pixels wide by 60 scan lines high.

A character font may be stored in any single-bit plane. This will result in the same pattern being replicated into all planes whose activity bits are set.

Alternatively, a font may be stored in all four planes allowing the pattern to vary from plane to plane.

This could be used, for example, to implement anti-aliased characters. The String instructions operate somewhat faster if the font is stored in all planes.

The font(s) must be stored in display memory (by the host) in the format shown in Figure 10-1. The entry for each character consists of an attribute word followed by a list of pattern words. The number of pattern words may vary from character to character within the same font. The Input Block instruction (by plane) with a Y dimension equal to 1 may be conveniently used to store fonts one character at a time.

10.2.1 The Attribute Word

The first word for each character is called the attribute word. Because the two-bit D field has a major influence on the interpretation of the rest of the fields, the attribute word will be described twice. The first description assumes the most significant bit of the D field is a 0 so that the String instruction orders characters horizontally in display memory. The second explanation will assume the most significant bit of the D field is a 1 so that the String instruction orders characters vertically in display memory.

10.2.1.1 Horizontally Ordered Characters The Figure 10-2 illustrates string operations when the first bit of the D field is a O.

The format of the attribute word is shown in Figure 10-3.

H is a 4-bit field that specifies the height (number of active scan lines) of the character. H is multiplied by the cell scale factor (either 2 or 4) so that the effective range is 2 through 60. If H is specified as zero, this is a nonprinting character and the S field becomes the ES/RD field that is explained in Section 10.5.

S is a 4-bit field that specifies the number of scan lines that are to be skipped above the character. S is multiplied by the cell scale factor (either 2 or 4) so that the effective range is 2 through 60.

D is a 2-bit field that controls the direction and sense of the H, Sand ICO fields. In this descrip-tion, the most significant bit of the D field is zero.

The least significant bit of the D field indicates whether characters are to be written from left-to-right in display memory (0=00) or from left-to-right-to-Ieft

X+16,Y X+(N·16),Y

~ · , J

~

CHARACT

X,Y ATIRIBUTE WORD PATIERNWORD PATIERNWORD PATIERNWORD

ER1 CHARACT

X,Y+1 ~

,:,

~

CHARACTER 4 X,Y+4094 CHARACTER 4 095

X,Y+4095 ~

ATIRIBUTE WORD

ATIRIBUTE WORD ATIRIBUTE WORD

H

s

CPPBEFORE S·CS

t

+

r

X X X XXXXX X X X

H·CS XXXXXXX

1

X X

X X

X X

X X

ICO

D=OO

,

·

·

,

, ·

, ,

Figure 10-1 Character Font

CPPAFTER CPPAFTER

tl.!.

S·CS

+

r

X X X XXXXX X X X

H·CS XXXXXXX

1

X X

X X

X X

X X

4 ICO

D=01

Figure 10-2 Horizontally Ordered Characters

CPPBEFORE

/

l.!

15 14 13 12 11 10 9 8 7 6 5 4 3 2 0

H

s I

0 D ICO

ES 0 RD

Figure 10-3 Format of the Attribute Word When D

= ox

1

07785A 10-1

07785A 10-2

07785A 10-3

in display memory (D=01). The D field has no influ- pattern down (for example for lower case letters).

ence on how individual characters appear in Then words are copied from the pattern portion of display memory; it affects only where they are the font. As many pattern words are copied from

written. the font as is necessary for one scan line (ICO

pixels). Pixels are discarded from the right of the ICO is a 6-bit field that is added to or subtracted last pattern word if ICO is not an integer multiple of from the X component of the Current Pen Position 16 (that is, pattern words do not span scan lines).

after each character has been copied from the font This process continues for H • cell scale scan lines.

area. If D=OO, ICO will be added after each Finally, CPP is added to or subtracted from the X character (so that characters are arranged from left- component of the CPP. The area in display to-right). If D=01, ICO will be subtracted (so that memory that is written is below and either to the left characters are arranged from right-to-Ieft). Figure or the right of CPP according to the low order bit of 10-4 shows the results of some combinations of S, the D field.

Hand ICO fields.

'10.2.1.2 Vertically Ordered Characters The character is copied from the font area in the

following manner. First, S cell scan lines are The Figure 10-5 illustrates string operations when skipped. This provides a means of moving the the first bit of the D field is a 1.

cpp

BEFORE

,

AFTERCPP

~ III

X X IX

IX

IX IX IX IX IXIXIX IX IX X

IXIX XIXX IX X IX X IX IXIX X

X IX X IX X XXX X X X

IX IX IX X IX X

X IX XX X IX X X X X

IX X IX IX IX XIX IXIX IXIX IX IXIXIX IX X I"

IX IX

LEITER SoCS HoCS ICO

S 0 10 8

P 4 10 7

A 4 6 8

I 2 8 4

07785A 10-4 N 4 6 7

Figure 10-4 Example Using 0

=

00 cpp

CPP AFTER

BEFORE .S·CS.~HoCS

.... ·• .. ·:~rCS • • HoCS

...

~ X X X XXXXXXX XXXXX X X X ICO X X X XXXXXXX XXXXX X X X ICO

I

X X

1

X X

X X X X

X X X X

X X X X

07785A 10-5

til

~ I

0=01 CPP

0= 11

cpp BEFORE

AFTER

Figure 10-5 Vertically Ordered Characters

The format of the attribute word is shown in Figure 10-6.

H is a 4-bit field that specifies the width (in pixels) of the character. H is multiplied by the cell scale factor (either 2 or 4) so that the effective range is 2 through 60. If H is specified as zero, this is a nonprinting character and the S field becomes the ES/RD field. This is explained in Section 10.5.

S is a 4-bit field that specifies the number of pixels that are skipped to the left of the character. S is multiplied by the cell scale factor (either 2 or 4) so that the effective range is 2 through 60.

D is a 2-bit field that controls the direction and sense of the H, Sand ICO fields. In this descrip-tion, the most significant bit of the D field is one.

The least significant bit of the D field indicates whether characters are to be written from top-to-bottom in display memory (D=1 0) orfrom top-to- bottom-to-top in display memory (D=11). The D field has no influence on how individual characters appear in display memory; it affects only where they are written.

ICO is a 6-bit field that is added to or subtracted from the Y component of the Current Pen Position after each character has been copied from the font area. If D=10, ICO will be added after each character (so that characters are arranged from top-to-bottom). If D=11, ICO will be subtracted (so that characters are arranged from bottom-to-top).

The character is copied from the font area in the process continues for ICO scan lines. Finally, ICO is added to or subtracted from the Y component of the CPP. The area in display memory that is written is to the right of and either above or below the CPP according to the low order bit of the D field.

10.3 ESTABLISHING THE CHARACTER FONT

W dokumencie AM95C60 (Stron 68-71)

Powiązane dokumenty