mirror of
https://github.com/badvision/lawless-legends.git
synced 2024-11-14 13:06:58 +00:00
Font engine integrated with raycaster.
This commit is contained in:
parent
d1e654d3f1
commit
14296ca13a
@ -23,6 +23,7 @@ class PackPartitions
|
||||
def TYPE_TILE_IMG = 4
|
||||
def TYPE_TEXTURE_IMG = 5
|
||||
def TYPE_FRAME_IMG = 6
|
||||
def TYPE_FONT = 7
|
||||
|
||||
def code = [:] // code name to code.num, code.buf
|
||||
def maps2D = [:] // map name to map.num, map.buf
|
||||
@ -30,6 +31,7 @@ class PackPartitions
|
||||
def tiles = [:] // tile name to tile.num, tile.buf
|
||||
def textures = [:] // img name to img.num, img.buf
|
||||
def frames = [:] // img name to img.num, img.buf
|
||||
def fonts = [:]
|
||||
|
||||
def parseMap(map, tiles)
|
||||
{
|
||||
@ -466,11 +468,9 @@ class PackPartitions
|
||||
buf.get(bytes)
|
||||
stream.write(bytes)
|
||||
}
|
||||
|
||||
def readCode(name, path)
|
||||
|
||||
def readBinary(path)
|
||||
{
|
||||
def num = code.size() + 1
|
||||
//println "Reading code #$num from '$path'."
|
||||
def inBuf = new byte[256]
|
||||
def outBuf = ByteBuffer.allocate(50000)
|
||||
def stream = new File(path).withInputStream { stream ->
|
||||
@ -480,7 +480,21 @@ class PackPartitions
|
||||
outBuf.put(inBuf, 0, got)
|
||||
}
|
||||
}
|
||||
code[name] = [num:num, buf:outBuf]
|
||||
return outBuf
|
||||
}
|
||||
|
||||
def readCode(name, path)
|
||||
{
|
||||
def num = code.size() + 1
|
||||
//println "Reading code #$num from '$path'."
|
||||
code[name] = [num:num, buf:readBinary(path)]
|
||||
}
|
||||
|
||||
def readFont(name, path)
|
||||
{
|
||||
def num = fonts.size() + 1
|
||||
//println "Reading font #$num from '$path'."
|
||||
fonts[name] = [num:num, buf:readBinary(path)]
|
||||
}
|
||||
|
||||
def writePartition(stream)
|
||||
@ -488,11 +502,12 @@ class PackPartitions
|
||||
// Make a list of all the chunks that will be in the partition
|
||||
def chunks = []
|
||||
code.values().each { chunks.add([type:TYPE_CODE, num:it.num, buf:it.buf]) }
|
||||
maps2D.values().each { chunks.add([type:TYPE_2D_MAP, num:it.num, buf:it.buf]) }
|
||||
maps3D.values().each { chunks.add([type:TYPE_3D_MAP, num:it.num, buf:it.buf]) }
|
||||
tiles.values().each { chunks.add([type:TYPE_TILE_IMG, num:it.num, buf:it.buf]) }
|
||||
textures.values().each { chunks.add([type:TYPE_TEXTURE_IMG, num:it.num, buf:it.buf]) }
|
||||
fonts.values().each { chunks.add([type:TYPE_FONT, num:it.num, buf:it.buf]) }
|
||||
frames.values().each { chunks.add([type:TYPE_FRAME_IMG, num:it.num, buf:it.buf]) }
|
||||
maps2D.values().each { chunks.add([type:TYPE_2D_MAP, num:it.num, buf:it.buf]) }
|
||||
tiles.values().each { chunks.add([type:TYPE_TILE_IMG, num:it.num, buf:it.buf]) }
|
||||
maps3D.values().each { chunks.add([type:TYPE_3D_MAP, num:it.num, buf:it.buf]) }
|
||||
textures.values().each { chunks.add([type:TYPE_TEXTURE_IMG, num:it.num, buf:it.buf]) }
|
||||
|
||||
// Generate the header chunk. Leave the first 2 bytes for the # of pages in the hdr
|
||||
def hdrBuf = ByteBuffer.allocate(50000)
|
||||
@ -535,6 +550,11 @@ class PackPartitions
|
||||
println "Reading code resources."
|
||||
readCode("render", "src/raycast/build/render.b")
|
||||
readCode("expand", "src/raycast/build/expand.b")
|
||||
readCode("fontEngine", "src/font/build/fontEngine.b")
|
||||
|
||||
// We have only one font, for now at least.
|
||||
println "Reading fonts."
|
||||
readFont("font", "data/fonts/font.bin")
|
||||
|
||||
// Open the XML data file produced by Outlaw Editor
|
||||
def dataIn = new XmlParser().parse(xmlPath)
|
||||
|
11
Platform/Apple/virtual/.project
Normal file
11
Platform/Apple/virtual/.project
Normal file
@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>Lawless-AppleII</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
</natures>
|
||||
</projectDescription>
|
@ -31,6 +31,8 @@
|
||||
<ant dir="${src.dir}/core" target="build" useNativeBasedir="true" inheritAll="false"/>
|
||||
<echo>Building raycast.</echo>
|
||||
<ant dir="${src.dir}/raycast" target="build" useNativeBasedir="true" inheritAll="false"/>
|
||||
<echo>Building font engine.</echo>
|
||||
<ant dir="${src.dir}/font" target="build" useNativeBasedir="true" inheritAll="false"/>
|
||||
|
||||
<!-- Pack the game data -->
|
||||
<echo>Packing game and code resources.</echo>
|
||||
|
@ -11,7 +11,7 @@
|
||||
|
||||
; Global definitions
|
||||
!source "../include/global.i"
|
||||
!source "mem.i"
|
||||
!source "../include/mem.i"
|
||||
|
||||
; Constants
|
||||
MAX_SEGS = 96
|
||||
|
42
Platform/Apple/virtual/src/font/build.xml
Normal file
42
Platform/Apple/virtual/src/font/build.xml
Normal file
@ -0,0 +1,42 @@
|
||||
<?xml version="1.0"?>
|
||||
|
||||
<project name="core" default="build">
|
||||
|
||||
<property name="projName" value="font"/> <!-- base part of output bin name -->
|
||||
<property name="src.dir" location="."/>
|
||||
<property name="include.dir" location="../include"/>
|
||||
<property file="${include.dir}/build.props"/> <!-- needs to define ACME_BIN_DIR -->
|
||||
|
||||
<property name="build.dir" value="${src.dir}/build"/>
|
||||
|
||||
<property name="ACME_TOOL" location="${ACME_BIN_DIR}/acme"/>
|
||||
|
||||
<property name="ASM_SETTINGS" value="-f plain"/>
|
||||
|
||||
<target name="all">
|
||||
<antcall target="clean"/>
|
||||
<antcall target="build"/>
|
||||
</target>
|
||||
|
||||
<target name="clean">
|
||||
<delete failonerror="false" dir="${build.dir}"/>
|
||||
</target>
|
||||
|
||||
<target name="build">
|
||||
|
||||
<!-- Create build directory -->
|
||||
<mkdir dir="${build.dir}"/>
|
||||
|
||||
<!-- Assemble all .s files -->
|
||||
<apply executable="${ACME_TOOL}" dir="${src.dir}"
|
||||
relative="true" parallel="false" failonerror="true" verbose="true">
|
||||
<fileset dir="${src.dir}" includes="*.s"/>
|
||||
<arg value="-o"/>
|
||||
<arg value="${build.dir}/fontEngine.b"/>
|
||||
<arg line="${ASM_SETTINGS}"/>
|
||||
<srcfile/>
|
||||
</apply>
|
||||
|
||||
</target>
|
||||
|
||||
</project>
|
@ -1,7 +1,5 @@
|
||||
;
|
||||
; Equates
|
||||
;
|
||||
|
||||
; Equates
|
||||
pHGR1 = $20
|
||||
pHGR2 = $40
|
||||
pHGR3 = $60
|
||||
@ -18,7 +16,7 @@ charCMD = $80
|
||||
; Zero page usage
|
||||
;
|
||||
|
||||
WNDLFT = $20 ; left edge of the window
|
||||
WNDLFT = $70 ; left edge of the window
|
||||
WNDWDTH = WNDLFT+1 ; width of text window
|
||||
WNDTOP = WNDWDTH+1 ; top of text window
|
||||
WNDBTM = WNDTOP+1 ; bottom+1 of text window
|
||||
@ -26,27 +24,17 @@ WNDBTM = WNDTOP+1 ; bottom+1 of text window
|
||||
CH = WNDBTM+1 ; Cursor H-pos 0-39
|
||||
CV = CH+1 ; Cursor V-pos 0-23 => 0-191
|
||||
|
||||
BASL = $28 ; Text base address
|
||||
BASL = CV+1 ; Text base address
|
||||
BASH = BASL+1
|
||||
GBASL = BASH+1 ; Second text base address
|
||||
GBASH = GBASL+1
|
||||
|
||||
INVFLG = GBASH+1 ; Inverse flag (FF: normal, 7F: flash, 3F: inverse)
|
||||
|
||||
HPAG = INVFLG+1 ; $20 for HGR1, $40 for HGR2
|
||||
|
||||
dpSTR = HPAG+1 ; Pointer to source string
|
||||
|
||||
dpFROM = BASL
|
||||
dpTO = dpFROM+2
|
||||
dpTO2 = dpTO+2
|
||||
|
||||
INVFLG = $32 ; Inverse flag (FF: normal, 7F: flash, 3F: inverse)
|
||||
|
||||
dpSTR = $fe ; Pointer to source string
|
||||
|
||||
CSWL = $36 ; Char output hook
|
||||
CSWH = CSWL+1
|
||||
|
||||
HPAG = $E6 ; $20 for HGR1, $40 for HGR2
|
||||
|
||||
;
|
||||
; Monitor routines
|
||||
;
|
||||
|
||||
HGR2 = $f3d8
|
||||
HGR = $f3e2
|
@ -1,102 +0,0 @@
|
||||
;
|
||||
; Font
|
||||
;
|
||||
|
||||
* = $7000
|
||||
|
||||
!byte $00,$00,$00,$00,$00,$00,$00,$00 ; A0 space
|
||||
!byte $18,$18,$18,$18,$18,$00,$18,$00 ; A1 !
|
||||
!byte $36,$1B,$00,$00,$00,$00,$00,$00 ; A2 "
|
||||
!byte $00,$24,$7E,$36,$3F,$12,$00,$00 ; A3 #
|
||||
!byte $18,$0C,$1E,$33,$1B,$0F,$3E,$00 ; A4 $
|
||||
!byte $0C,$1E,$00,$33,$33,$33,$1E,$00 ; A5 %
|
||||
!byte $0C,$16,$0C,$6E,$3B,$33,$6E,$00 ; A6 &
|
||||
!byte $18,$0C,$00,$00,$00,$00,$00,$00 ; A7 '
|
||||
!byte $38,$0C,$06,$06,$06,$0C,$38,$00 ; A8 (
|
||||
!byte $0E,$18,$30,$30,$30,$18,$0E,$00 ; A9 )
|
||||
!byte $00,$36,$1C,$3E,$1C,$36,$00,$00 ; AA *
|
||||
!byte $00,$08,$08,$3E,$08,$08,$00,$00 ; AB +
|
||||
!byte $00,$00,$00,$00,$00,$18,$0C,$00 ; AC ,
|
||||
!byte $00,$00,$00,$7E,$00,$00,$00,$00 ; AD -
|
||||
!byte $00,$00,$00,$00,$00,$00,$0C,$00 ; AE .
|
||||
!byte $20,$30,$18,$0C,$06,$03,$01,$00 ; AF /
|
||||
!byte $1E,$30,$33,$33,$33,$33,$1E,$00 ; B0 0
|
||||
!byte $1E,$00,$18,$18,$18,$18,$18,$00 ; B1 1
|
||||
!byte $1F,$00,$30,$1E,$03,$03,$3E,$00 ; B2 2
|
||||
!byte $1F,$00,$30,$1C,$30,$30,$1F,$00 ; B3 3
|
||||
!byte $03,$03,$03,$33,$3F,$30,$30,$00 ; B4 4
|
||||
!byte $3F,$00,$03,$1F,$30,$30,$1F,$00 ; B5 5
|
||||
!byte $1C,$06,$03,$1B,$33,$33,$1E,$00 ; B6 6
|
||||
!byte $3F,$00,$18,$0C,$0C,$0C,$0C,$00 ; B7 7
|
||||
!byte $1E,$30,$33,$1E,$33,$33,$1E,$00 ; B8 8
|
||||
!byte $3E,$33,$33,$36,$30,$30,$30,$00 ; B9 9
|
||||
!byte $00,$00,$0C,$00,$0C,$00,$00,$00 ; BA :
|
||||
!byte $00,$00,$0C,$00,$00,$0C,$06,$00 ; BB ;
|
||||
!byte $30,$18,$0C,$06,$0C,$18,$30,$00 ; BC <
|
||||
!byte $00,$00,$3E,$00,$3E,$00,$00,$00 ; BD =
|
||||
!byte $06,$0C,$18,$30,$18,$0C,$06,$00 ; BE >
|
||||
!byte $3C,$66,$60,$30,$18,$00,$18,$00 ; BF ?
|
||||
!byte $06,$0C,$1E,$33,$1B,$0F,$3E,$00 ; C0 @
|
||||
!byte $1E,$30,$33,$3B,$33,$33,$33,$00 ; C1 A
|
||||
!byte $1F,$30,$33,$1B,$33,$33,$1F,$00 ; C2 B
|
||||
!byte $3E,$00,$03,$03,$03,$03,$3E,$00 ; C3 C
|
||||
!byte $1F,$30,$33,$33,$33,$33,$1F,$00 ; C4 D
|
||||
!byte $3F,$00,$03,$1B,$03,$03,$3F,$00 ; C5 E
|
||||
!byte $3F,$00,$03,$1B,$03,$03,$03,$00 ; C6 F
|
||||
!byte $3E,$00,$03,$3B,$33,$33,$3E,$00 ; C7 G
|
||||
!byte $33,$33,$33,$3B,$33,$33,$33,$00 ; C8 H
|
||||
!byte $3F,$00,$0C,$0C,$0C,$0C,$3F,$00 ; C9 I
|
||||
!byte $30,$30,$30,$30,$33,$33,$1E,$00 ; CA J
|
||||
!byte $33,$1B,$0F,$07,$0F,$1B,$33,$00 ; CB K
|
||||
!byte $03,$03,$03,$03,$03,$03,$3F,$00 ; CC L
|
||||
!byte $3F,$30,$33,$33,$33,$33,$33,$00 ; CD M
|
||||
!byte $33,$33,$37,$3F,$3B,$33,$33,$00 ; CE N
|
||||
!byte $1E,$30,$33,$33,$33,$33,$1E,$00 ; CF O
|
||||
!byte $1F,$30,$33,$1F,$03,$03,$03,$00 ; D0 P
|
||||
!byte $1E,$30,$33,$33,$33,$3B,$3E,$00 ; D1 Q
|
||||
!byte $1F,$30,$33,$1F,$0F,$1B,$33,$00 ; D2 R
|
||||
!byte $3E,$00,$03,$1E,$30,$30,$1F,$00 ; D3 S
|
||||
!byte $3F,$00,$0C,$0C,$0C,$0C,$0C,$00 ; D4 T
|
||||
!byte $33,$33,$33,$33,$33,$33,$1E,$00 ; D5 U
|
||||
!byte $33,$33,$33,$1E,$1E,$0C,$0C,$00 ; D6 V
|
||||
!byte $33,$33,$33,$33,$33,$3F,$33,$00 ; D7 W
|
||||
!byte $33,$33,$1E,$0C,$1E,$33,$33,$00 ; D8 X
|
||||
!byte $33,$33,$33,$1E,$0C,$0C,$0C,$00 ; D9 Y
|
||||
!byte $3F,$00,$18,$0C,$06,$03,$3F,$00 ; DA Z
|
||||
!byte $00,$00,$00,$00,$00,$00,$00,$7F ; DB [
|
||||
!byte $06,$0E,$1C,$38,$70,$60,$00,$00 ; DC \
|
||||
!byte $3C,$30,$30,$30,$30,$30,$3C,$00 ; DD ]
|
||||
!byte $00,$00,$00,$08,$1C,$36,$63,$00 ; DE ^
|
||||
!byte $00,$00,$00,$00,$00,$00,$7F,$00 ; DF _
|
||||
!byte $00,$00,$00,$00,$00,$00,$7E,$03 ; E0 `
|
||||
!byte $00,$00,$1E,$33,$33,$33,$7E,$00 ; E1 a
|
||||
!byte $03,$03,$1F,$33,$33,$33,$1F,$00 ; E2 b
|
||||
!byte $00,$00,$1E,$33,$03,$33,$1E,$00 ; E3 c
|
||||
!byte $38,$30,$3E,$33,$33,$33,$3E,$00 ; E4 d
|
||||
!byte $00,$00,$1E,$33,$1B,$0F,$3E,$00 ; E5 e
|
||||
!byte $3C,$06,$06,$06,$1F,$06,$06,$06 ; E6 f
|
||||
!byte $00,$60,$3E,$33,$33,$1E,$03,$3E ; E7 g
|
||||
!byte $03,$03,$1B,$37,$33,$33,$33,$00 ; E8 h
|
||||
!byte $0C,$00,$0E,$0C,$0C,$0C,$1E,$00 ; E9 i
|
||||
!byte $30,$00,$30,$30,$30,$30,$33,$1E ; EA j
|
||||
!byte $03,$03,$33,$1B,$37,$33,$33,$00 ; EB k
|
||||
!byte $0E,$0C,$0C,$0C,$0C,$0C,$1E,$00 ; EC l
|
||||
!byte $00,$00,$33,$3F,$33,$33,$33,$00 ; ED m
|
||||
!byte $00,$00,$1B,$37,$33,$33,$33,$00 ; EE n
|
||||
!byte $00,$00,$1E,$33,$33,$33,$1E,$00 ; EF o
|
||||
!byte $00,$00,$1F,$33,$33,$1F,$03,$03 ; F0 p
|
||||
!byte $00,$00,$3E,$33,$33,$3E,$30,$30 ; F1 q
|
||||
!byte $00,$00,$3B,$0F,$07,$03,$03,$00 ; F2 r
|
||||
!byte $00,$00,$3E,$03,$1E,$30,$1F,$00 ; F3 s
|
||||
!byte $06,$3F,$06,$06,$06,$36,$1C,$00 ; F4 t
|
||||
!byte $00,$00,$33,$33,$33,$33,$1E,$00 ; F5 u
|
||||
!byte $00,$00,$33,$33,$33,$1E,$0C,$00 ; F6 v
|
||||
!byte $00,$00,$33,$33,$33,$3F,$33,$00 ; F7 w
|
||||
!byte $00,$00,$33,$33,$1E,$33,$33,$00 ; F8 x
|
||||
!byte $00,$00,$33,$33,$33,$3E,$30,$1E ; F9 y
|
||||
!byte $00,$00,$3F,$18,$0C,$06,$3F,$00 ; FA z
|
||||
!byte $00,$00,$00,$00,$00,$00,$0F,$18 ; FB {
|
||||
!byte $18,$18,$18,$18,$18,$18,$18,$18 ; FC |
|
||||
!byte $18,$18,$18,$18,$18,$18,$18,$0F ; FD }
|
||||
!byte $03,$03,$03,$03,$03,$03,$03,$7E ; FE ~
|
||||
!byte $03,$03,$03,$03,$03,$03,$03,$03 ; FF #
|
@ -6,7 +6,7 @@
|
||||
|
||||
* = $1b00 ; so it ends just before $2000
|
||||
|
||||
!source "equates.s"
|
||||
!source "equates.i"
|
||||
|
||||
;---------------------------
|
||||
;
|
||||
@ -668,4 +668,4 @@ strLENGTH !fill 1 ; length of string
|
||||
; End of the code...
|
||||
;---------------------------
|
||||
|
||||
!source "tables.s"
|
||||
!source "tables.i"
|
@ -1,150 +0,0 @@
|
||||
*
|
||||
* How to use the code
|
||||
*
|
||||
* (c) 2013, Brutal Deluxe Software
|
||||
*
|
||||
|
||||
org $1000
|
||||
lst off
|
||||
|
||||
mx %11
|
||||
|
||||
use LL.Equates
|
||||
|
||||
*---------------------------
|
||||
*
|
||||
* STR: draws a Pascal string
|
||||
* CSTR: draws a C string (null terminated)
|
||||
* CHAR: draws a single char
|
||||
*
|
||||
|
||||
*---------------------------
|
||||
|
||||
stringCODE = $6000
|
||||
printSTR = stringCODE
|
||||
printSSTR = printSTR+3
|
||||
printCSTR = printSSTR+3
|
||||
printSCSTR = printCSTR+3
|
||||
printCHAR = printSCSTR+3
|
||||
tabXY = printCHAR+3
|
||||
setFONT = tabXY+3
|
||||
displayMODE = setFONT+3
|
||||
drawMODE = displayMODE+3
|
||||
scrollWINDOW = drawMODE+3
|
||||
|
||||
fontDATA = $7000
|
||||
|
||||
*---------------------------
|
||||
* We assume the following:
|
||||
*
|
||||
* Code at $6000
|
||||
* Font at $7000
|
||||
|
||||
sta $c050
|
||||
sta $c052
|
||||
sta $c054
|
||||
sta $C057
|
||||
|
||||
ldx #>fontDATA ; set font data
|
||||
ldy #fontDATA
|
||||
jsr setFONT
|
||||
|
||||
*--- Set our frame
|
||||
|
||||
lda #0 ; (0,0) TO (39,23)
|
||||
sta WNDLFT
|
||||
sta CH
|
||||
lda #39
|
||||
sta WNDWDTH
|
||||
lda #0
|
||||
sta WNDTOP
|
||||
sta CV
|
||||
lda #23
|
||||
sta WNDBTM
|
||||
|
||||
*---
|
||||
|
||||
lda #pHGR1 ; HGR1 page active
|
||||
jsr displayMODE
|
||||
|
||||
ldx #2
|
||||
ldy #1
|
||||
jsr tabXY
|
||||
|
||||
lda #pNORMAL
|
||||
jsr drawMODE
|
||||
|
||||
ldx #>string1
|
||||
ldy #string1
|
||||
jsr printSTR
|
||||
|
||||
*---
|
||||
|
||||
lda #2 ; (2,4) TO (19,20)
|
||||
sta WNDLFT
|
||||
sta CH
|
||||
lda #19
|
||||
sta WNDWDTH
|
||||
lda #4
|
||||
sta WNDTOP
|
||||
sta CV
|
||||
lda #20
|
||||
sta WNDBTM
|
||||
|
||||
ldx #2
|
||||
ldy #10
|
||||
jsr tabXY
|
||||
|
||||
lda #pINVERSE
|
||||
jsr drawMODE
|
||||
|
||||
jsr printSSTR
|
||||
str 'Please press a key...'
|
||||
|
||||
|
||||
*---
|
||||
|
||||
jsr $fd0c
|
||||
|
||||
lda #22 ; (28,4) TO (38,20)
|
||||
sta WNDLFT
|
||||
sta CH
|
||||
lda #37
|
||||
sta WNDWDTH
|
||||
lda #6
|
||||
sta WNDTOP
|
||||
sta CV
|
||||
lda #16
|
||||
sta WNDBTM
|
||||
|
||||
lda #pNORMAL
|
||||
jsr drawMODE
|
||||
|
||||
lda #pHGR3 ; Both pages active
|
||||
jsr displayMODE
|
||||
|
||||
ldx #>string3
|
||||
ldy #string3
|
||||
jsr printCSTR
|
||||
|
||||
*-
|
||||
|
||||
jsr $fd0c
|
||||
sta $c055
|
||||
jsr $fd0c
|
||||
|
||||
sta $c054
|
||||
sta $c056
|
||||
sta $c051
|
||||
rts
|
||||
|
||||
*----------------------------
|
||||
|
||||
string1 str 'What time is it?'
|
||||
|
||||
string3 asc 'This is printed on both pages.'0d0d
|
||||
asc 'A very long text in both '83ff'inverse'8300
|
||||
asc ' and normal fontface.'0d
|
||||
asc 'This text will be long and will let the window scroll...'0d
|
||||
asc 'Yes, I promise it will scroll a lot... and a lot..'0d
|
||||
asc 83FF'Antoine'830000
|
51
Platform/Apple/virtual/src/include/fontEngine.i
Normal file
51
Platform/Apple/virtual/src/include/fontEngine.i
Normal file
@ -0,0 +1,51 @@
|
||||
;
|
||||
; Font Engine
|
||||
;
|
||||
; (c) 2013, Brutal Deluxe Software
|
||||
;
|
||||
|
||||
; Equates
|
||||
pHGR1 = $20
|
||||
pHGR2 = $40
|
||||
pHGR3 = $60
|
||||
|
||||
pNORMAL = $00
|
||||
pINVERSE = $FF
|
||||
|
||||
charNULL = $00
|
||||
charRET = $0d
|
||||
charSPACE = $20
|
||||
charCMD = $80
|
||||
|
||||
;
|
||||
; Zero page usage
|
||||
;
|
||||
wndleft = $70 ; left edge of the window
|
||||
wndwdth = wndleft+1 ; width of text window
|
||||
wndtop = wndwdth+1 ; top of text window
|
||||
wndbtm = wndtop+1 ; bottom+1 of text window
|
||||
|
||||
cursh = wndbtm+1 ; Cursor H-pos 0-39
|
||||
cursv = cursh+1 ; Cursor V-pos 0-23 => 0-191
|
||||
|
||||
|
||||
;---------------------------
|
||||
;
|
||||
; STR: draws a Pascal string
|
||||
; CSTR: draws a C string (null terminated)
|
||||
; CHAR: draws a single char
|
||||
;
|
||||
|
||||
;---------------------------
|
||||
|
||||
fontEngine = $1B00
|
||||
printSTR = fontEngine
|
||||
printSSTR = printSTR+3
|
||||
printCSTR = printSSTR+3
|
||||
printSCSTR = printCSTR+3
|
||||
printCHAR = printSCSTR+3
|
||||
tabXY = printCHAR+3
|
||||
setFONT = tabXY+3
|
||||
displayMODE = setFONT+3
|
||||
drawMODE = displayMODE+3
|
||||
scrollWINDOW = drawMODE+3
|
@ -85,6 +85,7 @@ RES_TYPE_3D_MAP = 3
|
||||
RES_TYPE_TILE = 4
|
||||
RES_TYPE_TEXTURE= 5
|
||||
RES_TYPE_SCREEN = 6
|
||||
RES_TYPE_FONT = 7
|
||||
|
||||
;------------------------------------------------------------------------------
|
||||
; Command codes
|
@ -20,7 +20,9 @@ DEBUG = 0 ; turn on verbose logging
|
||||
; Debug macros and support functions
|
||||
!source "../include/debug.i"
|
||||
; Memory manager
|
||||
!source "../core/mem.i"
|
||||
!source "../include/mem.i"
|
||||
; Font engine
|
||||
!source "../include/fontEngine.i"
|
||||
|
||||
; Variables
|
||||
backBuf: !byte 0 ; (value 0 or 1)
|
||||
@ -843,6 +845,16 @@ initMem: !zone
|
||||
ldx #<(tableEnd-tableStart)
|
||||
ldy #>(tableEnd-tableStart)
|
||||
jsr mainLoader
|
||||
; Load the font engine
|
||||
!if DEBUG { +prStr : !text "Loading font engine.",0 }
|
||||
lda #SET_MEM_TARGET
|
||||
ldx #<fontEngine
|
||||
ldy #>fontEngine
|
||||
jsr mainLoader
|
||||
lda #QUEUE_LOAD
|
||||
ldx #RES_TYPE_CODE
|
||||
ldy #3 ; hard coded for now: code #3 is the font engine
|
||||
jsr mainLoader
|
||||
!if DEBUG { +prStr : !text "Loading expansion code.",0 }
|
||||
; Load the texture expansion code into aux mem.
|
||||
lda #SET_MEM_TARGET
|
||||
@ -871,10 +883,30 @@ initMem: !zone
|
||||
jsr mainLoader
|
||||
stx mapHeader
|
||||
sty mapHeader+1
|
||||
; Load the font into main mem
|
||||
lda #QUEUE_LOAD
|
||||
ldx #RES_TYPE_FONT
|
||||
ldy #1 ; we have only one font, for now at least
|
||||
jsr mainLoader
|
||||
tya ; save location for when font engine has been loaded
|
||||
pha
|
||||
txa
|
||||
pha
|
||||
; Force the loads to complete now
|
||||
lda #FINISH_LOAD
|
||||
ldx #1 ; keep queue open
|
||||
jsr mainLoader
|
||||
pla ; get back the font location
|
||||
tay ; font engine likes *lo* byte in Y
|
||||
pla
|
||||
tax ; and hi byte in X
|
||||
jsr setFONT
|
||||
; Set to write text on both hi-res pages at the same time
|
||||
lda #pHGR3
|
||||
jsr displayMODE
|
||||
; Set to normal (non-inverse) text
|
||||
lda #pNORMAL
|
||||
jsr drawMODE
|
||||
; Copy the expansion caller to low stack.
|
||||
ldx #.callEnd - .callIt - 1
|
||||
- lda .callIt,x
|
||||
@ -1235,6 +1267,17 @@ main: !zone
|
||||
jsr makeLines
|
||||
jsr graphInit
|
||||
bit clrMixed
|
||||
; Write some test text
|
||||
ldx #24
|
||||
ldy #2
|
||||
jsr tabXY
|
||||
jsr printSCSTR
|
||||
!raw "Bonjour tout",0
|
||||
ldx #24
|
||||
ldy #3
|
||||
jsr tabXY
|
||||
jsr printSCSTR
|
||||
!raw "le monde.",0
|
||||
; Render the frame and flip it onto the screen
|
||||
.nextFrame:
|
||||
jsr renderFrame
|
||||
|
Loading…
Reference in New Issue
Block a user