Optimization - we save 15 bytes

This commit is contained in:
Pecusx
2022-06-21 12:51:49 +02:00
parent eda0e65189
commit 242bc4586c
2 changed files with 18 additions and 17 deletions
BIN
View File
Binary file not shown.
+18 -17
View File
@@ -2354,36 +2354,25 @@ MIRValreadyAll
; ------------------------------------------------- ; -------------------------------------------------
ldy #0 ; byte counter (from 0 to 39) ldy #0 ; byte counter (from 0 to 39)
NextColumn NextColumn
; big loop - we repat internal loops for each column of bytes
sty magic sty magic
ldx #0 ; line counter (ftom 0 to ?? ) ldx #0 ; line counter (from 0 to ?? )
; first inverse column of bytes for a while ; first loop - inverse column of bytes for a while
ldy magic ldy magic
NextLine1 NextLine1
lda LineTableL,x jsr InverseScreenByte
sta temp
lda LineTableH,x
sta temp+1
lda (temp),y
eor #$ff
sta (temp),y
inx inx
inx inx
cpx #60 cpx #60
bne NextLine1 bne NextLine1
; ;
wait ; wait uses A and Y wait ; wait uses A and Y
; second - inverse again and randomize column of bytes ; second loop - inverse again and put random "snow" to column of bytes
ldx #0 ldx #0
ldy magic ldy magic
mva #$55 magic+1 mva #$55 magic+1
NextLine2 NextLine2
lda LineTableL,x jsr InverseScreenByte
sta temp
lda LineTableH,x
sta temp+1
lda (temp),y
eor #$ff
sta (temp),y
lda random lda random
ora magic+1 ora magic+1
and (temp),y and (temp),y
@@ -2410,6 +2399,18 @@ NextLine2
jsr SoilDown2 jsr SoilDown2
jsr drawtanks ; for restore PM jsr drawtanks ; for restore PM
rts rts
; in order to optimize the fragment repeated in both internal loops
; we save 15 bytes :)
InverseScreenByte
lda LineTableL,x
sta temp
lda LineTableH,x
sta temp+1
lda (temp),y
eor #$ff
sta (temp),y
rts
.endp .endp
; ------------------------------------------------- ; -------------------------------------------------