Replaced debug font rendering with real thing

This commit is contained in:
blondie7575 2023-07-16 14:17:02 -07:00
parent 36474e22dd
commit b605fef0d2
11 changed files with 2888 additions and 4478 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 924 B

Binary file not shown.

BIN
Art/Assets/FontTiny.xcf Normal file

Binary file not shown.

View File

@ -14,7 +14,6 @@
700F21DF1F4A364600D7007D /* projectile.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = projectile.s; sourceTree = "<group>"; };
700F21E01F4A3A5500D7007D /* GenerateTrigTables.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; path = GenerateTrigTables.py; sourceTree = "<group>"; };
700F72872112428D00225B17 /* RenumberSpriteFiles.sh */ = {isa = PBXFileReference; lastKnownFileType = text.script.sh; path = RenumberSpriteFiles.sh; sourceTree = "<group>"; };
700FFAFB1F40F3BF00A442DE /* font.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = font.s; sourceTree = "<group>"; };
705456862A43E03B00A2B866 /* GeneratePixelCircle.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; path = GeneratePixelCircle.py; sourceTree = "<group>"; };
705456882A4D336200A2B866 /* animation.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = animation.s; sourceTree = "<group>"; };
7059502B1F37A0BE00BBE90F /* GenerateVRAMTable.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; path = GenerateVRAMTable.py; sourceTree = "<group>"; };
@ -63,7 +62,6 @@
7099E3841F41022100182A82 /* gameobject.s */,
70F011D123B989B800C8873F /* random.s */,
706DF1641F2D39F700AA6680 /* loader.s */,
700FFAFB1F40F3BF00A442DE /* font.s */,
7002647320CD78C40015B184 /* smallNumbers.s */,
706DF1651F2D4A8100AA6680 /* terrain.s */,
705AAFA920040B0D001BB0ED /* terrain_e1.s */,

View File

@ -44,6 +44,8 @@ RANDOM = $ce ; 16 bit random number
RANDOML = $ce ; Low byte of random number generator
RANDOMH = $cf ; High byte of random number generator
; Far entry points
renderStringFar = $050000
; Terrain constants
TERRAINWIDTH = 640 ; In pixels

687
font.s
View File

@ -1,687 +0,0 @@
;****************************************
;* FONT ENGINE (v3?) *
;* *
;* Dagen Brock <dagenbrock@gmail.com> *
;* 2013-07-20 *
;* Converted to ca65 by Quinn Dunki *
;* 2017-08-13 *
;****************************************
;* A= ptr to string preceded by length *
;* X= screen location *
;* Preserves all registers *
;* Trashes zero page locations 6,7 *
;****************************************
; each char:
; draw char at loc
; update loc
; see if length hit - no? back to draw char
F_Length: .word 0 ;length of string (only one byte currently used)
F_CharIdx: .word 0 ;index of current character
F_CurrentPos: .word 0 ;current top left char position
F_StrPtr = $06 ;pointer to string (including length byte) / DP
DrawString:
pha
phx
phy
sta F_StrPtr ;store at dp 0 ($00) for indirect loads
stx F_CurrentPos
stz F_CharIdx
lda (F_StrPtr)
and #$00ff ;strip off first char (len is only one byte)
sta F_Length ;get our length byte
NextChar: lda F_CharIdx
cmp F_Length
bne notDone
ply
plx
pla
rts ;DONE! Return to caller
notDone: inc F_CharIdx
ldy F_CharIdx
lda (F_StrPtr),y ;get next char!
and #$00FF ;mask high byte
sec
sbc #' ' ;our table starts with space ' '
asl ;*2
tay
ldx F_CurrentPos
jsr drawChar
inc F_CurrentPos ;compare to addition time (?)
inc F_CurrentPos
inc F_CurrentPos
inc F_CurrentPos ;update screen pos (2 words=8 pixels)
bra NextChar
;x = TopLeft screen pos
;y = char table offset
drawChar: lda FontTable,y ;get real address of char data
sec
sbc #FontData ;pivot offset - now a is offset of fontdata
tay ;so we'll index with that
lda FontData,y
sta $012000,x
lda FontData+2,y
sta $012000+2,x
lda FontData+4,y
sta $012000+160,x
lda FontData+6,y
sta $012000+160+2,x
lda FontData+8,y
sta $012000+160*2,x
lda FontData+10,y
sta $012000+160*2+2,x
lda FontData+12,y
sta $012000+160*3,x
lda FontData+14,y
sta $012000+160*3+2,x
lda FontData+16,y
sta $012000+160*4,x
lda FontData+18,y
sta $012000+160*4+2,x
lda FontData+20,y
sta $012000+160*5,x
lda FontData+22,y
sta $012000+160*5+2,x
rts
FontTable:
.addr s_Space
.addr s_Exclaim
.addr s_Quote
.addr s_Number
.addr s_Dollar
.addr s_Percent
.addr s_Amper
.addr s_Single
.addr s_OpenParen
.addr s_CloseParen
.addr s_Asterix
.addr s_Plus
.addr s_Comma
.addr s_Minus
.addr s_Period
.addr s_Slash
.addr s_N0
.addr s_N1
.addr s_N2
.addr s_N3
.addr s_N4
.addr s_N5
.addr s_N6
.addr s_N7
.addr s_N8
.addr s_N9
.addr s_Colon
.addr s_Semi
.addr s_LAngle
.addr s_Equal
.addr s_RAngle
.addr s_Question
.addr s_At
.addr s_A
.addr s_B
.addr s_C
.addr s_D
.addr s_E
.addr s_F
.addr s_G
.addr s_H
.addr s_I
.addr s_J
.addr s_K
.addr s_L
.addr s_M
.addr s_N
.addr s_O
.addr s_P
.addr s_Q
.addr s_R
.addr s_S
.addr s_T
.addr s_U
.addr s_V
.addr s_W
.addr s_X
.addr s_Y
.addr s_Z
.addr s_LBracket
.addr s_BackSlash
.addr s_RBracket
.addr s_Caret
.addr s_UnderLine
FontData:
s_Space:
qbyte $00000000
qbyte $00000000
qbyte $00000000
qbyte $00000000
qbyte $00000000
qbyte $00000000
s_Exclaim:
qbyte $000FF000
qbyte $000FF000
qbyte $000FF000
qbyte $000FF000
qbyte $00000000
qbyte $000FF000
s_Quote:
qbyte $0FF00FF0
qbyte $00F000F0
qbyte $00000000
qbyte $00000000
qbyte $00000000
qbyte $00000000
s_Number:
qbyte $00000000
qbyte $00F00F00
qbyte $0FFFFFF0
qbyte $00F00F00
qbyte $0FFFFFF0
qbyte $00F00F00
s_Dollar:
qbyte $00666600
qbyte $06616660
qbyte $06166660
qbyte $06666660
qbyte $00666600
qbyte $00000000
s_Percent:
qbyte $0FF000F0
qbyte $00000F00
qbyte $0000F000
qbyte $000F0000
qbyte $00F00000
qbyte $0F000FF0
s_Amper:
qbyte $000FF000
qbyte $00F00F00
qbyte $0F00F000
qbyte $00F000F0
qbyte $0F0FFF00
qbyte $00F0F000
s_Single:
qbyte $000FF000
qbyte $0000F000
qbyte $00000000
qbyte $00000000
qbyte $00000000
qbyte $00000000
s_OpenParen:
qbyte $000FF000
qbyte $00FF0000
qbyte $0FF00000
qbyte $0FF00000
qbyte $00FF0000
qbyte $000FF000
s_CloseParen: ; Anger symbol
qbyte $0F0000F0
qbyte $00F00F00
qbyte $00000000
qbyte $00FFFF00
qbyte $0F0000F0
qbyte $F000000F
s_Asterix:
qbyte $00000000 ; Angle symbol
qbyte $00000FF0
qbyte $0000FF00
qbyte $000FF000
qbyte $00FFFFF0
qbyte $00000000
s_Plus: ; Power symbol
qbyte $000F0000
qbyte $000F0000
qbyte $0FFFFF00
qbyte $000F0000
qbyte $000F0000
qbyte $00000000
s_Comma:
qbyte $00000000
qbyte $00000000
qbyte $00000000
qbyte $00000000
qbyte $0000FF00
qbyte $0000F000
s_Minus:
qbyte $00000000
qbyte $00000000
qbyte $0FFFFF00
qbyte $00000000
qbyte $00000000
qbyte $00000000
s_Period:
qbyte $00000000
qbyte $00000000
qbyte $00000000
qbyte $00000000
qbyte $0000FF00
qbyte $0000FF00
s_Slash:
qbyte $000000F0
qbyte $00000F00
qbyte $0000F000
qbyte $000F0000
qbyte $00F00000
qbyte $0F000000
s_N0:
qbyte $00FFFF00
qbyte $0F000FF0
qbyte $0F00F0F0
qbyte $0F0F00F0
qbyte $0FF000F0
qbyte $00FFFF00
s_N1:
qbyte $000F0000
qbyte $00FF0000
qbyte $000F0000
qbyte $000F0000
qbyte $000F0000
qbyte $00FFF000
s_N2:
qbyte $00FFFF00
qbyte $0F0000F0
qbyte $00000F00
qbyte $000FF000
qbyte $00F00000
qbyte $0FFFFFF0
s_N3:
qbyte $00FFFF00
qbyte $000000F0
qbyte $000FFF00
qbyte $000000F0
qbyte $000000F0
qbyte $00FFFF00
s_N4:
qbyte $0000FF00
qbyte $000F0F00
qbyte $00F00F00
qbyte $0FFFFFF0
qbyte $00000F00
qbyte $00000F00
s_N5:
qbyte $0FFFFFF0
qbyte $0F000000
qbyte $0FFFFF00
qbyte $000000F0
qbyte $0F0000F0
qbyte $00FFFF00
s_N6:
qbyte $000FFF00
qbyte $00F00000
qbyte $0F000000
qbyte $0FFFFF00
qbyte $0F0000F0
qbyte $00FFFFF0
s_N7:
qbyte $0FFFFFF0
qbyte $000000F0
qbyte $00000F00
qbyte $0000F000
qbyte $000F0000
qbyte $000F0000
s_N8:
qbyte $00FFFF00
qbyte $0F0000F0
qbyte $00FFFF00
qbyte $0F0000F0
qbyte $0F0000F0
qbyte $00FFFF00
s_N9:
qbyte $00FFFF00
qbyte $0F0000F0
qbyte $00FFFF00
qbyte $0000F000
qbyte $000F0000
qbyte $00F00000
s_Colon:
qbyte $000FF000
qbyte $000FF000
qbyte $00000000
qbyte $000FF000
qbyte $000FF000
qbyte $00000000
s_Semi:
qbyte $00000000
qbyte $000FF000
qbyte $000FF000
qbyte $00000000
qbyte $000FF000
qbyte $000F0000
s_LAngle:
qbyte $0000F000
qbyte $000F0000
qbyte $00F00000
qbyte $000F0000
qbyte $0000F000
qbyte $00000000
s_Equal:
qbyte $00000000
qbyte $00000000
qbyte $0FFFFF00
qbyte $00000000
qbyte $0FFFFF00
qbyte $00000000
s_RAngle:
qbyte $0000F000
qbyte $00000F00
qbyte $000000F0
qbyte $00000F00
qbyte $0000F000
qbyte $00000000
s_Question:
qbyte $00FFF000
qbyte $0F000F00
qbyte $00000F00
qbyte $000FF000
qbyte $00000000
qbyte $000FF000
s_At:
qbyte $00FFFF00
qbyte $0F0000F0
qbyte $0F00F0F0
qbyte $0FFFF0F0
qbyte $000000F0
qbyte $0FFFFF00
s_A:
qbyte $000FF000
qbyte $00F00F00
qbyte $0F0000F0
qbyte $0FFFFFF0
qbyte $0F0000F0
qbyte $0F0000F0
s_B:
qbyte $0FFFFF00
qbyte $0F0000F0
qbyte $0FFFFF00
qbyte $0F0000F0
qbyte $0F0000F0
qbyte $0FFFFF00
s_C:
qbyte $00FFFFF0
qbyte $0F000000
qbyte $0F000000
qbyte $0F000000
qbyte $0F000000
qbyte $00FFFFF0
s_D:
qbyte $0FFFFF00
qbyte $0F0000F0
qbyte $0F0000F0
qbyte $0F0000F0
qbyte $0F0000F0
qbyte $0FFFFF00
s_E:
qbyte $0FFFFFF0
qbyte $0F000000
qbyte $0FFFF000
qbyte $0F000000
qbyte $0F000000
qbyte $0FFFFFF0
s_F:
qbyte $0FFFFFF0
qbyte $0F000000
qbyte $0FFFF000
qbyte $0F000000
qbyte $0F000000
qbyte $0F000000
s_G:
qbyte $00FFFFF0
qbyte $0F000000
qbyte $0F000000
qbyte $0F00FFF0
qbyte $0F0000F0
qbyte $00FFFF00
s_H:
qbyte $0F0000F0
qbyte $0F0000F0
qbyte $0FFFFFF0
qbyte $0F0000F0
qbyte $0F0000F0
qbyte $0F0000F0
s_I:
qbyte $0FFFFF00
qbyte $000F0000
qbyte $000F0000
qbyte $000F0000
qbyte $000F0000
qbyte $0FFFFF00
s_J:
qbyte $000000F0
qbyte $000000F0
qbyte $000000F0
qbyte $0F0000F0
qbyte $0F0000F0
qbyte $00FFFF00
s_K:
qbyte $0F000F00
qbyte $0F00F000
qbyte $0FFF0000
qbyte $0F00F000
qbyte $0F000F00
qbyte $0F000F00
s_L:
qbyte $0F000000
qbyte $0F000000
qbyte $0F000000
qbyte $0F000000
qbyte $0F000000
qbyte $0FFFFFF0
s_M:
qbyte $0F0000F0
qbyte $0FF00FF0
qbyte $0F0FF0F0
qbyte $0F0000F0
qbyte $0F0000F0
qbyte $0F0000F0
s_N:
qbyte $0F0000F0
qbyte $0FF000F0
qbyte $0F0F00F0
qbyte $0F00F0F0
qbyte $0F000FF0
qbyte $0F0000F0
s_O:
qbyte $00FFFF00
qbyte $0F0000F0
qbyte $0F0000F0
qbyte $0F0000F0
qbyte $0F0000F0
qbyte $00FFFF00
s_P:
qbyte $0FFFFF00
qbyte $0F0000F0
qbyte $0FFFFF00
qbyte $0F000000
qbyte $0F000000
qbyte $0F000000
s_Q:
qbyte $00FFFF00
qbyte $0F0000F0
qbyte $0F0000F0
qbyte $0F00F0F0
qbyte $0F000FF0
qbyte $00FFFFF0
s_R:
qbyte $0FFFFF00
qbyte $0F0000F0
qbyte $0FFFFF00
qbyte $0F000F00
qbyte $0F0000F0
qbyte $0F0000F0
s_S:
qbyte $00FFFFF0
qbyte $0F000000
qbyte $00FFFF00
qbyte $000000F0
qbyte $000000F0
qbyte $0FFFFF00
s_T:
qbyte $0FFFFF00
qbyte $000F0000
qbyte $000F0000
qbyte $000F0000
qbyte $000F0000
qbyte $000F0000
s_U:
qbyte $0F0000F0
qbyte $0F0000F0
qbyte $0F0000F0
qbyte $0F0000F0
qbyte $0F0000F0
qbyte $00FFFF00
s_V:
qbyte $0F0000F0
qbyte $0F0000F0
qbyte $0F0000F0
qbyte $0F0000F0
qbyte $00F00F00
qbyte $000FF000
s_W:
qbyte $0F0000F0
qbyte $0F0000F0
qbyte $0F0000F0
qbyte $0F0FF0F0
qbyte $0FF00FF0
qbyte $0F0000F0
s_X:
qbyte $0F0000F0
qbyte $00F00F00
qbyte $000FF000
qbyte $000FF000
qbyte $00F00F00
qbyte $0F0000F0
s_Y:
qbyte $F00000F0
qbyte $0F000F00
qbyte $00F0F000
qbyte $000F0000
qbyte $000F0000
qbyte $000F0000
s_Z:
qbyte $0FFFFFF0
qbyte $00000F00
qbyte $0000F000
qbyte $000F0000
qbyte $00F00000
qbyte $0FFFFFF0
s_LBracket:
qbyte $000FFF00
qbyte $000F0000
qbyte $000F0000
qbyte $000F0000
qbyte $000F0000
qbyte $000FFF00
s_BackSlash:
qbyte $0F000000
qbyte $00F00000
qbyte $000F0000
qbyte $0000F000
qbyte $00000F00
qbyte $000000F0
s_RBracket:
qbyte $00FFF000
qbyte $0000F000
qbyte $0000F000
qbyte $0000F000
qbyte $0000F000
qbyte $00FFF000
s_Caret:
qbyte $0000F000
qbyte $000F0F00
qbyte $00F000F0
qbyte $00000000
qbyte $00000000
qbyte $00000000
s_UnderLine:
qbyte $00000000
qbyte $00000000
qbyte $00000000
qbyte $00000000
qbyte $00000000
qbyte $FFFFFFF0
s_Template:
qbyte $00000000
qbyte $00000000
qbyte $00000000
qbyte $00000000
qbyte $00000000
qbyte $00000000

6575
font8x8.s

File diff suppressed because it is too large Load Diff

View File

@ -11,11 +11,10 @@ FIRST_CHAR = 32
; Draws a Pascal string
;
; PARAML0 = Pointer to string
; PARAML1 = Width of one character in pixels (you can tweak kerning if you like)
; X = Font index
; Y = VRAM position of lower right corner of string at which to draw
;
; Trashes SCRATCHL, X, Y, A
; Trashes SCRATCHL,PARAML1,X, Y, A
;
renderString:
NATIVE
@ -29,8 +28,7 @@ renderString:
lda fontJumpTable,y
sta renderCharBounce+1
lda PARAML1 ; Convert pixel width to bytes
lsr
lda fontCharWidthTable,y
sta PARAML1
plb ; Temporarily revert to caller's DBR to access their pointer
@ -97,6 +95,9 @@ fontJumpTable:
.addr font8characterJumpTable
.addr font16characterJumpTable
fontCharWidthTable: ; In bytes
.word 4
.word 8
.include "font8x8.s"
.include "font16x16.s"

View File

@ -19,18 +19,6 @@ beginGameplay:
lda #0
jsr setPalette
; Set up palette for status bar
lda #statusBarPalette
sta PARAML0
lda #1
jsr setPalette
lda #1
sta PARAML0
ldx #0
ldy #10
jsr setScanlinePalette
; Set up sprite rendering
BITS8
lda #3
@ -68,18 +56,6 @@ beginGameplay:
jsr compileTerrain
jsr clipTerrain
; Test font renderer
lda #testString
sta PARAML0
lda #8
sta PARAML1
ldy #$4430 ; Correct start of line address for 16 wide: $4bc7
ldx #0
jsl $050000
bra gameplayLoop
testString:
pstring "HELLO WORLD!"
gameplayLoop:
lda projectileActive
bpl gameplayLoopKeyboardSkip
@ -420,9 +396,6 @@ fire:
basePalette:
.word $0aef,$0080,$0080,$0861,$0c93,$0eb4,$0d66,$0f9a,$0777,$0f00,$0bbb,$ddd,$007b,$0a5b,$0000,$0fff
statusBarPalette:
.word $0aef,$0fff,$0aef,$0aef,$0aef,$0aef,$0d66,$0aef,$0aef,$0aef,$0aef,$0aef,$0aef,$0aef,$0aef,$0000
quitRequested:

View File

@ -222,11 +222,17 @@ setPaletteLoop_SMC:
; Trashes PARAML0
;
drawNumber:
SAVE_AXY
sta PARAML0
jsr intToString
lda #intToStringResult
sta PARAML0
txy
ldx #0
jsl renderStringFar
jsr DrawString
RESTORE_AXY
rts

View File

@ -424,56 +424,44 @@ renderPlayerHeader:
SAVE_AXY
PLAYERPTR_Y
ldx #0 + 321
tya
clc
adc #playerData
adc #PD_NAME
jsr DrawString
sta PARAML0
phy
ldy #$25c0
ldx #0
jsl renderStringFar
ply
ldx #48 + 321
lda #angleStr
jsr DrawString
; lda playerData+PD_ANGLE,y
; ldx #56 + $2500
; jsr drawNumber
lda playerData+PD_ANGLE,y
ldx #56 + 321
jsr drawNumber
; lda playerData+PD_POWER,y
; ldx #76 + $2500
; jsr drawNumber
ldx #68 + 321
lda #powerStr
jsr DrawString
; ldx #88 + 321
; lda #angerStr
; jsr DrawString
lda playerData+PD_POWER,y
ldx #76 + 321
jsr drawNumber
ldx #88 + 321
lda #angerStr
jsr DrawString
lda playerData+PD_ANGER,y
ldx #96 + 321
lda playerData+PD_TREATS,y
ldx #$25f6
jsr drawNumber
lda #treatsStr
ldx #142 + 321
jsr DrawString
lda playerData+PD_TREATS,y
ldx #146 + 321
jsr drawNumber
sta PARAML0
ldy #$25f2
ldx #0
jsl renderStringFar
RESTORE_AXY
rts
angleStr:
pstring "*: "
powerStr:
pstring "+: "
angerStr:
pstring "): "
treatsStr:
pstring "$ "
pstring "TREATS:$"