mirror of
https://github.com/a2-4am/4cade.git
synced 2024-11-24 03:34:02 +00:00
shave some bytes
This commit is contained in:
parent
316be9bb0b
commit
d78a1c4807
@ -2,14 +2,19 @@
|
|||||||
;(c) 2020 by 4am & qkumba
|
;(c) 2020 by 4am & qkumba
|
||||||
;
|
;
|
||||||
|
|
||||||
src = $00 ; [word, must be at $00]
|
src = $00 ; [word][must be at $00]
|
||||||
dst = $02 ; [word]
|
dst = $02 ; [word]
|
||||||
box = $04 ; [byte]
|
box = $04 ; [byte]
|
||||||
stage = $05 ; [byte]
|
any = $05 ; [byte]
|
||||||
any = $06 ; [byte]
|
rowcount = $06 ; [byte]
|
||||||
x = $07
|
|
||||||
rowcount = $07 ; [byte]
|
; order matters for the following group
|
||||||
|
maskindex = $0A ; [byte][codegen]
|
||||||
|
stage = $0B ; [byte][codegen]
|
||||||
|
m_dst = $0C ; [word][codegen]
|
||||||
|
o_dst = $0E ; [word][codegen]
|
||||||
BoxStages = $10 ; [$30 bytes][must be at $10]
|
BoxStages = $10 ; [$30 bytes][must be at $10]
|
||||||
|
|
||||||
hgrhi = $40 ; [$C0 bytes]
|
hgrhi = $40 ; [$C0 bytes]
|
||||||
hgrlo = $300 ; [$C0 bytes]
|
hgrlo = $300 ; [$C0 bytes]
|
||||||
|
|
||||||
@ -51,78 +56,82 @@ hgrlo = $300 ; [$C0 bytes]
|
|||||||
dex
|
dex
|
||||||
bne -
|
bne -
|
||||||
|
|
||||||
ldx #13
|
--- ldx #6
|
||||||
stx x
|
stx maskindex
|
||||||
-- ldx x
|
-- ldy #$7F
|
||||||
ldy #$7F
|
|
||||||
- lda MIDDLE_STAGE, y
|
- lda MIDDLE_STAGE, y
|
||||||
sta ($0C), y
|
sta (m_dst), y
|
||||||
lda OUTER_STAGE, y
|
lda OUTER_STAGE, y
|
||||||
sta ($0E), y
|
sta (o_dst), y
|
||||||
dey
|
dey
|
||||||
bpl -
|
bpl -
|
||||||
|
|
||||||
|
ldx maskindex
|
||||||
lda MiddleRowCounts, x
|
lda MiddleRowCounts, x
|
||||||
ldy #m_rowcount
|
ldy #m_rowcount
|
||||||
sta ($0C), y
|
sta (m_dst), y
|
||||||
lda OuterRowCounts, x
|
lda OuterRowCounts, x
|
||||||
ldy #o_rowcount
|
ldy #o_rowcount
|
||||||
sta ($0E), y
|
sta (o_dst), y
|
||||||
|
|
||||||
lda MiddleFirstRows, x
|
lda MiddleFirstRows, x
|
||||||
ldy #m_firstrow
|
ldy #m_firstrow
|
||||||
sta ($0C), y
|
sta (m_dst), y
|
||||||
lda OuterFirstRows, x
|
lda OuterFirstRows, x
|
||||||
ldy #o_firstrow
|
ldy #o_firstrow
|
||||||
sta ($0E), y
|
sta (o_dst), y
|
||||||
|
|
||||||
lda EdgeLeftMasks, x
|
lda EdgeLeftMasks, x
|
||||||
ldy #m_edgeleftmask
|
ldy #m_edgeleftmask
|
||||||
sta ($0C), y
|
sta (m_dst), y
|
||||||
ldy #o_edgeleftmask
|
ldy #o_edgeleftmask
|
||||||
sta ($0E), y
|
sta (o_dst), y
|
||||||
|
|
||||||
lda EdgeRightMasks, x
|
lda EdgeRightMasks, x
|
||||||
ldy #m_edgerightmask
|
ldy #m_edgerightmask
|
||||||
sta ($0C), y
|
sta (m_dst), y
|
||||||
ldy #o_edgerightmask
|
ldy #o_edgerightmask
|
||||||
sta ($0E), y
|
sta (o_dst), y
|
||||||
|
|
||||||
lda LeftMasks, x
|
lda LeftMasks, x
|
||||||
ldy #m_leftmask
|
ldy #m_leftmask
|
||||||
sta ($0C), y
|
sta (m_dst), y
|
||||||
ldy #o_leftmask
|
ldy #o_leftmask
|
||||||
sta ($0E), y
|
sta (o_dst), y
|
||||||
|
|
||||||
lda RightMasks, x
|
lda RightMasks, x
|
||||||
ldy #m_rightmask
|
ldy #m_rightmask
|
||||||
sta ($0C), y
|
sta (m_dst), y
|
||||||
ldy #o_rightmask
|
ldy #o_rightmask
|
||||||
sta ($0E), y
|
sta (o_dst), y
|
||||||
|
|
||||||
|
ldx stage
|
||||||
lda CopyFlags, x
|
lda CopyFlags, x
|
||||||
bne +
|
bne +
|
||||||
|
|
||||||
lda #$A9
|
lda #$A9 ; LDA #$44 opcode
|
||||||
ldy #m_lda
|
ldy #m_lda
|
||||||
sta ($0C), y
|
sta (m_dst), y
|
||||||
ldy #o_lda1
|
ldy #o_lda1
|
||||||
sta ($0E), y
|
sta (o_dst), y
|
||||||
|
|
||||||
lda #$24
|
lda #$24 ; BIT $44 opcode
|
||||||
ldx #5
|
ldx #5
|
||||||
- ldy MiddleBits, x
|
- ldy MiddleBits, x
|
||||||
sta ($0C), y
|
sta (m_dst), y
|
||||||
ldy OuterBits, x
|
ldy OuterBits, x
|
||||||
sta ($0E), y
|
sta (o_dst), y
|
||||||
dex
|
dex
|
||||||
bpl -
|
bpl -
|
||||||
|
|
||||||
+ dec $0D
|
+ dec m_dst+1
|
||||||
dec $0F
|
dec o_dst+1
|
||||||
dec x
|
dec stage
|
||||||
+LBPL --
|
bmi +
|
||||||
|
dec maskindex
|
||||||
|
+LBMI ---
|
||||||
|
jmp --
|
||||||
|
+
|
||||||
+BUILD_HGR_LOOKUP_TABLES hgrlo, hgrhi
|
+BUILD_HGR_LOOKUP_TABLES hgrlo, hgrhi
|
||||||
|
|
||||||
MainLoop lda #0
|
MainLoop lda #0
|
||||||
@ -403,16 +412,12 @@ copy0F=$9B00
|
|||||||
|
|
||||||
MiddleFirstRows
|
MiddleFirstRows
|
||||||
!byte $0D,$0C,$0B,$0A,$09,$08,$07
|
!byte $0D,$0C,$0B,$0A,$09,$08,$07
|
||||||
!byte $0D,$0C,$0B,$0A,$09,$08,$07
|
|
||||||
OuterFirstRows
|
OuterFirstRows
|
||||||
!byte $06,$05,$04,$03,$02,$01,$00
|
!byte $06,$05,$04,$03,$02,$01,$00
|
||||||
!byte $06,$05,$04,$03,$02,$01,$00
|
|
||||||
MiddleRowCounts
|
MiddleRowCounts
|
||||||
!byte $05,$07,$09,$0B,$0D,$0F,$11
|
!byte $05,$07,$09,$0B,$0D,$0F,$11
|
||||||
!byte $05,$07,$09,$0B,$0D,$0F,$11
|
|
||||||
OuterRowCounts
|
OuterRowCounts
|
||||||
!byte $13,$15,$17,$19,$1B,$1D,$1F
|
!byte $13,$15,$17,$19,$1B,$1D,$1F
|
||||||
!byte $13,$15,$17,$19,$1B,$1D,$1F
|
|
||||||
EdgeLeftMasks
|
EdgeLeftMasks
|
||||||
!byte %11000000
|
!byte %11000000
|
||||||
!byte %11100000
|
!byte %11100000
|
||||||
@ -421,13 +426,6 @@ EdgeLeftMasks
|
|||||||
!byte %11111100
|
!byte %11111100
|
||||||
!byte %11111110
|
!byte %11111110
|
||||||
!byte %11111111
|
!byte %11111111
|
||||||
!byte %11000000
|
|
||||||
!byte %11100000
|
|
||||||
!byte %11110000
|
|
||||||
!byte %11111000
|
|
||||||
!byte %11111100
|
|
||||||
!byte %11111110
|
|
||||||
!byte %11111111
|
|
||||||
EdgeRightMasks
|
EdgeRightMasks
|
||||||
!byte %10000001
|
!byte %10000001
|
||||||
!byte %10000011
|
!byte %10000011
|
||||||
@ -436,13 +434,6 @@ EdgeRightMasks
|
|||||||
!byte %10011111
|
!byte %10011111
|
||||||
!byte %10111111
|
!byte %10111111
|
||||||
!byte %11111111
|
!byte %11111111
|
||||||
!byte %10000001
|
|
||||||
!byte %10000011
|
|
||||||
!byte %10000111
|
|
||||||
!byte %10001111
|
|
||||||
!byte %10011111
|
|
||||||
!byte %10111111
|
|
||||||
!byte %11111111
|
|
||||||
LeftMasks
|
LeftMasks
|
||||||
!byte %11000000
|
!byte %11000000
|
||||||
!byte %10100000
|
!byte %10100000
|
||||||
@ -451,13 +442,6 @@ LeftMasks
|
|||||||
!byte %10000100
|
!byte %10000100
|
||||||
!byte %10000010
|
!byte %10000010
|
||||||
!byte %10000001
|
!byte %10000001
|
||||||
!byte %11000000
|
|
||||||
!byte %10100000
|
|
||||||
!byte %10010000
|
|
||||||
!byte %10001000
|
|
||||||
!byte %10000100
|
|
||||||
!byte %10000010
|
|
||||||
!byte %10000001
|
|
||||||
RightMasks
|
RightMasks
|
||||||
!byte %10000001
|
!byte %10000001
|
||||||
!byte %10000010
|
!byte %10000010
|
||||||
@ -466,13 +450,6 @@ RightMasks
|
|||||||
!byte %10010000
|
!byte %10010000
|
||||||
!byte %10100000
|
!byte %10100000
|
||||||
!byte %11000000
|
!byte %11000000
|
||||||
!byte %10000001
|
|
||||||
!byte %10000010
|
|
||||||
!byte %10000100
|
|
||||||
!byte %10001000
|
|
||||||
!byte %10010000
|
|
||||||
!byte %10100000
|
|
||||||
!byte %11000000
|
|
||||||
CopyFlags
|
CopyFlags
|
||||||
!byte 0,0,0,0,0,0,0
|
!byte 0,0,0,0,0,0,0
|
||||||
!byte 1,1,1,1,1,1,1
|
!byte 1,1,1,1,1,1,1
|
||||||
@ -508,7 +485,10 @@ BoxesY ; starting byte offset for each box
|
|||||||
!byte $00,$05,$0A,$0F,$14,$19,$1E,$23
|
!byte $00,$05,$0A,$0F,$14,$19,$1E,$23
|
||||||
!byte $00,$05,$0A,$0F,$14,$19,$1E,$23
|
!byte $00,$05,$0A,$0F,$14,$19,$1E,$23
|
||||||
|
|
||||||
CopyParams ; must be immediately before BoxInitialStages
|
CopyParams
|
||||||
|
; must be immediately before BoxInitialStages so they get
|
||||||
|
; copied into the right places in zero page
|
||||||
|
!byte 13
|
||||||
!word $8D00
|
!word $8D00
|
||||||
!word $9B00
|
!word $9B00
|
||||||
|
|
||||||
|
@ -106,6 +106,12 @@
|
|||||||
+
|
+
|
||||||
}
|
}
|
||||||
|
|
||||||
|
!macro LBMI .target {
|
||||||
|
bpl +
|
||||||
|
jmp .target
|
||||||
|
+
|
||||||
|
}
|
||||||
|
|
||||||
!macro LBNE .target {
|
!macro LBNE .target {
|
||||||
beq +
|
beq +
|
||||||
jmp .target
|
jmp .target
|
||||||
|
Loading…
Reference in New Issue
Block a user