home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
AMOS PD CD
/
amospdcd.iso
/
sourcecode
/
routines
/
fontx.amos
/
fontx.amosSourceCode
< prev
next >
Wrap
AMOS Source Code
|
1992-10-04
|
11KB
|
478 lines
' ---------------------------------
' - -
' - FontX 8*8 Font Editor V1.1 -
' - -
' - By Neil Wright � 1993 -
' - -
' - This version is -
' - Freeware -
' - -
' - -
' ---------------------------------
'
' ---------------------------------------------------------
' - -
' - Shortcuts:- l = load font -
' - s = save font -
' - q = quit -
' - c = clear character set -
' - p = put character into set -
' - g = get character from set -
' - f = fill edit window -
' - e = clear edit window -
' - i = invert character -
' - x = mirror character on x-axis -
' - y = mirror character on y-axis -
' - -
' ---------------------------------------------------------
'
' Consult the help file for instructions
'
' Also consult the Routines directory for some useful text routines
' for you to use and abuse.
'
Change Mouse 3
Flash Off : Curs Off : Cls 0
Unpack 6 To 0
Erase 11
Reserve As Work 11,2048
Reserve Zone 332
'
Dim CHARACTER_SET_X(256),CHARACTER_SET_Y(256)
Dim CHARACTER_X(64),CHARACTER_Y(64)
Dim _VALUE(7),X(64),JON(64)
Global CHARACTER_SET_X(),X(),CHARACTER_SET_Y()
Global CHARACTER_Y(),CHARACTER_X(),_VALUE(),L,CIA,JON(),STCURS
Change Mouse 3
'
Rem *** Set character set zones ***
'
Y=21
Ink 2
For L=0 To 15 : X=15
For C=1 To 16 : N=L*16+C
CHARACTER_SET_X(N)=X : CHARACTER_SET_Y(N)=Y
Set Zone N,X,Y To X+11,Y+11
Add X,11
Next
Add Y,11
Next
'
Y=21
For L=0 To 7 : X=211
For C=1 To 8 : N=L*8+C
CHARACTER_X(N)=X : CHARACTER_Y(N)=Y
Set Zone N+256,X,Y To X+11,Y+11
Add X,12
Next
Add Y,12
Next
'
Rem *** Set zones ***
'
Set Zone 322,196,66 To 207,105 : Rem put
Set Zone 323,113,6 To 152,17 : Rem save
Set Zone 324,68,6 To 107,17 : Rem load
Set Zone 325,196,22 To 207,61 : Rem get
Set Zone 326,211,6 To 257,17 : Rem clear edit window
Set Zone 327,267,6 To 306,17 : Rem fill
Set Zone 328,212,169 To 259,180 : Rem flipx
Set Zone 329,212,184 To 259,195 : Rem flipy
Set Zone 330,212,154 To 251,165 : Rem inverse
Set Zone 331,16,6 To 62,17 : Rem clear main grid
Set Zone 332,158,6 To 197,17 : Rem quit
'
Change Mouse 2
L=1
'
'
'
'
Do
CIA=0
MOOSE=Mouse Zone
A$=Inkey$
'
'
Rem *** Check for shortcuts ***
'
'
If A$="i"
_INVERT
End If
If A$="x"
_FLIP_X
End If
If A$="y"
_FLIP_Y
End If
If A$="c"
_CLEAR_MAIN_GRID
End If
If A$="p"
Bob Off 1
_PUT
End If
If A$="g" and STORE>0
CIA=1
_GET_ONE[STORE-1]
_GET_TWO
End If
If A$="q"
Fade 4
Wait 50
Edit
End If
If A$="l"
_LOAD
End If
If A$="s"
_SAVE
End If
If A$="f"
_FILL
_GET_TWO
_NEW_GRID
End If
If A$="e"
_CLEAR_GRID
_GET_TWO
_NEW_GRID
End If
'
'
Rem *** Check mouse ***
'
'
If Mouse Key=1 and MOOSE<257 and MOOSE>0
STORE=MOOSE
_GET_ONE[MOOSE-1]
_GET_TWO
End If
If Mouse Key=1 and MOOSE>256 and MOOSE<321
MY=MOOSE-256
_EDIT[MY]
End If
If Mouse Key=1 and MOOSE=322
Bob Off 1
_INDENT[196,66,5]
_PUT
End If
If Mouse Key=1 and MOOSE=323
_INDENT[113,6,2]
_SAVE
End If
If Mouse Key=1 and MOOSE=324
_INDENT[68,6,2]
_LOAD
End If
If Mouse Key=1 and MOOSE=325 and STORE>0
_INDENT[196,22,5]
CIA=1
_GET_ONE[STORE-1]
_GET_TWO
End If
If Mouse Key=1 and MOOSE=326
_INDENT[211,6,4]
_CLEAR_GRID
_GET_TWO
_NEW_GRID
End If
If Mouse Key=1 and MOOSE=327
_INDENT[267,6,2]
_FILL
_GET_TWO
_NEW_GRID
End If
If Mouse Key=1 and MOOSE=328
_INDENT[212,169,3]
_FLIP_X
End If
If Mouse Key=1 and MOOSE=329
_INDENT[212,184,3]
_FLIP_Y
End If
If Mouse Key=1 and MOOSE=330
_INDENT[212,154,2]
_INVERT
End If
If Mouse Key=1 and MOOSE=331
_INDENT[16,6,4]
_CLEAR_MAIN_GRID
End If
If Mouse Key=1 and MOOSE=332
_INDENT[158,6,2]
Fade 4
Wait 50
Edit
End If
Loop
'
'
'
' *** Procedures ***
'
Procedure _DISPLAY[X]
S=Start(11)+(X*8)
CP=(127)*40+(288/8)
For C=0 To 7
P=Peek(S+C)
Poke Phybase(0)+CP+C*40,P
Poke Phybase(1)+CP+C*40,P
Poke Phybase(2)+CP+C*40,P
Poke Phybase(3)+CP+C*40,P
Next
Screen Copy 0,288,127,296,135 To 0,CHARACTER_SET_X(X+1)+2,CHARACTER_SET_Y(X+1)+2
End Proc
Procedure _GET_ONE[X]
L=X
Bob 1,CHARACTER_SET_X(L+1),CHARACTER_SET_Y(L+1),1
If CIA=1
Q=1
S=Start(11)+(X*8)
For C=0 To 7
P=Peek(S+C) : _VALUE(C)=P
For A=7 To 0 Step -1
If Btst(A,P)
X(Q)=1
Ink 4 : Bar CHARACTER_X(Q)+2,CHARACTER_Y(Q)+2 To CHARACTER_X(Q)+10,CHARACTER_Y(Q)+10
Else
X(Q)=0
Ink 2 : Bar CHARACTER_X(Q)+2,CHARACTER_Y(Q)+2 To CHARACTER_X(Q)+10,CHARACTER_Y(Q)+10
End If
Inc Q
Next
Next
End If
End Proc
Procedure _GET_TWO
For C=0 To 7
CP=(127)*40+(288/8)
P=_VALUE(C)
Poke Phybase(0)+CP+C*40,P
Poke Phybase(1)+CP+C*40,P
Poke Phybase(2)+CP+C*40,P
Poke Phybase(3)+CP+C*40,P
Next
Shoot
GOS=0
End Proc
Procedure _EDIT[X]
NUM=7-(X-1) mod 8 : LINE=(X-1)/8
TEST=Btst(NUM,_VALUE(LINE))
If TEST=True
Ink 2
Bar CHARACTER_X(X)+2,CHARACTER_Y(X)+2 To CHARACTER_X(X)+10,CHARACTER_Y(X)+10
Bclr NUM,_VALUE(LINE)
X(X)=0
Else
Ink 4
Bar CHARACTER_X(X)+2,CHARACTER_Y(X)+2 To CHARACTER_X(X)+10,CHARACTER_Y(X)+10
Bset NUM,_VALUE(LINE)
X(X)=1
End If
Repeat : Until Mouse Key=0
_GET_TWO
End Proc
Procedure _PUT
S=Start(11)+(L*8)
For C=0 To 7
Poke S+C,_VALUE(C)
Next
_DISPLAY[L]
End Proc
'
Procedure _LOAD
STCURS=X
Bob Off 1
F$=Fsel$("*.font","","Load AMOS font","for editing")
If F$>""
Change Mouse 3
Bload F$,11
For N=0 To 255 : _DISPLAY[N] : Next
X=STCURS
_GET_ONE[L] : _GET_TWO
Change Mouse 2
End If
End Proc
Procedure _SAVE
STCURS=X
F$=Fsel$("*.font","","Save edited font")
If F$>"" Then Change Mouse 3 : Bsave F$,Start(11) To Start(11)+2048
X=STCURS
_GET_ONE[L]
Change Mouse 2
End Proc
'
Procedure _CLEAR_GRID
For A=0 To 7
_VALUE(A)=0
Next
End Proc
'
Procedure _FILL
For A=0 To 7
_VALUE(A)=$FFF
Next
End Proc
Procedure _NEW_GRID
Q=1
For C=0 To 7
For A=7 To 0 Step -1
P=_VALUE(C)
If Btst(A,P)
Ink 4 : Bar CHARACTER_X(Q)+2,CHARACTER_Y(Q)+2 To CHARACTER_X(Q)+10,CHARACTER_Y(Q)+10
Else
Ink 2 : Bar CHARACTER_X(Q)+2,CHARACTER_Y(Q)+2 To CHARACTER_X(Q)+10,CHARACTER_Y(Q)+10
End If
Inc Q
Next
Next
End Proc
'
Procedure _INVERT
Change Mouse 3
For X=1 To 64
_EDIT[X]
Next X
Change Mouse 2
End Proc
'
Procedure _FLIP_X
Change Mouse 3
For U=1 To 64
JON(U)=X(U)
Next U
X(8)=X(1) : X(1)=JON(8)
X(7)=X(2) : X(2)=JON(7)
X(6)=X(3) : X(3)=JON(6)
X(5)=X(4) : X(4)=JON(5)
'
X(16)=X(9) : X(9)=JON(16)
X(15)=X(10) : X(10)=JON(15)
X(14)=X(11) : X(11)=JON(14)
X(13)=X(12) : X(12)=JON(13)
'
X(24)=X(17) : X(17)=JON(24)
X(23)=X(18) : X(18)=JON(23)
X(22)=X(19) : X(19)=JON(22)
X(21)=X(20) : X(20)=JON(21)
'
X(32)=X(25) : X(25)=JON(32)
X(31)=X(26) : X(26)=JON(31)
X(30)=X(27) : X(27)=JON(30)
X(29)=X(28) : X(28)=JON(29)
'
X(40)=X(33) : X(33)=JON(40)
X(39)=X(34) : X(34)=JON(39)
X(38)=X(35) : X(35)=JON(38)
X(37)=X(36) : X(36)=JON(37)
'
X(48)=X(41) : X(41)=JON(48)
X(47)=X(42) : X(42)=JON(47)
X(46)=X(43) : X(43)=JON(46)
X(45)=X(44) : X(44)=JON(45)
'
X(56)=X(49) : X(49)=JON(56)
X(55)=X(50) : X(50)=JON(55)
X(54)=X(51) : X(51)=JON(54)
X(53)=X(52) : X(52)=JON(53)
'
X(64)=X(57) : X(57)=JON(64)
X(63)=X(58) : X(58)=JON(63)
X(62)=X(59) : X(59)=JON(62)
X(61)=X(60) : X(60)=JON(61)
'
For T=1 To 64
_FLIP_EDIT[T]
Next T
Change Mouse 2
End Proc
Procedure _FLIP_EDIT[X]
NUM=7-(X-1) mod 8 : LINE=(X-1)/8
If X(X)=0
Ink 2
Bar CHARACTER_X(X)+2,CHARACTER_Y(X)+2 To CHARACTER_X(X)+10,CHARACTER_Y(X)+10
Bclr NUM,_VALUE(LINE)
Else
Ink 4
Bar CHARACTER_X(X)+2,CHARACTER_Y(X)+2 To CHARACTER_X(X)+10,CHARACTER_Y(X)+10
Bset NUM,_VALUE(LINE)
End If
Repeat : Until Mouse Key=0
_GET_TWO
End Proc
Procedure _FLIP_Y
Change Mouse 3
For U=1 To 64
JON(U)=X(U)
Next U
X(57)=X(1) : X(1)=JON(57)
X(58)=X(2) : X(2)=JON(58)
X(59)=X(3) : X(3)=JON(59)
X(60)=X(4) : X(4)=JON(60)
X(61)=X(5) : X(5)=JON(61)
X(62)=X(6) : X(6)=JON(62)
X(63)=X(7) : X(7)=JON(63)
X(64)=X(8) : X(8)=JON(64)
'
X(49)=X(9) : X(9)=JON(49)
X(50)=X(10) : X(10)=JON(50)
X(51)=X(11) : X(11)=JON(51)
X(52)=X(12) : X(12)=JON(52)
X(53)=X(13) : X(13)=JON(53)
X(54)=X(14) : X(14)=JON(54)
X(55)=X(15) : X(15)=JON(55)
X(56)=X(16) : X(16)=JON(56)
'
X(41)=X(17) : X(17)=JON(41)
X(42)=X(18) : X(18)=JON(42)
X(43)=X(19) : X(19)=JON(43)
X(44)=X(20) : X(20)=JON(44)
X(45)=X(21) : X(21)=JON(45)
X(46)=X(22) : X(22)=JON(46)
X(47)=X(23) : X(23)=JON(47)
X(48)=X(24) : X(24)=JON(48)
'
X(33)=X(25) : X(25)=JON(33)
X(34)=X(26) : X(26)=JON(34)
X(35)=X(27) : X(27)=JON(35)
X(36)=X(28) : X(28)=JON(36)
X(37)=X(29) : X(29)=JON(37)
X(38)=X(30) : X(30)=JON(38)
X(39)=X(31) : X(31)=JON(39)
X(40)=X(32) : X(32)=JON(40)
'
For T=1 To 64
_FLIP_EDIT[T]
Next T
Change Mouse 2
End Proc
'
Procedure _CLEAR_MAIN_GRID
Change Mouse 3
Bob Off 1
Y=21 : Ink 2
For L=0 To 15 : X=15
For C=1 To 16 : N=L*16+C
Bar X+2,Y+2 To X+9,Y+9
Add X,11
Next
Add Y,11
Next
_ERASE_ALL_DATA
Change Mouse 2
End Proc
Procedure _ERASE_ALL_DATA
Erase 11
Reserve As Work 11,2048
End Proc
'
Procedure _INDENT[XIND,YIND,IMAGE]
Bob 5,XIND,YIND,IMAGE
Wait 10
Bob Off 5
Wait 5
End Proc