Code cleanup and optimizations

This commit is contained in:
Pecusx
2023-04-04 12:40:24 +02:00
parent f475999918
commit fa79836f77
4 changed files with 24 additions and 9 deletions
+4
View File
@@ -5,6 +5,8 @@
;-------------------------------------------------- ;--------------------------------------------------
.proc draw ;;fuxxing good draw :) .proc draw ;;fuxxing good draw :)
; xdraw,ydraw (word) - coordinates of first point
; xbyte,ybyte (word) - coordinates of last point
;-------------------------------------------------- ;--------------------------------------------------
;creditz to Dr Jankowski / MIM U.W. ;creditz to Dr Jankowski / MIM U.W.
; (xi,yi)-----(xk,yk) ; (xi,yi)-----(xk,yk)
@@ -291,6 +293,8 @@ EndOfDraw
;-------------------------------------------------- ;--------------------------------------------------
.proc circle ;fxxxing good circle drawing :) .proc circle ;fxxxing good circle drawing :)
; xdraw,ydraw (word) - coordinates of circle center
; radius (byte) - radius of circle
;-------------------------------------------------- ;--------------------------------------------------
;Turbo Basic source ;Turbo Basic source
; R=30 ; R=30
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
+20 -9
View File
@@ -3,6 +3,9 @@
.IF *>0 ;this is a trick that prevents compiling this file alone .IF *>0 ;this is a trick that prevents compiling this file alone
;-------------------------------------------------- ;--------------------------------------------------
.proc Explosion .proc Explosion
; xdraw,ydraw (word) - coordinates of explosion center
; TankNr - number of shooting tank
; ActiveWeapon(TankNr) - weapon that tank fires
;-------------------------------------------------- ;--------------------------------------------------
;cleanup of the soil fall down ranges (left and right) ;cleanup of the soil fall down ranges (left and right)
jsr ClearScreenSoilRange jsr ClearScreenSoilRange
@@ -358,29 +361,34 @@ EndNurnedCheckLoop
; ------------------------ ; ------------------------
.proc babyroller .proc babyroller
mva #11 ExplosionRadius mva #11 ExplosionRadius
GoRoller
jmp xroller jmp xroller
.endp .endp
; ------------------------ ; ------------------------
.proc roller ; .proc roller ;
mva #21 ExplosionRadius mva #21 ExplosionRadius
jmp xroller bne babyroller.GoRoller ; 1 byte saved
; jmp xroller
.endp .endp
; ------------------------ ; ------------------------
.proc heavyroller .proc heavyroller
mva #30 ExplosionRadius mva #30 ExplosionRadius
jmp xroller bne babyroller.GoRoller ; 1 byte saved
; jmp xroller
.endp .endp
; ------------------------ ; ------------------------
.proc riotbomb .proc riotbomb
mva #17 ExplosionRadius mva #17 ExplosionRadius
GoRiotBomb
jsr CalculateExplosionRange jsr CalculateExplosionRange
jmp xriotbomb jmp xriotbomb
.endp .endp
; ------------------------ ; ------------------------
.proc heavyriotbomb .proc heavyriotbomb
mva #29 ExplosionRadius mva #29 ExplosionRadius
jsr CalculateExplosionRange bne riotbomb.GoRiotBomb ; 4 bytes saved - optimization :)
jmp xriotbomb ; jsr CalculateExplosionRange
; jmp xriotbomb
.endp .endp
; ------------------------ ; ------------------------
.proc babydigger .proc babydigger
@@ -932,6 +940,14 @@ ExplodeNow
; -------------------------------------------------- ; --------------------------------------------------
.proc checkRollDirection .proc checkRollDirection
; check rolling direction (for roller and other rolling weapons) ; check rolling direction (for roller and other rolling weapons)
; xdraw (word) - X coordinate
; Y coordinate is taken from mountaintable and go to ydraw (word)
; shoot direction is taken from VX+3
; result:
; HowMuchToFall - direction
; $FF - we are in a hole (flying in missile direction)
; 1 - right, 2 - left
; --------------------------------------------------
ldy #0 ldy #0
adw xdraw #mountaintable tempXROLLER adw xdraw #mountaintable tempXROLLER
lda (tempXROLLER),y lda (tempXROLLER),y
@@ -951,15 +967,12 @@ PositiveVelocity
; 1 - right, 2 - left ; 1 - right, 2 - left
mva #$ff HowMuchToFall mva #$ff HowMuchToFall
mva ydraw HeightRol mva ydraw HeightRol
;mwa #mountaintable tempXROLLER - It's already done !!!
;adw tempXROLLER xdraw
SeekLeft SeekLeft
cpw tempXROLLER #mountaintable cpw tempXROLLER #mountaintable
beq GoRightNow ; "bounce" if we have on left end beq GoRightNow ; "bounce" if we have on left end
.nowarn dew tempXROLLER .nowarn dew tempXROLLER
lda (tempXROLLER),y ;fukk! beware of Y value lda (tempXROLLER),y ;fukk! beware of Y value
cmp HeightRol cmp HeightRol
;bne HowMuchToFallLeft
HowMuchToFallLeft HowMuchToFallLeft
bcs GoRightNow bcs GoRightNow
mva #1 HowMuchToFall mva #1 HowMuchToFall
@@ -971,9 +984,7 @@ SeekRight
inw tempXROLLER inw tempXROLLER
lda (tempXROLLER),y lda (tempXROLLER),y
cmp HeightRol cmp HeightRol
;bne HowMuchToFallRight
HowMuchToFallRight HowMuchToFallRight
; check if up or down
bcs HowMuchToFallKnown bcs HowMuchToFallKnown
lda HowMuchToFall lda HowMuchToFall
bpl ItIsLeftAlready bpl ItIsLeftAlready