Faster and shorter draw

And C64 version works again :)
This commit is contained in:
Pecusx
2023-08-11 21:37:39 +02:00
parent 98e6e7ee49
commit 8bed031cc4
8 changed files with 56 additions and 44 deletions
+10
View File
@@ -304,6 +304,16 @@ NoMountain
rts rts
.endp .endp
;-------------------------------------------------- ;--------------------------------------------------
.proc SoilDownTurbo
;--------------------------------------------------
; fast SoilDown froc - test
jsr ClearTanks
NoClearTanks
; jsr CalcAndDrawMountains
jmp DrawTanks
;rts
.endp
;--------------------------------------------------
.proc TypeChar .proc TypeChar
; puts char on the graphics screen ; puts char on the graphics screen
; in: CharCode ; in: CharCode
+1 -1
View File
@@ -25,7 +25,7 @@ TextBackgroundColor = $02 ; REAL constans - use: LDA #TextBackgroundColor
TextForegroundColor = $0A TextForegroundColor = $0A
space = 0 ; space in screencodes space = 0 ; space in screencodes
KeyRepeatSpeed = 10 ; (max 127 !!!) KeyRepeatSpeed = 8 ; (max 127 !!!)
;character codes for symbols (tank, parachute, etc. ) ;character codes for symbols (tank, parachute, etc. )
; characters from tanks.fnt (graphics screen) ; characters from tanks.fnt (graphics screen)
+36 -38
View File
@@ -59,21 +59,25 @@ DrawOnTheScreen
sta XI+1 sta XI+1
sta YI sta YI
sta YI+1 sta YI+1
sta HowToDraw ; reset flags
sta DrawDirFactor ; reset flags
; setting the direction controll bits ; setting the direction controll bits
cpw ydraw ybyte cpw ydraw ybyte
bcc LineDown bcc LineDown
; here one line up ; here one line up
; we are setting bit 0
mva #1 HowToDraw ;here we can because it's first operation
; we are subctracting Yend from Ybegin (reverse order) ; we are subctracting Yend from Ybegin (reverse order)
; DY=YI-YK ; DY=YI-YK
sbw ydraw ybyte DY sbw ydraw ybyte DY
jmp CheckDirectionX ; we are setting bit 7
lda #%10000000
sta HowToDraw ;here we can because it's first operation
bne CheckDirectionX ; JMP
LineDown LineDown
; one line down here ; one line down here
; we are setting bit 0 ; we are clearing bit 7 (it's cleared :) )
mva #0 HowToDraw ;here we can because it's first operation ; mva #0 HowToDraw ;here we can because it's first operation
; substract Ybegin from Yend (normal order) ; substract Ybegin from Yend (normal order)
; DY=YK-YI ; DY=YK-YI
sbw ybyte ydraw DY sbw ybyte ydraw DY
@@ -81,22 +85,21 @@ CheckDirectionX
cpw xdraw xbyte cpw xdraw xbyte
bcc LineRight bcc LineRight
; here goes line to the left ; here goes line to the left
; we set bit 1
lda HowToDraw
ora #$02
sta HowToDraw
; substract Xend from Xbegin (reverse) ; substract Xend from Xbegin (reverse)
; DX=XI-XK ; DX=XI-XK
sbw xdraw xbyte DX sbw xdraw xbyte DX
jmp CheckDirectionFactor ; we set bit 6
lda HowToDraw
ora #%01000000
sta HowToDraw
bne CheckDirectionFactor ; JMP
LineRight LineRight
; here goes one line to the right ; here goes one line to the right
; we clear bit 0 ; we clear bit 6
; we can do nothing because the bit is cleared! ; we can do nothing because the bit is cleared!
;lda HowToDraw ;lda HowToDraw
;and #$FD ;and #%10111111
;sta HowToDraw ;sta HowToDraw
; substracting Xbegin from Xend (normal way) ; substracting Xbegin from Xend (normal way)
@@ -111,17 +114,7 @@ CheckDirectionFactor
; we already have DX in A ; we already have DX in A
cpw DX DY cpw DX DY
bcc SwapXY bcs NoSwapXY
; 'a' factor is fire, so we copy parameters
; XK=DX
mwa DX XK
; and clearing bit 2
; and bit 2 clear
; (is not needed because already cleared)
;lda HowToDraw
;and #$FB
;sta HowToDraw
jmp LineParametersReady
SwapXY SwapXY
; not this half of a quarter! - parameters must be swapped ; not this half of a quarter! - parameters must be swapped
; XK=DY ; XK=DY
@@ -132,10 +125,18 @@ SwapXY
mwa DX DY mwa DX DY
mwa XK DX mwa XK DX
; and let's set bit 2 ; and let's set bit 7 of DrawDirFactor
lda HowToDraw dec DrawDirFactor
ora #$04 ; bmi LineParametersReady ; JMP - but we don't need JMP :)
sta HowToDraw NoSwapXY
; 'a' factor is fire, so we copy parameters
; XK=DX
mwa DX XK
; and clearing bit 7 of DrawDirFactor
; and bit 7 clear
; (is not needed because already cleared)
;lda #0
;sta DrawDirFactor
LineParametersReady LineParametersReady
; let's check if length is not zero ; let's check if length is not zero
lda DX lda DX
@@ -191,9 +192,8 @@ drplot ; Our plot that checks how to calculate pixels.
; and YI to temp) ; and YI to temp)
lda HowToDraw bit DrawDirFactor
and #$04 bmi SwappedXY
bne SwappedXY
mwa XI temp mwa XI temp
mwa YI temp2 mwa YI temp2
jmp CheckPlotY jmp CheckPlotY
@@ -201,9 +201,8 @@ SwappedXY
mwa XI temp2 mwa XI temp2
mwa YI temp mwa YI temp
CheckPlotY CheckPlotY
lda HowToDraw bit HowToDraw
and #01 bmi LineGoesUp
bne LineGoesUp
; here we know that line goes down and we are not changing Y ; here we know that line goes down and we are not changing Y
adw temp2 ytempDRAW ydraw ; YI adw temp2 ytempDRAW ydraw ; YI
jmp CheckPlotX jmp CheckPlotX
@@ -211,9 +210,8 @@ LineGoesUp
; line goes up here - we are reversing Y ; line goes up here - we are reversing Y
sbw ytempDRAW temp2 ydraw ; YI sbw ytempDRAW temp2 ydraw ; YI
CheckPlotX CheckPlotX
lda HowToDraw bit HowToDraw
and #02 bvs LineGoesLeft
bne LineGoesLeft
; here we know that line goes right and we are not changing X ; here we know that line goes right and we are not changing X
adw temp xtempDRAW xdraw ; XI adw temp xtempDRAW xdraw ; XI
jmp PutPixelinDraw jmp PutPixelinDraw
+2 -1
View File
@@ -38,7 +38,7 @@
icl 'definitions.asm' icl 'definitions.asm'
;--------------------------------------------------- ;---------------------------------------------------
FirstZpageVariable = $53 FirstZpageVariable = $52
.zpvar DliColorBack .byte = FirstZpageVariable .zpvar DliColorBack .byte = FirstZpageVariable
.zpvar ClearSky .byte ; $ff - Crear sky during drawmountains, 0 - no clear sky .zpvar ClearSky .byte ; $ff - Crear sky during drawmountains, 0 - no clear sky
.zpvar PaddleState .byte ; old state 2nd button for 2 buttons joysticks .zpvar PaddleState .byte ; old state 2nd button for 2 buttons joysticks
@@ -142,6 +142,7 @@ FirstZpageVariable = $53
.zpvar Multiplier .word .zpvar Multiplier .word
.zpvar Multiplier_ .byte ; 3 bytes .zpvar Multiplier_ .byte ; 3 bytes
.zpvar HowToDraw .byte .zpvar HowToDraw .byte
.zpvar DrawDirFactor .byte
.zpvar gravity .byte .zpvar gravity .byte
.zpvar LineLength .word .zpvar LineLength .word
.zpvar tracerflag .byte .zpvar tracerflag .byte
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
+7 -4
View File
@@ -24,7 +24,7 @@
;--------------------------------------------------- ;---------------------------------------------------
.macro build .macro build
dta d"1.32" ; number of this build (4 bytes) dta d"1.33" ; number of this build (4 bytes)
.endm .endm
.macro RMTSong .macro RMTSong
@@ -35,11 +35,12 @@
icl 'definitions.asm' icl 'definitions.asm'
;--------------------------------------------------- ;---------------------------------------------------
FirstZpageVariable = $58 ; $57 FirstZpageVariable = $56 ; $57
.zpvar DliColorBack .byte = FirstZpageVariable .zpvar DliColorBack .byte = FirstZpageVariable
.zpvar GradientNr .byte .zpvar GradientNr .byte
.zpvar GradientColors .word .zpvar GradientColors .word
.zpvar WindChangeInRound .byte ; wind change after each turn (not round only) flag - (0 - round only, >0 - each turn) .zpvar WindChangeInRound .byte ; wind change after each turn (not round only) flag - (0 - round only, >0 - each turn)
.zpvar RandomMountains .byte ; mountains type change after each turn flag - (0 - round only, >0 - each turn)
.zpvar JoystickNumber .byte .zpvar JoystickNumber .byte
.zpvar LazyFlag .byte ; 7 bit - run Lazy Darwin, 6 bit - run Lazy Boy or Darwin (!) after inventory, 0 - nothing .zpvar LazyFlag .byte ; 7 bit - run Lazy Darwin, 6 bit - run Lazy Boy or Darwin (!) after inventory, 0 - nothing
.zpvar SpyHardFlag .byte ; >$7f - run SpyHard after inventory .zpvar SpyHardFlag .byte ; >$7f - run SpyHard after inventory
@@ -135,6 +136,7 @@ FirstZpageVariable = $58 ; $57
.zpvar Multiplier .word .zpvar Multiplier .word
.zpvar Multiplier_ .byte ; 3 bytes .zpvar Multiplier_ .byte ; 3 bytes
.zpvar HowToDraw .byte .zpvar HowToDraw .byte
.zpvar DrawDirFactor .byte
.zpvar gravity .byte .zpvar gravity .byte
.zpvar LineLength .word .zpvar LineLength .word
.zpvar tracerflag .byte .zpvar tracerflag .byte
@@ -334,7 +336,8 @@ MakeDarkScreen
.endp .endp
;-------------------------------------------------- ;--------------------------------------------------
.proc ShellDelay .proc ShellDelay
ldx flyDelay ldy flyDelay
Y
DelayLoop DelayLoop
lda $d012 lda $d012
@ cmp $d012 @ cmp $d012
@@ -342,7 +345,7 @@ DelayLoop
lda $d012 lda $d012
@ cmp $d012 @ cmp $d012
beq @- beq @-
dex dey
bne DelayLoop bne DelayLoop
noShellDelay noShellDelay
rts rts
BIN
View File
Binary file not shown.