Fast SoilDown ready! ??

This commit is contained in:
Pecusx
2023-06-12 19:39:56 +02:00
parent f4d1865fd6
commit 3787823288
3 changed files with 47 additions and 25 deletions
+45 -24
View File
@@ -197,6 +197,14 @@ ClearPlot
mva #1 color mva #1 color
drawmountainsloop drawmountainsloop
jsr DrawMountainLine
NoMountain
inw modify
inw xdraw
cpw xdraw #screenwidth
bne drawmountainsloop
rts
DrawMountainLine
.IF FASTER_GRAF_PROCS = 1 .IF FASTER_GRAF_PROCS = 1
; calculate lower point in one screen byte ; calculate lower point in one screen byte
lda xdraw lda xdraw
@@ -211,15 +219,26 @@ NotLower
bpl @- bpl @-
sta temp2 sta temp2
inc temp2 ; this is our minimum inc temp2 ; this is our minimum
bit ClearSky
bpl NoClearSky
; Clear Sky
mwa #0 ydraw
jsr plot.MakePlot
@ lda #$ff
sta (xbyte),y
adw xbyte #screenBytes
inc ydraw
lda ydraw
cmp temp2
bne @-
NoClearSky
MinCalculated MinCalculated
.ENDIF
ldy #0 ldy #0
lda (modify),y lda (modify),y
cmp #screenheight cmp #screenheight
beq NoMountain beq NoMountain
sta ydraw sta ydraw
sty ydraw+1 sty ydraw+1
.IF FASTER_GRAF_PROCS = 1
; there was Drawline proc ; there was Drawline proc
jsr plot.MakePlot jsr plot.MakePlot
; after plot we have: (xbyte),y - addres of screen byte; X - index in bittable (number of bit) ; after plot we have: (xbyte),y - addres of screen byte; X - index in bittable (number of bit)
@@ -254,6 +273,12 @@ MinCalculated
bne @- bne @-
NotFillBytes NotFillBytes
.ELSE .ELSE
ldy #0
lda (modify),y
cmp #screenheight
beq NoMountain
sta ydraw
sty ydraw+1
; there was Drawline proc ; there was Drawline proc
drawline drawline
jsr plot.MakePlot jsr plot.MakePlot
@@ -263,19 +288,14 @@ drawline
bne drawline bne drawline
; end of Drawline proc ; end of Drawline proc
.ENDIF .ENDIF
NoMountain
inw modify
inw xdraw
cpw xdraw #screenwidth
bne drawmountainsloop
rts rts
.endp .endp
;-------------------------------------------------- ;--------------------------------------------------
.proc CalculateMountainTable .proc CalcAndDrawMountains
;-------------------------------------------------- ;--------------------------------------------------
; Calculate mountaintable from screen data ; Calculate mountaintable from screen data
; for speedup SoilDown, etc. ; for speedup SoilDown, etc.
mva #$ff ClearSky
; Range alignment to full bytes. ; Range alignment to full bytes.
lda RangeLeft lda RangeLeft
and #%11111000 and #%11111000
@@ -287,17 +307,15 @@ NoMountain
cpw RangeLeft RangeRight cpw RangeLeft RangeRight
jcs NothingToFall jcs NothingToFall
; convert range to bytes ; convert range to bytes
mwa RangeLeft temp lda RangeLeft
lsr temp+1 ; temp / 8 sta temp
sta xdraw
lda RangeLeft+1
sta xdraw+1
lsr @ ; temp / 8
ror temp ror temp
lsr temp ; max range is 511 ! (9 bits) lsr temp ; max range is 511 ! (9 bits)
lsr temp ; temp+1 = 0 lsr temp ; temp+1 = 0
mva RangeRight temp+1
mva RangeRight+1 temp2
lsr temp2 ; temp+1 / 8
ror temp+1
lsr temp+1 ; max range is 511 ! (9 bits)
lsr temp+1 ; temp+1 = 0
; mwa #0 temp+1 ; byte in screen line ; mwa #0 temp+1 ; byte in screen line
adw RangeLeft #mountaintable modify adw RangeLeft #mountaintable modify
@@ -335,13 +353,18 @@ NoPixel
;ldy ydraw ;ldy ydraw
cpx #screenheight cpx #screenheight
bne ColumnLoop ; next byte in colum bne ColumnLoop ; next byte in colum
; redrawing a column (byte) of mountains uses the drawmountains fragment
adw modify #8 mva #7 temp+1 ; draw 8 mountain columns
@ jsr drawmountains.DrawMountainLine
inw modify
inw xdraw
dec temp+1
bpl @-
inc temp inc temp
lda temp cpw xdraw RangeRight
cmp temp+1
bne HorizontalByteLoop ; next column of bytes bne HorizontalByteLoop ; next column of bytes
NothingToFall NothingToFall
mva #$00 ClearSky
rts rts
.endp .endp
;-------------------------------------------------- ;--------------------------------------------------
@@ -350,9 +373,7 @@ NothingToFall
; fast SoilDown froc - test ; fast SoilDown froc - test
jsr ClearTanks jsr ClearTanks
NoClearTanks NoClearTanks
jsr CalculateMountainTable jsr CalcAndDrawMountains
jsr ClearScreen
jsr drawmountains
jmp DrawTanks jmp DrawTanks
;rts ;rts
.endp .endp
+2 -1
View File
@@ -36,8 +36,9 @@
icl 'definitions.asm' icl 'definitions.asm'
;--------------------------------------------------- ;---------------------------------------------------
FirstZpageVariable = $56 FirstZpageVariable = $55
.zpvar DliColorBack .byte = FirstZpageVariable .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 .zpvar PaddleState .byte ; old state 2nd button for 2 buttons joysticks
.zpvar GradientNr .byte .zpvar GradientNr .byte
.zpvar GradientColors .word .zpvar GradientColors .word
BIN
View File
Binary file not shown.