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