[net.micro.amiga] SAIL font for use with AmigaDisplay

woods@glacier.ARPA (Don Woods) (03/28/86)

In a previous posting, I sent the source for a program that lets you
use the Amiga to emulate a "smart display" (well, a DataMedia 2500)
talking via the serial port.  That program uses a special font, which
I happen to need in order to see certain weird characters that the
Stanford system generates.  You don't really need this font to use
the AmigaDisplay program, but some people might find it interesting
anyway.  (It also is somewhat "cleaner" than the default CLI font;
all the characters have been redesigned to fit better within the
character box.)

This source produces the file fonts:SAIL/8.  You'll also have to
create fonts:SAIL.font.  See the ROM Kernel Manual for more info.

As with the AmigaDisplay source, this source happens to demonstrate
some potentially interesting techniques.  In particular, note the
section at the end where it gets around a limitation in the assembler
(to wit: no iteration feature) using recursion.

======================================================================

 INCLUDE "exec/types.i"
 INCLUDE "exec/nodes.i"
 INCLUDE "libraries/diskfont.i"

FIRSTCHAR SET $20
LASTCHAR  SET $9F
YSIZE     SET 8

   MOVEQ #0,D0  in case anybody tries to execute this file
   RTS

   DC.L 0
   DC.L 0
   DC.B NT_FONT
   DC.B 0
   DC.L fontName
   DC.W DFH_ID
   DC.W 1
   DC.L 0
fontName:
   DS.B  MAXFONTNAME
font:
   DC.L 0
   DC.L 0
   DC.B NT_FONT
   DC.B 0
   DC.L fontName
   DC.L 0
   DC.W fontEnd-font
   DC.W 8
   DC.B 0
   DC.B FPF_DESIGNED
   DC.W YSIZE
   DC.W 6
   DC.W 1
   DC.W 0
   DC.B FIRSTCHAR
   DC.B LASTCHAR
   DC.L fontData
   DC.W (fontLoc-fontData)/YSIZE
   DC.L fontLoc
   DC.L 0
   DC.L 0

fontData:
   DC.L $00306C6C,$10003818,$18600000,$00000003
   DC.L $78307878,$1CFC38FC,$78780000,$00000078
   DC.L $7C10FC3C,$F8FEFE3C,$C6FC0EE6,$F082C638
   DC.L $FC38FC7C,$FCC6C6C6,$C6CCFE78,$C0783000
   DC.L $3000E000,$1C003800,$E0300CE0,$70000000
   DC.L $00000000,$20000000,$0000001C,$30E076F0
   DC.L $CC300000,$00000000,$60FCC00E,$30700000
   DC.L $00000000,$C6FE0008,$00001004,$00000000
   DC.W $2000,0
*  extra word is required (undocumented restriction: modulo must be 0 mod 4)

   DC.L $00786C6C,$7EC66C18,$30306C30,$00000006
   DC.L $CC70CCCC,$3CC060CC,$CCCC0000,$0E00E0CC
   DC.L $C6386666,$6C666666,$C6300666,$60C6E66C
   DC.L $666C66C6,$B4C6C6C6,$6CCCC660,$60187820
   DC.L $30006000,$0C006C02,$60000060,$30000000
   DC.L $00000000,$60000000,$00000030,$3030DCD8
   DC.L $EC300038,$10003C7E,$3030C01B,$30C00078
   DC.L $3EF87CC6,$C606380C,$0008380C,$0EE0FEC6
   DC.W $3000,0

   DC.L $00786CFE,$D0CC6830,$60183830,$0000000C
   DC.L $DC300C0C,$6CF8C00C,$CCCC3018,$38FC380C
   DC.L $DE3866C0,$666060C0,$C630066C,$60EEF6C6
   DC.L $66C666E0,$30C66CC6,$38CC8C60,$3018FC60
   DC.L $18786C78,$6C78607C,$6C700C66,$30CCD878
   DC.L $DC7AEC7C,$F8CCCCC6,$C6CCFC30,$303000F0
   DC.L $DC30006C,$380060EC,$1830C018,$FCC06C0C
   DC.L $E00EC6C6,$FE066CFE,$000C6CFC,$3838006C
   DC.W $3800,0

   DC.L $0030006C,$7C187600,$6018FEFC,$00FC0018
   DC.L $FC303838,$CC0CF818,$787C3018,$E0000E18
   DC.L $D66C7CC0,$667878CE,$FE300678,$60FEDEC6
   DC.L $7CC67C38,$30C66CD6,$38781860,$181830FE
   DC.L $000C76CC,$DCCCF0CC,$76300C6C,$30EEECCC
   DC.L $66CC76C0,$60CCCCD6,$6CCC98E0,$301C00DF
   DC.L $CC30766C,$6CFCFC6C,$1C3EFF18,$307ED67C
   DC.L $C006C6C6,$C6FED62C,$00FEC630,$E00EFE38
   DC.W $3E00,0

   DC.L $003000FE,$1630DC00,$60183830,$00000030
   DC.L $EC30600C,$FE0CCC30,$CC0C0000,$38FC3830
   DC.L $DE7C66C0,$666060C6,$C630C66C,$62D6CEC6
   DC.L $60C66C0E,$30C638FE,$38303260,$0C183060
   DC.L $003C66C0,$CCFC6078,$66300C78,$30D6CCCC
   DC.L $66CC6678,$60CCCCD6,$38CC3030,$303000F8
   DC.L $18FCDC7E,$C60C606C,$3C1B1818,$301B6CCC
   DC.L $E00EC6C6,$7C06D668,$000C6CFC,$38380010
   DC.W $2000,0

   DC.L $0000006C,$FC66CC00,$30306C30,$18003060
   DC.L $CC30CCCC,$0CCCCC30,$CC183018,$0E00E000
   DC.L $C0C66666,$6C666066,$C630C666,$66C6C66C
   DC.L $606C66C6,$30C638EE,$6C306660,$06183020
   DC.L $00CC66CC,$CCC0607C,$66300C6C,$30C6CCCC
   DC.L $7C7C600C,$6CCC786C,$6C786430,$3030000E
   DC.L $1878DC66,$00003C66,$661E1E18,$001E00CC
   DC.L $3EF8C67C,$38066CFE,$000838C0,$0EE0FE00
   DC.W $FF00,0

   DC.L $0030006C,$10C67600,$18600000,$180030C0
   DC.L $78FCFC78,$1E787830,$78703018,$00000030
   DC.L $78C6FC3C,$F8FEF03E,$C6FC7CE6,$FEC6C638
   DC.L $F03CE67C,$787C10C6,$C678FE78,$03783000
   DC.L $00763C78,$7678F0C6,$E678CCE6,$78C6CC78
   DC.L $600CF0F8,$3876306C,$C630FC1C,$30E00003
   DC.L $1830767C,$00000000,$C61B18D8,$FC1B0078
   DC.L $00000000,$10FE3860,$00001080,$00000000
   DC.W $3C00,0

   DC.L $00000000,$00000000,$00000000,$30000000
   DC.L $00000000,$00000000,$00000030,$00000000
   DC.L $00000000,$00000000,$00000000,$00000000
   DC.L $00060000,$00000000,$00000000,$00000000
   DC.L $00000000,$0000007C,$00007800,$00000000
   DC.L $F00E0000,$00000000,$00E00000,$3000001E
   DC.L $1F0000E0,$00000000,$001E1870,$001B0000
   DC.L $00000000,$00000020,$FF000000,$FEFE0000
   DC.W $0000,0

* The macro below demonstrates how to implement a "while" loop using
* recursion.  The loop executes a maximum of about 5000 times.  (This
* could be increased by adding to the number of recursive calls in WHILE2,
* or by adding more calls to WHILE2 inside the toplevel macro WHILE.)
* The statement being repeated can be a macro call, but note that the
* overhead of the WHILE uses 8 levels of nesting, out of the max of 10.

WHILE MACRO    first arg is condition (>= 0), second is statement to repeat
   NOLIST  don't clutter listing with all this overhead stuff
NEST SET 2  number of levels of macro call (cannot exceed 10)
   WHILE2 \1,\2
   LIST
   ENDM

WHILE2 MACRO
   IFGE \1
   \2
   IFLT NEST-8  never nest deeper than 8, including toplevel call to WHILE
NEST SET NEST+1
   WHILE2 \1,\2
   WHILE2 \1,\2
   WHILE2 \1,\2
   WHILE2 \1,\2
NEST SET NEST-1
   ENDC  (if nest < 8)
   ENDC  (if condition >= 0)
   ENDM

CHAR SET FIRSTCHAR  which character comes next

LOCS MACRO
   DC.W (CHAR-FIRSTCHAR)*8,8  offset,width
CHAR SET CHAR+1
   ENDM

fontLoc:
   WHILE LASTCHAR+1-CHAR,LOCS

fontEnd:
   END