changeset 22:82224f9ef319

Convert font to unpacked representation Convert the text font to an unpacked raw format. Also include glyphs for all the regular ASCII characters in preparation for changing over to full ASCII operations.
author William Astle <lost@l-w.ca>
date Thu, 01 Jan 2015 23:01:23 -0700
parents aa23c59bd36a
children 5e61b3eac873
files dod.s
diffstat 1 files changed, 34 insertions(+), 65 deletions(-) [+]
line wrap: on
line diff
--- a/dod.s	Thu Jan 01 22:32:23 2015 -0700
+++ b/dod.s	Thu Jan 01 23:01:23 2015 -0700
@@ -1890,12 +1890,9 @@
 ; is used as a carriage return. Codes 32 and 33 are the left and right parts of the contracted heart symbol
 ; while 34 and 35 are the left and right parts of the expanded heart symbol. 36 is backspace.
 ;
-; Glyphs for codes 0 through 30 are encoded using the packed five bit encoding and are located at LDB1B. They
-; are encoded in a 5 by 7 bitmap which is shifted to be offset one pixel from the left of the character cell
-; upon decoding.
-;
-; The glyphs for the heart codes are in unpacked encoding and are located at LDBB6 and occupy the entire
-; 8 bit width of the character cell.
+; Glyhps are taken from the font data in font.s which consists of glyphs for ASCII 32 through 126 and also
+; contains extra glyphs for the heart parts encoded at offset 128. The character codes as listed above are
+; translated to the font and displayed accordingly.
 ;
 ; These routines expect a pointer to the text configuration parameters in U. At offset 0 is the start address
 ; of the scrollable area of the screen (memory address). At offset 2 is the ending character cell address of
@@ -1905,7 +1902,7 @@
 ; will point to commandarea.
 LC9B2		cmpa #$24			; is it backspace?	
 		beq LC9BF			; brif so
-		cmpa #$1f			; vertical spacer?
+		cmpa #$1f			; carriage return?
 		beq LC9CA			; brif so
 		bsr LCA17			; go handle a glyph
 		leax 1,x			; move to next character position
@@ -1957,26 +1954,34 @@
 		rola				;*
 		rts
 LCA17		pshs a,b,x,y,u			; save registers
-		cmpa #$20			; is it a printing character?
-		blo LCA29			; brif so
-		suba #$20			; mask off printing characters
-		ldb #7				; 7 bytes per font table entry
-		mul				; get offset in table
-		addd #LDBB6			; add in base address of table
-		tfr d,x				; put font pointer somewhere useful
-		bra LCA44			; go draw glyph
-LCA29		ldb #5				; 5 bytes per font table entry
-		mul				; get offset in table
-		addd #LDB1B			; add in base address of table
+		tsta				; is it space?
+		beq LCA29b			; brif so
+		cmpa #$1b			; is it an printing character?
+		blo LCA29a			; brif so
+		beq LCA29c			; brif !
+		cmpa #$1c			; is it _?
+		beq LCA29d			; brif so
+		cmpa #$1d			; is it ??
+		beq LCA29e			; brif so
+		cmpa #$1e			; is it .?
+		beq LCA29f			; brif so
+		adda #128-32			; offset to special characters in font data
+		skip2				; go render the font data
+LCA29a		adda #$40			; adjust to letter area of font
+		skip2				; go render font data
+LCA29b		lda #32				; code for space
+		skip2
+LCA29c		lda #'!				; code for !
+		skip2
+LCA29d		lda #'_				; code for _
+		skip2
+LCA29e		lda #'?				; code for ?
+		skip2
+LCA29f		lda #'.				; code for .
+		ldb #8				; 8 bytes per font entry
+		mul				; now D is offset
+		addd #fontdata-(32*8)		; offset into table
 		tfr d,x				; put pointer somewhere useful
-		ldu #fontbuf			; point to buffer to decode glyph data
-		decodestr			; go decode a packed string
-		ldx #fontbuf+7			; point one past end of buffer
-LCA39		lsl ,-x				;* centre glyph data in byte
-		lsl ,x				;*
-		cmpx #fontbuf			; at start of buffer?
-		bhi LCA39			; brif not - keep centring
-		ldu 6,s				; get back U value
 LCA44		ldd 4,u				; get display address location
 		bsr LCA10			; multiply by 8 - gets start of row in 11..8
 		lsrb				;* and divide lsb by 8 again to get offset within
@@ -1984,7 +1989,7 @@
 		lsrb				;* and force to top of character cell
 		addd ,u				; add in start of text area
 		tfr d,y				; put pointer somewhere useful
-		ldb #7				; seven bytes to copy
+		ldb #8				; eight bytes to copy
 LCA51		lda ,x+				; get byte from font data
 		eora 6,u			; merge with background colour
 		sta ,y				; save it on the screen
@@ -4105,44 +4110,8 @@
 		fcb $03,$E8,$FF,$05,$FF,$03,$04,$03 ; galdrog
 		fcb $03,$E8,$FF,$06,$FF,$00,$0D,$07 ; wizard's image
 		fcb $1F,$40,$FF,$06,$FF,$00,$0D,$07 ; wizard
-; This is the text font - these values are in packed format
-LDB1B		fcb $30,$00,$00,$00,$00		; char code 0 - space
-		fcb $31,$15,$18,$fe,$31		; char code 1 - A
-		fcb $37,$a3,$1f,$46,$3e		; char code 2 - B
-		fcb $33,$a3,$08,$42,$2e		; char code 3 - C
-		fcb $37,$a3,$18,$c6,$3e		; char code 4 - D	
-		fcb $37,$e1,$0f,$42,$1f		; char code 5 - E
-		fcb $37,$e1,$0f,$42,$10		; char code 6 - F
-		fcb $33,$e3,$08,$4e,$2f		; char code 7 - G
-		fcb $34,$63,$1f,$c6,$31		; char code 8 - H
-		fcb $33,$88,$42,$10,$8e		; char code 9 - I
-		fcb $30,$42,$10,$86,$2e		; char code 10 - J
-		fcb $34,$65,$4c,$52,$51		; char code 11 - K
-		fcb $34,$21,$08,$42,$1f		; char code 12 - L
-		fcb $34,$77,$5a,$d6,$31		; char code 13 - M
-		fcb $34,$63,$9a,$ce,$31		; char code 14 - N
-		fcb $33,$a3,$18,$c6,$2e		; char code 15 - O
-		fcb $37,$a3,$1f,$42,$10		; char code 16 - P
-		fcb $33,$a3,$18,$d6,$4d		; char code 17 - Q
-		fcb $37,$a3,$1f,$52,$51		; char code 18 - R
-		fcb $33,$a3,$07,$06,$2e		; char code 19 - S
-		fcb $37,$ea,$42,$10,$84		; char code 20 - T
-		fcb $34,$63,$18,$c6,$2e		; char code 21 - U
-		fcb $34,$63,$15,$28,$84		; char code 22 - V
-		fcb $34,$63,$1a,$d7,$71		; char code 23 - W
-		fcb $34,$62,$a2,$2a,$31		; char code 24 - X
-		fcb $34,$62,$a2,$10,$84		; char code 25 - Y
-		fcb $37,$c2,$22,$22,$1f		; char code 26 - Z
-		fcb $31,$08,$42,$10,$04		; char code 27 - !
-		fcb $30,$00,$00,$00,$1f		; char code 28 - underscore
-		fcb $33,$a2,$13,$10,$04		; char code 29 - ?
-		fcb $30,$00,$00,$00,$04		; char code 30 - .
-; some special glyphs
-LDBB6		fcb $00,$00,$01,$01,$00,$00,$00	; char code 32 - left part of contracted heart
-		fcb $00,$a0,$f0,$f0,$e0,$40,$00	; char code 33 - right part of contracted heart
-		fcb $00,$01,$03,$03,$01,$00,$00	; char code 34 - left half of expanded heart
-		fcb $00,$b0,$f8,$f8,$f0,$e0,$40	; char code 35 - right part of expanded heart
-
+; Fetch in the font data
+		include font.s
 ; These two entries are related to sound generation.
 LDBD2		fcb $00,$80,$00,$01,$00,$50,$00,$04	; for the "wizard fade out" sound and the walk into wall sound
 LDBDA		fcb $00,$50,$00,$05			; for the create death sound