Soil fall optymisation

My first approach after many years :)

The mountaintable3 is no longer needed, and better code in SoulDown2 procedure.
This commit is contained in:
Pecusx
2022-04-27 17:08:24 +02:00
parent d57a8265db
commit e6c2f89f12
3 changed files with 7 additions and 28 deletions
+7 -25
View File
@@ -742,8 +742,8 @@ SoilDown2 .proc
; both tables ; both tables
mwa RangeLeft xdraw mwa RangeLeft xdraw
adw RangeLeft #mountaintable temp
adw RangeLeft #mountaintable2 tempor2 adw RangeLeft #mountaintable2 tempor2
adw RangeLeft #mountaintable3 tempor3
NextColumn1 NextColumn1
mva #0 ydraw mva #0 ydraw
@@ -753,7 +753,7 @@ NextPoint1
ldy #0 ldy #0
lda ydraw lda ydraw
sta (tempor2),y sta (tempor2),y
sta (tempor3),y sta (temp),y
jmp FoundPeek1 jmp FoundPeek1
StillNothing StillNothing
inc ydraw inc ydraw
@@ -762,7 +762,7 @@ StillNothing
bne NextPoint1 bne NextPoint1
FoundPeek1 FoundPeek1
inw tempor2 inw tempor2
inw tempor3 inw temp
inw xdraw inw xdraw
;vcmp xdraw,screenwidth,NextColumn1 ;vcmp xdraw,screenwidth,NextColumn1
cpw xdraw RangeRight cpw xdraw RangeRight
@@ -775,7 +775,6 @@ MainFallout2
mwa RangeLeft xdraw mwa RangeLeft xdraw
adw RangeLeft #mountaintable temp adw RangeLeft #mountaintable temp
adw RangeLeft #mountaintable2 tempor2 adw RangeLeft #mountaintable2 tempor2
adw RangeLeft #mountaintable3 tempor3
mva #1 IsEndOfTheFallFlag mva #1 IsEndOfTheFallFlag
FalloutOfLine FalloutOfLine
@@ -803,12 +802,12 @@ FalloutOfLine
; zeroing pixel from the second table ; zeroing pixel from the second table
; and increase Y in second table ; and increase Y in second table
ldy #0 ldy #0
lda (tempor3),y lda (temp),y
sta ydraw sta ydraw
lda (tempor3),y lda (temp),y
clc clc
adc #1 adc #1
sta (tempor3),y sta (temp),y
sty color sty color
jsr plot.MakePlot jsr plot.MakePlot
@@ -816,7 +815,6 @@ ThereIsPixelHere
ColumnIsReady ColumnIsReady
inw temp inw temp
inw tempor2 inw tempor2
inw tempor3
inw xdraw inw xdraw
;vcmp xdraw,screenwidth,FalloutOfLine ;vcmp xdraw,screenwidth,FalloutOfLine
cpw xdraw RangeRight cpw xdraw RangeRight
@@ -827,23 +825,7 @@ ColumnIsReady
; we repeat untill at some point first table reaches ; we repeat untill at some point first table reaches
; level of the mountains ; level of the mountains
jeq MainFallout2 jeq MainFallout2
; now correct heights are in the second temporary table ; now correct heights are in the mountaintable
; so we copy
mwa RangeLeft xdraw
adw RangeLeft #mountaintable temp
adw RangeLeft #mountaintable3 tempor3
ldy #0
CopyHeights
lda (tempor3),y
sta (temp),y
inw temp
inw tempor3
inw xdraw
;vcmp xdraw,screenwidth,CopyHeights
cpw xdraw RangeRight
bcc CopyHeights
beq CopyHeights
mva #1 color mva #1 color
rts rts
.endp .endp
BIN
View File
Binary file not shown.
-3
View File
@@ -316,9 +316,6 @@ mountaintable ;table of mountains (size=screenwidth)
mountaintable2 ;table of mountains (size=screenwidth) mountaintable2 ;table of mountains (size=screenwidth)
.DS [screenwidth] .DS [screenwidth]
.DS 1 ; additional byte for fallout (sometimes 1 pixel) .DS 1 ; additional byte for fallout (sometimes 1 pixel)
mountaintable3
.ds [screenwidth]
.ds 1 ; additional byte for fallout (sometimes 1 pixel)
MountaintableEnd ;good for table clearing MountaintableEnd ;good for table clearing
;---------------------------------------------- ;----------------------------------------------
TextPositionX .DS 2 TextPositionX .DS 2