* Demo09.a  (SC for FontMaker)    Version 1.00   20.7.00    by Ken Shillito


*  This program makes Amiga Fonts from Ucode Glyphs
*  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


 IFND what
 INCLUDE 'exec/types.i'
 INCLUDE 'UCODE:Includes/ucode.i'
 INCLUDE 'UCODE:Includes/ucodeasms.i'
 ENDC

 INCLUDE 'exec/memory.i'
 INCLUDE 'dos/dosextens.i'
 INCLUDE 'intuition/intuition.i'
 INCLUDE 'intuition/icclass.i'
 INCLUDE 'libraries/locale.i'

 INCLUDE 'UCODE:Includes/lvos.i'       ;LVOs for system library calls
 INCLUDE 'UCODE:Includes/scrollers.i'  ;Structures for tll_stuff.i calls


*>>************************************************************************
*
*   Cold start up, call TLUjob, close down
*   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
***************************************************************************


Start:                     ;cold startup...

 moveq #0,d2               ;d2 = 0 if cli, else workbench startup

 move.l _AbsExecBase,a6
 sub.l a1,a1               ;for current task..
 jsr _LVOFindTask(a6)      ;.. find own Process structure
 move.l d0,a2              ;(A2) = our own Process structure
 tst.l pr_CLI(a2)          ;pr_CLI<>0 if from CLI
 bne.s .both               ;go if from CLI

 lea pr_MsgPort(a2),a0     ;wait for workbench startup message to arrive
 jsr _LVOWaitPort(a6)
 lea pr_MsgPort(a2),a0     ;get workbench startup message now it's here
 jsr _LVOGetMsg(a6)
 move.l d0,d2              ;d2 = startup message

.both:
 movem.l d2,-(a7)

 bsr TLUjob                ;do a ucode.library-type job

 move.l (a7)+,d2           ;go if was from cli
 beq.s .quit

 move.l _AbsExecBase,a6    ;reply to startup message
 jsr _LVOForbid(a6)
 move.l d2,a1
 jsr _LVOReplyMsg(a6)

.quit:
 rts



*>>************************************************************************
*
*   TLUjob - set up gui for ucode.library programs, call TLFontmaker
*   ~~~~~~
***************************************************************************


TLUjob:

; no input register values
; call from any process
;
; n.b. will use 'UCODE:catalogs/[pref language]/fontmaker.catalog'
;      if it exists
;
; returns D0 = 0 if bad, else D0 = -1


 STRUCTURE .soffs,0        ;stack offsets
 APTR .ubase               ;ucode.library base
 APTR .tbase               ;gadtools.library base
 APTR .gbase               ;graphic.library base
 APTR .ibase               ;intuition.library base
 APTR .dbase               ;dos.library base
 APTR .upath               ;ucode_path
 APTR .clone               ;clone of .upath
 APTR .scren               ;lock on default public screen
 APTR .wndow               ;window
 APTR .bakup               ;TLDMakeback rastport
 APTR .gcont               ;gadget context
 APTR .strig               ;strings loaded by TLLstart
 STRUCT .mesag,im_SIZEOF   ;space to copy IntuiMessage
 STRUCT .slis,xxp_ssz2     ;xxp_slis structure for .scren
 STRUCT .scro,xxp_scs2     ;xxp_scro structure for .wndow
 ULONG .ucod               ;unicode
 UWORD .size               ;nominal size  } attributes of currently-loaded
 UWORD .wdth               ;width         } ucode_group
 UWORD .styl               ;style         }
 UWORD .wght               ;weight        }
 LABEL .sszof

.offs:  EQU (((.sszof+3)/4)*4)  ;total stack offset, rounded up to longword


 moveq #0,d0
 movem.l d0-d7/a0-a6,-(a7) ;saves all except result in D0

; make and clear the stack offsets

 move.l a7,a1
 sub.w #.offs,a7
 move.l a7,a0
.stkz:
 clr.w (a0)+
 cmp.l a1,a0
 bcs .stkz

; open ucode.library

 move.l _AbsExecBase,a6

 IFND what                 ;here if assembling free-standing
 lea .uname,a1
 moveq #xxp_uver,d0
 jsr _LVOOpenLibrary(a6)
 move.l d0,.ubase(a7)
 beq .bad1
 ENDC

 IFD  what                 ;here if assembling in ucode.asm
 IFEQ what-3
 lea .uname,a1
 moveq #xxp_uver,d0
 jsr _LVOOpenLibrary(a6)
 move.l d0,.ubase(a7)
 beq .bad1
 ENDC
 IFEQ what-4               ;here if debugging - "open" ucode.library
 move.l #Endcode+24,.ubase(a7)
 ENDC
 ENDC

; open gadtools.library

 lea .gname,a1
 moveq #37,d0
 jsr _LVOOpenLibrary(a6)
 move.l d0,.tbase(a7)
 beq .bad2

; make ucode_path and its clone

 move.l .ubase(a7),a6      ;create ucode_path (default parameters)
 moveq #0,d0
 moveq #0,d1
 moveq #0,d2
 jsr _LVOTLUstart(a6)
 move.l d0,.upath(a7)
 beq .bad3                 ;quit if can't

 move.l d0,a0              ;use library bases in ucode_path
 move.l xxp_dosp(a0),.dbase(a7)
 move.l xxp_intp(a0),.ibase(a7)
 move.l xxp_gfxp(a0),.gbase(a7)

 jsr _LVOTLUclone(a6)      ;make clone
 move.l d0,.clone(a7)
 beq .bad3                 ;quit if can't (unlikely)

; pre-load Latin-1 glyphs to clone (to make faster)

 sub.w #12,a7
 move.l a7,a2
 move.l #$0021007E,(a2)+
 move.l #$00A100FF,(a2)+
 clr.w (a2)
 move.l d0,a0              ;a0 = clone
 moveq #11,d0              ;d0 = nominal height
 moveq #4,d1               ;d1 = width
 move.w #'SS',d2           ;d2 = style
 moveq #1,d3               ;d3 = weight
 moveq #xxp_bmake,d4       ;d4 = flags = ucode_block add list in a2
 move.l a7,a2              ;a2 = ucode_block add list
 jsr _LVOTLUset(a6)
 add.w #12,a7              ;discard ucode_block list after use

; get scroller information for screen

; If we want windows with scrollers, we must call the TLSlis
; subroutine for each screen to be used. In this case, only the
; default public screen is to be used.

 move.l .ibase(a7),a6      ;a6 = intuition.library base
 sub.l a0,a0
 jsr _LVOLockPubScreen(a6) ;set .scren = lock on default public screen
 move.l d0,.scren(a7)
 beq .bad4                 ;bad if no default public screen

 move.l d0,a0              ;a0 = screen
 lea .slis(a7),a3          ;a3 = memory for screen's xxp_slis structure
 bsr TLSlis
 beq .bad5                 ;bad if TLSlis fails

; get scroller information for window

; If we want a window with scrollers, we must have already called
; TLSlis for the screen it will inhabit. Now, we must call TLScro
; for each window to be opened

 move.l .tbase(a7),a5      ;a5 = gadtools.library base
 move.l .scren(a7),a0      ;a0 = screen  a6 already = intuition.library base
 lea .gcont(a7),a1         ;a1 = ds.l for gadget context
 move.l a3,a2              ;a2 = xxp_slis defined by TLSlis
 lea .scro(a7),a3          ;a3 = memory for window's xxp_scro structure
 bsr TLScro
 beq .bad6                 ;bad if TLScro fails

; load 'GlyphViewer.catalog'

 move.l .dbase(a7),a6      ;a6 = dos.library base
 move.l #.str1,d1
 moveq #ACCESS_READ,d2     ;set d0 = lock on 'Ucode:Catalogs'
 jsr _LVOLock(a6)
 move.l d0,d7
 beq.s .dflt               ;use dflt if can't

 move.l #.str2,d1          ;d1 points to 'GlyphViewer.catalog'
 move.l #.strs,d2          ;d2 = required number of strings
 bsr TLLstart              ;get strg from catalogs
 move.l d0,d2
 move.l d7,d1              ;unlock Ucode:catalogs
 jsr _LVOUnLock(a6)
 move.l d2,.strig(a7)      ;set strig with strings as loaded
 bne.s .bkup               ;go if ok

.dflt:                     ;if TLLstart failed, use .dfalt
 move.l #.dfalt,.strig(a7)

; set up TLDBackup

.bkup:
 move.l .gbase(a7),a6
 move.l #128,d0            ;bitplanes = 128 bytes
 moveq #8,d1               ;8 bitplanes
 bsr TLDMakeback
 move.l d0,.bakup(a7)
 beq .bad7                 ;bad if can't

; open window

 move.l .ibase(a7),a6      ;a6 = intuition.library base
 move.l .scren(a7),a0      ;a0 = screen
 lea .scro(a7),a1          ;a1 = xxp_scro for window
 move.l .strig(a7),a2      ;a2 = string 1 = window name
 addq.l #1,a2
 lea .flags,a3             ;a3 = flags,idcmp
 moveq #0,d0
 moveq #0,d1
 move.w #500,d2            ;init width = 500
 moveq #0,d3
 moveq #0,d4
 moveq #0,d5
 moveq #20,d6              ;posn 20,10
 moveq #10,d7
 bclr #31,d7               ;screen is public

 bsr TLSOpenWindow         ;set .wndow = window
 move.l d0,.wndow(a7)
 beq .bad8                 ;quit if can't open window

; call TLFontmaker to make the font

 move.l .strig(a7),d0      ;d0 = strings
 move.l .tbase(a7),d1      ;d1 = gadtools.library base
 move.l a7,d2
 add.l #.mesag,d2          ;d2 = copy of IntuiMessage
 move.l .wndow(a7),a0      ;a0 = window
 move.l .upath(a7),a1      ;a1 = ucode_path (with clone)
 move.l .bakup(a7),a2      ;a2 = rastport from TLDBackmake
 lea .scro(a7),a3          ;a3 = window's xxp_scro
 move.l .ubase(a7),a6      ;a6 = ucode.library base

 bsr TLFontmaker           ;show glyphs - interact with user

; set stack D0 = -1 and quit ok

.good:
 subq.l #1,.offs(a7)
 bra .clos

; here if startup fails

.bad1:                     ;bad1 - can't open ucode.library
 move.l #.err1,d7
 bra.s .bad

.bad2:                     ;bad2 - can't open gadtools.library
 move.l #.err2,d7
 bra.s .bad

.bad3:                     ;bad3 - can't make ucode_path
 move.l #.err3,d7
 bra.s .bad

.bad4:                     ;bad4 - can't lock default public screen
 move.l #.err4,d7
 bra.s .bad

.bad5:                     ;bad5 - TLSlis failed
 move.l #.err5,d7
 bra.s .bad

.bad6:                     ;bad6 - TLScro failed
 move.l #.err6,d7
 bra.s .bad

.bad7:                     ;bad7 - TLDMakeback failed
 move.l #.err7,d7

.bad8:                     ;bad8 - can't open window
 move.l #.err8,d7

; here if bad - try to report error into monitor / output stream

.bad:

; open any version of dos.library

 move.l _AbsExecBase,a6
 lea .dname,a1
 moveq #0,d0
 jsr _LVOOpenLibrary(a6)
 tst.l d0
 beq .clos                 ;quit if can't (unlikely)
 move.l d0,a5

; if cli, get output stream, of workbench, open monitor

 moveq #0,d6               ;d6 = 0 if from cli, -1 if from workbench
 sub.l a1,a1               ;for current task..
 jsr _LVOFindTask(a6)      ;.. find own Process structure
 move.l d0,a2              ;(A2) = our own Process structure
 tst.l pr_CLI(a2)          ;pr_CLI<>0 if from CLI
 bne.s .cli                ;go if from CLI
 moveq #-1,d6              ;else set d6 = -1

 move.l a5,a6
 move.l #.conn,d1          ;if from workbench, open monitor
 move.l #MODE_NEWFILE,d2
 jsr _LVOOpen(a6)
 move.l d0,d5
 beq .cdos                 ;go if can't
 bra.s .both               ;yes, pick up with cli to reort error

.cli:
 move.l a5,a6              ;if cli, get output stream handle
 jsr _LVOOutput(a6)
 move.l d0,d5

; send error report

.both:                     ;d5 = cli / monitor handle
 subq.l #4,a7
 move.l #$0C0A2020,(a7)    ;send 0C0A2020
 move.l d5,d1
 move.l a7,d2
 moveq #4,d3
 jsr _LVOWrite(a6)
 addq.l #4,a7

 move.l d7,a0              ;set d3 = error message length
 moveq #-1,d3
.errl:
 addq.l #1,d3
 tst.b (a0)+
 bne .errl
 move.l d5,d1              ;send the error message
 move.l d7,d2
 jsr _LVOWrite(a6)

 subq.l #4,a7              ;send 0A0A0A0A
 move.l #$0A0A0A0A,(a7)
 move.l d5,d1
 move.l a7,d2
 moveq #4,d3
 jsr _LVOWrite(a6)
 addq.l #4,a7

 lea .errz,a0              ;send 'click to acknowledge'
 move.l a0,d2
 moveq #-1,d3
.eroz:
 addq.l #1,d3
 tst.b (a0)+
 bne .eroz
 move.l d5,d1
 jsr _LVOWrite(a6)

; get click to acknowledge

 move.l d5,d1              ;d1 = handle if monitor
 tst.l d6
 bne.s .inpt

 jsr _LVOInput(a6)         ;else get input handle for cli to d1
 move.l d0,d1

.inpt:
 sub.w #100,a7             ;get input to acknowledge
 move.l a7,d2
 moveq #10,d3
 jsr _LVORead(a6)
 add.w #100,a7

; close monitor

.cmon:
 tst.l d6                  ;go if from cli
 beq.s .cdos
 move.l d5,d1              ;if from workbench, close monitor
 jsr _LVOClose(a6)

; close dos.library

.cdos:
 move.l a6,a1              ;close dos.library
 move.l _AbsExecBase,a6
 jsr _LVOCloseLibrary(a6)

; release TLUjob resources ready to close down

.clos:

 move.l .bakup(a7),d0      ;free TLDMakeback rastport if any
 bsr TLDFreeback

 move.l .wndow(a7),d0      ;close window if ever opened
 beq.s .cls2
 move.l .ibase(a7),a6
 move.l d0,a0
 bsr TLSCloseWindow

.cls2:                     ;free TLLstart data if any
 move.l .strig(a7),d0
 cmp.l #.dfalt,d0
 beq.s .cls3
 bsr TLLfinish

.cls3:                     ;free xxp_scro objects if any
 move.l .ibase(a7),d0
 beq.s .cls4
 move.l d0,a6
 move.l .tbase(a7),a5
 lea .scro(a7),a3
 bsr TLScrk

 lea .slis(a7),a3          ;free xxp_slis objects if any
 move.l .scren(a7),d0
 beq.s .cls4
 move.l d0,a0
 bsr TLSlik

 sub.l a0,a0               ;free default public screen, if ever locked
 move.l .scren(a7),a1
 jsr _LVOUnlockPubScreen(a6)

.cls4:                     ;release ucode_path, if ever created
 move.l .ubase(a7),a6
 move.l .upath(a7),d0
 beq.s .cls5
 move.l d0,a0
 jsr _LVOTLUfinish(a6)

.cls5:                     ;close gadtools.library, if ever opened
 move.l _AbsExecBase,a6
 move.l .tbase(a7),d0
 beq.s .cls6
 move.l d0,a1
 jsr _LVOCloseLibrary(a6)

.cls6:                     ;close ucode.library, if ever opened

 IFND what
 move.l _AbsExecBase,a6
 move.l .ubase(a7),d0
 beq.s .cls7
 move.l d0,a1
 jsr _LVOCloseLibrary(a6)
 ENDC

 IFND what
 IFEQ what-3
 move.l _AbsExecBase,a6
 move.l .ubase(a7),d0
 beq.s .cls7
 move.l d0,a1
 jsr _LVOCloseLibrary(a6)
 ENDC
 ENDC

.cls7:
 add.w #.offs,a7           ;discard stack offsets
 movem.l (a7)+,d0-d7/a0-a6
 rts                       ;D0 = 0 if bad


***   data for TLUjob   ***


; system data

.gname: dc.b 'gadtools.library',0
.uname: dc.b 'UCODE:ucode.library',0
.dname: dc.b 'dos.library',0
.conn: dc.b 'CON:20/10/500/100/Console',0
 dc.w 0


; error reports if failure setting up

.err1: dc.b 'Error: can''t open ucode.library',0
.err2: dc.b 'Error: can''t open gadtools.library',0
.err3: dc.b 'Error: can''t make ucode_path',0
.err4: dc.b 'Error: can''t lock default public screen',0
.err5: dc.b 'Error: can''t set up scroller objects for screen',0
.err6: dc.b 'Error: can''t set up scroller objects for window',0
.err7: dc.b 'Error: TLLMakeback failed - out of memory',0
.err8: dc.b 'Error: can''t open window (out of memory)',0
.errz: dc.b '(Press <return> to acknowledge)',$0A,0


; flags and idcmp         ;2 longwords required by TLSOpenwindow

.flags:

.flg0: EQU WFLG_SIZEGADGET!WFLG_DRAGBAR!WFLG_CLOSEGADGET!WFLG_DEPTHGADGET
.flg1: EQU WFLG_SMART_REFRESH!WFLG_ACTIVATE!WFLG_HASZOOM
 dc.l .flg0!.flg1

.idc0: EQU IDCMP_NEWSIZE!IDCMP_MOUSEBUTTONS!IDCMP_SIZEVERIFY
.idc1: EQU IDCMP_CLOSEWINDOW!IDCMP_RAWKEY!IDCMP_ACTIVEWINDOW
.idc2: EQU IDCMP_INACTIVEWINDOW!IDCMP_VANILLAKEY!IDCMP_IDCMPUPDATE
 dc.l .idc0!.idc1!.idc2


; catalog file data

.str1:  dc.b 'Ucode:Catalogs',0
.str2:  dc.b 'FontMaker.catalog',0

; default strings in case catalog won't load (string 1 = window number)

.dfalt: dc.b 0             ;default strings in case catalog won't load

 dc.b 'Ucode FontMaker - by Ken Shillito, by Ken Shillito',0 ;1

 dc.b 'Help',0 ;2
 dc.b 'Default',0 ;3
 dc.b 'Range',0 ;4
 dc.b 'Presets',0 ;5
 dc.b 'Font',0 ;6
 dc.b 'Preview',0 ;7
 dc.b 'Attributes',0 ;8
 dc.b 'About',0 ;9

 dc.b 'Click a preset, or press <Esc> to cancel...',0 ;10
 dc.b 'ISO8859-1   Latin-1  West European',0 ;11
 dc.b 'ISO8859-2   Latin-2  East European',0 ;12
 dc.b 'ISO8859-3   Latin-3  South European',0 ;13
 dc.b 'ISO8859-4   Latin-4  North European',0 ;14
 dc.b 'ISO8859-5   Cyrillic',0 ;14
 dc.b 'ISO8859-6   Arabic',0 ;16
 dc.b 'ISO8859-7   Greek',0 ;17
 dc.b 'ISO8859-8   Hebrew',0 ;18
 dc.b 'ISO8859-9   Latin-5  Turkish',0 ;19
 dc.b 'ISO8859-10  Latin-6  Nordish',0 ;20
 dc.b 'ISO8859-11  Thai',0 ;21
 dc.b '(unimplemented)',0 ;22
 dc.b 'ISO8859-13  Latin-7',0 ;23
 dc.b 'ISO8859-14  Latin-8',0 ;24
 dc.b 'ISO8859-15  Latin-9',0 ;25
 dc.b '(unimplemented)',0 ;26
 dc.b '(unimplememted)',0 ;27
 dc.b '(unimplemented)',0 ;28
 dc.b '(unimplemented)',0 ;29
 dc.b '(unimplemented)',0 ;30
 dc.b '(unimplemented)',0 ;31
 dc.b 'KOI-8  Russian',0 ;32
 dc.b 'ISCII-1  Devanagari',0 ;33
 dc.b 'ISCII-2  Bengali',0 ;34
 dc.b 'ISCII-3  Gurmukhi',0 ;35
 dc.b 'ISCII-4  Gujurati',0 ;36
 dc.b 'ISCII-5  Oriya',0 ;37
 dc.b 'ISCII-6  Tamil',0 ;38
 dc.b 'ISCII-7  Telugu',0 ;39
 dc.b 'ISCII-8  Kannada',0 ;40
 dc.b 'ISCII-9  Malayalam',0 ;41
 dc.b '(unimplemented)',0 ;42
 dc.b 'Spurious Microsoft 01-1F, 80-9F values',0 ;43
 dc.b 0 ;44
 dc.b 0 ;45
 dc.b 0 ;46
 dc.b 0 ;47
 dc.b 0 ;48
 dc.b 0 ;49
 dc.b 0 ;50

 dc.b 'Welcome to the Ucode FontMaker...',0 ;51
 dc.b 'You will see a set of 256 buttons, each holding a unicode value. '
 dc.b 'Any buttons with 0000 in them will cause a blank glyph to be '
 dc.b 'placed in the font. It is customary (but not compulsory) '
 dc.b 'to leave 00-20 and 7F-A0 blank.',0 ;52
 dc.b 0 ;53
 dc.b 'You can click any of the 256 buttons to edit it. If you are '
 dc.b 'editing a value, you can press 0-9 or A-F to type a digit, '
 dc.b 'or the left or right arrows to move the cursor.',0 ;54
 dc.b 0 ;55
 dc.b 'You can also press any of the 8 buttons near the top of the '
 dc.b 'window, as follows:',0 ;56
 dc.b 0 ;57
 dc.b 'Help - for the information you are looking at now',0 ;58
 dc.b 0 ;59
 dc.b 'Default - to set the 256 glyphs to their initial values',0 ;60
 dc.b 0 ;61
 dc.b 'Range - to set several boxes to consecutive unicode values',0 ;62
 dc.b 0 ;63
 dc.b 'Font - to start making a font',0 ;64
 dc.b 0 ;65
 dc.b 'Preview - to preview how the font will look',0 ;66
 dc.b 0 ;67
 dc.b 'Attributes - to change the size etc. of the glyphs',0 ;68
 dc.b 0 ;69
 dc.b 'About - info about the program',0 ;70
 dc.b 'Range - click the first button of the range',0 ;71
 dc.b '(or press <Esc> to cancel)',0 ;72
 dc.b 'Range - click the last button of the range',0 ;73
 dc.b 'Choosing glyph attributes - Step 1',0 ;74
 dc.b 'Choose a nominal glyph height',0 ;75
 dc.b 'The default glyph height is 11',0 ;76
 dc.b '(or press <Esc> to cancel)',0 ;77
 dc.b 'Choosing glyph attributes - Step 2',0 ;78
 dc.b 'Choose a glyph width descriptor',0 ;79
 dc.b 'The default width is &ldquo;NM  Normal&rdquo;',0 ;80
 dc.b '(or press <Esc> to cancel)',0 ;81
 dc.b 'UC  Ultra condensed',0 ;82
 dc.b 'EC  Extra condensed',0 ;83
 dc.b 'CD  Condensed',0 ;84
 dc.b 'SC  Semi condensed',0 ;85
 dc.b 'NM  Normal',0 ;86
 dc.b 'SE  Semi expanded',0 ;87
 dc.b 'EX  Expanded',0 ;88
 dc.b 'EE  Extra expanded',0 ;89
 dc.b 'UE  Ultra expanded',0 ;90
 dc.b 'Choosing glyph attributes - Step 3',0 ;91
 dc.b 'Choose a glyph weight',0 ;92
 dc.b 'The default weight is &ldquo;1  Lightest&rdquo;',0 ;93
 dc.b '(or press <Esc> to cancel)',0 ;94
 dc.b '1  Lightest',0 ;95
 dc.b '2',0 ;96
 dc.b '3',0 ;97
 dc.b '4  Normal',0 ;98
 dc.b '5',0 ;99
 dc.b '6',0 ;100
 dc.b '7  Bold',0 ;101
 dc.b '8',0 ;102
 dc.b '9  Heaviest',0 ;103
 dc.b 'Choosing glyph attributes - Step 4',0 ;104
 dc.b 'Choose a glyph style',0 ;105
 dc.b 'The default style is &ldquo;SS  Sans Serif&rdquo;',0 ;106
 dc.b '(or press <Esc> to cancel)',0 ;107
 dc.b 'SS  Sans Serif',0 ;108
 dc.b 'WS  With Serif',0 ;109
 dc.b 'CS  Cursive (Italic)',0 ;110
 dc.b 'FA  Fantasy',0 ;111
 dc.b 'TT  Teletype (fixed width)',0 ;112
 dc.b 'Choosing Glyph widths - instructions',0 ;113
 dc.b 0 ;114
 dc.b '(Click this window when ready)',0 ;115
 dc.b 0 ;116
 dc.b 'Choosing glyph widths is a four step process.',0 ;117
 dc.b 'First, you will be asked to specify a nominal glyph height. The actual '
 dc.b 'font height will be a little more, since a few extra lines are allowed '
 dc.b 'for diacritical marks such as acute and grave. For example, nominal '
 dc.b 'height 11 is actual height 14. ',0 ;118
 dc.b 0 ;119
 dc.b 'Second, choose a font width. Third, a font weight. Finally, a font '
 dc.b 'style.',0 ;120
 dc.b 0 ;121
 dc.b 'Basically, glyphs exist only in normal width, lightest weight, and '
 dc.b 'sans serif. If you specify a set of attributes for which the specified '
 dc.b 'unicode glyphs don&rsquo;t exist, Fontmaker will try to resize glyphs to '
 dc.b 'fit the attributes you require. The attributs that actually get set '
 dc.b 'may therefore not be the same as what you specify, but rather will be  '
 dc.b 'the best match that Fontmaker could find among the glyph files.',0 ;122
 dc.b 'Error: No glyphs match the chosen attributes',0 ;123
 dc.b '(Click to acknowledge)',0 ;124
 dc.b 'Preview of current glyph contents',0 ;125
 dc.b 'Blank glyphs are glyphless unicodes,',0 ;126
 dc.b 'or files with current attributes are incomplete',0 ;127
 dc.b '(Click the window when finished)',0 ;128
 dc.b 'The Ucode &#X21E8; Fontmaker &#X21E6;',0 ;129
 dc.b 0 ;130
 dc.b 'A program to make a set of Unicode values into an Amiga font.',0 ;131
 dc.b 0 ;132
 dc.b 'Version 1.00',0 ;133
 dc.b 'January 2002',0 ;134
 dc.b 0 ;135
 dc.b 'Written by Ken Shillito, of Corio, Victoria, Australia',0 ;136
 dc.b 'Email  shillito@tpg.com.au',0 ;137
 dc.b 'Web    www2.tpg.com.au/users/shillito',0 ;138
 dc.b '&#X27A9;  &#X27AA;  &#X27AB;  &#X27AC; &#X27AD;  '
 dc.b '&#X27AE;  &#X27AF;',0 ;139
 dc.b 'Specify the name of your font',0 ;140
 dc.b 'Type up to 25 Latin-1 characters',0 ;141
 dc.b 'Do not use spaces',0 ;142
 dc.b 'Do not append .font',0 ;143
 dc.b 'Click &ldquo;OK&rdquo; or &ldquo;Cancel&rdquo; when ready',0 ;144
 dc.b 'OK',0 ;145
 dc.b 'Cancel',0 ;146
 dc.b 'Error: filename of zero length',0 ;147
 dc.b 'Correct filename, and then click &ldquo;OK&rdquo; again',0 ;148
 dc.b 'I am about to create these files in FONTS:',0 ;149
 dc.b 'If the .font file already exists, it will be updated',0 ;150
 dc.b 'If the other file already exists, it will be over-written',0 ;151
 dc.b 'The font is complete....',0 ;152
 dc.b 'Here is a sample of text written in your new font',0 ;153
 dc.b 'Make another font',0 ;154
 dc.b 'Quit from Fontmaker',0 ;155
 dc.b 'ucode.library&rsquo;s TLUmakefont routine failed',0 ;156
 dc.b 'ucode.library said the reason for failure was',0 ;157
 dc.b 'Out of memory',0 ;158
 dc.b 'Bad filename',0 ;159
 dc.b 'Can&rsquo;t open FONTS:name/size for writing',0 ;160
 dc.b 'Can&rsquo;t write to FONTS:name/size',0 ;161
 dc.b 'Can&rsquo;t create dir FONT:name',0 ;162
 dc.b 'Can&rsquo;t open diskfont.library',0 ;163
 dc.b 'NewFontContents failed',0 ;164
 dc.b 'Can&rsquo;t open FONTS:name.font for writing',0 ;165
 dc.b 'Can&rsquo;t write FONTS:names.font',0 ;166
 dc.b 'Can&rsquo;t lock FONTS:',0 ;167

 ds.w 0

.strs: EQU 168            ;number of strings required to be in catalog



*>>************************************************************************
*
*  TLFontmaker - make a font from unicode glyphs
*  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
***************************************************************************


TLFontmaker:

; D0 = strings
; D1 = gadtools.library base
; D2 = space to copy IntuiMessage
; A0 = window
; A1 = ucode_path (w. clone)
; A2 = backup
; A3 = xxp_scro
; A6 = ucode.library base


; stack offsets

 STRUCTURE .offs,0
 APTR  .clone         ;ucode_path (clone)
 APTR  .ibase         ;intuition.library base
 APTR  .dbase         ;dos.library base
 APTR  .gbase         ;graphics.library base
 STRUCT .wint,8       ;wint
 STRUCT .wbox,8       ;wbox
 STRUCT .lins,204     ;TLLWrap points (enough for 50 lines)
 STRUCT .vals,512     ;256 unicode vals -> font glyphs
 UWORD .ytop          ;topline on window } on return from TLDShow
 UWORD .link          ;lines on window   }
 UWORD .nomh          ;nominal height }
 UWORD .wdth          ;width          } current attributes
 UWORD .wght          ;weight         }
 UWORD .styl          ;style          }
 STRUCT .fname,36     ;font name (without .font)
 LABEL .ofsz

.osiz:  EQU (((.ofsz+3)/4)*4)   ;offsets rounded up longwords

.strig: EQU .osiz+0   ;D0 = TLLstart string address
.tbase: EQU .osiz+4   ;D1 = gadtools.library base
.mesag: EQU .osiz+8   ;D2 = copy of IntuiMessages
.wndow: EQU .osiz+32  ;A0 = window
.upath: EQU .osiz+36  ;A1 = ucode_path (base)
.bakup: EQU .osiz+40  ;A2 = rastport made by TLDMakeback
.scro:  EQU .osiz+44  ;A3 = window's xxp_scro
.ubase: EQU .osiz+56  ;A6 = ucode.library base

 movem.l d0-d7/a0-a6,-(a7)     ;save all
 sub.w #.osiz,a7

 move.l xxp_clon(a1),.clone(a7)
 move.l xxp_intp(a1),.ibase(a7)
 move.l xxp_dosp(a1),.dbase(a7)
 move.l xxp_gfxp(a1),.gbase(a7)

; initialise vals

.dflt:
 clr.b .fname(a7)
 lea .vals(a7),a0
 moveq #0,d0
.valf:
 clr.w (a0)
 cmp.w #$0021,d0
 bcs.s .null
 cmp.w #$00A1,d0
 bcc.s .nnul
 cmp.w #$007F,d0
 bcc.s .null
.nnul:
 move.w d0,(a0)
.null:
 addq.w #2,a0
 addq.w #1,d0
 cmp.w #256,d0
 bcs .valf

; re-draw window after resizing

.draw:

; set wint to window interior, wbox to entire window

 move.l .wndow(a7),a0      ;a0 = window
 lea .wint(a7),a1          ;a1 = wint
 bsr TLDWindow
 lea .wbox(a7),a2          ;a2 = wbox
 clr.l (a2)
 move.l 4(a1),4(a2)
 move.l wd_RPort(a0),a0    ;a0 = rastport

; clear window

 move.l .gbase(a7),a6
 moveq #0,d0
 moveq #0,d1
 move.w 4(a1),d2
 move.w 6(a1),d3
 moveq #0,d4
 bsr TLDArea

; draw top buttons

 move.l .strig(a7),a3      ;point a3 to string 2
 moveq #1,d0
.st02:
 tst.b (a3)+
 bne .st02
 dbra d0,.st02

 moveq #0,d0               ;d0-d3 = region
 moveq #0,d1
 move.w .wint+4(a7),d2
 moveq #36,d3
 moveq #1,d4               ;d4 = box dark pen
 moveq #2,d5               ;d5 = box light pen
 move.l #$00030002,d6      ;d6 = - bpen - fpen
 move.l #$00040002,d7      ;d7 = - cols - rows
 move.l .wndow(a7),a0
 move.l wd_RPort(a0),a0    ;a0 = rastport
 lea .wint(a7),a1          ;a1 = wint
 lea .wbox(a7),a2          ;a2 = wbox
 move.l .clone(a7),a5      ;a5 = ucode_path
 move.l .ubase(a7),a6      ;a6 = ucode.library base
 bsr TLDButtons

; here to redraw area below buttons

.rdrw:

; set wbox for showing .vals

 addq.w #2,(a2)
 subq.w #4,4(a2)
 add.w #45,2(a2)
 sub.w #46,6(a2)

; clear .vals area

 moveq #0,d0
 moveq #0,d1
 move.w 4(a2),d2
 move.w 6(a2),d3
 moveq #0,d4
 move.l .gbase(a7),a6
 move.l .wndow(a7),a0
 move.l wd_RPort(a7),a0
 bsr TLDArea

; show .vals

 moveq #32,d0              ;d0 = number of strings
 moveq #18,d1              ;d1 = line height in pixels
 move.l a1,d2              ;d2 = wint
 move.l a2,d3              ;d3 = wbox
 move.l #$02000001,d4      ;d4 = cpsc - bpen fpen
 move.l .mesag(a7),d5      ;d5 = copy of message
 move.l .ibase(a7),d6      ;d6 = intuition.library base
 move.l .tbase(a7),d7      ;d7 = gadtools.library base
 move.l .wndow(a7),a0      ;a0 = window
 move.l .scro(a7),a1       ;a1 = window's xxp_scro
 lea .fline,a2             ;a2 = address to call to draw lines
 move.l a7,a3              ;a3 = passed to .fline = a7 when TLDShow called
 sub.l a5,a5               ;a5 = popup = none
 move.l .gbase(a7),a6      ;a6 = graphics.library base
 bsr TLDShow

 move.w d0,.ytop(a7)       ;.ytop = topline on window on return
 swap d0
 move.w d0,.link(a7)       ;.link = lines on window on return

; set wbox ready to process message from TLDShow

.emes:
 move.l .mesag(a7),a0      ;a0 = messag
 lea .wint(a7),a1          ;a1 = wint
 lea .wbox(a7),a2          ;a2 = wbox
 clr.l (a2)
 move.l 4(a1),4(a2)        ;set wbox as when buttons drawn

; see if LMB in wint

 bsr TLDMouse
 beq.s .misc               ;go if not

; see if a button was clicked

 moveq #0,d0               ;d0-d3 = region
 moveq #0,d1               ;a0 already = message
 move.w 4(a1),d2           ;a2 already = wbox
 moveq #36,d3
 move.l #$00040002,d7      ;d7 = - cols - rows

 bsr TLDButmon             ;d0 = 0 if not, 1+ = button

 tst.w d0                  ;go see if edit .vals if no button pressed
 beq .eval
 subq.w #2,d0              ;go to whichever button
 bcs .help                 ;(all branch back ti .draw)
 beq .default
 subq.w #2,d0
 bcs .range
 beq .presets
 subq.w #2,d0
 bcs .makefont
 beq .preview
 subq.w #2,d0
 bcs .attributes
 beq .about

; process miscellaneous messages from TLDShow

.misc:
 move.l im_Class(a0),d0
 move.w im_Code(a0),d1

 cmp.l #IDCMP_NEWSIZE,d0     ;go redraw all if window resized
 beq .draw
 cmp.l #IDCMP_CLOSEWINDOW,d0 ;quit if closewindow
 bne .rdrw                   ;else, go redraw .vals area

; quit from TLFontmaker

.quit:
 add.w #.osiz,a7
 movem.l (a7)+,d0-d7/a0-a6
 rts


; ** TLFontmaker subroutine - draw a line of .vals (called via TLDShow)

.fline:
 move.l a3,a6              ;a6 = stack when TLDShow called

 lea .vals(a6),a0          ;a0 gets from .vals
 ext.l d0
 move.l d0,d7
 lsl.w #4,d7
 add.l d7,a0

 sub.w #64,a7              ;a2 builds line in stack

 move.l a7,a2              ;show 00 08 10...F8
 lsl.w #3,d0
 divu #16,d0
 add.b #'0',d0
 cmp.b #':',d0
 bcs.s .c1
 add.b #'A'-':',d0
.c1:
 move.b d0,(a2)+
 swap d0
 add.b #'0',d0
 cmp.b #':',d0
 bcs.s .c2
 add.b #'A'-':',d0
.c2:
 move.b d0,(a2)+
 move.w #'  ',(a2)+

 moveq #7,d7               ;d7 counts .vals
.val:
 move.w (a0)+,d0           ;d0 = next value
 move.w #$1000,d5
 moveq #3,d6
.digt:
 move.b #'0'-1,(a2)
.digb:
 addq.b #1,(a2)
 cmp.b #'9'+1,(a2)
 bne.s .dicr
 move.b #'A',(a2)
.dicr:
 sub.w d5,d0
 bcc .digb
 add.w d5,d0
 lsr.w #4,d5
 addq.l #1,a2
 dbra d6,.digt
 move.b #' ',(a2)+
 dbra d7,.val
 clr.b -(a2)

 exg d2,d3                 ;d2 = wbox d3 = wint   a1 already = rastport
 moveq #0,d0               ;d0 = xpos             d1 already = ypos
 moveq #0,d4               ;d4 = flags
 move.b #6,d4              ;     fixed width (+cspc 2 -> 8)
 bset #31,d4               ;     ASCII
 bset #30,d4               ;     &...;
 moveq #1,d5               ;d5 = fgpen
 moveq #0,d6               ;d6 = bgpen
 moveq #2,d7               ;d7 = cspace
 move.l .clone(a6),a0      ;a0 = ucode_path
 move.l a7,a2              ;a2 = string
 move.l a6,-(a7)
 move.l .ubase(a6),a6      ;a6 = ucode.library base (temporarily)
 addq.w #2,d1
 jsr _LVOTLUstring(a6)
 subq.w #2,d1
 move.l (a7)+,a6

 add.w #64,a7              ;discard line after printing

; draw boxes

 move.l a1,a0              ;a0 = rastport
 move.l d3,a1              ;a1 = wint
 move.l d2,a2              ;a2 = wbox
 moveq #32-6,d0            ;d0-d3 = region
 moveq #40,d2
 moveq #18,d3
 moveq #1,d4               ;d4 = dark pen
 moveq #2,d5               ;d5 = light pen
 move.l .gbase(a6),a6      ;a6 = graphics.library base

 moveq #7,d6               ;d6 counts boxes
.box:
 move.w d0,d7
 bsr TLDBox
 move.w d7,d0
 add.w d2,d0
 dbra d6,.box

; return from .fline

 rts


*>> TLFontmaker's 'help' button pressed

.help:
 moveq #51,d0              ;d0 = 1st string
 moveq #70,d1              ;d1 = last string
 moveq #0,d2               ;d2 = flags (no d3)
 bset #29,d2               ;     quit if LMB in wint
 move.l #$020F0001,d4      ;d4 = cpsc lspc bpen fpen
 moveq #50,d5              ;d5 = max lines
 move.l .clone(a7),d6      ;d6 = ucode_path
 move.l .mesag(a7),d7      ;d7 = addr to copy messages
 move.l .wndow(a7),a0      ;a0 = window
 move.l .scro(a7),a1       ;a1 = window's xxp_scro
 move.l .strig(a7),a2      ;a2 = strings
 lea .lins(a7),a3          ;a3 = start addresses
 move.l .tbase(a7),a5      ;a5 = gadtools.library base
 move.l .ubase(a7),a6      ;a6 = ucode.library base
 bsr TLLinfo
 bra .draw


*>> TLFontmaker's 'Default' button pressed

.default:
 bra .dflt                 ;back to beginning


*>> TLFontmaker's 'Range' button pressed

.range:

; clear top buttons

 move.l .wndow(a7),a0
 move.l wd_RPort(a0),a0
 lea .wint(a7),a1
 lea .wbox(a7),a2
 clr.l (a2)
 move.l 4(a1),4(a2)
 moveq #0,d0
 moveq #0,d1
 move.w 4(a2),d2
 moveq #36,d3
 moveq #0,d4
 move.l .gbase(a7),a6
 bsr TLDArea

; print instructions

 move.l .strig(a7),a3
 moveq #70,d0
.st71:
 tst.b (a3)+               ;a3 = string 71
 bne .st71
 dbra d0,.st71
 move #4,d0                ;d0 = xpos
 moveq #4,d1               ;d1 = ypos
 move.l a2,d2              ;d2 = wbox
 move.l a1,d3              ;d3 = wint
 moveq #0,d4               ;d4 = flags
 bset #31,d4               ;     ASCII
 bset #30,d4               ;     &...;
 moveq #2,d5               ;d5 = fpen
 moveq #0,d6               ;d6 = bpen
 moveq #2,d7               ;d7 = cpace
 move.l a0,a1              ;a1 = rastport
 move.l .clone(a7),a0      ;a0 = ucode_path
 move.l a3,a2              ;a2 = string
 move.l .ubase(a7),a6      ;a6 = ucode.library base
 jsr _LVOTLUstring(a6)

.st72:                     ;a2 = string 72
 tst.b (a2)+
 bne .st72
 moveq #4,d0
 moveq #22,d1              ;ypos = 31
 jsr _LVOTLUstring(a6)

; get response

.rwat:
 move.l _AbsExecBase,a6    ;wait for message
 move.l .wndow(a7),a2
 move.l wd_UserPort(a2),a0
 jsr _LVOWaitPort(a6)
 move.l wd_UserPort(a2),a0 ;get message
 move.l .tbase(a7),a6      ;a6 = gadtools.library base
 jsr _LVOGT_GetIMsg(a6)
 tst.l d0                  ;retry if null (can't happen?)
 beq .rwat
 move.l d0,a0              ;copy of message in .mesag, a2
 move.l .mesag(a7),a1
 move.l a1,a2
 move.w #im_SIZEOF-1,d1
.rmsg:
 move.b (a0)+,(a1)+
 dbra d1,.rmsg
 move.l d0,a1
 jsr _LVOGT_ReplyIMsg(a6)  ;reply to message

 move.l a2,a0              ;a0 = message
 lea .wint(a7),a1
 lea .wbox(a7),a2
 bsr TLDMouse
 bne.s .rnex               ;go if LMB down in wint

; process miscellaneous messages

 move.l im_Class(a0),d0
 cmp.l #IDCMP_NEWSIZE,d0
 beq .draw
 cmp.l #IDCMP_CLOSEWINDOW,d0
 beq .draw
 cmp.l #IDCMP_VANILLAKEY,d0
 bne .rwat
 cmp.w #$001B,im_Code(a0)
 bne .rwat
 bra .draw

; see if a .val clicked

.rnex:
 addq.w #2,(a2)            ;set wbox for .vals
 subq.w #4,4(a2)
 add.w #45,2(a2)
 sub.w #46,6(a2)

 moveq #0,d5
 move.w im_MouseX(a0),d5   ;d5 = horz box 0-7
 sub.w (a2),d5
 sub.w #26,d5
 bmi .rwat
 divu #40,d5
 cmp.w #8,d5
 bcc .rwat

 moveq #0,d6
 move.w im_MouseY(a0),d6   ;d6 = line 0 - .ytop-1
 sub.w 2(a2),d6
 divu #18,d6
 cmp.w .link(a7),d6        ;no if d6 >= .link
 bcc .rwat
 add.w .ytop(a7),d6        ;d6 abs
 cmp.w #32,d6
 bcc .rwat                 ;no if d6 >= 32

; point a5 to .val clicked

 move.w d6,d7
 mulu #8,d7
 add.w d5,d7
 lsl.l #1,d7
 lea .vals(a7),a5
 add.l d7,a5

; clear all .vals before the .val clicked

 move.l .wndow(a7),a0
 move.l wd_RPort(a0),a0
 moveq #26,d0
 moveq #0,d1
 move.w #320,d2
 moveq #0,d4
 move.l .gbase(a7),a6
 move.w d6,d3
 sub.w .ytop(a7),d3
 beq.s .gl0
 mulu #18,d3
 bsr TLDArea

.gl0:
 add.w d3,d1
 moveq #18,d3
 moveq #26,d0
 move.w d5,d2
 beq .gl1
 mulu #40,d2
 bsr TLDArea

; print instructions for end of range

.gl1:
 clr.l (a2)
 move.l 4(a1),4(a2)
 moveq #0,d0
 moveq #0,d1
 move.w 4(a2),d2
 moveq #36,d3
 bsr TLDArea

 move.l .strig(a7),a3
 moveq #71,d0
.s271:
 tst.b (a3)+               ;a3 = string 72
 bne .s271
 dbra d0,.s271
 move #4,d0                ;d0 = xpos
 moveq #22,d1              ;d1 = ypos
 move.l a2,d2              ;d2 = wbox
 move.l a1,d3              ;d3 = wint
 moveq #0,d4               ;d4 = flags
 bset #31,d4               ;     ASCII
 bset #30,d4               ;     &...;
 moveq #2,d5               ;d5 = fpen
 moveq #0,d6               ;d6 = bpen
 moveq #2,d7               ;d7 = cpace
 move.l a0,a1              ;a1 = rastport
 move.l .clone(a7),a0      ;a0 = ucode_path
 move.l a3,a2              ;a2 = string
 move.l .ubase(a7),a6      ;a6 = ucode.library base
 jsr _LVOTLUstring(a6)

.st73:                     ;a2 = string 73
 tst.b (a2)+
 bne .st73
 moveq #4,d0
 moveq #4,d1               ;ypos = 4
 jsr _LVOTLUstring(a6)

; wait for user to choose end of range

.rwt2:
 move.l _AbsExecBase,a6    ;wait for message
 move.l .wndow(a7),a2
 move.l wd_UserPort(a2),a0
 jsr _LVOWaitPort(a6)
 move.l wd_UserPort(a2),a0 ;get message
 move.l .tbase(a7),a6      ;a6 = gadtools.library base
 jsr _LVOGT_GetIMsg(a6)
 tst.l d0                  ;retry if null (can't happen?)
 beq .rwt2
 move.l d0,a0              ;copy of message in .mesag, a2
 move.l .mesag(a7),a1
 move.l a1,a2
 move.w #im_SIZEOF-1,d1
.rmg2:
 move.b (a0)+,(a1)+
 dbra d1,.rmg2
 move.l d0,a1
 jsr _LVOGT_ReplyIMsg(a6)  ;reply to message

; go if LMB down in wint

 move.l a2,a0              ;a0 = message
 lea .wint(a7),a1
 lea .wbox(a7),a2
 bsr TLDMouse
 bne.s .rnx2               ;go if LMB down in wint

; process miscellaneous messages

 move.l im_Class(a0),d0
 cmp.l #IDCMP_NEWSIZE,d0
 beq .draw
 cmp.l #IDCMP_CLOSEWINDOW,d0
 beq .draw
 cmp.l #IDCMP_VANILLAKEY,d0
 bne .rwt2
 cmp.w #$001B,im_Code(a0)
 bne .rwt2

 bra .draw

; see if a .val chosen

.rnx2:
 addq.w #2,(a2)            ;set wbox for .vals
 subq.w #4,4(a2)
 add.w #45,2(a2)
 sub.w #46,6(a2)

 moveq #0,d5
 move.w im_MouseX(a0),d5   ;d5 = horz box 0-7
 sub.w (a2),d5
 sub.w #26,d5
 bmi .rwt2
 divu #40,d5
 cmp.w #8,d5
 bcc .rwt2

 moveq #0,d6
 move.w im_MouseY(a0),d6   ;d6 = line 0 - .ytop-1
 sub.w 2(a2),d6
 divu #18,d6
 cmp.w .link(a7),d6        ;no if d6 >= .link
 bcc .rwt2
 add.w .ytop(a7),d6        ;d6 abs
 cmp.w #32,d6
 bcc .rwt2                 ;no if d6 >= 32

; point a3 to .val clicked

 move.w d6,d7
 mulu #8,d7
 add.w d5,d7
 lsl.l #1,d7
 lea .vals(a7),a3
 add.l d7,a3

; no if a3 < a5

 cmp.l a5,a3
 bcs .rwt2
 beq .draw                 ;done if only 1 .val in range

; put range

.rput:
 addq.w #2,a5
 move.w -2(a5),(a5)
 addq.w #1,(a5)
 cmp.l a3,a5
 bcs .rput
 bra .draw


*>> TLFontmaker's 'Presets' button pressed

.presets:

; set wint, wbox

 move.l .wndow(a7),a0      ;a0 = window
 lea .wint(a7),a1          ;a1 = wint
 bsr TLDWindow
 lea .wbox(a7),a2          ;a2 = wbox
 clr.l (a2)
 move.l 4(a1),4(a2)

; show presets

 moveq #34,d0              ;d0 = number of strings
 moveq #15,d1              ;d1 = line height
 move.l a1,d2              ;d2 = wint
 move.l a2,d3              ;d3 = wbox
 move.l #$02000001,d4      ;d4 = cpsc - bpen fpen
 move.l .mesag(a7),d5      ;d5 = message area
 move.l .ibase(a7),d6      ;d6 = intuition.library base
 move.l .tbase(a7),d7      ;d7 = gadtools.library base
 move.l .wndow(a7),a0      ;a0 = window
 move.l .scro(a7),a1       ;a1 = window's xxp_scro
 lea .pline,a2             ;a2 = .pline
 move.l a7,a3              ;a3 = passed to .pline = SP
 sub.l a5,a5               ;a5 = popup = none
 move.l .gbase(a7),a6      ;a6 = graphics.library base
 bsr TLDShow

 move.w d0,.ytop(a7)
 swap d0
 move.w d0,.link(a7)

; see if message was LMB down

 move.l d5,a0              ;a0 = message
 move.l d2,a1              ;a1 = wint
 move.l d3,a2              ;a2 = wbox
 bsr TLDMouse
 bne.s .plmb

; process misc messages from TLDShow

 move.l im_Class(a0),d0
 move.w im_Code(a0),d1
 cmp.l #IDCMP_NEWSIZE,d0
 beq .presets
 cmp.l #IDCMP_CLOSEWINDOW,d0  ;quit if closewindow or Esc, else recycle
 beq .draw
 cmp.l #IDCMP_RAWKEY,d0
 bne .presets
 cmp.w #$001B,d1
 bne .presets
 bra .draw

; here if TLDShow returned with LMB (TLDMouse has been called)

.plmb:
 moveq #0,d0
 move.w im_MouseY(a0),d0      ;make mousey relative to wbox
 sub.w 2(a2),d0
 bcs .presets                 ;go if above wbox
 divu #15,d0                  ;d0 = line no. in wbox
 cmp.w .link(a7),d0
 bcc .presets                 ;go if > lines on window
 add.w .ytop(a7),d0           ;make line number absolute
 beq .presets                 ;ignore line 0 (i.e. title)
 cmp.w #33,d0
 beq.s .spew                  ;go if line 33
 bhi .presets                 ;not if > 33 (can't happen?

; here if A0 - FF presets (line 1-31)

.a1ff:
 subq.w #1,d0                 ;d0 = 0 to 30
 lea .pres,a0                 ;point a0 to d0'th preset in .pres table
 mulu #192,d0
 add.l d0,a0
 lea .vals(a7),a1             ;point a1 to .vals entry for A0
 add.l #320,a1
 moveq #95,d0                 ;A0-FF = 96 words
.a1ft:
 move.w (a0)+,(a1)+           ;tfr preset data to A1 - FF
 dbra d0,.a1ft
 bra .draw

; here if Microsoft 01-2F, 80-BF preset

.spew:
 lea .spuu,a0
 lea .vals(a7),a1             ;from .vals + (1 word)
 addq.l #2,a1
 moveq #30,d0
.spu0:
 move.w (a0)+,(a1)+           ;01-1F = 31 words
 dbra d0,.spu0
 lea .vals(a7),a1
 add.w #256,a1                ;from .vals + (128 words)
 moveq #31,d0
.spu1:
 move.w (a0)+,(a1)+           ;80-9F = 32 words
 dbra d0,.spu1
 bra .draw

.pline:                    ;** draw lines for .preset (called via TLDShow)
 move.l a3,a6              ;a6 = SP when TLDShow called

 move.l .strig(a6),a2      ;a2 = string d0 + 10
 move.w d0,d6
 add.w #9,d0
.pl10:
 tst.b (a2)+
 bne .pl10
 dbra d0,.pl10

 moveq #2,d0               ;d0 = xpos,   d1 already = ypos
 exg d2,d3                 ;d2 = wbox, d3 = wint
 moveq #0,d4               ;d4 = flags
 bset #31,d4               ;     ASCII
 bset #30,d4               ;     &...;
 moveq #1,d5               ;d5 = fpen
 tst.b d6
 bne.s .pll0
 moveq #2,d5               ;     pen2 if line 0
.pll0:
 moveq #0,d6               ;d6 = bpen
 move #2,d7                ;d7 = cspc
 move.l .clone(a6),a0      ;a0 = ucode_path   a1 already = rastport
 move.l .ubase(a6),a6      ;a6 = ucode.library base
 jsr _LVOTLUstring(a6)
 rts


*>> TLFontmaker's 'Font' button pressed

.makefont:

; set wint, wbox

 move.l .wndow(a7),a0      ;a0 = window
 lea .wint(a7),a1          ;a1 = wint
 lea .wbox(a7),a2          ;a2 = wbox
 bsr TLDWindow             ;set wint to window
 clr.l (a2)
 move.l 4(a1),4(a2)        ;set wbox to whole wint

; clear window

 move.l wd_RPort(a0),a0    ;a0 = rastport
 moveq #0,d0               ;d0-d3 = region
 moveq #0,d1
 move.w 4(a2),d2
 move.w 6(a2),d3
 moveq #0,d4               ;d4 = bpen
 move.l .gbase(a7),a6      ;a6 = graphics.library base
 bsr TLDArea

; print title and instructions

 move.l .strig(a7),a3
 move.w #139,d0
.st140:
 tst.b (a3)+               ;a3 = strng 140
 bne .st140
 dbra d0,.st140
 moveq #2,d0               ;d0 = xpos
 moveq #1,d1               ;d1 = ypos
 move.l a7,d2
 add.l #.wbox,d2           ;d2 = wbox
 move.l a7,d3
 add.l #.wint,d3           ;d3 = wint
 moveq #0,d4               ;d4 = flags
 bset #31,d4               ;     ASCII
 bset #30,d4               ;     &...;
 moveq #2,d5               ;d5 = fpen
 moveq #0,d6               ;d6 = bpen
 moveq #2,d7               ;d7 = cspace
 move.l a0,a1              ;a1 = rastport
 move.l .clone(a7),a0      ;a0 = ucode_path
 move.l a3,a2              ;a2 = string
 move.l .ubase(a7),a6      ;a6 = ucode.library base
 jsr _LVOTLUstring(a6)

.st141:
 tst.b (a2)+               ;a2 = string 141
 bne .st141
 moveq #2,d0
 add.w #15,d1
 moveq #1,d5
 jsr _LVOTLUstring(a6)

.st142:
 tst.b (a2)+               ;a2 = string 142
 bne .st142
 moveq #2,d0
 add.w #15,d1
 jsr _LVOTLUstring(a6)

.st143:
 tst.b (a2)+               ;a3 = string 143
 bne .st143
 moveq #2,d0
 add.w #15,d1
 jsr _LVOTLUstring(a6)

.st144:
 tst.b (a2)+               ;a3 = string 144
 bne .st144
 moveq #2,d0
 add.w #15,d1
 jsr _LVOTLUstring(a6)

 move.l a2,a3
.st145:
 tst.b (a3)+               ;a3 = string 145
 bne .st145

; show OK, Cancel boxes

 move.l a0,a5              ;a5 = ucode_path
 move.l a1,a0              ;a0 = rastport
 move.l d3,a1              ;a1 = wint
 move.l d2,a2              ;a2 = wbox
 moveq #4,d0               ;d0-d3 = region
 moveq #113,d1
 move.w 4(a2),d2
 subq.w #8,d2
 moveq #18,d3
 moveq #1,d4               ;d4 = box dark pen
 moveq #2,d5               ;d5 = box light pen
 move.l #$00030001,d6      ;d6 = hpen bpen hili fpen
 move.l #$00020001,d7      ;d7 = - cols - rows
 move.l .ubase(a7),a6      ;a6 = ucode.library base
 bsr TLDButtons

; set a5 = cursor

 lea .fname(a7),a5
.setc:
 tst.b (a5)+               ;point a5 to fname delimiter
 bne .setc
 subq.l #1,a5

; clear the fname area, put box around (here to redo fname completely)

.cler:
 move.l .wndow(a7),a0
 move.l wd_RPort(a0),a0
 lea .wint(a7),a1
 lea .wbox(a7),a2
 moveq #4,d0
 moveq #77,d1
 move.w 4(a2),d2
 subq.w #8,d2
 moveq #18,d3
 moveq #0,d4
 move.l .gbase(a7),a6
 bsr TLDArea

 moveq #1,d4               ;d4 = dark pen
 moveq #2,d5               ;d5 = light pen
 bsr TLDBox

; echo fname so far (here if at least as wide as when previously here)

.echo:

; make sure <= 25 chrs in name

 lea .fname(a7),a0         ;a0 = 1st chr
 lea .fname+25(a7),a1      ;a1 = max legal eol
.lege:
 cmp.l a1,a0               ;go if max legal eol reached
 bcc.s .legf
 tst.b (a0)+               ;else see if eol
 bne .lege
 subq.w #1,a0              ;a0 = eol
.legf:
 clr.b (a0)                ;set eol
 cmp.l a0,a5
 bls.s .lgok               ;fix a5 if past eol
 move.l a0,a5
.lgok:

; show the fname

 moveq #8,d0               ;d0 = xpos
 moveq #79,d1              ;d1 = ypos
 move.l a7,d2              ;d2 = wbox
 add.l #.wbox,d2
 move.l a7,d3              ;d3 = wint
 add.l #.wint,d3
 moveq #0,d4               ;d4 = flags
 bset #31,d4               ;     ASCII
 bset #28,d4               ;     spacing 005Fs
 move.b #10,d4             ;     fixed width of 10
 moveq #1,d5               ;d5 = fpen
 moveq #0,d6               ;d6 = bpen
 clr.w d7                  ;d7 = cpsc
 move.l .clone(a7),a0      ;a0 = ucode_path
 move.l .wndow(a7),a1
 move.l wd_RPort(a1),a1    ;a1 = rastport
 lea .fname(a7),a2         ;a2 = fname
 move.l .ubase(a7),a6      ;a6 = ucode.library base
 jsr _LVOTLUstring(a6)

; hilight the chr under the cursor

.hili:
 lea .fname(a7),a0         ;d0 = xpos = (10 * crsr tab) + 8
 move.l a5,d0
 sub.l a0,d0
 mulu #10,d0
 addq.w #8,d0
 moveq #79,d1              ;d1 = ypos
 move.l a7,d2
 add.l #.wbox,d2           ;d2 = wbox
 move.l a7,d3
 add.l #.wint,d3           ;d3 = wint
 moveq #0,d4
 move.b (a5),d4
 moveq #2,d5               ;d5 = fpen
 moveq #3,d6               ;d5 = bpen
 move.l .clone(a7),a0      ;a0 = ucode_path
 move.l .wndow(a7),a1
 move.l wd_RPort(a1),a1    ;a1 = rastport
 move.l .ubase(a7),a6      ;a6 = ucode.library base

 move.l a7,a3              ;a3 = a7 before pushing
 movem.l d0-d6/a0-a1/a6,-(a7) ;save regs for un-hilighting

; if 0 or space under crsr, do area

 tst.b d4
 beq.s .fcmp
 cmp.b #' ',d4
 bne.s .grpt

.fcmp:
 move.l a1,a0
 move.l d3,a1
 move.l d2,a2
 move.l .gbase(a3),a6
 moveq #8,d2
 addq.w #3,d1
 moveq #8,d3
 moveq #2,d4
 bsr TLDArea
 bra.s .fnwt

; else, hilight characters

.grpt:
 jsr _LVOTLUgrabrport(a6)

; wait for response

.fnwt:
 move.l _AbsExecBase,a6    ;wait for message
 move.l .wndow(a3),a2
 move.l wd_UserPort(a2),a0
 jsr _LVOWaitPort(a6)
 move.l wd_UserPort(a2),a0 ;get message
 move.l .tbase(a3),a6      ;a6 = gadtools.library base
 jsr _LVOGT_GetIMsg(a6)
 tst.l d0                  ;retry if null (can't happen?)
 beq .fnwt
 move.l d0,a0              ;copy of message in .mesag, a2
 move.l .mesag(a3),a1
 move.l a1,a2
 move.w #im_SIZEOF-1,d1
.fnms:
 move.b (a0)+,(a1)+
 dbra d1,.fnms
 move.l d0,a1
 jsr _LVOGT_ReplyIMsg(a6)  ;reply to message

; if 0 or space under crsr, un area

 movem.l (a7)+,d0-d6/a0-a1/a6  ;retrieve regs that hilighted

 tst.b d4
 beq.s .ucmp
 cmp.b #' ',d4
 bne.s .unhi

.ucmp:
 move.l a1,a0
 move.l d3,a1
 move.l d2,a2
 move.l .gbase(a3),a6
 moveq #8,d2
 addq.w #3,d1
 moveq #8,d3
 moveq #0,d4
 bsr TLDArea
 bra.s .iflm

; else, unhilight characters

.unhi:
 moveq #1,d5               ;d5 = fgpen
 moveq #0,d6               ;d6 = bgpen
 jsr _LVOTLUgrabrport(a6)

; see if LMB down in rastport

.iflm:
 move.l .mesag(a7),a0
 lea .wint(a7),a1
 bsr TLDMouse
 bne .flmb                 ;go if yes

; see if vanillakey

 move.l im_Class(a0),d0
 move.w im_Code(a0),d1
 cmp.l #IDCMP_VANILLAKEY,d0
 beq.s .vanl

; process other messages

 cmp.l #IDCMP_NEWSIZE,d0     ;go if window resized
 beq .makefont
 cmp.l #IDCMP_CLOSEWINDOW,d0 ;go if window closed
 beq .draw
 cmp.l #IDCMP_RAWKEY,d0      ;else recycle unless rawkey
 bne .hili

; here if rawkey - see if left/right arrow

 cmp.w #$004E,d1           ;go bump tab if right arrow
 beq.s .fra
 cmp.w #$004F,d1
 bne .hili
 lea .fname(a7),a0         ;dec tab if left arrow
 cmp.l a0,a5
 beq .hili
 subq.l #1,a5
 bra .hili
.fra:
 tst.b (a5)                ;bump tab
 beq .hili
 addq.l #1,a5
 bra .hili

; backspace

.bs:
 tst.b (a5)                ;go if crsr not at eol
 bne.s .bsnz
 lea .fname(a7),a0         ;go if crsr also at start
 cmp.l a5,a0
 beq .hili
 clr.b -(a5)               ;chop last chr
 bra .cler
.bsnz:                     ;here if crsr not at eol
 lea .fname(a7),a0
 cmp.l a5,a0
 beq.s .bsch
 subq.l #1,a5              ;dec crsr, unless at start of line
 move.l a5,a0
.bsch:
 move.b 1(a0),(a0)         ;move all past crsr back a step
 addq.l #1,a0
 bne .bsch
 bra .cler

; vanilla key got

.vanl:
 cmp.w #$000D,d1           ;of if <Return>
 beq .ok
 cmp.w #$0008,d1           ;go if backspace
 beq .bs
 cmp.w #$001B,d1           ;go if Esc
 beq .vanl
 cmp.w #24,d1
 beq.s .clss               ;go if Esc/X
 cmp.w #$0021,d1
 bcs .hili
 cmp.w #$007F,d1           ;accept 21-7E, A1-FF
 bcs.s .vany
 cmp.w #$00A1,d1
 bcs .hili
.vany:
 tst.b (a5)                ;go if crsr not at eol
 bne.s .nanp
 lea .fname+25(a7),a0
 cmp.l a0,a5               ;not if line full
 bcc .hili
 move.b d1,(a5)+           ;put if crsr a eol
 clr.b (a5)
 bra .echo
.nanp:
 move.l a5,a0              ;find eol
.nnpe:
 tst.b (a0)+
 bne .nnpe
.nnpt:
 move.b -1(a0),(a0)        ;push all chrs from crsr forward
 subq.l #1,a0
 cmp.l a5,a0
 bne .nnpt
 move.b d1,(a5)+           ;insert chr
 clr.b .fname+25(a7)       ;ensure line doesn't overflow
 bra .cler

.clss:                     ;Ctrl/X = clear all
 lea .fname(a7),a5
 clr.b (a5)
 bra .cler

; lmb down

.flmb:                     ;a0 already = message
 lea .wbox(a7),a2          ;a2 = wbox

 moveq #4,d0               ;d0-d3 = region
 moveq #113,d1
 move.w 4(a2),d2
 subq.w #8,d2
 moveq #18,d3
 move.l #$00020001,d7      ;d7 = - cols - rows
 bsr TLDButmon
 cmp.w #1,d0
 bcs .fnwt                 ;go get another message if neither button
 bne .draw                 ;go if cancel

; OK button clicked / <Return> pressed

.ok:
 tst.b .fname(a7)
 bne .warn

; report bad if fname zero length

.okbd:

; set wint, wbox

 move.l .wndow(a7),a0      ;a0 = window
 lea .wint(a7),a1          ;a1 = wint
 lea .wbox(a7),a2          ;a2 = wbox
 bsr TLDWindow             ;set wint to window
 clr.l (a2)
 move.l 4(a1),4(a2)        ;set wbox to whole wint

; clear window

 move.l wd_RPort(a0),a0    ;a0 = rastport
 moveq #0,d0               ;d0-d3 = region
 moveq #0,d1
 move.w 4(a2),d2
 move.w 6(a2),d3
 moveq #0,d4               ;d4 = bpen
 move.l .gbase(a7),a6      ;a6 = graphics.library base
 bsr TLDArea

; print error message

 move.l .strig(a7),a3
 move.w #146,d0
.st147:
 tst.b (a3)+               ;a3 = strng 147
 bne .st147
 dbra d0,.st147
 moveq #8,d0               ;d0 = xpos
 moveq #20,d1              ;d1 = ypos
 move.l a7,d2
 add.l #.wbox,d2           ;d2 = wbox
 move.l a7,d3
 add.l #.wint,d3           ;d3 = wint
 moveq #0,d4               ;d4 = flags
 bset #31,d4               ;     ASCII
 bset #30,d4               ;     &...;
 moveq #2,d5               ;d5 = fpen
 moveq #0,d6               ;d6 = bpen
 moveq #2,d7               ;d7 = cspace
 move.l a0,a1              ;a1 = rastport
 move.l .clone(a7),a0      ;a0 = ucode_path
 move.l a3,a2              ;a2 = string
 move.l .ubase(a7),a6      ;a6 = ucode.library base
 jsr _LVOTLUstring(a6)

.st148:
 tst.b (a2)+               ;a2 = string 148
 bne .st148
 moveq #8,d0
 add.w #30,d1
 moveq #1,d5
 jsr _LVOTLUstring(a6)

 move.l .strig(a7),a2
 moveq #123,d0
.okc:
 tst.b (a2)+               ;a2 = string 124
 bne .okc
 dbra d0,.okc
 moveq #8,d0
 add.w #30,d1
 jsr _LVOTLUstring(a6)

; wait for response

.okwt:
 move.l _AbsExecBase,a6    ;wait for message
 move.l .wndow(a7),a2
 move.l wd_UserPort(a2),a0
 jsr _LVOWaitPort(a6)
 move.l wd_UserPort(a2),a0 ;get message
 move.l .tbase(a7),a6      ;a6 = gadtools.library base
 jsr _LVOGT_GetIMsg(a6)
 tst.l d0                  ;retry if null (can't happen?)
 beq .okwt
 move.l d0,a0              ;copy of message in .mesag, a2
 move.l .mesag(a7),a1
 move.l a1,a2
 move.w #im_SIZEOF-1,d1
.okms:
 move.b (a0)+,(a1)+
 dbra d1,.okms
 move.l d0,a1
 jsr _LVOGT_ReplyIMsg(a6)  ;reply to message

 move.l im_Class(a2),d0
 move.w im_Code(a2),d1
 cmp.l #IDCMP_NEWSIZE,d0       ;redo message if newsize
 beq .okbd
 cmp.l #IDCMP_CLOSEWINDOW,d0   ;go if closewindow
 beq .draw
 cmp.l #IDCMP_VANILLAKEY,d0    ;to makefont if Esc
 bne.s .okmb
 cmp.w #$001B,d1
 beq .makefont
.okmb:
 cmp.l #IDCMP_MOUSEBUTTONS,d0  ;to makefont if LMB down
 bne .okwt
 cmp.w #$0068,d1               ;else get another message
 bne .okwt
 bra .makefont

; we have our filename - warn user

.warn:

; set wint, wbox

 move.l .wndow(a7),a0      ;a0 = window
 lea .wint(a7),a1          ;a1 = wint
 lea .wbox(a7),a2          ;a2 = wbox
 bsr TLDWindow             ;set wint to window
 clr.l (a2)
 move.l 4(a1),4(a2)        ;set wbox to whole wint

; clear window

 move.l wd_RPort(a0),a0    ;a0 = rastport
 moveq #0,d0               ;d0-d3 = region
 moveq #0,d1
 move.w 4(a2),d2
 move.w 6(a2),d3
 moveq #0,d4               ;d4 = bpen
 move.l .gbase(a7),a6      ;a6 = graphics.library base
 bsr TLDArea

; print warning

 move.l .strig(a7),a3
 move.w #148,d0
.st149:
 tst.b (a3)+               ;a3 = strng 149
 bne .st149
 dbra d0,.st149
 moveq #2,d0               ;d0 = xpos
 moveq #1,d1               ;d1 = ypos
 move.l a7,d2
 add.l #.wbox,d2           ;d2 = wbox
 move.l a7,d3
 add.l #.wint,d3           ;d3 = wint
 moveq #0,d4               ;d4 = flags
 bset #31,d4               ;     ASCII
 bset #30,d4               ;     &...;
 moveq #1,d5               ;d5 = fpen
 moveq #0,d6               ;d6 = bpen
 moveq #2,d7               ;d7 = cspace
 move.l a0,a1              ;a1 = rastport
 move.l .clone(a7),a0      ;a0 = ucode_path
 move.l a3,a2              ;a2 = string
 move.l .ubase(a7),a6      ;a6 = ucode.library base
 jsr _LVOTLUstring(a6)

.st150:
 tst.b (a2)+               ;a2 = string 150
 bne .st150
 moveq #2,d0
 moveq #46,d1
 jsr _LVOTLUstring(a6)

.st151:
 tst.b (a2)+               ;a2 = string 151
 bne .st151
 moveq #2,d0
 moveq #61,d1
 jsr _LVOTLUstring(a6)

; print name.font

 lea .fname(a7),a2
 move.l a2,a3
.ffnt:
 tst.b (a3)+
 bne .ffnt
 move.b #'.',-1(a3)
 move.b #'f',(a3)
 move.b #'o',1(a3)
 move.b #'n',2(a3)
 move.b #'t',3(a3)
 clr.b 4(a3)
 moveq #20,d0
 moveq #16,d1
 bset #28,d4
 moveq #2,d5
 jsr _LVOTLUstring(a6)

; print name/size

 move.b #'/',-1(a3)
 move.l .upath(a7),a6
 moveq #0,d7
 move.w xxp_uwsl(a6),d7
 move.l .ubase(a7),a6
 divu #10,d7
 tst.b d7
 beq.s .ff1
 move.b #'0',(a3)
 add.b d7,(a3)+
.ff1:
 swap d7
 move.b #'0',(a3)
 add.b d7,(a3)
 clr.b 1(a3)
 subq.l #1,a3
 cmp.b #'/',(a3)
 beq.s .ff2
 subq.l #1,a3
.ff2:
 moveq #20,d0
 moveq #31,d1
 moveq #2,d7
 jsr _LVOTLUstring(a6)
 clr.b (a3)

; show OK, Cancel boxes

 move.l .strig(a7),a3
 move.w #144,d0
.sg145:
 tst.b (a3)+               ;a3 = string 145
 bne .sg145
 dbra d0,.sg145

 move.l .clone(a7),a5      ;a5 = ucode_path
 move.l .wndow(a7),a0
 move.l wd_RPort(a0),a0    ;a0 = rastport
 lea .wint(a7),a1          ;a1 = wint
 lea .wbox(a7),a2          ;a2 = wbox
 moveq #4,d0               ;d0-d3 = region
 moveq #91,d1
 move.w 4(a2),d2
 subq.w #8,d2
 moveq #18,d3
 moveq #1,d4               ;d4 = box dark pen
 moveq #2,d5               ;d5 = box light pen
 move.l #$00030001,d6      ;d6 = hpen bpen hili fpen
 move.l #$00020001,d7      ;d7 = - cols - rows
 move.l .ubase(a7),a6      ;a6 = ucode.library base
 bsr TLDButtons

.wnwt:
 move.l _AbsExecBase,a6    ;wait for message
 move.l .wndow(a7),a2
 move.l wd_UserPort(a2),a0
 jsr _LVOWaitPort(a6)
 move.l wd_UserPort(a2),a0 ;get message
 move.l .tbase(a7),a6      ;a6 = gadtools.library base
 jsr _LVOGT_GetIMsg(a6)
 tst.l d0                  ;retry if null (can't happen?)
 beq .wnwt
 move.l d0,a0              ;copy of message in .mesag, a2
 move.l .mesag(a7),a1
 move.l a1,a2
 move.w #im_SIZEOF-1,d1
.wnms:
 move.b (a0)+,(a1)+
 dbra d1,.wnms
 move.l d0,a1
 jsr _LVOGT_ReplyIMsg(a6)  ;reply to message

; see if button pressed

 move.l a2,a0
 lea .wint(a7),a1
 bsr TLDMouse
 beq.s .wnmi               ;no, go misc messages

; see if button pressed

 lea .wbox(a7),a2          ;a2 = wbox
 moveq #4,d0               ;d0-d3 = region
 moveq #91,d1
 move.w 4(a2),d2
 subq.w #8,d2
 moveq #18,d3
 move.l #$00020001,d7      ;d7 = - cols - rows
 bsr TLDButmon
 cmp.w #1,d0
 bcs .wnwt                 ;go get another message if neither button
 beq.s .make               ;go make if OK
 bra .draw                 ;go if cancel

; do miscellaneous messages

.wnmi:
 move.l im_Class(a0),d0
 move.w im_Code(a0),d1

 cmp.l #IDCMP_NEWSIZE,d0       ;redo message if newsize
 beq .warn
 cmp.l #IDCMP_CLOSEWINDOW,d0   ;go if closewindow
 beq .draw
 cmp.l #IDCMP_VANILLAKEY,d0    ;to .makefont if Esc, .make if <Return>
 bne .wnwt
 cmp.w #$001B,d1               ;else get another message
 beq .makefont
 cmp.l #$000D,d1
 bne .wnwt

; make the font

.make:

; make pointer busy

 move.l .wndow(a7),a0      ;a0 = window
 move.l .ibase(a7),a6      ;a6 = intuition.library base
 bsr TLDBusy

; call TLUmakefont

 lea .fname(a7),a0         ;append .font to fname
 move.l a0,a1
.msuf:
 tst.b (a0)+
 bne .msuf
 move.b #'.',-1(a0)
 move.b #'f',(a0)+
 move.b #'o',(a0)+
 move.b #'n',(a0)+
 move.b #'t',(a0)+
 clr.b (a0)
 lea .vals(a7),a0          ;a0 = table of values
 move.l .upath(a7),a2      ;a2 = ucode_path
 move.l .ubase(a7),a6      ;a6 = ucode.library base
 jsr _LVOTLUmakefont(a6)

; make pointer unbusy

 move.l .wndow(a7),a0      ;a0 = window
 move.l .ibase(a7),a6      ;a6 = intuition.library base
 bsr TLDUnbusy

; go if successful

 tst.l d0
 bne .good

; report reason for failure

 lea .fname(a7),a0         ;remove .font
.fk0:
 tst.b (a0)+
 bne .fk0
 clr.b -6(a0)

 move.w xxp_eror(a2),d7    ;D7 msw = error code - s/be 5 or 9-17
 swap d7

; set wint, wbox

.erep:
 move.l .wndow(a7),a0      ;a0 = window
 lea .wint(a7),a1          ;a1 = wint
 lea .wbox(a7),a2          ;a2 = wbox
 bsr TLDWindow             ;set wint to window
 clr.l (a2)
 move.l 4(a1),4(a2)        ;set wbox to whole wint

; clear window

 move.l wd_RPort(a0),a0    ;a0 = rastport
 moveq #0,d0               ;d0-d3 = region
 moveq #0,d1
 move.w 4(a2),d2
 move.w 6(a2),d3
 moveq #0,d4               ;d4 = bpen
 move.l .gbase(a7),a6      ;a6 = graphics.library base
 bsr TLDArea

; print error report

 move.l .strig(a7),a3
 move.w #155,d0
.st156:
 tst.b (a3)+               ;a3 = strng 156
 bne .st156
 dbra d0,.st156

 moveq #8,d0               ;d0 = xpos
 moveq #10,d1              ;d1 = ypos
 move.l a7,d2
 add.l #.wbox,d2           ;d2 = wbox
 move.l a7,d3
 add.l #.wint,d3           ;d3 = wint
 moveq #0,d4               ;d4 = flags
 bset #31,d4               ;     ASCII
 bset #30,d4               ;     &...;
 moveq #1,d5               ;d5 = fpen
 moveq #0,d6               ;d6 = bpen
 move.w #2,d7              ;d7 = cspace
 move.l a0,a1              ;a1 = rastport
 move.l .clone(a7),a0      ;a0 = ucode_path
 move.l a3,a2              ;a2 = string
 move.l .ubase(a7),a6      ;a6 = ucode.library base
 jsr _LVOTLUstring(a6)

.st157:
 tst.b (a2)+               ;a2 = string 141
 bne .st157
 moveq #8,d0
 add.w #30,d1
 jsr _LVOTLUstring(a6)

 swap d7                   ;retrieve error code from d7 msw
 move.w d7,d6
 swap d7

 add.w #30,d1
 subq.w #5,d6              ;d6 = 0 if error 5
 bmi.s .b123
 beq.s .st158
 subq.w #2,d6              ;d6 = 1 to 9 if error 9 to 17
 ble.s .b123
 cmp.w #10,d6              ;go if spurious error code - can't happen?
 bcc.s .b123
.st158:
 tst.b (a2)+
 bne .st158
 dbra d6,.st158
 moveq #8,d0
 moveq #2,d5
 moveq #0,d6
 move.w #2,d7
 jsr _LVOTLUstring(a6)

.b123:
 move.l .strig(a7),a2      ;a2 = string 124
 moveq #123,d0
.s124:
 tst.b (a2)+
 bne .s124
 dbra d0,.s124
 moveq #8,d0
 add.w #30,d1
 moveq #1,d5
 moveq #0,d6
 move.w #2,d7
 jsr _LVOTLUstring(a6)

; wait for response

.bwat:
 move.l _AbsExecBase,a6    ;wait for message
 move.l .wndow(a7),a2
 move.l wd_UserPort(a2),a0
 jsr _LVOWaitPort(a6)
 move.l wd_UserPort(a2),a0 ;get message
 move.l .tbase(a7),a6      ;a6 = gadtools.library base
 jsr _LVOGT_GetIMsg(a6)
 tst.l d0                  ;retry if null (can't happen?)
 beq .bwat
 move.l d0,a0              ;copy of message in .mesag, a2
 move.l .mesag(a7),a1
 move.l a1,a2
 move.w #im_SIZEOF-1,d1
.bmsg:
 move.b (a0)+,(a1)+
 dbra d1,.bmsg
 move.l d0,a1
 jsr _LVOGT_ReplyIMsg(a6)  ;reply to message

; react to message

 move.l a2,a0
 move.l im_Class(a0),d0
 move.w im_Code(a0),d1

 cmp.l #IDCMP_MOUSEBUTTONS,d0  ;go if LMB down
 bne.s .bdmi
 cmp.w #$0068,d1
 beq .draw
.bdmi:
 cmp.l #IDCMP_NEWSIZE,d0       ;recycle if window sized
 beq .erep
 cmp.l #IDCMP_CLOSEWINDOW,d0   ;go if closewindow
 beq .draw
 cmp.l #IDCMP_VANILLAKEY,d0    ;go if Esc
 bne .bwat
 cmp.w #$001B,d1               ;else get next message
 beq .draw
 bra .bwat

; here if TLUmakefont succeeded

.good:

; set wint, wbox

 move.l .wndow(a7),a0      ;a0 = window
 lea .wint(a7),a1          ;a1 = wint
 lea .wbox(a7),a2          ;a2 = wbox
 bsr TLDWindow             ;set wint to window
 clr.l (a2)
 move.l 4(a1),4(a2)        ;set wbox to whole wint

; clear window

 move.l wd_RPort(a0),a0    ;a0 = rastport
 moveq #0,d0               ;d0-d3 = region
 moveq #0,d1
 move.w 4(a2),d2
 move.w 6(a2),d3
 moveq #0,d4               ;d4 = bpen
 move.l .gbase(a7),a6      ;a6 = graphics.library base
 bsr TLDArea

; show font

 moveq #0,d7               ;d7 = -1 if can open font

 move.l _AbsExecBase,a6    ;open diskfont.library..
 lea .flnam,a1
 moveq #0,d0
 jsr _LVOOpenLibrary(a6)
 tst.l d0
 beq .succ                 ;bad if can't

 move.l d0,a6              ;a6 = diskfont.library base
 move.l .upath(a7),a0
 move.w xxp_uwsl(a0),d5    ;d5 = font height
 lea .fname(a7),a0         ;a0 = font name
 subq.l #8,a7
 move.l a0,(a7)            ;make TextAttr
 move.w d5,4(a7)
 clr.w 6(a7)
 move.l a7,a0
 jsr _LVOOpenDiskFont(a6)  ;try to open the font
 addq.l #8,a7
 move.l d0,d6              ;d6 = 0 / font
 move.l a6,a1
 move.l _AbsExecBase,a6
 jsr _LVOCloseLibrary(a6)  ;close diskfont.library
 tst.l d6
 beq .succ                 ;go if couldn't open

 moveq #-1,d7              ;note we opened it ok

 move.l .wndow(a7),a0      ;a2 = rastport
 move.l wd_RPort(a0),a2
 move.l a2,a1
 move.l d6,a0
 move.l .gbase(a7),a6      ;a6 = graphics.library base
 jsr _LVOSetFont(a6)       ;set font to rastport

 addq.w #1,d5              ;d5 = font ht + 1 = line ht
 moveq #0,d4
 move.w .wbox+6(a7),d4     ;d4 = wbox ht - 46 = room for lines
 sub.w #46,d4
 ble.s .cfnt               ;(go if room for none)
 divu d5,d4                ;d4 = lines that will fit
 subq.w #1,d4
 bmi.s .cfnt
 moveq #0,d2               ;d2 = xpos
 move.w .wint(a7),d2
 add.w .wbox(a7),d2
 addq.w #2,d2
 moveq #0,d3
 move.w .wint+2(a7),d3     ;d3 = init ypos
 add.w .wbox+2(a7),d3
 add.w #46,d3
 move.l .upath(a7),a0
 add.w xxp_uwbl(a0),d3     ;(add ascender for _LVOText posn)

 move.l a2,a1              ;set pens 1,0
 moveq #1,d0
 jsr _LVOSetAPen(a6)
 move.l a2,a1
 moveq #0,d0
 jsr _LVOSetBPen(a6)

 sub.w #20,a7              ;build strings in stack
 move.b #31,15(a7)         ;(cause to start from 32)

.flin:                     ;next line
 moveq #15,d0
 move.b 15(a7),d1          ;d1 = last of prev line
 move.l a7,a0              ;a0 puts asciis
.fput:
 addq.b #1,d1
 beq.s .cend
 cmp.b #127,d1             ;skip 127-160
 bne.s .fskp
 move.b #161,d1
.fskp:
 move.b d1,(a0)+           ;put ascii
 dbra d0,.fput

 move.l d2,d0              ;move to d2,d3
 move.w d3,d1
 move.l a2,a1
 jsr _LVOMove(a6)
 move.l a2,a1              ;print
 move.l a7,a0
 moveq #16,d0
 jsr _LVOText(a6)

 add.w d5,d3               ;bump ypos
 dbra d4,.flin             ;until all done

.cend:
 add.w #20,a7

.cfnt:
 move.l d6,a1
 jsr _LVOCloseFont(a6)     ;close the font

 lea .fname(a7),a0         ;remove it from mem
 subq.w #1,d5              ;(to force re-load if new version made)
 subq.l #8,a7
 move.l a0,(a7)
 move.w d5,4(a7)
 clr.w 6(a7)
 move.l a7,a1
 jsr _LVORemFont(a6)
 addq.l #8,a7

; report success

.succ:
 lea .fname(a7),a3         ;remove .font
.fk2:
 tst.b (a3)+
 bne .fk2
 clr.b -6(a3)

 move.l .strig(a7),a3
 move.w #151,d0
.st152:
 tst.b (a3)+               ;a3 = strng 152
 bne .st152
 dbra d0,.st152

 moveq #2,d0               ;d0 = xpos
 moveq #1,d1               ;d1 = ypos
 move.l a7,d2
 add.l #.wbox,d2           ;d2 = wbox
 move.l a7,d3
 add.l #.wint,d3           ;d3 = wint
 moveq #0,d4               ;d4 = flags
 bset #31,d4               ;     ASCII
 bset #30,d4               ;     &...;
 moveq #2,d5               ;d5 = fpen
 moveq #0,d6               ;d6 = bpen
 move.w #2,d7              ;d7 = cspace
 move.l .wndow(a7),a0
 move.l wd_RPort(a0),a1    ;a1 = rastport
 move.l .clone(a7),a0      ;a0 = ucode_path
 move.l a3,a2              ;a2 = string
 move.l .ubase(a7),a6      ;a6 = ucode.library base
 jsr _LVOTLUstring(a6)

 tst.w d7                  ;go if couldn't show font
 beq.s .124g
.st153:
 tst.b (a2)+               ;a2 = string 153
 bne .st153
 moveq #2,d0
 moveq #16,d1
 moveq #1,d5
 jsr _LVOTLUstring(a6)

.124g:
 move.l .strig(a7),a2      ;print string 124
 moveq #123,d0
.g124:
 tst.b (a2)+
 bne .g124
 dbra d0,.g124
 moveq #2,d0
 moveq #31,d1
 jsr _LVOTLUstring(a6)

; wait for response

.gwat:
 move.l _AbsExecBase,a6    ;wait for message
 move.l .wndow(a7),a2
 move.l wd_UserPort(a2),a0
 jsr _LVOWaitPort(a6)
 move.l wd_UserPort(a2),a0 ;get message
 move.l .tbase(a7),a6      ;a6 = gadtools.library base
 jsr _LVOGT_GetIMsg(a6)
 tst.l d0                  ;retry if null (can't happen?)
 beq .gwat
 move.l d0,a0              ;copy of message in .mesag, a2
 move.l .mesag(a7),a1
 move.l a1,a2
 move.w #im_SIZEOF-1,d1
.gmsg:
 move.b (a0)+,(a1)+
 dbra d1,.gmsg
 move.l d0,a1
 jsr _LVOGT_ReplyIMsg(a6)  ;reply to message

; react to message

 move.l a2,a0
 move.l im_Class(a0),d0
 move.w im_Code(a0),d1

 cmp.l #IDCMP_MOUSEBUTTONS,d0  ;go if LMB down
 bne.s .gdmi
 cmp.w #$0068,d1
 beq .draw
.gdmi:
 cmp.l #IDCMP_NEWSIZE,d0       ;recycle if window sized
 beq .good
 cmp.l #IDCMP_CLOSEWINDOW,d0   ;go if closewindow
 beq .draw
 cmp.l #IDCMP_VANILLAKEY,d0    ;go if Esc
 bne .gwat
 cmp.w #$001B,d1               ;else get next message
 beq .draw
 bra .gwat


*>> TLFontmaker's 'Preview' button pressed

.preview:

; set wint, wbox

 move.l .wndow(a7),a0      ;a0 = window
 lea .wint(a7),a1          ;a1 = wint
 lea .wbox(a7),a2          ;a2 = wbox
 bsr TLDWindow             ;set wint to window
 clr.l (a2)
 move.l 4(a1),4(a2)        ;set wbox to whole wint

; clear window

 move.l wd_RPort(a0),a0    ;a0 = rastport
 moveq #0,d0               ;d0-d3 = region
 moveq #0,d1
 move.w 4(a2),d2
 move.w 6(a2),d3
 moveq #0,d4               ;d4 = bpen
 move.l .gbase(a7),a6      ;a6 = graphics.library base
 bsr TLDArea

 move.l .strig(a7),a3
 move.w #124,d0
.st125:
 tst.b (a3)+               ;a3 = strng 125
 bne .st125
 dbra d0,.st125
 moveq #2,d0               ;d0 = xpos
 moveq #1,d1               ;d1 = ypos
 move.l a7,d2
 add.l #.wbox,d2           ;d2 = wbox
 move.l a7,d3
 add.l #.wint,d3           ;d3 = wint
 moveq #0,d4               ;d4 = flags
 bset #31,d4               ;     ASCII
 bset #30,d4               ;     &...;
 moveq #2,d5               ;d5 = fpen
 moveq #0,d6               ;d6 = bpen
 moveq #2,d7               ;d7 = cspace
 move.l a0,a1              ;a1 = rastport
 move.l .clone(a7),a0      ;a0 = ucode_path
 move.l a3,a2              ;a2 = string
 move.l .ubase(a7),a6      ;a6 = ucode.library base
 jsr _LVOTLUstring(a6)

.st126:
 tst.b (a2)+               ;a2 = string 126
 bne .st126
 moveq #2,d0
 add.w #15,d1
 moveq #1,d5
 jsr _LVOTLUstring(a6)

.st127:
 tst.b (a2)+               ;a2 = string 127
 bne .st127
 moveq #2,d0
 add.w #15,d1
 jsr _LVOTLUstring(a6)

.st128:
 tst.b (a2)+               ;a3 = string 128
 bne .st128
 moveq #2,d0
 add.w #15,d1
 jsr _LVOTLUstring(a6)

; set wbox for strings

 lea .wint(a7),a1
 lea .wbox(a7),a2
 addq.w #2,(a2)
 subq.w #4,4(a2)
 add.w #62,2(a2)
 sub.w #63,6(a2)

; show strings

 moveq #32,d0              ;d0 = number of strings = 32
 move.l .upath(a7),a0
 move.w xxp_uwsl(a0),d1    ;d1 = line ht = actual glyph ht + 1
 addq.w #1,d1
 cmp.w #15,d1              ;(minimum 15)
 bcc.s .minh
 moveq #15,d1
.minh:
 move.l a1,d2              ;d2 = wint
 move.l a2,d3              ;d3 = wbox
 move.l #$02000001,d4      ;d4 = cspc - bpen fpen
 move.l .mesag(a7),d5      ;d5 = address to copy messages
 move.l .ibase(a7),d6      ;d6 = intuition.library base
 move.l .tbase(a7),d7      ;d7 = gadtools.library base
 move.l .wndow(a7),a0      ;a0 = window
 move.l .scro(a7),a1       ;a1 = window's xxp_scro
 lea .zline,a2             ;a2 = routine for putting lines
 move.l a7,a3              ;a3 = SP passed to .zline via TLDShow
 sub.l a5,a5               ;a5 = popup = none
 move.l .gbase(a7),a6      ;a6 = graphics.library base
 bsr TLDShow

 bra .draw


.zline:
 sub.w #32,a7              ;build string in stack

 move.l a3,a6              ;a6 = stack when TLDShow formed

 move.l a7,a0              ;a0 puts string (in UTF16)
 move.w d0,d2
 move.w #$0030,2(a0)       ;put 00/08/10...F0/F8
 lsr.w #1,d2
 bcc.s .zlc0
 addq.w #8,2(a0)
.zlc0:
 move.w #$0030,(a0)
 add.w d2,(a0)
 cmp.b #':',1(a0)
 bcs.s .zlc1
 add.b #'A'-':',1(a0)
.zlc1:
 addq.l #4,a0
 clr.w (a0)+               ;delimit stub
 lea .vals(a6),a1
 mulu #16,d0
 add.l d0,a1               ;a1 = .vals for this line
 moveq #7,d0
.zltf:
 move.w (a1)+,(a0)+        ;put .vals
 bne.s .zlc2
 move.w #$0020,-2(a0)      ;replace 0000's by 0020
.zlc2:
 dbra d0,.zltf
 clr.w (a0)                ;null delimit

; print stub

 moveq #0,d0               ;d0 = xpos,   d1 already = ypos
 move.l a6,d2
 add.l #.wbox,d2           ;d2 = wbox
 move.l a6,d3
 add.l #.wint,d3           ;d3 = wint
 moveq #0,d4               ;d4 = flags
 bset #28,d4               ;     spacing 005F's
 moveq #2,d5               ;d5 = fpen
 moveq #0,d6               ;d6 = bpen
 moveq #2,d7               ;d7 = cspace
 move.l .clone(a6),a0      ;a0 = ucode_path
 move.l .wndow(a6),a1
 move.l wd_RPort(a1),a1    ;a1 = rastport
 move.l a7,a2              ;a2 = string
 move.l a6,-(a7)
 move.l .ubase(a6),a6      ;a6 = ucode.library base
 jsr _LVOTLUstring(a6)
 move.l (a7)+,a6

; print glyphs

 moveq #24,d0              ;xpos = 24
 move.l d2,a5              ;set d4 bits 0-7 to (wbox wdth - 24) / 8
 move.w 4(a5),d4           ;(fixed width)
 sub.w d0,d4
 lsr.w #3,d4
 moveq #1,d5               ;fpen = 1
 move.l a7,a2              ;point to glyphs
 addq.l #6,a2
 move.l .upath(a6),a0      ;use ucode_path base
 move.l .ubase(a6),a6
 jsr _LVOTLUstring(a6)

 add.w #32,a7              ;discard string
 rts


*>> TLFontmaker's 'Attributes' button pressed

.attributes:

; get old attributes

 move.l .upath(a7),a0
 move.w xxp_uasz(a0),.nomh(a7)
 clr.w .wdth(a7)
 move.b xxp_uawd(a0),.wdth+1(a7)
 clr.w .wght(a7)
 move.b xxp_uabo(a0),.wght+1(a7)
 move.w xxp_uast(a0),.styl(a7)

; show preliminary instructions

 moveq #113,d0             ;d0 = xpos
 moveq #122,d1             ;d1 = ypos
 moveq #0,d2               ;d2 = flags
 bset #29,d2               ;     stop if LMB down
 move.l #$020F0001,d4      ;d4 = cspc lspc bpen fpen
 moveq #50,d5              ;d5 = max lines
 move.l .clone(a7),d6      ;d6 = ucode_path
 move.l .mesag(a7),d7      ;d7 = addr to copy messages
 move.l .wndow(a7),a0      ;a0 = window
 move.l .scro(a7),a1       ;a1 = window's xxp_scro
 move.l .strig(a7),a2      ;a2 = strings
 lea .lins(a7),a3          ;a3 = line starts
 move.l .tbase(a7),a5      ;a5 = gadtools.library base
 move.l .ubase(a7),a6      ;a6 = code.library base
 bsr TLLinfo

; attributes - step 1

.stp1:

; set wint, wbox

 move.l .wndow(a7),a0      ;a0 = window
 lea .wint(a7),a1          ;a1 = wint
 lea .wbox(a7),a2          ;a2 = wbox
 bsr TLDWindow             ;set wint to window
 clr.l (a2)
 move.l 4(a1),4(a2)        ;set wbox to whole wint

; clear window

 move.l wd_RPort(a0),a0    ;a0 = rastport
 moveq #0,d0               ;d0-d3 = region
 moveq #0,d1
 move.w 4(a2),d2
 move.w 6(a2),d3
 moveq #0,d4               ;d4 = bpen
 move.l .gbase(a7),a6      ;a6 = graphics.library base
 bsr TLDArea

 move.l .strig(a7),a3
 moveq #73,d0
.st74:
 tst.b (a3)+               ;a3 = strng 74
 bne .st74
 dbra d0,.st74
 moveq #2,d0               ;d0 = xpos
 moveq #1,d1               ;d1 = ypos
 move.l a7,d2
 add.l #.wbox,d2           ;d2 = wbox
 move.l a7,d3
 add.l #.wint,d3           ;d3 = wint
 moveq #0,d4               ;d4 = flags
 bset #31,d4               ;     ASCII
 bset #30,d4               ;     &...;
 moveq #2,d5               ;d5 = fpen
 moveq #0,d6               ;d6 = bpen
 moveq #2,d7               ;d7 = cspace
 move.l a0,a1              ;a1 = rastport
 move.l .clone(a7),a0      ;a0 = ucode_path
 move.l a3,a2              ;a2 = string
 move.l .ubase(a7),a6      ;a6 = ucode.library base
 jsr _LVOTLUstring(a6)

.st75:
 tst.b (a2)+               ;a2 = string 75
 bne .st75
 moveq #2,d0
 add.w #15,d1
 moveq #1,d5
 jsr _LVOTLUstring(a6)

.st76:
 tst.b (a2)+               ;a2 = string 76
 bne .st76
 moveq #2,d0
 add.w #15,d1
 jsr _LVOTLUstring(a6)

.st77:
 tst.b (a2)+               ;a3 = string 77
 bne .st77
 moveq #2,d0
 add.w #15,d1
 jsr _LVOTLUstring(a6)

; draw buttons for nominal sizes 5 to 31

 move.l a1,a0              ;a0 = rastport
 lea .wint(a7),a1          ;a1 = wint
 lea .wbox(a7),a2          ;a2 = wbox

 sub.w #84,a7              ;a3 =  stack = ' 5',0,'6',0, ..... '31',0

 move.l a7,a3
 move.w #' 5',(a3)+
 clr.b (a3)+
 moveq #25,d0
.s1ss:
 move.b -3(a3),d3
 move.b -2(a3),d2
 addq.b #1,d2
 cmp.b #':',d2
 bne.s .s1s2
 moveq #'0',d2
 cmp.b #' ',d3
 bne.s .s1s1
 moveq #'0',d3
.s1s1:
 addq.b #1,d3
.s1s2:
 move.b d3,(a3)+
 move.b d2,(a3)+
 clr.b (a3)+
 dbra d0,.s1ss
 move.l a7,a3

 moveq #0,d0               ;d0-d3 = region
 moveq #66,d1
 move.w 4(a2),d2
 moveq #54,d3
 moveq #1,d4               ;d4 = box dark pen
 moveq #2,d5               ;d5 = box light pen
 moveq #0,d6               ;d6 = hpen bpen hbox fpen
 move.w 84+.nomh(a7),d6
 subq.b #4,d6              ;d6 bits 8-15 = 1+ for old nomh 5+
 lsl.w #8,d6
 or.l #$02030001,d6
 move.l #$00090003,d7      ;d7 = - cols - rows  3 X 9 = 27, i.e. 5 ... 31
 move.l 84+.clone(a7),a5   ;a5 = ucode_path
 move.l 84+.ubase(a7),a6   ;a6 = ucode.library base
 bsr TLDButtons

 add.w #84,a7              ;discard button strings

; wait for response

.s1wt:
 move.l _AbsExecBase,a6    ;wait for message
 move.l .wndow(a7),a2
 move.l wd_UserPort(a2),a0
 jsr _LVOWaitPort(a6)
 move.l wd_UserPort(a2),a0 ;get message
 move.l .tbase(a7),a6      ;a6 = gadtools.library base
 jsr _LVOGT_GetIMsg(a6)
 tst.l d0                  ;retry if null (can't happen?)
 beq .s1wt
 move.l d0,a0              ;copy of message in .mesag, a2
 move.l .mesag(a7),a1
 move.l a1,a2
 move.w #im_SIZEOF-1,d1
.s1ms:
 move.b (a0)+,(a1)+
 dbra d1,.s1ms
 move.l d0,a1
 jsr _LVOGT_ReplyIMsg(a6)  ;reply to message

; go if LMB down

 move.l a2,a0              ;a0 = message
 lea .wint(a7),a1          ;a1 = wint
 lea .wbox(a7),a2          ;a2 = wbox
 bsr TLDMouse
 bne.s .s1bu

; process other messages

 move.l im_Class(a0),d0
 move.w im_Code(a0),d1

 cmp.l #IDCMP_NEWSIZE,d0
 beq .stp1
 cmp.l #IDCMP_CLOSEWINDOW,d0
 beq .draw
 cmp.l #IDCMP_VANILLAKEY,d0
 bne .s1wt
 cmp.w #$001B,d1
 bne .s1wt
 bra .draw

; see if button pressed

.s1bu:
 moveq #0,d0               ;d0-d3 = region
 moveq #66,d1
 move.w 4(a2),d2
 moveq #54,d3
 move.l #$00090003,d7      ;d7 = - cols - rows  3 X 9 = 27, i.e. 5 ... 31
 lea .wbox(a7),a2          ;a2 = wbox,  a0 already = message
 bsr TLDButmon

 addq.w #4,d0              ;go if not
 cmp.w #5,d0
 bcs .s1wt
 cmp.w #32,d0
 bcc .s1wt
 move.w d0,.nomh(a7)       ;else, set nominal height

; attributes - step 2

.stp2:

; set wint, wbox

 move.l .wndow(a7),a0      ;a0 = window
 lea .wint(a7),a1          ;a1 = wint
 lea .wbox(a7),a2          ;a2 = wbox
 bsr TLDWindow             ;set wint to window
 clr.l (a2)
 move.l 4(a1),4(a2)        ;set wbox to whole wint

; clear window

 move.l wd_RPort(a0),a0    ;a0 = rastport
 moveq #0,d0               ;d0-d3 = region
 moveq #0,d1
 move.w 4(a2),d2
 move.w 6(a2),d3
 moveq #0,d4               ;d4 = bpen
 move.l .gbase(a7),a6      ;a6 = graphics.library base
 bsr TLDArea

 move.l .strig(a7),a3
 moveq #77,d0
.st78:
 tst.b (a3)+               ;a3 = strng 78
 bne .st78
 dbra d0,.st78
 moveq #2,d0               ;d0 = xpos
 moveq #1,d1               ;d1 = ypos
 move.l a7,d2
 add.l #.wbox,d2           ;d2 = wbox
 move.l a7,d3
 add.l #.wint,d3           ;d3 = wint
 moveq #0,d4               ;d4 = flags
 bset #31,d4               ;     ASCII
 bset #30,d4               ;     &...;
 moveq #2,d5               ;d5 = fpen
 moveq #0,d6               ;d6 = bpen
 moveq #2,d7               ;d7 = cspace
 move.l a0,a1              ;a1 = rastport
 move.l .clone(a7),a0      ;a0 = ucode_path
 move.l a3,a2              ;a2 = string
 move.l .ubase(a7),a6      ;a6 = ucode.library base
 jsr _LVOTLUstring(a6)

.st79:
 tst.b (a2)+               ;a2 = string 79
 bne .st79
 moveq #2,d0
 add.w #15,d1
 moveq #1,d5
 jsr _LVOTLUstring(a6)

.st80:
 tst.b (a2)+               ;a2 = string 80
 bne .st80
 moveq #2,d0
 add.w #15,d1
 jsr _LVOTLUstring(a6)

.st81:
 tst.b (a2)+               ;a3 = string 71
 bne .st81
 moveq #2,d0
 add.w #15,d1
 jsr _LVOTLUstring(a6)

; draw buttons for width descriptor

 move.l .strig(a7),a3
 moveq #81,d0
.st82:
 tst.b (a3)+               ;a3 = string 82
 bne .st82
 dbra d0,.st82

 move.l a1,a0              ;a0 = rastport
 lea .wint(a7),a1          ;a1 = wint
 lea .wbox(a7),a2          ;a2 = wbox

 moveq #0,d0               ;d0-d3 = region
 moveq #66,d1
 move.w 4(a2),d2
 moveq #54,d3
 moveq #1,d4               ;d4 = box dark pen
 moveq #2,d5               ;d5 = box light pen
 moveq #0,d6               ;d6 = hpen bpen hbox fpen
 move.w .wdth(a7),d6
 addq.b #1,d6              ;d6 bits 8-15 = 1+ for old wdth 0+
 lsl.w #8,d6
 or.l #$02030001,d6
 move.l #$00030003,d7      ;d7 = - cols - rows
 move.l .clone(a7),a5      ;a5 = ucode_path
 move.l .ubase(a7),a6      ;a6 = ucode.library base
 bsr TLDButtons

; wait for response

.s2wt:
 move.l _AbsExecBase,a6    ;wait for message
 move.l .wndow(a7),a2
 move.l wd_UserPort(a2),a0
 jsr _LVOWaitPort(a6)
 move.l wd_UserPort(a2),a0 ;get message
 move.l .tbase(a7),a6      ;a6 = gadtools.library base
 jsr _LVOGT_GetIMsg(a6)
 tst.l d0                  ;retry if null (can't happen?)
 beq .s2wt
 move.l d0,a0              ;copy of message in .mesag, a2
 move.l .mesag(a7),a1
 move.l a1,a2
 move.w #im_SIZEOF-1,d1
.s2ms:
 move.b (a0)+,(a1)+
 dbra d1,.s2ms
 move.l d0,a1
 jsr _LVOGT_ReplyIMsg(a6)  ;reply to message

; go if LMB down

 move.l a2,a0              ;a0 = message
 lea .wint(a7),a1          ;a1 = wint
 bsr TLDMouse
 bne.s .s2bu

; process other messages

 move.l im_Class(a0),d0
 move.w im_Code(a0),d1

 cmp.l #IDCMP_NEWSIZE,d0
 beq .stp2
 cmp.l #IDCMP_CLOSEWINDOW,d0
 beq .draw
 cmp.l #IDCMP_VANILLAKEY,d0
 bne .s2wt
 cmp.w #$001B,d1
 bne .s2wt
 bra .draw

; see if button pressed

.s2bu:
 lea .wbox(a7),a2          ;a2 = wbox,  a0 already = message
 moveq #0,d0               ;d0-d3 = region
 moveq #66,d1
 move.w 4(a2),d2
 moveq #54,d3
 move.l #$00030003,d7      ;d7 = - cols - rows
 bsr TLDButmon

 subq.w #1,d0              ;go if not
 bmi .s2wt
 cmp.w #9,d0
 bcc .s2wt
 move.w d0,.wdth(a7)       ;set .wdth

; attributes step 3 - set weight

.stp3:

; set wint, wbox

 move.l .wndow(a7),a0      ;a0 = window
 lea .wint(a7),a1          ;a1 = wint
 lea .wbox(a7),a2          ;a2 = wbox
 bsr TLDWindow             ;set wint to window
 clr.l (a2)
 move.l 4(a1),4(a2)        ;set wbox to whole wint

; clear window

 move.l wd_RPort(a0),a0    ;a0 = rastport
 moveq #0,d0               ;d0-d3 = region
 moveq #0,d1
 move.w 4(a2),d2
 move.w 6(a2),d3
 moveq #0,d4               ;d4 = bpen
 move.l .gbase(a7),a6      ;a6 = graphics.library base
 bsr TLDArea

 move.l .strig(a7),a3
 moveq #90,d0
.st91:
 tst.b (a3)+               ;a3 = strng 91
 bne .st91
 dbra d0,.st91
 moveq #2,d0               ;d0 = xpos
 moveq #1,d1               ;d1 = ypos
 move.l a7,d2
 add.l #.wbox,d2           ;d2 = wbox
 move.l a7,d3
 add.l #.wint,d3           ;d3 = wint
 moveq #0,d4               ;d4 = flags
 bset #31,d4               ;     ASCII
 bset #30,d4               ;     &...;
 moveq #2,d5               ;d5 = fpen
 moveq #0,d6               ;d6 = bpen
 moveq #2,d7               ;d7 = cspace
 move.l a0,a1              ;a1 = rastport
 move.l .clone(a7),a0      ;a0 = ucode_path
 move.l a3,a2              ;a2 = string
 move.l .ubase(a7),a6      ;a6 = ucode.library base
 jsr _LVOTLUstring(a6)

.st92:
 tst.b (a2)+               ;a2 = string 92
 bne .st92
 moveq #2,d0
 add.w #15,d1
 moveq #1,d5
 jsr _LVOTLUstring(a6)

.st93:
 tst.b (a2)+               ;a2 = string 93
 bne .st93
 moveq #2,d0
 add.w #15,d1
 jsr _LVOTLUstring(a6)

.st94:
 tst.b (a2)+               ;a3 = string 94
 bne .st94
 moveq #2,d0
 add.w #15,d1
 jsr _LVOTLUstring(a6)

; draw buttons for weight descriptor

 move.l .strig(a7),a3
 moveq #94,d0
.st95:
 tst.b (a3)+               ;a3 = string 95
 bne .st95
 dbra d0,.st95

 move.l a1,a0              ;a0 = rastport
 lea .wint(a7),a1          ;a1 = wint
 lea .wbox(a7),a2          ;a2 = wbox

 moveq #0,d0               ;d0-d3 = region
 moveq #66,d1
 move.w 4(a2),d2
 moveq #54,d3
 moveq #1,d4               ;d4 = box dark pen
 moveq #2,d5               ;d5 = box light pen
 moveq #0,d6               ;d6 = hpen bpen hbox fpen
 move.w .wght(a7),d6       ;d6 bits 8-15 = 1+ for old wght 1+
 lsl.w #8,d6
 or.l #$02030001,d6
 move.l #$00030003,d7      ;d7 = - cols - rows
 move.l .clone(a7),a5      ;a5 = ucode_path
 move.l .ubase(a7),a6      ;a6 = ucode.library base
 bsr TLDButtons

; wait for response

.s3wt:
 move.l _AbsExecBase,a6    ;wait for message
 move.l .wndow(a7),a2
 move.l wd_UserPort(a2),a0
 jsr _LVOWaitPort(a6)
 move.l wd_UserPort(a2),a0 ;get message
 move.l .tbase(a7),a6      ;a6 = gadtools.library base
 jsr _LVOGT_GetIMsg(a6)
 tst.l d0                  ;retry if null (can't happen?)
 beq .s3wt
 move.l d0,a0              ;copy of message in .mesag, a2
 move.l .mesag(a7),a1
 move.l a1,a2
 move.w #im_SIZEOF-1,d1
.s3ms:
 move.b (a0)+,(a1)+
 dbra d1,.s3ms
 move.l d0,a1
 jsr _LVOGT_ReplyIMsg(a6)  ;reply to message

; go if LMB down

 move.l a2,a0              ;a0 = message
 lea .wint(a7),a1          ;a1 = wint
 bsr TLDMouse
 bne.s .s3bu

; process other messages

 move.l im_Class(a0),d0
 move.w im_Code(a0),d1

 cmp.l #IDCMP_NEWSIZE,d0
 beq .stp3
 cmp.l #IDCMP_CLOSEWINDOW,d0
 beq .draw
 cmp.l #IDCMP_VANILLAKEY,d0
 bne .s3wt
 cmp.w #$001B,d1
 bne .s3wt
 bra .draw

; see if button pressed

.s3bu:
 lea .wbox(a7),a2          ;a2 = wbox,  a0 already = message
 moveq #0,d0               ;d0-d3 = region
 moveq #66,d1
 move.w 4(a2),d2
 moveq #54,d3
 move.l #$00030003,d7      ;d7 = - cols - rows
 bsr TLDButmon

 tst.w d0                  ;go if not
 beq .s3wt
 cmp.w #10,d0
 bcc .s3wt
 move.w d0,.wght(a7)       ;set .wght

; attributes step 4 - style

.stp4:

; set wint, wbox

 move.l .wndow(a7),a0      ;a0 = window
 lea .wint(a7),a1          ;a1 = wint
 lea .wbox(a7),a2          ;a2 = wbox
 bsr TLDWindow             ;set wint to window
 clr.l (a2)
 move.l 4(a1),4(a2)        ;set wbox to whole wint

; clear window

 move.l wd_RPort(a0),a0    ;a0 = rastport
 moveq #0,d0               ;d0-d3 = region
 moveq #0,d1
 move.w 4(a2),d2
 move.w 6(a2),d3
 moveq #0,d4               ;d4 = bpen
 move.l .gbase(a7),a6      ;a6 = graphics.library base
 bsr TLDArea

 move.l .strig(a7),a3
 moveq #103,d0
.st104:
 tst.b (a3)+               ;a3 = strng 104
 bne .st104
 dbra d0,.st104
 moveq #2,d0               ;d0 = xpos
 moveq #1,d1               ;d1 = ypos
 move.l a7,d2
 add.l #.wbox,d2           ;d2 = wbox
 move.l a7,d3
 add.l #.wint,d3           ;d3 = wint
 moveq #0,d4               ;d4 = flags
 bset #31,d4               ;     ASCII
 bset #30,d4               ;     &...;
 moveq #2,d5               ;d5 = fpen
 moveq #0,d6               ;d6 = bpen
 moveq #2,d7               ;d7 = cspace
 move.l a0,a1              ;a1 = rastport
 move.l .clone(a7),a0      ;a0 = ucode_path
 move.l a3,a2              ;a2 = string
 move.l .ubase(a7),a6      ;a6 = ucode.library base
 jsr _LVOTLUstring(a6)

.st105:
 tst.b (a2)+               ;a2 = string 105
 bne .st105
 moveq #2,d0
 add.w #15,d1
 moveq #1,d5
 jsr _LVOTLUstring(a6)

.st106:
 tst.b (a2)+               ;a2 = string 106
 bne .st106
 moveq #2,d0
 add.w #15,d1
 jsr _LVOTLUstring(a6)

.st107:
 tst.b (a2)+               ;a3 = string 107
 bne .st107
 moveq #2,d0
 add.w #15,d1
 jsr _LVOTLUstring(a6)

; draw buttons for style descriptor

 move.l .strig(a7),a3
 moveq #107,d0
.st108:
 tst.b (a3)+               ;a3 = string 108
 bne .st108
 dbra d0,.st108

 move.l a1,a0              ;a0 = rastport
 lea .wint(a7),a1          ;a1 = wint
 lea .wbox(a7),a2          ;a2 = wbox

 moveq #0,d0               ;d0-d3 = region
 moveq #66,d1
 move.w 4(a2),d2
 lsr.w #1,d2
 moveq #90,d3
 moveq #1,d4               ;d4 = box dark pen
 moveq #2,d5               ;d5 = box light pen
 moveq #0,d6               ;d6 = hpen bpen hbox fpen
 moveq #1,d6
 cmp.w #'SS',.styl(a7)     ;d6 = 1-5 for SS WS CS FA TT
 beq.s .s4st
 moveq #2,d6
 cmp.w #'WS',.styl(a7)
 beq.s .s4st
 moveq #3,d6
 cmp.w #'CS',.styl(a7)
 beq.s .s4st
 moveq #4,d6
 cmp.w #'FA',.styl(a7)
 beq.s .s4st
 moveq #5,d6
.s4st:
 lsl.w #8,d6
 or.l #$02030001,d6
 move.l #$00010005,d7      ;d7 = - cols - rows
 move.l .clone(a7),a5      ;a5 = ucode_path
 move.l .ubase(a7),a6      ;a6 = ucode.library base
 bsr TLDButtons

; wait for response

.s4wt:
 move.l _AbsExecBase,a6    ;wait for message
 move.l .wndow(a7),a2
 move.l wd_UserPort(a2),a0
 jsr _LVOWaitPort(a6)
 move.l wd_UserPort(a2),a0 ;get message
 move.l .tbase(a7),a6      ;a6 = gadtools.library base
 jsr _LVOGT_GetIMsg(a6)
 tst.l d0                  ;retry if null (can't happen?)
 beq .s4wt
 move.l d0,a0              ;copy of message in .mesag, a2
 move.l .mesag(a7),a1
 move.l a1,a2
 move.w #im_SIZEOF-1,d1
.s4ms:
 move.b (a0)+,(a1)+
 dbra d1,.s4ms
 move.l d0,a1
 jsr _LVOGT_ReplyIMsg(a6)  ;reply to message

; go if LMB down

 move.l a2,a0              ;a0 = message
 lea .wint(a7),a1          ;a1 = wint
 bsr TLDMouse
 bne.s .s4bu

; process other messages

 move.l im_Class(a0),d0
 move.w im_Code(a0),d1

 cmp.l #IDCMP_NEWSIZE,d0
 beq .stp4
 cmp.l #IDCMP_CLOSEWINDOW,d0
 beq .draw
 cmp.l #IDCMP_VANILLAKEY,d0
 bne .s4wt
 cmp.w #$001B,d1
 bne .s4wt
 bra .draw

; see if button pressed

.s4bu:
 lea .wbox(a7),a2          ;a2 = wbox,  a0 already = message
 moveq #0,d0               ;d0-d3 = region
 moveq #66,d1
 move.w 4(a2),d2
 lsr.w #1,d2
 moveq #90,d3
 move.l #$00010005,d7      ;d7 = - cols - rows
 bsr TLDButmon

 tst.w d0                  ;go if not
 beq .s4wt
 cmp.w #6,d0
 bcc .s4wt
 move.w #'SS',.styl(a7)
 cmp.w #1,d0
 beq.s .stp5
 move.w #'WS',.styl(a7)
 cmp.w #2,d0
 beq.s .stp5
 move.w #'CS',.styl(a7)
 cmp.w #3,d0
 beq.s .stp5
 move.w #'FA',.styl(a7)
 beq.s .stp5
 move.w #'TT',.styl(a7)

; now set the new attributes

.stp5:

; set the attributes

 move.w .nomh(a7),d0       ;d0 = nominal height
 move.w .wdth(a7),d1       ;d1 = width
 move.w .styl(a7),d2       ;d2 = style
 move.w .wght(a7),d3       ;d3 = weight
 moveq #xxp_lwarp,d4       ;d4 = set ucode_warper if required
 move #0,d5                ;d5 = sample unicode 0000
 move.l .upath(a7),a0      ;a0 = ucode_path
 move.l .ubase(a7),a6      ;a6 = ucode.library base
 jsr _LVOTLUfindpath(a6)

; go if good

 tst.l d0                  ;go if good
 bne .draw

; report the error

 move.l .wndow(a7),a0      ;a0 = window
 lea .wint(a7),a1          ;a1 = wint
 lea .wbox(a7),a2          ;a2 = wbox
 bsr TLDWindow             ;set wint to window
 clr.l (a2)
 move.l 4(a1),4(a2)        ;set wbox to whole wint

; clear window

 move.l wd_RPort(a0),a0    ;a0 = rastport
 moveq #0,d0               ;d0-d3 = region
 moveq #0,d1
 move.w 4(a2),d2
 move.w 6(a2),d3
 moveq #0,d4               ;d4 = bpen
 move.l .gbase(a7),a6      ;a6 = graphics.library base
 bsr TLDArea

 move.l .strig(a7),a3
 moveq #122,d0
.st123:
 tst.b (a3)+               ;a3 = strng 123
 bne .st123
 dbra d0,.st123
 moveq #2,d0               ;d0 = xpos
 moveq #10,d1              ;d1 = ypos
 move.l a7,d2
 add.l #.wbox,d2           ;d2 = wbox
 move.l a7,d3
 add.l #.wint,d3           ;d3 = wint
 moveq #0,d4               ;d4 = flags
 bset #31,d4               ;     ASCII
 bset #30,d4               ;     &...;
 moveq #2,d5               ;d5 = fpen
 moveq #0,d6               ;d6 = bpen
 moveq #2,d7               ;d7 = cspace
 move.l a0,a1              ;a1 = rastport
 move.l .clone(a7),a0      ;a0 = ucode_path
 move.l a3,a2              ;a2 = string
 move.l .ubase(a7),a6      ;a6 = ucode.library base
 jsr _LVOTLUstring(a6)

.st124:
 tst.b (a2)+               ;a2 = string 124
 bne .st124
 moveq #2,d0
 add.w #30,d1
 moveq #1,d5
 jsr _LVOTLUstring(a6)

; wait for response

.s5wt:
 move.l _AbsExecBase,a6    ;wait for message
 move.l .wndow(a7),a2
 move.l wd_UserPort(a2),a0
 jsr _LVOWaitPort(a6)
 move.l wd_UserPort(a2),a0 ;get message
 move.l .tbase(a7),a6      ;a6 = gadtools.library base
 jsr _LVOGT_GetIMsg(a6)
 tst.l d0                  ;retry if null (can't happen?)
 beq .s5wt
 move.l d0,a0              ;copy of message in .mesag, a2
 move.l .mesag(a7),a1
 move.l a1,a2
 move.w #im_SIZEOF-1,d1
.s5ms:
 move.b (a0)+,(a1)+
 dbra d1,.s5ms
 move.l d0,a1
 jsr _LVOGT_ReplyIMsg(a6)  ;reply to message

; go if LMB down

 move.l a2,a0              ;a0 = message
 lea .wint(a7),a1          ;a1 = wint
 bsr TLDMouse
 bne .draw

; process other messages

 move.l im_Class(a0),d0
 move.w im_Code(a0),d1

 cmp.l #IDCMP_NEWSIZE,d0
 beq .stp5
 cmp.l #IDCMP_CLOSEWINDOW,d0
 beq .draw
 cmp.l #IDCMP_VANILLAKEY,d0
 bne .s5wt
 cmp.w #$001B,d1
 bne .s5wt
 bra .draw


*>> TLFontmaker's 'About' button pressed

.about:
 move.w #129,d0            ;d0 = 1st string
 move.w #139,d1            ;d1 = last string
 moveq #0,d2               ;d2 = flags
 bset #29,d2               ;     quit if LMB
 move.l #$020F0001,d4      ;d4 = cspc lspc bpen fpen
 moveq #50,d5              ;d5 = maxlines
 move.l .clone(a7),d6      ;d6 = ucode_path
 move.l .mesag(a7),d7      ;d7 = where to copy messages
 move.l .wndow(a7),a0      ;a0 = window
 move.l .scro(a7),a1       ;a1 = window's xxp_scro
 move.l .strig(a7),a2      ;a2 = strings
 lea .lins(a7),a3          ;a3 = line starts
 move.l .tbase(a7),a5      ;a5 = gadtools.library base
 move.l .ubase(a7),a6      ;a6 = ucode.library base
 bsr TLLinfo

 bra .draw


*>> see if TLFontmaker's .vals to be edited (LMB has been pressed)

.eval                      ;a0 = message, a1 = wint, a2 = wbox

 move.l a7,a5              ;a5 caches a7 in .eval

; set wbox as when .vals were shown

 addq.w #2,(a2)
 subq.w #4,4(a2)
 add.w #45,2(a2)
 sub.w #46,6(a2)

; see if a digit of a .val was clicked

 moveq #0,d1
 move.w im_MouseY(a0),d1   ;d1 = mousey rel to wint
 sub.w 2(a2),d1            ;d1 rel to wbox
 bcs .draw                 ;go if above wbox
 divu #18,d1               ;d1 = line number on window
 cmp.w .link(a5),d1
 bcc .draw                 ;go if below bottom line shown by TLDShow
 add.w .ytop(a5),d1        ;line num rel to line 0
 cmp.w #32,d1
 bcc .draw                 ;go if > 31 (can't happen?)
 moveq #0,d0
 move.w im_MouseX(a0),d0   ;d0 = mousex rel to wint
 sub.w (a2),d0             ;d0 rel to wbox (4 chrs before lhs val)
 sub.w #32,d0              ;(1st 4 chrs = line stub)
 bmi .draw                 ;go if left of wbox
 divu #40,d0               ;d0 = which val
 cmp.w #8,d0
 bcc .draw                 ;go if right of vals (8 per line)

; point (a3) to .val clicked

 lea .vals(a5),a3
 move.w d1,d2              ; = a3 + (2 * ((8 * d1) + d0))
 mulu #8,d2
 add.w d0,d2
 lsl.w #1,d2
 add.l d2,a3

; set d0 = xpos of .val, d1 = ypos of .val, d7 = 0-3 = tab within val

 swap d0                   ;get posn in val
 lsr.w #3,d0               ;d0 = chr posn (8 bits / chr)
 cmp.w #4,d0               ;go if if gap between .vals
 bcc .draw
 move.w d0,d7              ;d7 = tab (0-3) within val

 sub.w .ytop(a5),d1
 mulu #18,d1               ;d1 = ypos of val
 addq.w #2,d1
 swap d0
 mulu #40,d0               ;d0 = xpos of val
 add.w #32,d0

; hilight the digit clicked, get a response

.digi:
 movem.l d0-d1/d7/a3,-(a7)

; hilight

 move.w d7,d2
 mulu #8,d2
 add.w d2,d0
 move.l a5,d2
 add.l #.wbox,d2
 move.l a5,d3
 add.l #.wint,d3
 moveq #0,d4
 move.w (a3),d4            ;d4 = abcd abcd abcd abcd
 moveq #3,d5               ;d7 = 0    1    2    3
 sub.w d7,d5               ;d5 = 3    2    1    0
 lsl.w #2,d5               ;d5 = C    8    4    0
 lsr.w d5,d4               ;d4 = 000a 00ab 0abc abcd
 and.w #$000F,d4           ;d4 = 000a 000b 000c 000d
 add.w #'0',d4
 cmp.w #':',d4
 bcs.s .ec1
 add.w #'A'-':',d4
.ec1:
 moveq #2,d5               ;d5 = fpen
 moveq #3,d6               ;d6 = bpen
 move.l .clone(a5),a0      ;a0 = ucode_path
 move.l .wndow(a5),a1
 move.l wd_RPort(a1),a1    ;a1 = rastport

 movem.l d0-d6/a0-a1,-(a7)

 move.l .ubase(a5),a6      ;highlight the character
 jsr _LVOTLUgrabrport(a6)

; wait for response

.ewat:
 move.l _AbsExecBase,a6    ;wait for message
 move.l .wndow(a5),a2
 move.l wd_UserPort(a2),a0
 jsr _LVOWaitPort(a6)
 move.l wd_UserPort(a2),a0 ;get message
 move.l .tbase(a5),a6      ;a6 = gadtools.library base
 jsr _LVOGT_GetIMsg(a6)
 tst.l d0                  ;retry if null (can't happen?)
 beq .ewat
 move.l d0,a0              ;copy of message in .mesag, a2
 move.l .mesag(a5),a1
 move.l a1,a2
 move.w #im_SIZEOF-1,d1
.mesg:
 move.b (a0)+,(a1)+
 dbra d1,.mesg
 move.l d0,a1
 jsr _LVOGT_ReplyIMsg(a6)  ;reply to message

 movem.l (a7)+,d0-d6/a0-a1 ;retrieve regs from TLUgrabrport

; go if was vanillakey

 cmp.l #IDCMP_VANILLAKEY,im_Class(a2)  ;go if maybe 0-9/A-F
 beq.s .vani

; else unhilight the character

.epop:
 move.l .ubase(a5),a6
 moveq #1,d5
 moveq #0,d6               ;un-hilight the character
 jsr _LVOTLUgrabrport(a6)

; go as required by the message

 movem.l (a7)+,d0-d1/d7/a3 ;pop lhs/rhs/tab/addr

 move.l im_Class(a2),d2       ;quit if newsize, closewindow
 cmp.l #IDCMP_IDCMPUPDATE,d2
 beq .draw
 cmp.l #IDCMP_NEWSIZE,d2
 beq .draw
 cmp.l #IDCMP_CLOSEWINDOW,d2
 beq .draw
 cmp.l #IDCMP_MOUSEBUTTONS,d2 ;go if maybe lmb
 beq .lmb
 cmp.l #IDCMP_RAWKEY,d2       ;go if maybe left/right arrow
 beq .raw
 cmp.l #IDCMP_VANILLAKEY,d2   ;quit if Esc
 bne .digi
 move.w im_Code(a2),d3
 cmp.w #$001B,d3
 beq .draw
 bra .digi                    ;else ignore, get next message

; here if vanillakey

.vani:

; see if 0-9/A-F/a-f

 move.w im_Code(a2),d7
 cmp.w #'a',d7             ;see if 0-9/A-F/a-f
 bcs.s .ec2
 cmp.w #'g',d7
 bcc .epop
 sub.w #'a'-'A',d7
 move.w d7,im_Code(a2)
.ec2:
 cmp.w #'A',d7
 bcs.s .ec3
 cmp.w #'G',d7
 bcc .epop
 sub.w #'A'-':',d7
.ec3:
 sub.w #'0',d7
 bcs .epop
 cmp.w #16,d7
 bcc .epop

; if yes, print the new character, unhighlighted

 move.w im_Code(a2),d4     ;if yes, d4 = new chr
 move.l .ubase(a5),a6
 moveq #1,d5               ;which print, unhilighted
 moveq #0,d6
 jsr _LVOTLUgrabrport(a6)

 move.w d7,d3              ;d3 = 0-F as input
 movem.l (a7)+,d0-d1/d7/a3 ;pop lhs/rhs/tab/addr

; poke the new digit into the .val

 move.w #$FFF0,d4
 moveq #3,d6               ;d7 = 0    1    2    3
 sub.w d7,d6               ;d6 = 3    2    1    0
 lsl.w #2,d6               ;d6 = C    8    4    0
 lsl.w d6,d3               ;d3 = x... .x.. ..x. ...x
 rol.w d6,d4               ;d4 = 0FFF F0FF FF0F FFF0
 move.w (a3),d6            ;d6 = abcd abcd abcd abcd
 and.w d4,d6               ;d6 = 0bcd a0cd ab0d abc0
 or.w d3,d6                ;d6 = xbcd axbc abxd abcx
 move.w d6,(a3)
.ra:
 cmp.w #3,d7               ;bump tab (max 3)
 beq .digi
 addq.w #1,d7
 bra .digi                 ;go get next response

; here if rawkey - see if left/right arrow

.raw:
 move.w im_Code(a2),d3
 cmp.w #$004E,d3           ;go bump tab if right arrow
 beq .ra
 cmp.w #$004F,d3
 bne .digi
 tst.w d7                  ;dec tab if left arrow
 beq .digi
 subq.w #1,d7
 bra .digi

; here if mousbuttons - go process if LMB

.lmb:
 cmp.w #$0068,im_Code(a2)  ;try again unless LMB
 bne .digi
 bra .emes                 ;go process as LMB

* data for TLFontmaker

.flnam: dc.b 'diskfont.library',0
.fbase: ds.l 1


*>> presets (192 bytes per item)

.pres:

; 1 ISO8859-1  Latin1  West European

 dc.w $00A0,$00A1,$00A2,$00A3,$00A4,$00A5,$00A6,$00A7 ; A0-A7
 dc.w $00A8,$00A9,$00AA,$00AB,$00AC,$00AD,$00AE,$00AF ; A8-AF
 dc.w $00B0,$00B1,$00B2,$00B3,$00B4,$00B5,$00B6,$00B7 ; B0-B7
 dc.w $00B8,$00B9,$00BA,$00BB,$00BC,$00BD,$00BE,$00BF ; B8-BF
 dc.w $00C0,$00C1,$00C2,$00C3,$00C4,$00C5,$00C6,$00C7 ; C0-C7
 dc.w $00C8,$00C9,$00CA,$00CB,$00CC,$00CD,$00CE,$00CF ; C8-CF
 dc.w $00D0,$00D1,$00D2,$00D3,$00D4,$00D5,$00D6,$00D7 ; D0-D7
 dc.w $00D8,$00D9,$00DA,$00DB,$00DC,$00DD,$00DE,$00DF ; D8-DF
 dc.w $00E0,$00D1,$00E2,$00E3,$00E4,$00E5,$00E6,$00E7 ; E0-E7
 dc.w $00E8,$00E9,$00EA,$00EB,$00EC,$00ED,$00EE,$00EF ; E8-EF
 dc.w $00F0,$00F1,$00F2,$00F3,$00F4,$00F5,$00F6,$00F7 ; F0-F7
 dc.w $00F8,$00F9,$00FA,$00FB,$00FC,$00FD,$00FE,$00FF ; F8-FF

; 2 ISO8859-2 Latin2  East European

 dc.w $00A0,$0104,$02D8,$0141,$00A4,$013D,$015A,$00A7 ; A0-A7
 dc.w $00A8,$0160,$015E,$0164,$0179,$00AD,$017D,$017B ; A8-AF
 dc.w $00B0,$0105,$02DB,$0142,$00B4,$013E,$015B,$02C7 ; B0-B7
 dc.w $00B8,$0161,$015F,$0165,$017A,$02DD,$017E,$017C ; B8-BF
 dc.w $0154,$00C1,$00C2,$0102,$00C4,$0139,$0106,$00C7 ; C0-C7
 dc.w $010C,$00C9,$0118,$00CB,$011A,$00CD,$00CE,$010E ; C8-CF
 dc.w $0110,$0143,$0147,$00D3,$00D4,$0150,$00D6,$00D7 ; D0-D7
 dc.w $0158,$016E,$00DA,$0170,$00DC,$00DD,$0162,$00DF ; D8-DF
 dc.w $0155,$00E1,$00E2,$0103,$00E4,$013A,$0107,$00E7 ; E0-E7
 dc.w $010D,$00E9,$0119,$00EB,$011B,$00ED,$00EE,$010F ; E8-EF
 dc.w $0111,$0144,$0148,$00F3,$00F4,$0151,$00F6,$00F7 ; F0-F7
 dc.w $0159,$016F,$00FA,$0171,$00FC,$00FD,$0163,$02D9 ; F8-FF

; 3 ISO8859-3  Latin3  South European

 dc.w $00A0,$0126,$02D8,$00A3,$00A4,$00A5,$0124,$00A7 ; A0-A7
 dc.w $00A8,$0130,$015E,$011E,$0134,$00AD,$00AE,$017B ; A8-AF
 dc.w $00B0,$0127,$00B2,$00B3,$00B4,$00B5,$0125,$00B7 ; B0-B7
 dc.w $00B8,$0131,$015F,$011F,$0135,$00BD,$00BE,$017C ; B8-BF
 dc.w $00C0,$00C1,$00C2,$00C3,$00C4,$010A,$0108,$00C7 ; C0-C7
 dc.w $00C8,$00C9,$00CA,$00CB,$00CC,$00CD,$00CE,$00CF ; C8-CF
 dc.w $00D0,$00D1,$00D2,$00D3,$00D4,$0120,$00D6,$00D7 ; D0-D7
 dc.w $011C,$00D9,$00DA,$00DB,$00DC,$016C,$015C,$00DF ; D8-DF
 dc.w $00E0,$00E1,$00E2,$00E3,$00E4,$010B,$0109,$00E7 ; E0-E7
 dc.w $00E8,$00E9,$00EA,$00EB,$00EC,$00ED,$00EE,$00EF ; E8-EF
 dc.w $00F0,$00F1,$00F2,$00F3,$00F4,$0121,$00F6,$00F7 ; F0-F7
 dc.w $011D,$00F9,$00FA,$00FB,$00FC,$016D,$015D,$02D9 ; F8-FF

; 4 ISO8859-4  Latin4  North European

 dc.w $00A0,$0104,$0138,$0156,$00A4,$0128,$013B,$00A7 ; A0-A7
 dc.w $00A8,$0160,$0112,$0122,$0166,$00AD,$017D,$00AF ; A8-AF
 dc.w $00B0,$0105,$02DB,$0157,$00B4,$0129,$013C,$02C7 ; B0-B7
 dc.w $00B8,$0161,$0113,$0123,$0167,$014A,$017E,$014B ; B8-BF
 dc.w $0100,$00C1,$00C2,$00C3,$00C4,$00C5,$00C6,$012E ; D0-C7
 dc.w $010C,$00C9,$0118,$00CB,$0116,$00CD,$00CE,$012A ; C8-CF
 dc.w $0110,$0145,$014C,$0136,$00D4,$00D5,$00D6,$00D7 ; D0-D7
 dc.w $00D8,$0172,$00DA,$00DB,$00DC,$0168,$016A,$00DF ; D8-DF
 dc.w $0101,$00E1,$00E2,$00E3,$00E4,$00E5,$00E6,$012F ; E0-E7
 dc.w $010D,$00E9,$0119,$00EB,$0117,$00ED,$00EE,$012B ; E8-EF
 dc.w $0111,$0146,$014D,$0137,$00F4,$00F5,$00F6,$00F7 ; F0-F7
 dc.w $00F8,$0173,$00FA,$00FB,$00FC,$0169,$016B,$02D9 ; F8-FF

; 5 ISO8859-5  Cyrillic

 dc.w $00A0,$0401,$0402,$0403,$0404,$0405,$0406,$0407 ; A0-A7
 dc.w $0408,$0409,$040A,$040B,$040C,$00AD,$040E,$040F ; A8-AF
 dc.w $0410,$0411,$0412,$0413,$0414,$0415,$0416,$0417 ; B0-B7
 dc.w $0418,$0419,$041A,$041B,$041C,$041D,$041E,$041F ; B8-BF
 dc.w $0420,$0421,$0422,$0423,$0424,$0425,$0426,$0427 ; C0-C7
 dc.w $0428,$0429,$042A,$042B,$042C,$042D,$042E,$042F ; C8-CF
 dc.w $0430,$0431,$0432,$0433,$0434,$0435,$0436,$0437 ; D0-D7
 dc.w $0438,$0439,$043A,$043B,$043C,$043D,$043E,$043F ; D8-DF
 dc.w $0440,$0441,$0442,$0443,$0444,$0445,$0446,$0447 ; E0-E7
 dc.w $0448,$0449,$044A,$044B,$044C,$044D,$044E,$044F ; E8-EF
 dc.w $2116,$0451,$0452,$0453,$0454,$0455,$0456,$0457 ; F0-F7
 dc.w $0458,$0459,$045A,$045B,$045C,$00A7,$045E,$045F ; F8-FF

; 6 ISO8859-6  Arabic

 dc.w $00A0,$00A1,$00A2,$00A3,$00A4,$00A5,$00A6,$00A7 ; A0-A7
 dc.w $00A8,$00A9,$00AA,$00AB,$060C,$00AD,$00AE,$00AF ; A8-AF
 dc.w $00B0,$00B1,$00B2,$00B3,$00B4,$00B5,$00B6,$00B7 ; B0-B7
 dc.w $00B8,$00B9,$00BA,$061B,$00BC,$00BD,$00BE,$061F ; B8-BF
 dc.w $00C0,$0621,$0622,$0623,$0624,$0625,$0626,$0627 ; C0-C7
 dc.w $0628,$0629,$062A,$062B,$062C,$062D,$062E,$062F ; C8-CF
 dc.w $0630,$0631,$0632,$0633,$0634,$0635,$0636,$0637 ; D0-D7
 dc.w $0638,$0639,$063A,$00DB,$00DC,$00DD,$00DE,$00DF ; D8-DF
 dc.w $0640,$0641,$0642,$0643,$0644,$0645,$0646,$0647 ; E0-E7
 dc.w $0648,$0649,$064A,$064B,$064C,$064D,$064E,$064F ; E8-EF
 dc.w $0650,$0651,$0652,$00F3,$00F4,$00F5,$00F6,$00F7 ; D0-F7
 dc.w $00F8,$00F9,$00FA,$00FB,$00FC,$00FD,$00FE,$00FF ; F8-FF

; 7 ISO8859-7  Greek

 dc.w $00A0,$2018,$00A3,$00A4,$00A5,$00A6,$00A7,$00A8 ; A0-A7
 dc.w $00A8,$00A9,$00AA,$00AB,$00AC,$00AD,$00AE,$00AF ; A8-AF
 dc.w $00B0,$00B1,$00B2,$00B3,$0384,$0385,$0386,$0387 ; B0-B7
 dc.w $0388,$0389,$038A,$00BB,$038C,$00BD,$038E,$038F ; B8-BF
 dc.w $0390,$0391,$0392,$0393,$0394,$0395,$0396,$0397 ; C0-C7
 dc.w $0398,$0399,$039A,$039B,$039C,$039D,$039E,$039F ; C8-CF
 dc.w $03A0,$03A1,$00D2,$03A3,$03A4,$03A5,$03A6,$03A7 ; D0-D7
 dc.w $03A8,$03A9,$03AA,$03AB,$03AC,$03AD,$03AE,$03AF ; D8-DF
 dc.w $03B0,$03B1,$03B2,$03B3,$03B4,$03B5,$03B6,$03B7 ; E0-E7
 dc.w $03B8,$03B9,$03BA,$03BB,$03BC,$03BD,$03BE,$03BF ; E8-FF
 dc.w $03C0,$03C1,$03C2,$03C3,$03C4,$03C5,$03C6,$03C7 ; F0-F7
 dc.w $03C8,$03C9,$03CA,$03CB,$03CC,$03CD,$03CE,$00FF ; F8-FF

; 8 ISO8859-8  Hebrew

 dc.w $00A0,$00A1,$00A2,$00A3,$00A4,$00A5,$00A6,$00A7 ; A0-A7
 dc.w $00A8,$00A9,$00D7,$00AB,$00AC,$00AD,$00AE,$00AF ; A8-AF
 dc.w $00B0,$00B1,$00B2,$00B3,$00B4,$00B5,$00B6,$00B7 ; B0-B7
 dc.w $00B8,$00B9,$00F7,$00BB,$00BC,$00BD,$00BE,$00BF ; B8-BF
 dc.w $00C0,$00C1,$00C2,$00C3,$00C4,$00C5,$00C6,$00C7 ; C0-C7
 dc.w $00C8,$00C9,$00CA,$00CB,$00CC,$00CD,$00CE,$00CF ; C8-CF
 dc.w $00D0,$00D1,$00D2,$00D3,$00D4,$00D5,$00D6,$00D7 ; D0-D7
 dc.w $00D8,$00D9,$00DA,$00DB,$00DC,$00DD,$00DE,$0333 ; D8-DF
 dc.w $05D0,$05D1,$05D2,$05D3,$05D4,$05D5,$05D6,$05D7 ; E0-E7
 dc.w $05D8,$05D9,$05DA,$05DB,$05DC,$05DD,$05DE,$05DF ; E8-EF
 dc.w $05E0,$05E1,$05E2,$05E3,$05E4,$05E5,$05E6,$05E7 ; F0-F7
 dc.w $05E8,$05E9,$05EA,$00FB,$00FC,$00FD,$00FE,$00FF ; F8-FF

; 9 ISO8859-9  Latin5  Turkish

 dc.w $00A0,$00A1,$00A2,$00A3,$00A4,$00A5,$00A6,$00A7 ; A0-A7
 dc.w $00A8,$00A9,$00AA,$00AB,$00AC,$00AD,$00AE,$00AF ; A8-AF
 dc.w $00B0,$00B1,$00B2,$00B3,$00B4,$00B5,$00B6,$00B7 ; B0-B7
 dc.w $00B8,$00B9,$00BA,$00BB,$00BC,$00BD,$00BE,$00BF ; B8-BF
 dc.w $00C0,$00C1,$00C2,$00C3,$00C4,$00C5,$00C6,$00C7 ; C0-C7
 dc.w $00C8,$00C9,$00CA,$00CB,$00CC,$00CD,$00CE,$00CF ; C8-CF
 dc.w $011E,$00D1,$00D2,$00D3,$00D4,$00D5,$00D6,$00D7 ; D0-D7
 dc.w $00D8,$00D9,$00DA,$00DB,$00DC,$0130,$015E,$00DF ; D8-DF
 dc.w $00E0,$00D1,$00E2,$00E3,$00E4,$00E5,$00E6,$00E7 ; E0-E7
 dc.w $00E8,$00E9,$00EA,$00EB,$00EC,$00ED,$00EE,$00EF ; E8-EF
 dc.w $011F,$00F1,$00F2,$00F3,$00F4,$00F5,$00F6,$00F7 ; F0-F7
 dc.w $00F8,$00F9,$00FA,$00FB,$00FC,$0131,$015F,$00FF ; F8-FF

; 10 ISO8859-10  Latin6  Nordish

 dc.w $00A0,$0104,$0112,$0122,$012A,$0128,$0136,$00A7 ; A0-A7
 dc.w $013B,$0110,$0160,$0166,$017D,$00AD,$016A,$014A ; A8-AF
 dc.w $00B0,$0105,$0113,$0123,$012B,$0129,$0137,$00B7 ; B0-B7
 dc.w $013C,$0111,$0161,$0167,$017E,$00AF,$016B,$014B ; B8-BF
 dc.w $0100,$00C1,$00C2,$00C3,$00C4,$00C5,$00C6,$012E ; C0-C7
 dc.w $010C,$00C9,$0118,$00CB,$0116,$00CD,$00CE,$00CF ; C8-CF
 dc.w $011E,$0145,$014C,$00D3,$00D4,$00D5,$00D6,$0168 ; D0-D7
 dc.w $00D8,$0172,$00DA,$00DB,$00DC,$00DD,$00DE,$00DF ; D8-DF
 dc.w $0101,$00D1,$00E2,$00E3,$00E4,$00E5,$00E6,$012F ; E0-E7
 dc.w $010D,$00E9,$0119,$00EB,$0117,$00ED,$00EE,$00EF ; E8-EF
 dc.w $00F0,$00F1,$014D,$00F3,$00F4,$00F5,$00F6,$0169 ; F0-F7
 dc.w $00F8,$0173,$00FA,$00FB,$00FC,$00FD,$00FE,$0138 ; F8-FF

; 11 ISO8859-11  Thai

 dc.w $00A0,$0E01,$0E02,$0E03,$0E04,$0E05,$0E06,$0E07 ; A0-A7
 dc.w $0E08,$0E09,$0E0A,$0E0B,$0E0C,$0E0D,$0E0E,$0E0F ; A8-AF
 dc.w $0E10,$0E11,$0E12,$0E13,$0E14,$0E15,$0E16,$0E17 ; B0-B7
 dc.w $0E18,$0E19,$0E1A,$0E1B,$0E1C,$0E1D,$0E1E,$0E1F ; B8-BF
 dc.w $0E20,$0E21,$0E22,$0E23,$0E24,$0E25,$0E26,$0E27 ; C0-C7
 dc.w $0E28,$0E29,$0E2A,$0E2B,$0E2C,$0E2D,$0E2E,$0E2F ; C8-CF
 dc.w $0E30,$0E31,$0E32,$0E33,$0E34,$0E35,$0E36,$0E37 ; D0-D7
 dc.w $0E38,$0E39,$033A,$00DB,$00DC,$00DD,$00DE,$0E3F ; D8-DF
 dc.w $0E40,$0E41,$0E42,$0E43,$0E44,$0E45,$0E46,$0E47 ; E0-E7
 dc.w $0E48,$0E49,$0E4A,$0E4B,$0E4C,$0E4D,$0E4E,$0E4F ; E8-EF
 dc.w $0E50,$0E51,$0E52,$0E53,$0E54,$0E55,$0E56,$0E57 ; F0-F7
 dc.w $0E58,$0E59,$0E5A,$0E5B,$00FC,$00FD,$00FE,$00FF ; F8-FF

; 12 ISO8859-12  (Unimplemented)

 dc.w $00A0,$00A1,$00A2,$00A3,$00A4,$00A5,$00A6,$00A7 ; A0-A7
 dc.w $00A8,$00A9,$00AA,$00AB,$00AC,$00AD,$00AE,$00AF ; A8-AF
 dc.w $00B0,$00B1,$00B2,$00B3,$00B4,$00B5,$00B6,$00B7 ; B0-B7
 dc.w $00B8,$00B9,$00BA,$00BB,$00BC,$00BD,$00BE,$00BF ; B8-BF
 dc.w $00C0,$00C1,$00C2,$00C3,$00C4,$00C5,$00C6,$00C7 ; C0-C7
 dc.w $00C8,$00C9,$00CA,$00CB,$00CC,$00CD,$00CE,$00CF ; C8-CF
 dc.w $00D0,$00D1,$00D2,$00D3,$00D4,$00D5,$00D6,$00D7 ; D0-D7
 dc.w $00D8,$00D9,$00DA,$00DB,$00DC,$00DD,$00DE,$00DF ; D8-DF
 dc.w $00E0,$00D1,$00E2,$00E3,$00E4,$00E5,$00E6,$00E7 ; E0-E7
 dc.w $00E8,$00E9,$00EA,$00EB,$00EC,$00ED,$00EE,$00EF ; E8-EF
 dc.w $00F0,$00F1,$00F2,$00F3,$00F4,$00F5,$00F6,$00F7 ; F0-F7
 dc.w $00F8,$00F9,$00FA,$00FB,$00FC,$00FD,$00FE,$00FF ; F8-FF

; 13 ISO8859-13  Latin7

 dc.w $00A0,$201D,$00A2,$00A3,$00A4,$201E,$00A6,$00A7 ; A0-A7
 dc.w $00D8,$00A9,$0156,$00AB,$00AC,$00AD,$00AE,$00C6 ; A8-AF
 dc.w $00B0,$00B1,$00B2,$00B3,$201C,$00B5,$00B6,$00B7 ; B0-B7
 dc.w $00D8,$00B9,$0157,$00BB,$00BC,$00BD,$00BE,$00E6 ; B8-BF
 dc.w $0104,$012E,$0100,$0106,$00C4,$00C5,$0118,$00C9 ; C0-C7
 dc.w $010C,$00E9,$0179,$0116,$0122,$0136,$012A,$013B ; C8-CF
 dc.w $0160,$0143,$0145,$00D3,$014C,$00D5,$00D6,$00D7 ; D0-D7
 dc.w $0172,$0141,$015A,$0168,$00DC,$017B,$017D,$00DF ; D8-DF
 dc.w $0105,$012F,$0101,$0107,$00E4,$00E5,$0119,$0113 ; E0-E7
 dc.w $010D,$00E9,$017A,$0117,$0123,$0137,$012B,$013C ; E8-EF
 dc.w $0175,$00F1,$00F2,$00F3,$00F4,$00F5,$00F6,$1E6B ; F0-F7
 dc.w $00F8,$00F9,$00FA,$00FB,$00FC,$00FD,$0177,$00FF ; F8-FF

; 14 ISO8859-14  Latin8

 dc.w $00A0,$1E04,$1E05,$00A3,$010A,$010B,$1E0A,$00A7 ; A0-A7
 dc.w $1E80,$00A9,$1E82,$1E0B,$1EF2,$00AD,$00AE,$0178 ; A8-AF
 dc.w $1E1E,$1E1F,$0120,$0121,$1E40,$1E41,$00B6,$1E86 ; B0-B7
 dc.w $1E81,$1E57,$1E83,$1E60,$1EF3,$1E84,$1E85,$1E61 ; B8-BF
 dc.w $00C0,$00C1,$00C2,$00C3,$00C4,$00C5,$00C6,$00C7 ; C0-C7
 dc.w $00C8,$00C9,$00CA,$00CB,$00CC,$00CD,$00CE,$00CF ; C8-CF
 dc.w $0174,$00D1,$00D2,$00D3,$00D4,$00D5,$00D6,$1E6A ; D0-D7
 dc.w $00D8,$00D9,$00DA,$00DB,$00DC,$00DD,$0176,$00DF ; D8-DF
 dc.w $00E0,$00D1,$00E2,$00E3,$00E4,$00E5,$00E6,$00E7 ; E0-E7
 dc.w $00E8,$00E9,$00EA,$00EB,$00EC,$00ED,$00EE,$00EF ; E8-EF
 dc.w $0175,$00F1,$00F2,$00F3,$00F4,$00F5,$00F6,$1E6B ; F0-F7
 dc.w $00F8,$00F9,$00FA,$00FB,$00FC,$00FD,$0177,$00FF ; F8-FF

; 15 ISO8859-15  Latin 9

 dc.w $00A0,$00A1,$00A2,$00A3,$20AC,$00A5,$0160,$00A7 ; A0-A7
 dc.w $0161,$00A9,$00AA,$00AB,$00AC,$00AD,$00AE,$00AF ; A8-AF
 dc.w $00B0,$00B1,$00B2,$00B3,$017D,$00B5,$00B6,$00B7 ; B0-B7
 dc.w $017E,$00B9,$00BA,$00BB,$0152,$0153,$0178,$00BF ; B8-BF
 dc.w $00C0,$00C1,$00C2,$00C3,$00C4,$00C5,$00C6,$00C7 ; C0-C7
 dc.w $00C8,$00C9,$00CA,$00CB,$00CC,$00CD,$00CE,$00CF ; C8-CF
 dc.w $00D0,$00D1,$00D2,$00D3,$00D4,$00D5,$00D6,$00D7 ; D0-D7
 dc.w $00D8,$00D9,$00DA,$00DB,$00DC,$00DD,$00DE,$00DF ; D8-DF
 dc.w $00E0,$00D1,$00E2,$00E3,$00E4,$00E5,$00E6,$00E7 ; E0-E7
 dc.w $00E8,$00E9,$00EA,$00EB,$00EC,$00ED,$00EE,$00EF ; E8-EF
 dc.w $00F0,$00F1,$00F2,$00F3,$00F4,$00F5,$00F6,$00F7 ; F0-F7
 dc.w $00F8,$00F9,$00FA,$00FB,$00FC,$00FD,$00FE,$00FF ; F8-FF

; 16 (Unimplemented)

 dc.w $00A0,$00A1,$00A2,$00A3,$00A4,$00A5,$00A6,$00A7 ; A0-A7
 dc.w $00A8,$00A9,$00AA,$00AB,$00AC,$00AD,$00AE,$00AF ; A8-AF
 dc.w $00B0,$00B1,$00B2,$00B3,$00B4,$00B5,$00B6,$00B7 ; B0-B7
 dc.w $00B8,$00B9,$00BA,$00BB,$00BC,$00BD,$00BE,$00BF ; B8-BF
 dc.w $00C0,$00C1,$00C2,$00C3,$00C4,$00C5,$00C6,$00C7 ; C0-C7
 dc.w $00C8,$00C9,$00CA,$00CB,$00CC,$00CD,$00CE,$00CF ; C8-CF
 dc.w $00D0,$00D1,$00D2,$00D3,$00D4,$00D5,$00D6,$00D7 ; D0-D7
 dc.w $00D8,$00D9,$00DA,$00DB,$00DC,$00DD,$00DE,$00DF ; D8-DF
 dc.w $00E0,$00D1,$00E2,$00E3,$00E4,$00E5,$00E6,$00E7 ; E0-E7
 dc.w $00E8,$00E9,$00EA,$00EB,$00EC,$00ED,$00EE,$00EF ; E8-EF
 dc.w $00F0,$00F1,$00F2,$00F3,$00F4,$00F5,$00F6,$00F7 ; F0-F7
 dc.w $00F8,$00F9,$00FA,$00FB,$00FC,$00FD,$00FE,$00FF ; F8-FF

; 17 (Unimplemented)

 dc.w $00A0,$00A1,$00A2,$00A3,$00A4,$00A5,$00A6,$00A7 ; A0-A7
 dc.w $00A8,$00A9,$00AA,$00AB,$00AC,$00AD,$00AE,$00AF ; A8-AF
 dc.w $00B0,$00B1,$00B2,$00B3,$00B4,$00B5,$00B6,$00B7 ; B0-B7
 dc.w $00B8,$00B9,$00BA,$00BB,$00BC,$00BD,$00BE,$00BF ; B8-BF
 dc.w $00C0,$00C1,$00C2,$00C3,$00C4,$00C5,$00C6,$00C7 ; C0-C7
 dc.w $00C8,$00C9,$00CA,$00CB,$00CC,$00CD,$00CE,$00CF ; C8-CF
 dc.w $00D0,$00D1,$00D2,$00D3,$00D4,$00D5,$00D6,$00D7 ; D0-D7
 dc.w $00D8,$00D9,$00DA,$00DB,$00DC,$00DD,$00DE,$00DF ; D8-DF
 dc.w $00E0,$00D1,$00E2,$00E3,$00E4,$00E5,$00E6,$00E7 ; E0-E7
 dc.w $00E8,$00E9,$00EA,$00EB,$00EC,$00ED,$00EE,$00EF ; E8-EF
 dc.w $00F0,$00F1,$00F2,$00F3,$00F4,$00F5,$00F6,$00F7 ; F0-F7
 dc.w $00F8,$00F9,$00FA,$00FB,$00FC,$00FD,$00FE,$00FF ; F8-FF

; 18 (Unimplemented)

 dc.w $00A0,$00A1,$00A2,$00A3,$00A4,$00A5,$00A6,$00A7 ; A0-A7
 dc.w $00A8,$00A9,$00AA,$00AB,$00AC,$00AD,$00AE,$00AF ; A8-AF
 dc.w $00B0,$00B1,$00B2,$00B3,$00B4,$00B5,$00B6,$00B7 ; B0-B7
 dc.w $00B8,$00B9,$00BA,$00BB,$00BC,$00BD,$00BE,$00BF ; B8-BF
 dc.w $00C0,$00C1,$00C2,$00C3,$00C4,$00C5,$00C6,$00C7 ; C0-C7
 dc.w $00C8,$00C9,$00CA,$00CB,$00CC,$00CD,$00CE,$00CF ; C8-CF
 dc.w $00D0,$00D1,$00D2,$00D3,$00D4,$00D5,$00D6,$00D7 ; D0-D7
 dc.w $00D8,$00D9,$00DA,$00DB,$00DC,$00DD,$00DE,$00DF ; D8-DF
 dc.w $00E0,$00D1,$00E2,$00E3,$00E4,$00E5,$00E6,$00E7 ; E0-E7
 dc.w $00E8,$00E9,$00EA,$00EB,$00EC,$00ED,$00EE,$00EF ; E8-EF
 dc.w $00F0,$00F1,$00F2,$00F3,$00F4,$00F5,$00F6,$00F7 ; F0-F7
 dc.w $00F8,$00F9,$00FA,$00FB,$00FC,$00FD,$00FE,$00FF ; F8-FF

; 19 (Unimplemented)

 dc.w $00A0,$00A1,$00A2,$00A3,$00A4,$00A5,$00A6,$00A7 ; A0-A7
 dc.w $00A8,$00A9,$00AA,$00AB,$00AC,$00AD,$00AE,$00AF ; A8-AF
 dc.w $00B0,$00B1,$00B2,$00B3,$00B4,$00B5,$00B6,$00B7 ; B0-B7
 dc.w $00B8,$00B9,$00BA,$00BB,$00BC,$00BD,$00BE,$00BF ; B8-BF
 dc.w $00C0,$00C1,$00C2,$00C3,$00C4,$00C5,$00C6,$00C7 ; C0-C7
 dc.w $00C8,$00C9,$00CA,$00CB,$00CC,$00CD,$00CE,$00CF ; C8-CF
 dc.w $00D0,$00D1,$00D2,$00D3,$00D4,$00D5,$00D6,$00D7 ; D0-D7
 dc.w $00D8,$00D9,$00DA,$00DB,$00DC,$00DD,$00DE,$00DF ; D8-DF
 dc.w $00E0,$00D1,$00E2,$00E3,$00E4,$00E5,$00E6,$00E7 ; E0-E7
 dc.w $00E8,$00E9,$00EA,$00EB,$00EC,$00ED,$00EE,$00EF ; E8-EF
 dc.w $00F0,$00F1,$00F2,$00F3,$00F4,$00F5,$00F6,$00F7 ; F0-F7
 dc.w $00F8,$00F9,$00FA,$00FB,$00FC,$00FD,$00FE,$00FF ; F8-FF

; 20 (Unimplemented)

 dc.w $00A0,$00A1,$00A2,$00A3,$00A4,$00A5,$00A6,$00A7 ; A0-A7
 dc.w $00A8,$00A9,$00AA,$00AB,$00AC,$00AD,$00AE,$00AF ; A8-AF
 dc.w $00B0,$00B1,$00B2,$00B3,$00B4,$00B5,$00B6,$00B7 ; B0-B7
 dc.w $00B8,$00B9,$00BA,$00BB,$00BC,$00BD,$00BE,$00BF ; B8-BF
 dc.w $00C0,$00C1,$00C2,$00C3,$00C4,$00C5,$00C6,$00C7 ; C0-C7
 dc.w $00C8,$00C9,$00CA,$00CB,$00CC,$00CD,$00CE,$00CF ; C8-CF
 dc.w $00D0,$00D1,$00D2,$00D3,$00D4,$00D5,$00D6,$00D7 ; D0-D7
 dc.w $00D8,$00D9,$00DA,$00DB,$00DC,$00DD,$00DE,$00DF ; D8-DF
 dc.w $00E0,$00D1,$00E2,$00E3,$00E4,$00E5,$00E6,$00E7 ; E0-E7
 dc.w $00E8,$00E9,$00EA,$00EB,$00EC,$00ED,$00EE,$00EF ; E8-EF
 dc.w $00F0,$00F1,$00F2,$00F3,$00F4,$00F5,$00F6,$00F7 ; F0-F7
 dc.w $00F8,$00F9,$00FA,$00FB,$00FC,$00FD,$00FE,$00FF ; F8-FF

; 21  (Unimplemented)

 dc.w $00A0,$00A1,$00A2,$00A3,$00A4,$00A5,$00A6,$00A7 ; A0-A7
 dc.w $00A8,$00A9,$00AA,$00AB,$00AC,$00AD,$00AE,$00AF ; A8-AF
 dc.w $00B0,$00B1,$00B2,$00B3,$00B4,$00B5,$00B6,$00B7 ; B0-B7
 dc.w $00B8,$00B9,$00BA,$00BB,$00BC,$00BD,$00BE,$00BF ; B8-BF
 dc.w $00C0,$00C1,$00C2,$00C3,$00C4,$00C5,$00C6,$00C7 ; C0-C7
 dc.w $00C8,$00C9,$00CA,$00CB,$00CC,$00CD,$00CE,$00CF ; C8-CF
 dc.w $00D0,$00D1,$00D2,$00D3,$00D4,$00D5,$00D6,$00D7 ; D0-D7
 dc.w $00D8,$00D9,$00DA,$00DB,$00DC,$00DD,$00DE,$00DF ; D8-DF
 dc.w $00E0,$00D1,$00E2,$00E3,$00E4,$00E5,$00E6,$00E7 ; E0-E7
 dc.w $00E8,$00E9,$00EA,$00EB,$00EC,$00ED,$00EE,$00EF ; E8-EF
 dc.w $00F0,$00F1,$00F2,$00F3,$00F4,$00F5,$00F6,$00F7 ; F0-F7
 dc.w $00F8,$00F9,$00FA,$00FB,$00FC,$00FD,$00FE,$00FF ; F8-FF

; 22  KOI-8  Russian

 dc.w $00A0,$00A1,$00A2,$0451,$00A4,$00A5,$00A6,$00A7 ; A0-A7
 dc.w $00A8,$00A9,$00AA,$00AB,$00AC,$00AD,$00AE,$00AF ; A8-AF
 dc.w $00B0,$00B1,$00B2,$0401,$00B4,$00B5,$00B6,$00B7 ; B0-B7
 dc.w $00B8,$00B9,$00BA,$00BB,$00BC,$00BD,$00BE,$00BF ; B8-BF
 dc.w $044E,$0430,$0431,$0446,$0434,$0435,$0444,$0433 ; C0-C7
 dc.w $0445,$0438,$0439,$043A,$0459,$043C,$043D,$043E ; C8-CF
 dc.w $043F,$044F,$0440,$0441,$0442,$0443,$0436,$0432 ; D0-D7
 dc.w $044C,$044B,$0437,$0448,$044D,$0449,$0447,$042A ; D8-DF
 dc.w $042E,$0410,$0426,$0426,$0414,$0415,$0424,$041D ; E0-E7
 dc.w $0425,$0418,$0419,$041A,$0409,$041C,$041D,$041E ; E8-EF
 dc.w $041F,$042F,$0420,$0421,$0422,$0423,$0416,$0412 ; F0-F7
 dc.w $042C,$042B,$0417,$0428,$042D,$0429,$0427,$044A ; F8-FF

; 23  ISCII-1  Devanagari

 dc.w $00A0,$0901,$0902,$0903,$0904,$0905,$0906,$0907 ; A0-A7
 dc.w $0908,$0909,$090A,$090B,$090C,$090D,$090E,$090F ; A8-AF
 dc.w $0910,$0911,$0912,$0913,$0914,$0915,$0916,$0917 ; B0-B7
 dc.w $0918,$0919,$091A,$091B,$091C,$091D,$091E,$091F ; B8-BF
 dc.w $0920,$0921,$0922,$0923,$0924,$0925,$0926,$0927 ; C0-C7
 dc.w $0928,$0929,$092A,$092B,$092C,$092D,$092E,$092F ; C8-CF
 dc.w $0930,$0931,$0932,$0933,$0934,$0935,$0936,$0937 ; D0-D7
 dc.w $0938,$0939,$093A,$093B,$093C,$093D,$093E,$093F ; D8-DF
 dc.w $0940,$0941,$0942,$0943,$0944,$0945,$0946,$0947 ; E0-E7
 dc.w $0948,$0949,$094A,$094B,$094C,$094D,$094E,$094F ; E8-EF
 dc.w $0950,$0951,$0952,$0953,$0954,$0955,$0956,$0957 ; F0-F7
 dc.w $0958,$0959,$095A,$095B,$095C,$095D,$095E,$095F ; F8-FF

; 24  ISCII-2  Bengali

 dc.w $00A0,$0981,$0982,$0983,$0984,$0985,$0986,$0987 ; A0-A7
 dc.w $0988,$0989,$098A,$098B,$098C,$098D,$098E,$098F ; A8-AF
 dc.w $0990,$0991,$0992,$0993,$0994,$0995,$0996,$0997 ; B0-B7
 dc.w $0998,$0999,$099A,$099B,$099C,$099D,$099E,$099F ; B8-BF
 dc.w $09A0,$09A1,$09A2,$09A3,$09A4,$09A5,$09A6,$09A7 ; C0-C7
 dc.w $09A8,$09A9,$09AA,$09AB,$09AC,$09AD,$09AE,$09AF ; C8-CF
 dc.w $09B0,$09B1,$09B2,$09B3,$09B4,$09B5,$09B6,$09B7 ; D0-D7
 dc.w $09B8,$09B9,$09BA,$09BB,$09BC,$09BD,$09BE,$09BF ; D8-DF
 dc.w $09C0,$09C1,$09C2,$09C3,$09C4,$09C5,$09C6,$09C7 ; E0-E7
 dc.w $09C8,$09C9,$09CA,$09CB,$09CC,$09CD,$09CE,$09CF ; E8-EF
 dc.w $09D0,$09D1,$09D2,$09D3,$09D4,$09D5,$09D6,$09D7 ; F0-F7
 dc.w $09D8,$09D9,$09DA,$09DB,$09DC,$09DD,$09DE,$09DF ; F8-FF

; 25  ISCII-3  Gurmukhi

 dc.w $00A0,$0A01,$0A02,$0A03,$0A04,$0A05,$0A06,$0A07 ; A0-A7
 dc.w $0A08,$0A09,$0A0A,$0A0B,$0A0C,$0A0D,$0A0E,$0A0F ; A8-AF
 dc.w $0A10,$0A11,$0A12,$0A13,$0A14,$0A15,$0A16,$0A17 ; B0-B7
 dc.w $0A18,$0A19,$0A1A,$0A1B,$0A1C,$0A1D,$0A1E,$0A1F ; B8-BF
 dc.w $0A20,$0A21,$0A22,$0A23,$0A24,$0A25,$0A26,$0A27 ; C0-C7
 dc.w $0A28,$0A29,$0A2A,$0A2B,$0A2C,$0A2D,$0A2E,$0A2F ; C8-CF
 dc.w $0A30,$0A31,$0A32,$0A33,$0A34,$0A35,$0A36,$0A37 ; D0-D7
 dc.w $0A38,$0A39,$0A3A,$0A3B,$0A3C,$0A3D,$0A3E,$0A3F ; D8-DF
 dc.w $0A40,$0A41,$0A42,$0A43,$0A44,$0A45,$0A46,$0A47 ; E0-E7
 dc.w $0A48,$0A49,$0A4A,$0A4B,$0A4C,$0A4D,$0A4E,$0A4F ; E8-EF
 dc.w $0A50,$0A51,$0A52,$0A53,$0A54,$0A55,$0A56,$0A57 ; F0-F7
 dc.w $0A58,$0A59,$0A5A,$0A5B,$0A5C,$0A5D,$0A5E,$0A5F ; F8-FF

; 26  ISCII-4  Gujurati

 dc.w $00A0,$0A81,$0A82,$0A83,$0A84,$0A85,$0A86,$0A87 ; A0-A7
 dc.w $0A88,$0A89,$0A8A,$0A8B,$0A8C,$0A8D,$0A8E,$0A8F ; A8-AF
 dc.w $0A90,$0A91,$0A92,$0A93,$0A94,$0A95,$0A96,$0A97 ; B0-B7
 dc.w $0A98,$0A99,$0A9A,$0A9B,$0A9C,$0A9D,$0A9E,$0A9F ; B8-BF
 dc.w $0AA0,$0AA1,$0AA2,$0AA3,$0AA4,$0AA5,$0AA6,$0AA7 ; C0-C7
 dc.w $0AA8,$0AA9,$0AAA,$0AAB,$0AAC,$0AAD,$0AAE,$0AAF ; C8-CF
 dc.w $0AB0,$0AB1,$0AB2,$0AB3,$0AB4,$0AB5,$0AB6,$0AB7 ; D0-D7
 dc.w $0AB8,$0AB9,$0ABA,$0ABB,$0ABC,$0ABD,$0ABE,$0ABF ; D8-DF
 dc.w $0AC0,$0AC1,$0AC2,$0AC3,$0AC4,$0AC5,$0AC6,$0AC7 ; E0-E7
 dc.w $0AC8,$0AC9,$0ACA,$0ACB,$0ACC,$0ACD,$0ACE,$0ACF ; E8-EF
 dc.w $0AD0,$0AD1,$0AD2,$0AD3,$0AD4,$0AD5,$0AD6,$0AD7 ; F0-F7
 dc.w $0AD8,$0AD9,$0ADA,$0ADB,$0ADC,$0ADD,$0ADE,$0ADF ; F8-FF

; 27  ISCII-5  Oriya

 dc.w $00A0,$0B01,$0B02,$0B03,$0B04,$0B05,$0B06,$0B07 ; A0-A7
 dc.w $0B08,$0B09,$0B0A,$0B0B,$0B0C,$0B0D,$0B0E,$0B0F ; A8-AF
 dc.w $0B10,$0B11,$0B12,$0B13,$0B14,$0B15,$0B16,$0B17 ; B0-B7
 dc.w $0B18,$0B19,$0B1A,$0B1B,$0B1C,$0B1D,$0B1E,$0B1F ; B8-BF
 dc.w $0B20,$0B21,$0B22,$0B23,$0B24,$0B25,$0B26,$0B27 ; C0-C7
 dc.w $0B28,$0B29,$0B2A,$0B2B,$0B2C,$0B2D,$0B2E,$0B2F ; C8-CF
 dc.w $0B30,$0B31,$0B32,$0B33,$0B34,$0B35,$0B36,$0B37 ; D0-D7
 dc.w $0B38,$0B39,$0B3A,$0B3B,$0B3C,$0B3D,$0B3E,$0B3F ; D8-DF
 dc.w $0B40,$0B41,$0B42,$0B43,$0B44,$0B45,$0B46,$0B47 ; E0-E7
 dc.w $0B48,$0B49,$0B4A,$0B4B,$0B4C,$0B4D,$0B4E,$0B4F ; E8-EF
 dc.w $0B50,$0B51,$0B52,$0B53,$0B54,$0B55,$0B56,$0B57 ; F0-F7
 dc.w $0B58,$0B59,$0B5A,$0B5B,$0B5C,$0B5D,$0B5E,$0B5F ; F8-FF

; 28  ISCII-6  Tamil

 dc.w $00A0,$0B81,$0B82,$0B83,$0B84,$0B85,$0B86,$0B87 ; A0-A7
 dc.w $0B88,$0B89,$0B8A,$0B8B,$0B8C,$0B8D,$0B8E,$0B8F ; A8-AF
 dc.w $0B90,$0B91,$0B92,$0B93,$0B94,$0B95,$0B96,$0B97 ; B0-B7
 dc.w $0B98,$0B99,$0B9A,$0B9B,$0B9C,$0B9D,$0B9E,$0B9F ; B8-BF
 dc.w $0BA0,$0BA1,$0BA2,$0BA3,$0BA4,$0BA5,$0BA6,$0BA7 ; C0-C7
 dc.w $0BA8,$0BA9,$0BAA,$0BAB,$0BAC,$0BAD,$0BAE,$0BAF ; C8-CF
 dc.w $0BB0,$0BB1,$0BB2,$0BB3,$0BB4,$0BB5,$0BB6,$0BB7 ; D0-D7
 dc.w $0BB8,$0BB9,$0BBA,$0BBB,$0BBC,$0BBD,$0BBE,$0BBF ; D8-DF
 dc.w $0BC0,$0BC1,$0BC2,$0BC3,$0BC4,$0BC5,$0BC6,$0BC7 ; E0-E7
 dc.w $0BC8,$0BC9,$0BCA,$0BCB,$0BCC,$0BCD,$0BCE,$0BCF ; E8-EF
 dc.w $0BD0,$0BD1,$0BD2,$0BD3,$0BD4,$0BD5,$0BD6,$0BD7 ; F0-F7
 dc.w $0BD8,$0BD9,$0BDA,$0BDB,$0BDC,$0BDD,$0BDE,$0BDF ; F8-FF

; 29  ISCII-7  Telugu

 dc.w $00A0,$0C01,$0C02,$0C03,$0C04,$0C05,$0C06,$0C07 ; A0-A7
 dc.w $0C08,$0C09,$0C0A,$0C0B,$0C0C,$0C0D,$0C0E,$0C0F ; A8-AF
 dc.w $0C10,$0C11,$0C12,$0C13,$0C14,$0C15,$0C16,$0C17 ; B0-B7
 dc.w $0C18,$0C19,$0C1A,$0C1B,$0C1C,$0C1D,$0C1E,$0C1F ; B8-BF
 dc.w $0C20,$0C21,$0C22,$0C23,$0C24,$0C25,$0C26,$0C27 ; C0-C7
 dc.w $0C28,$0C29,$0C2A,$0C2B,$0C2C,$0C2D,$0C2E,$0C2F ; C8-CF
 dc.w $0C30,$0C31,$0C32,$0C33,$0C34,$0C35,$0C36,$0C37 ; D0-D7
 dc.w $0C38,$0C39,$0C3A,$0C3B,$0C3C,$0C3D,$0C3E,$0C3F ; D8-DF
 dc.w $0C40,$0C41,$0C42,$0C43,$0C44,$0C45,$0C46,$0C47 ; E0-E7
 dc.w $0C48,$0C49,$0C4A,$0C4B,$0C4C,$0C4D,$0C4E,$0C4F ; E8-EF
 dc.w $0C50,$0C51,$0C52,$0C53,$0C54,$0C55,$0C56,$0C57 ; F0-F7
 dc.w $0C58,$0C59,$0C5A,$0C5B,$0C5C,$0C5D,$0C5E,$0C5F ; F8-FF

; 30  ISCII-8  Kannada

 dc.w $00A0,$0C81,$0C82,$0C83,$0C84,$0C85,$0C86,$0C87 ; A0-A7
 dc.w $0C88,$0C89,$0C8A,$0C8B,$0C8C,$0C8D,$0C8E,$0C8F ; A8-AF
 dc.w $0C90,$0C91,$0C92,$0C93,$0C94,$0C95,$0C96,$0C97 ; B0-B7
 dc.w $0C98,$0C99,$0C9A,$0C9B,$0C9C,$0C9D,$0C9E,$0C9F ; B8-BF
 dc.w $0CA0,$0CA1,$0CA2,$0CA3,$0CA4,$0CA5,$0CA6,$0CA7 ; C0-C7
 dc.w $0CA8,$0CA9,$0CAA,$0CAB,$0CAC,$0CAD,$0CAE,$0CAF ; C8-CF
 dc.w $0CB0,$0CB1,$0CB2,$0CB3,$0CB4,$0CB5,$0CB6,$0CB7 ; D0-D7
 dc.w $0CB8,$0CB9,$0CBA,$0CBB,$0CBC,$0CBD,$0CBE,$0CBF ; D8-DF
 dc.w $0CC0,$0CC1,$0CC2,$0CC3,$0CC4,$0CC5,$0CC6,$0CC7 ; E0-E7
 dc.w $0CC8,$0CC9,$0CCA,$0CCB,$0CCC,$0CCD,$0CCE,$0CCF ; E8-EF
 dc.w $0CD0,$0CD1,$0CD2,$0CD3,$0CD4,$0CD5,$0CD6,$0CD7 ; F0-F7
 dc.w $0CD8,$0CD9,$0CDA,$0CDB,$0CDC,$0CDD,$0CDE,$0CDF ; F8-FF

; 31  ISCII-9  Malayalam

 dc.w $00A0,$0D01,$0D02,$0D03,$0D04,$0D05,$0D06,$0D07 ; A0-A7
 dc.w $0D08,$0D09,$0D0A,$0D0B,$0D0C,$0D0D,$0D0E,$0D0F ; A8-AF
 dc.w $0D10,$0D11,$0D12,$0D13,$0D14,$0D15,$0D16,$0D17 ; B0-B7
 dc.w $0D18,$0D19,$0D1A,$0D1B,$0D1C,$0D1D,$0D1E,$0D1F ; B8-BF
 dc.w $0D20,$0D21,$0D22,$0D23,$0D24,$0D25,$0D26,$0D27 ; C0-C7
 dc.w $0D28,$0D29,$0D2A,$0D2B,$0D2C,$0D2D,$0D2E,$0D2F ; C8-CF
 dc.w $0D30,$0D31,$0D32,$0D33,$0D34,$0D35,$0D36,$0D37 ; D0-D7
 dc.w $0D38,$0D39,$0D3A,$0D3B,$0D3C,$0D3D,$0D3E,$0D3F ; D8-DF
 dc.w $0D40,$0D41,$0D42,$0D43,$0D44,$0D45,$0D46,$0D47 ; E0-E7
 dc.w $0D48,$0D49,$0D4A,$0D4B,$0D4C,$0D4D,$0D4E,$0D4F ; E8-EF
 dc.w $0D50,$0D51,$0D52,$0D53,$0D54,$0D55,$0D56,$0D57 ; F0-F7
 dc.w $0D58,$0D59,$0D5A,$0D5B,$0D5C,$0D5D,$0D5E,$0D5F ; F8-FF

; 32  Misc 1 (Unimplemented)

 dc.w $00A0,$00A1,$00A2,$00A3,$00A4,$00A5,$00A6,$00A7 ; A0-A7
 dc.w $00A8,$00A9,$00AA,$00AB,$00AC,$00AD,$00AE,$00AF ; A8-AF
 dc.w $00B0,$00B1,$00B2,$00B3,$00B4,$00B5,$00B6,$00B7 ; B0-B7
 dc.w $00B8,$00B9,$00BA,$00BB,$00BC,$00BD,$00BE,$00BF ; B8-BF
 dc.w $00C0,$00C1,$00C2,$00C3,$00C4,$00C5,$00C6,$00C7 ; C0-C7
 dc.w $00C8,$00C9,$00CA,$00CB,$00CC,$00CD,$00CE,$00CF ; C8-CF
 dc.w $00D0,$00D1,$00D2,$00D3,$00D4,$00D5,$00D6,$00D7 ; D0-D7
 dc.w $00D8,$00D9,$00DA,$00DB,$00DC,$00DD,$00DE,$00DF ; D8-DF
 dc.w $00E0,$00D1,$00E2,$00E3,$00E4,$00E5,$00E6,$00E7 ; E0-E7
 dc.w $00E8,$00E9,$00EA,$00EB,$00EC,$00ED,$00EE,$00EF ; E8-EF
 dc.w $00F0,$00F1,$00F2,$00F3,$00F4,$00F5,$00F6,$00F7 ; F0-F7
 dc.w $00F8,$00F9,$00FA,$00FB,$00FC,$00FD,$00FE,$00FF ; F8-FF

; spurious Microsoft 01-1F, 80-BF values

.spuu:
 dc.w       $263A,$263B,$2665,$2666,$2663,$2660,$2022 ;01-07  31 words
 dc.w $25D8,$25E6,$25D9,$2642,$2640,$266A,$266B,$263C ;08-0F
 dc.w $25B6,$25C0,$2195,$203C,$00B6,$00A7,$25AC,$21A8 ;10-17
 dc.w $2191,$2193,$2192,$2190,$2310,$2194,$25B2,$25BC ;18-1F ________
 dc.w $00C7,$00FC,$00E9,$00E2,$00E4,$00E0,$00E5,$00E7 ;80-87
 dc.w $00EA,$00EB,$00E8,$00EF,$00EE,$00EC,$00C4,$00C5 ;88-8F
 dc.w $00C9,$00E6,$00C6,$00F4,$00F6,$00F2,$00FB,$00F9 ;90-97  64 words
 dc.w $00FF,$00D6,$00DC,$00A2,$00A3,$00A5,$20A7,$0192 ;98-9F
 dc.w $00E1,$00ED,$00F3,$00FA,$00F1,$00D1,$00AA,$00BA ;A0-A7
 dc.w $00BF,$2310,$00AC,$00BD,$00BC,$00A1,$00AB,$00BB ;A8-AF
 dc.w $2591,$2592,$2593,$2502,$2524,$2561,$2562,$2556 ;B0-B7
 dc.w $2555,$2563,$2551,$2557,$255D,$255C,$255B,$2510 ;B8-BF


; TLD, TLS, and TLL subroutines

 INCLUDE 'UCODE:Includes/tld_stuff.i'
 INCLUDE 'UCODE:Includes/tls_stuff.i'
 INCLUDE 'UCODE:Includes/tll_stuff.i'
