Classic Computer Magazine Archive COMPUTE! ISSUE 72 / MAY 1986 / PAGE 88

Custom Characters
For Atari SpeedScript

Charles Brannon, Program Edtor

Atari SpeedScript's large-sized character set with true descenders is designed for maximum readability. Since it is built into SpeedScript, though, it's difficult to change. Now, with the accompanying program, you can add your own custom font to SpeedScript-even special characters for foreign languages. To help you design your own sets, last month we published "Atari FontMaker," a versatile character editor written completely in machine language. This month's program automatically creates a new copy of SpeedScript with your custom set installed. It works on any Atari 400/800, XL, or XE computer with at least 24K RAM and a disk drive.


When you're writing, you probably don't think about the technical miracles that make word processing possible. The characters on the screen seem as fixed as those on paper, but they're actually displayed from a section of memory. If you can change this memory, you can change the shape, form, and order of the characters.
    Normally, the Atari's character set is permanently and unalterably stored in Read Only Memory (ROM). But you can tell the video chip to look elsewhere for the character patterns, so it's possible to substitute your own set. Atari SpeedScript uses just such a technique, coupled with a special Atari character mode, to display large, well-formed characters.
    One way to design your own characters is to sketch them on grid paper, convert the resulting binary patterns into numbers, and then substitute these numbers in the section of SpeedScript that modifies the character set.
    Fortunately, there's an easier way. You can use a character set editor (or font editor) to "draw" the desired characters with a joystick. The font editor converts the patterns into numbers for you and saves the new set on disk for later use. There are many font editors available for the Atari, but relatively few of them let you design characters for the unusual ANTIC 3 mode that SpeedScript uses. This mode displays a taller character grid so you can design characters with true descenders (the protruding tails on letters such as j and y).
    Last month's COMPUTE! introduced "Atari FontMaker," a fullfeatured font editor written completely in machine language. FontMaker lets you design custom fonts for all Atari character modes, including ANTIC mode 3. The FontMaker article included some instructions for creating SpeedScript ANTIC 3 characters, and also some tips for designing more readable characters. After designing a new character set with FontMaker, you can use Program 1, "SpeedScript Characterizer," to automatically create a new copy of SpeedScript with your custom font. The custom characters appear each time you load the modified copy of SpeedScript.

Making A SpeedScript Font
If you want to convert a normal character set for use with SpeedScript (perhaps one that you've designed with another font editor), start by loading the set into FontMaker. Press G to switch to the ANTIC 3 mode. (The G command cycles through the graphics modes, and the first mode after the default GRAPHICS 0 mode is ANTIC 3.) You'll recognize this mode because the normal characters appear split, with their lower portions shifted to the top of the character grid.
    Use FontMaker's roll up command (CTRL-cursor up) to move each character up by one line. Roll up automatically wraps the lowercase descenders. If you want to make two-line descenders such as those found in the SpeedScript font, roll the lowercase letters up by two notches, erasing the last line of any characters that intrude into the descender zone, such as the lowercase h. Then shift up (SHIFT-cursor up) all the uppercase characters by two lines, and add an extra line of definition to each character so they have the same baseline as the lowercase characters. As you work, refer to the "quick brown fox" sentence displayed by FontMaker to see how your characters match up. When you're done, save your new font on disk with the S (Save) command.
    One additional preparatory step is required if your copy of SpeedScript came from the May 1985 COMPUTE! DISK. A version of SpeedScript typed in and saved with MLX (or from the companion disk for the book SpeedScript: The Word Processor for Atari Computers) appears on disk as one continuous block and requires no special preparation. The COMPUTE! DISK version is stored in an alternative format-as a collection of linked segments. (For a discussion of the differences between these formats, see Bill Wilkinson's "Insight: Atari" column in the April 1986 issue.) This causes a problem because Program 1 expects to load SpeedScript as a continuous file.
    The solution is to use Program 2, a corrected version of the file unification program from the April "Insight" column, to convert the linked segment file into a continuous block file. If you're unsure about the origin of your copy of SpeedScript, it won't hurt to process it with the file unifier program anyway. If the file was already a continuous block, Program 2 just produces a duplicate copy. (One way to tell the difference: In DOS 2.0 format the desired continuous block version of SpeedScript is 67 blocks long, while the linked segment version requiring conversion is 66 blocks long.)
    Now you're ready to merge your redefined character set with SpeedScript. Type in and save the SpeedScript Characterizer (Program 1) below. After you run it, insert the disk containing your copy of SpeedScript (the unified copy produced by Program 2 if you have the COMPUTE! DISK version) and type in the filename you use for SpeedScript (AUTORUN.SYS, for example). Characterizer loads SpeedScript into a memory buffer.
    Next, insert the disk containing your character set and enter its filename. After this character set is loaded, insert the disk that will store the new copy of SpeedScript. Type in the filename you'd like to call it. (For safety's sake, be very careful not to replace your existing copy of SpeedScript. If you have to name SpeedScript as AUTORUN. SYS to run it with Atari DOS 2.0 or 2.5, use another disk or rename the original copy of SpeedScript something else before you try to use Program 1.)
    Finally, boot up the new SpeedScript and behold your custom character set. Try typing all the characters to make sure they are well-formed. If you made a mistake, you can always edit the character set and reinstall it.
    Keep in mind that SpeedScript uses the heart character to pad out the end of each line with spaces. If you don't want to see a screenful of hearts, make sure you've blanked out the heart character in your set. Also, SpeedScript normally uses the left arrow (cursor-left) for the return mark at the end of each paragraph, so you may want to change this to some personalized symbol. If you don't want to see return marks, blank out this character, or perhaps change it to a single tiny dot so you can easily delete what would otherwise be an invisible character.

Program 1: SpeedScript
Characterizer

For instructions on entering this listing, please
refer to "COMPUTE!'s Guide to Typing In Programs" in
this issue of COMPUTE!.


JK 10 OPEN #3,4,0,"K:"
LG 15 DIM CIO$(7):CIO$="hhh*
      LV":CIO$(4,4)=CHR$(170
      ):CIO$(7)=CHR$(228)
AL 100 DIM SF$(14),T$(40),SS
       $(10000),CS$(14)
CJ ll0 GRAPHICS 17:POKE 82,0
       :SETCOLOR 4,0,10:SETC
       OLOR 2,0,2:SETCOLOR 0
       ,3,4:SETCOLOR 1,5,14
LJ 120 ? #6;"{RVS}SPEEDSCRIPT 3.0{OFF}
       ":? #6;"{RVS}CHARACTERIZER{OFF}
       "
IK 130 POKE 87,0:? "{RVS}ENTER SP
       EEDSCRIPT{3 SPACES}FI
       LENAME:{OFF}"

AN 140 INPUT SF$:IF SF$="" T
       HEN RUN
FM 150 IF LEN(SF$)>2 THEN IF
        SF$(2,2)=":" OR SF$(
       3,3)=":" THEN 170
CP 160 T$=SF$:SF$="D:":SF$(3
       )=T$
EA 170 TRAP 180:OPEN #2,4,0,
       SF$:TRAP 40000:GOTO 1
       90
OE 180 ? "error trying to op
       en":? SF$:? "PRESS {RVS}RE
       TURN{OFF}":GET #3,A:RUN
IC 190 LET READ=1:X=32:SADR=
       ADR(SS$):MAXLEN=9999:
       GOSUB 970:SS$(TRUELEN
       )=CHR$(0):CLOSE #2
LC 200 ? CHR$ (125);"{RVS}ENTER NA
       ME OF{OFF}":? "{RVS}CHARACTER S
       ET,{OFF}"

KC 210 INPUT CS$:IF CS$="" T
       HEN 200
EP 220 IF LEN(CS$)>2 THEN IF
        CS$(2,2)=":" OR CS$(
       3,3)=":" THEN 240
CE 230 T$=CS$:CS$="D:":CS$(3
       )=T$
DH 240 TRAP 250:OPEN #2,4,0,
       CS$:TRAP 40000:GOTO 2
       60
NP 250 ? CHR$(125);"error tr
       ying to open":? CS$:?
        "PRESS {RVS}RETURN{OFF}":GET #
       3,A:CLOSE #2:GOTO 200
PF 260 LET READ=I:X=32:MAXLE
       N=1024:SADR=ADR(SS$)+
       262:GOSUB 970:CLOSE #
       2
PN 270 ? CHR$(125);
J6 280 ? "{RVS}ENTER NEW NAME{OFF}":?
       "{RVS}FOR SPEEDSCRIPT{OFF}."
LA 290 INPUT SF$:IF SF$="" T
       HEN 200
FG 300 IF LEN(SF$)>2 THEN IF
        SF$(2,2)=":" OR SF$(
       3,3)=":" THEN 320
CM 310 T$=SF$:SF$="D:":SF$(3
       )=T$
DG 320 TRAP 335:OPEN #2,8,0,
       SF$:TRAP 40000
GF 330 LET READ=0:X=32:MAXLE
       N=LEN(SS$):SADR=ADR(S
       S$):GOSUB 970:GOTO 34
       0
AL 335 IF PEEK(195)<>1 THEN
       ? CHR$(125);"{RVS}CAN'T WR
       ITE FILE{OFF}":CLOSE #2:GO
       TO 280
FP 340 POKE 82,2:GRAPHICS 0:
       ? "Good luck!"
GP 350 END
IN 899 GOTO 899
MB 970 REM {RVS}CIO Load/Sase Fil
       e#2 opened READ#0 fo
       r write, READ=1 for r
       ead{OFF}

AM 980 REM File#2,$20
EF 990 ICCOM=834:ICBADR=836:
       ICBLEN=840:ICSTAT=835
AL 1000 H=INT(SADR/256):L=SA
        DR-H*256:POKE ICBADR
        +X,L:POKE ICBADR+X+1
        ,H
FC 1010 H=INT(MAXLEN/256):L=
        MAXLEN-H*256:POKE IC
        BLEN+X,L:POKE ICBLEN
        +X+1,H
MD 1020 POKE ICCOM+X,11-4*RE
        AD:A=USR(ADR(CIO$),X
        )
BK 1025 TRUELEN=PEEK(ICBLEN+
        X)+256*PEEK(ICBLEN+X
        +1)+1
BG 1030 POKE 195,PEEK(ICSTAT
        ):RETURN


Program 2: File Unifier
Program by Bill Wilkinson
For instructions on entering this listing, please
refer to "COMPUTE!'s Guide to Typing In
Programs" in this issue of COMPUTE!.


EE 1000 REM ** BINARY FILE U
        NIFIER **
DF 1010 BUFSIZE=FRE(0)-300
AH 1020 DIM BUF$(BUFSIZE)
IF 1030 DIM FILEOLD$(40),FIL
        ENEW$(40)
FJ 1040 FILL=0
NO 1050 PRINT "I need two fi
        le names: An existin
        g"
EA 1060 PRINT "  object file
         and a new file whic
        h"
EE 1070 PRINT "  will get th
        e 'unified' object c
        ode."
FG 1080 PRINT
AA 1090 PRINT "Existing file
        ? ";
CL 1100 INPUT #6,FILEOLD$
NI 1110 PRINT "{5 SPACES}New
         file? ";
DI 1120 INPUT #6,FILENEW$
FG 1130 OPEN #1,4,0,FILEOLD$
NP 1140 GET #1,HDRI:GET #1,H
        DR2
PD 1150 IF HDR1=255 AND HDR2
        =255 THEN 1180
PF 1160 PRINT :PRINT "Existi
        ng file: invalid for
        mat"
KA 1170 END
GL 1180 OPEN #2,8,0,FILENEW$
BI 1190 PUT #2,HDR1:PUT #2,H
        DR2
IN 1200 GET #1,SEGLOW:GET #1
        ,SEGHIGH
BC 1205 REM ** Process a new
         origin
AE 1210 BUFPTR=0
OI 1220 BUF$=CHRS(0):BUF$(BU
        FSIZE)-CHR$(0)
GL 1230 BUF$(2)=BUF$:REM zap
         buffer
MF 1240 PUT #2,SEGLOW: PUT #2
        ,SEGHIGH
DE 1250 SEGSTART=SEGLOW+256*
        SEGHIGH
DI 1255 REM ** Process a seg
        ment
ID 1260 GET #1,ENDLOW:GET #1
        ,ENDHIGH
GP 1270 SEGLED-ENDLOW+256*EN
        DHIGH
HC 1280 SEGLEN=SEGLED-SEGSTA
        RT+1
HI 1290 FOR PTR=1 TO SEGLEN
JL 1300 GET #1,BYTE:BUFS(BUF
        PTR+PTR)=CHR$(BYTE)
PK 1310 NEXT PTR
ML 1320 TRAP 1490
JB 1330 GET#1,SEGLOW:GET #1
        ,SEGHIGH
PD 1340 TRAP 40000
KB 1350 IF SEGLOW=255 AND SE
        OHIGH=255 THEN GET #
        1,SEGLOW:GET #1,SEGH
        IGH
DG 1360 SEGSTART=SEGLOW+256*
        SEGHIGH
IO 1370 GAP=SEGSTART-SEGEND-
        1
HD 1380 IF GAP>FILL OR GAP<0
         THEN 1420
JM 1390 BUFPTR=BUFPTR+SEGLEN
        +GAP
DL 1400 IF BUFPTR+256>BUFSIZ
        E THEN 1420
M1 1410 GOTO 1260
BA 1420 GOSUB 1440
MF 1430 GOTO 1210
BF 1435 REM ** Dump buffer
LH 1440 PUT #2,ENDLOW: PUT #2
        ,ENDHIGH
0J 1450 FOR PTR=1 TO LEN(BUF
        $)
LF 1460 PUT #2,ASC(BUFS(PTR)
        )
AB 1470 NEXT PTR
KN 1480 RETURN
LA 1485 REM ** Error encount
        ered
EA 1490 IF PEEK(195)=136 THE
        N 1520
ML 1500 PRINT "Unexpected er
        ror, number ";PEEK(1
        95)
JO 1510 END
JA 1515 REM ** End of file
CM 1520 GOSUB 1440:REM write
         out buffer
KA 1530 END