diff --git a/src/fx/fx.hgr.48boxes.common.a b/src/fx/fx.hgr.48boxes.common.a index ed1d9e8d1..0ee09e597 100644 --- a/src/fx/fx.hgr.48boxes.common.a +++ b/src/fx/fx.hgr.48boxes.common.a @@ -2,14 +2,19 @@ ;(c) 2020 by 4am & qkumba ; -src = $00 ; [word, must be at $00] +src = $00 ; [word][must be at $00] dst = $02 ; [word] box = $04 ; [byte] -stage = $05 ; [byte] -any = $06 ; [byte] -x = $07 -rowcount = $07 ; [byte] +any = $05 ; [byte] +rowcount = $06 ; [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] + hgrhi = $40 ; [$C0 bytes] hgrlo = $300 ; [$C0 bytes] @@ -51,78 +56,82 @@ hgrlo = $300 ; [$C0 bytes] dex bne - - ldx #13 - stx x --- ldx x - ldy #$7F +--- ldx #6 + stx maskindex +-- ldy #$7F - lda MIDDLE_STAGE, y - sta ($0C), y + sta (m_dst), y lda OUTER_STAGE, y - sta ($0E), y + sta (o_dst), y dey bpl - + ldx maskindex lda MiddleRowCounts, x ldy #m_rowcount - sta ($0C), y + sta (m_dst), y lda OuterRowCounts, x ldy #o_rowcount - sta ($0E), y + sta (o_dst), y lda MiddleFirstRows, x ldy #m_firstrow - sta ($0C), y + sta (m_dst), y lda OuterFirstRows, x ldy #o_firstrow - sta ($0E), y + sta (o_dst), y lda EdgeLeftMasks, x ldy #m_edgeleftmask - sta ($0C), y + sta (m_dst), y ldy #o_edgeleftmask - sta ($0E), y + sta (o_dst), y lda EdgeRightMasks, x ldy #m_edgerightmask - sta ($0C), y + sta (m_dst), y ldy #o_edgerightmask - sta ($0E), y + sta (o_dst), y lda LeftMasks, x ldy #m_leftmask - sta ($0C), y + sta (m_dst), y ldy #o_leftmask - sta ($0E), y + sta (o_dst), y lda RightMasks, x ldy #m_rightmask - sta ($0C), y + sta (m_dst), y ldy #o_rightmask - sta ($0E), y + sta (o_dst), y + ldx stage lda CopyFlags, x bne + - lda #$A9 + lda #$A9 ; LDA #$44 opcode ldy #m_lda - sta ($0C), y + sta (m_dst), y ldy #o_lda1 - sta ($0E), y + sta (o_dst), y - lda #$24 + lda #$24 ; BIT $44 opcode ldx #5 - ldy MiddleBits, x - sta ($0C), y + sta (m_dst), y ldy OuterBits, x - sta ($0E), y + sta (o_dst), y dex bpl - -+ dec $0D - dec $0F - dec x - +LBPL -- - ++ dec m_dst+1 + dec o_dst+1 + dec stage + bmi + + dec maskindex + +LBMI --- + jmp -- ++ +BUILD_HGR_LOOKUP_TABLES hgrlo, hgrhi MainLoop lda #0 @@ -403,16 +412,12 @@ copy0F=$9B00 MiddleFirstRows !byte $0D,$0C,$0B,$0A,$09,$08,$07 - !byte $0D,$0C,$0B,$0A,$09,$08,$07 OuterFirstRows !byte $06,$05,$04,$03,$02,$01,$00 - !byte $06,$05,$04,$03,$02,$01,$00 MiddleRowCounts !byte $05,$07,$09,$0B,$0D,$0F,$11 - !byte $05,$07,$09,$0B,$0D,$0F,$11 OuterRowCounts !byte $13,$15,$17,$19,$1B,$1D,$1F - !byte $13,$15,$17,$19,$1B,$1D,$1F EdgeLeftMasks !byte %11000000 !byte %11100000 @@ -421,13 +426,6 @@ EdgeLeftMasks !byte %11111100 !byte %11111110 !byte %11111111 - !byte %11000000 - !byte %11100000 - !byte %11110000 - !byte %11111000 - !byte %11111100 - !byte %11111110 - !byte %11111111 EdgeRightMasks !byte %10000001 !byte %10000011 @@ -436,13 +434,6 @@ EdgeRightMasks !byte %10011111 !byte %10111111 !byte %11111111 - !byte %10000001 - !byte %10000011 - !byte %10000111 - !byte %10001111 - !byte %10011111 - !byte %10111111 - !byte %11111111 LeftMasks !byte %11000000 !byte %10100000 @@ -451,13 +442,6 @@ LeftMasks !byte %10000100 !byte %10000010 !byte %10000001 - !byte %11000000 - !byte %10100000 - !byte %10010000 - !byte %10001000 - !byte %10000100 - !byte %10000010 - !byte %10000001 RightMasks !byte %10000001 !byte %10000010 @@ -466,13 +450,6 @@ RightMasks !byte %10010000 !byte %10100000 !byte %11000000 - !byte %10000001 - !byte %10000010 - !byte %10000100 - !byte %10001000 - !byte %10010000 - !byte %10100000 - !byte %11000000 CopyFlags !byte 0,0,0,0,0,0,0 !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 -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 $9B00 diff --git a/src/macros.a b/src/macros.a index 4a5727004..b76d93fa0 100755 --- a/src/macros.a +++ b/src/macros.a @@ -106,6 +106,12 @@ + } +!macro LBMI .target { + bpl + + jmp .target ++ +} + !macro LBNE .target { beq + jmp .target