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)
NextColumn
; big loop - we repat internal loops for each column of bytes
sty magic
ldx #0 ; line counter (ftom 0 to ?? )
; first inverse column of bytes for a while
ldx #0 ; line counter (from 0 to ?? )
; first loop - inverse column of bytes for a while
ldy magic
NextLine1
lda LineTableL,x
sta temp
lda LineTableH,x
sta temp+1
lda (temp),y
eor #$ff
sta (temp),y
jsr InverseScreenByte
inx
inx
cpx #60
bne NextLine1
;
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
ldy magic
mva #$55 magic+1
NextLine2
lda LineTableL,x
sta temp
lda LineTableH,x
sta temp+1
lda (temp),y
eor #$ff
sta (temp),y
jsr InverseScreenByte
lda random
ora magic+1
and (temp),y
@@ -2410,6 +2399,18 @@ NextLine2
jsr SoilDown2
jsr drawtanks ; for restore PM
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
; -------------------------------------------------