mirror of
https://github.com/Pecusx/scorch_src.git
synced 2026-05-21 14:49:40 +02:00
Better (and faster!) 4x4 char handling.
New PutChar4x4FULL proc.
This commit is contained in:
+123
-53
@@ -1198,7 +1198,7 @@ IntoDraw adw xbyte #screenBytes
|
|||||||
.endp
|
.endp
|
||||||
;
|
;
|
||||||
; ------------------------------------------
|
; ------------------------------------------
|
||||||
TypeChar .proc
|
.proc TypeChar
|
||||||
; puts char on the graphics screen
|
; puts char on the graphics screen
|
||||||
; in: CharCode
|
; in: CharCode
|
||||||
; in: left LOWER corner of the char coordinates (xdraw, ydraw)
|
; in: left LOWER corner of the char coordinates (xdraw, ydraw)
|
||||||
@@ -1336,7 +1336,8 @@ CharLoopi
|
|||||||
rts
|
rts
|
||||||
.endp
|
.endp
|
||||||
; ------------------------------------------
|
; ------------------------------------------
|
||||||
PutChar4x4 .proc ;puts 4x4 pixels char on the graphics screen
|
.proc PutChar4x4
|
||||||
|
; puts 4x4 pixels char on the graphics screen
|
||||||
; in: xdraw, ydraw (upper left corner of the char)
|
; in: xdraw, ydraw (upper left corner of the char)
|
||||||
; in: CharCode4x4 (.sbyte)
|
; in: CharCode4x4 (.sbyte)
|
||||||
;--------------------------------------------------
|
;--------------------------------------------------
|
||||||
@@ -1399,66 +1400,135 @@ Loop4x4Continued
|
|||||||
|
|
||||||
rts
|
rts
|
||||||
.endp
|
.endp
|
||||||
; ------------------------------------------
|
|
||||||
PutChar4x4FULL .proc;
|
|
||||||
;this routine works just like PutChar4x4,
|
|
||||||
;but this time all pixels are being drawn
|
|
||||||
;(empty and not empty)
|
|
||||||
;--------------------------------------------------
|
;--------------------------------------------------
|
||||||
|
.proc PutChar4x4FULL
|
||||||
; calculating address of the first byte
|
; puts 4x4 pixels char on the graphics screen
|
||||||
mva #4 LoopCounter4x4
|
; in: xdraw, ydraw (upper left corner of the char)
|
||||||
|
; in: CharCode4x4 (.sbyte)
|
||||||
|
; this routine works just like PutChar4x4,
|
||||||
|
; but this time all pixels are being drawn
|
||||||
|
; (empty and not empty)
|
||||||
|
;--------------------------------------------------
|
||||||
|
cpw ydraw #(screenheight-4)
|
||||||
|
jcs EndPut4x4
|
||||||
|
cpw xdraw #(screenwidth-4)
|
||||||
|
jcs EndPut4x4 ;nearest RTS
|
||||||
|
; char to the table
|
||||||
lda CharCode4x4
|
lda CharCode4x4
|
||||||
and #1
|
and #1
|
||||||
|
beq Upper4bits
|
||||||
|
lda #$ff ; better option to check (nibbler4x4 = $00 or $ff)
|
||||||
|
Upper4bits
|
||||||
sta nibbler4x4
|
sta nibbler4x4
|
||||||
lda CharCode4x4
|
lda CharCode4x4
|
||||||
ror
|
lsr
|
||||||
; in carry there is which nibble of the byte is to be taken clc
|
sta fontind
|
||||||
clc
|
lda #$00
|
||||||
adc #(3*32)
|
sta fontind+1
|
||||||
sta y4x4
|
|
||||||
nextline4x4FULL
|
adw fontind #font4x4
|
||||||
mva #4 Xcounter4x4
|
|
||||||
ldy y4x4
|
|
||||||
lda font4x4,y
|
|
||||||
|
|
||||||
ldx nibbler4x4
|
; and 4 bytes to the table
|
||||||
beq uppernibbleFULL
|
ldy #0
|
||||||
|
ldx #3
|
||||||
|
CopyChar
|
||||||
|
lda (fontind),y ; Y must be 0 !!!!
|
||||||
|
bit nibbler4x4
|
||||||
|
bmi GetLower4bits
|
||||||
|
ror
|
||||||
|
ror
|
||||||
|
ror
|
||||||
|
ror
|
||||||
|
GetLower4bits
|
||||||
|
ora #$f0
|
||||||
|
sta char1,x
|
||||||
|
lda #$ff
|
||||||
|
sta char2,x
|
||||||
|
; and 4 bytes as a mask
|
||||||
|
lda #$0f
|
||||||
|
sta mask1,x
|
||||||
|
lda #$00
|
||||||
|
sta mask2,x
|
||||||
|
adw fontind #32 ; next byte of 4x4 font
|
||||||
|
dex
|
||||||
|
bpl CopyChar
|
||||||
|
|
||||||
asl
|
; calculating coordinates from xdraw and ydraw
|
||||||
asl
|
mwa xdraw xbyte
|
||||||
asl
|
|
||||||
asl
|
lda xbyte
|
||||||
uppernibbleFULL
|
and #$7
|
||||||
rol
|
sta ybit
|
||||||
sta StoreA4x4
|
|
||||||
bcs EmptyPixelFULL
|
lsrw xbyte ; div 8
|
||||||
lda plot4x4color ;these lines are not necessary
|
rorw xbyte
|
||||||
sta color ;if a plots are one color only
|
rorw xbyte
|
||||||
jsr plot
|
|
||||||
jmp Loop4x4ContinuedFULL
|
;---
|
||||||
EmptyPixelFULL
|
ldy xbyte
|
||||||
lda #1 ;reverse color (color==1-color)
|
lda ydraw ; y = y - 7 because left lower. shouldn't it be 8?
|
||||||
sec
|
sec
|
||||||
sbc plot4x4color
|
sbc #7
|
||||||
sta color
|
tax
|
||||||
jsr plot
|
|
||||||
;this is turned on now
|
|
||||||
;of course it is slower
|
|
||||||
|
|
||||||
Loop4x4ContinuedFULL
|
|
||||||
inw xdraw
|
|
||||||
lda StoreA4x4
|
|
||||||
dec Xcounter4x4
|
|
||||||
ldx Xcounter4x4
|
|
||||||
bne uppernibbleFULL
|
|
||||||
; here we have on screen one line of the char
|
|
||||||
inw ydraw
|
|
||||||
sbw xdraw #4
|
|
||||||
sbw y4x4 #32 ; why? possibly because of width of the 4x4 font
|
|
||||||
dec:lda LoopCounter4x4
|
|
||||||
bne nextline4x4FULL
|
|
||||||
|
|
||||||
|
lda linetableL,x
|
||||||
|
sta xbyte
|
||||||
|
lda linetableH,x
|
||||||
|
sta xbyte+1
|
||||||
|
; mask preparation and character shifting
|
||||||
|
ldx ybit
|
||||||
|
beq MaskOK01
|
||||||
|
MakeMask01
|
||||||
|
lsr mask1
|
||||||
|
ror mask2
|
||||||
|
lsr mask1+1
|
||||||
|
ror mask2+1
|
||||||
|
lsr mask1+2
|
||||||
|
ror mask2+2
|
||||||
|
lsr mask1+3
|
||||||
|
ror mask2+3
|
||||||
|
sec
|
||||||
|
ror char1
|
||||||
|
ror char2
|
||||||
|
sec
|
||||||
|
ror char1+1
|
||||||
|
ror char2+1
|
||||||
|
sec
|
||||||
|
ror char1+2
|
||||||
|
ror char2+2
|
||||||
|
sec
|
||||||
|
ror char1+3
|
||||||
|
ror char2+3
|
||||||
|
dex
|
||||||
|
bne MakeMask01
|
||||||
|
MaskOK01
|
||||||
|
; here x=0
|
||||||
|
; lda Erase
|
||||||
|
; beq CharLoopi ; it works, because x=0
|
||||||
|
; lda #$ff
|
||||||
|
; ldx #3
|
||||||
|
;EmptyChar
|
||||||
|
; sta char1,x
|
||||||
|
; sta char2,x
|
||||||
|
; dex
|
||||||
|
; bpl EmptyChar
|
||||||
|
ldx #0
|
||||||
|
CharLoopi4x4
|
||||||
|
lda (xbyte),y
|
||||||
|
ora mask1,x
|
||||||
|
and char1,x
|
||||||
|
sta (xbyte),y
|
||||||
|
iny
|
||||||
|
lda (xbyte),y
|
||||||
|
ora mask2,x
|
||||||
|
and char2,x
|
||||||
|
sta (xbyte),y
|
||||||
|
dey
|
||||||
|
adw xbyte #screenBytes
|
||||||
|
inx
|
||||||
|
cpx #4
|
||||||
|
bne CharLoopi4x4
|
||||||
|
EndPut4x4
|
||||||
rts
|
rts
|
||||||
.endp
|
.endp
|
||||||
|
|
||||||
|
|||||||
BIN
Binary file not shown.
Reference in New Issue
Block a user