;~@sa1 <-- DO NOT REMOVE THIS LINE! ;========================================== ;; Robirdo ;========================================== ;; trash code ;========================================== print "INIT ",pc STZ $6AE5 LDA $6F34 STA $748B JSL $01ACF9 JSL SubHorzPos TYA STA $3334,x RTL print "MAIN ",pc ; LDA $6AE5 ; BEQ + ; PEA $0110 ; PLB ; TDC ; PHA ; PEA $3461 ; RTL ;+ PHB PHK PLB JSR .run_sprite PLB RTL .run_sprite LDA $32C6,x XBA LDA $32B0,x AND #$06 TAY LDA $3284,x AND #$0E TAX LDA $9D REP #$20 BNE .arLabel02B XBA BNE .arLabel027 CPY #$00 BNE .arLabel027 LDA Table_off_2,x PHA .arLabel027 LDA Table,y PHA .arLabel02B LDA Table_off_1,y PHA SEP #$20 LDX $75E9 RTS draw_something: LDA $6311 CMP #$F0 BEQ .arLabel060 LDA $78BD BEQ .arLabel060 AND #$03 SBC #$02 CLC ADC $6311 STA $6311 CLC ADC #$10 STA $6315 LDA $19 CMP #$02 BNE .arLabel060 LDA $6315 SBC #$02 STA $6321 .arLabel060 LDA $3284,x CMP #$0C BCS .arLabel089 JSR routine_6955 ;$6955 LDA $32C6,x BEQ .arLabel089 DEC A BNE .arLabel0A2 STA $32C6,x LDA $329A,x CMP #$05 BEQ .arLabel08A JSL SubHorzPos TYA STA $3334,x LDA #$04 STA $3284,x .arLabel089 RTS .arLabel08A LDA #$0C STA $3284,x JSL $02ACEF LDA #$D0 STA $9E,x STZ $B6,x STZ $32F2,x LDA #$10 STA $7DF9 RTS .arLabel0A2 LDA $14 AND #$04 LSR A LSR A ADC #$05 STA $D8,x RTS routine_3: LDA #$02 STA $D8,x INC $331E,x LDA $331E,x CMP #$30 BNE .arLabel0E2 STZ $331E,x INC $750A,x LDA $750A,x CMP #$03 BEQ .arLabel0D1 JSL $02A9DE BMI .arLabel0E2 JMP routine_660B .arLabel0D1 LDA #$40 STA $32F2,x LDA #$04 STA $3284,x LDA #$03 STA $D8,x STZ $750A,x .arLabel0E2 RTS routine_4: STZ $B6,x JSL $01802A LDA $334A,x AND #$04 LSR A LSR A EOR #$01 ADC #$03 STA $D8,x LDA $750A,x BNE .arLabel104 LDA #$40 STA $32F2,x INC $750A,x RTS .arLabel104 DEC A BNE .arLabel124 LDA $32F2,x BNE .arLabel123 LDA #$C0 STA $9E,x INC $750A,x LDA $7471 BEQ .arLabel123 REP #$21 LDA $96 SBC #$000F STA $96 SEP #$20 .arLabel123 RTS .arLabel124 LDA $334A,x AND #$04 BEQ .arLabel15A LDA $750A,x CMP #$02 BNE .arLabel14A INC $750A,x JSL $02A9DE BMI .arLabel15A TDC JSR routine_79F8 JSL $02A9DE BMI .arLabel15A LDA #$01 JMP routine_79F8 .arLabel14A LDA #$40 STA $32F2,x LDA #$04 STA $3284,x DEC A STA $D8,x STZ $750A,x .arLabel15A RTS routine_5: LDA $32F2,x BEQ .arLabel187 DEC A BNE routine_4_arLabel15A STA $32F2,x JSL SubHorzPos TYA STA $3334,x JSL $01ACF9 AND #$02 STA $750A,x LDA $7471 BEQ .arLabel187 REP #$21 LDA $96 SBC #$0007 STA $96 SEP #$20 .arLabel187 LDA $14 AND #$02 LSR A STA $7DF9 LDA $14 AND #$04 LSR A ORA $33CE,x LSR A TAY LDA Table_Tile,y ;$B9BA,y STA $D8,x LDA $750A,x ORA $3334,x ORA $33CE,x TAY LDA Table_Xspd,y ;$B9BE,y STA $B6,x LDA $334A,x AND #$04 BNE .arLabel1B6 STZ $B6,x .arLabel1B6 LDA $B6,x ROL A ROL A AND #$01 TAY LDA $322C,x CLC ADC Table_XoffsetL,y ;$B9B6,y STA $322C,x LDA $326E,x ADC Table_XoffsetH,y ;$B9B8,y STA $326E,x JSL $01802A LDA $322C,x SEC SBC Table_XoffsetL,y ;$B9B6,y STA $322C,x LDA $326E,x SBC Table_XoffsetH,y ;$B9B8,y STA $326E,x LDA $334A,x AND #$03 BEQ .arLabel200 LDA #$06 STA $3284,x LDY $3334,x LDA Table_Xspd2,y ;$B9C6,y STA $B6,x LDA #$E0 STA $32F2,x .arLabel200 RTS routine_6: LDA $14 AND #$04 LSR A LSR A STA $D8,x JSL $01802A LDA $32F2,x BEQ .arLabel219 LDA $334A,x AND #$03 BEQ .arLabel240 .arLabel219 JSL $01ACF9 AND #$02 ORA #$08 STA $3284,x LDA $748E AND #$03 STA $750A,x JSL $01ACF9 AND #$01 TAY LDA Table_Xspd3 ;$B9C8,y STA $B6,x LDA $748E AND #$3C STA $32F2,x .arLabel240 RTS routine_7: LDA $14 AND #$08 LSR A LSR A LSR A STA $D8,x JSL $01802A LDA $334A,x AND #$03 BEQ .arLabel25C LDA $B6,x EOR #$FF INC A STA $B6,x .arLabel25C JSL SubHorzPos TYA STA $3334,x LDA $32F2,x BNE .arLabel27F INC $750A,x LDA $750A,x CMP #$04 BNE .arLabel280 JSL $01ACF9 AND #$02 STA $3284,x STZ $750A,x .arLabel27F RTS .arLabel280 LDA $3284,x EOR #$02 STA $3284,x LDA $748E AND #$3C STA $32F2,x LDA $750A,x LSR A BCS .arLabel29D LDA $B6,x EOR #$FF INC A STA $B6,x .arLabel29D RTS ;$6665 routine_1: LDA $3242,x CMP #$08 BEQ .arLabel010 CMP #$0A BNE .arLabel00F DEC A STA $3242,x .arLabel00F RTS .arLabel010 JSR routine_6514 LDA $D8,x BNE .arLabel051 JSL $018022 LDY $3334,x LDA $322C,x PHA CLC ADC E_XoffsetL,y ;$B9F0,y STA $322C,x LDA $326E,x PHA ADC E_XoffsetH,y ;$B9F2,y STA $326E,x JSL $019138 PLA STA $326E,x PLA STA $322C,x LDA $334A,x AND #$03 BEQ .arLabel073 LDY $3334,x LDA E_Xspd,y ;$B9EE,y STA $B6,x INC $D8,x RTS .arLabel051 LDA $7616,x AND #$FB STA $7616,x LDY #$00 JSL SubOffScreen ;$10BB45 LDA $762C,x ORA #$80 STA $762C,x LDA $32F2,x BNE .arLabel073 JSL $01802A INC $331E,x .arLabel073 RTS routine_6514: LDA $3376,x ORA $71 BNE routine_1_arLabel073 LDA $73F9 EOR $75A4,x BNE routine_1_arLabel073 JSL $03B664 LDA $322C,x CLC ADC #$FA STA $04 LDA $326E,x ADC #$FF STA $0A LDA #$1C STA $06 LDA #$1A STA $07 LDA $3216,x SEC SBC #$06 STA $05 LDA $3258,x SBC #$00 STA $0B JSL $03B72B BCC routine_6564_arLabel104 LDA $D3 SBC $3216,x CMP #$E0 BPL .arLabel0BF JMP routine_6564 .arLabel0BF JSL $00F5B7 RTS routine_6564: LDA $7D BMI .arLabel104 LDA $73E0 CMP #$38 BEQ .arLabel119 LDA #$01 STA $7471 LDA $787A BNE .arLabel119 LDA $32F2,x BNE .arLabel105 LDA $3284,x BNE .arLabel0F5 BIT $16 BVC .arLabel119 STZ $B6,x STZ $7B LDA #$40 STA $32F2,x INC $3284,x BRA .arLabel119 .arLabel0F5 LDA #$0B STA $3242,x LDA $762C,x AND #$F7 ORA #$80 STA $762C,x .arLabel104 RTS .arLabel105 STZ $7B STZ $7471 LDA #$80 TRB $15 TRB $17 LDA #$04 STA $73 LDA #$38 STA $73E0 .arLabel119 LDY #$24 LDA $787A BEQ .arLabel122 LDY #$34 .arLabel122 STY $01 STZ $72 LDA $3216,x SEC SBC $01 STA $96 LDA $3258,x SBC #$00 STA $97 LDA $73E0 CMP #$38 BEQ .arLabel104 LDA $77 LSR A BCS .arLabel104 JMP routine_6A27 routine_2: LDA $3284,x BMI .arLabel162 LDA $73EF BEQ .arLabel162 LDA $78BD BNE .arLabel159 LDA $77 AND #$04 BEQ .arLabel162 .arLabel159 LDA $14 AND #$03 ORA #$48 STA $78BD .arLabel162 LDA $32C6,x BNE .arLabel16A STZ $3242,x .arLabel16A RTS routine_660B: LDA #$08 STA $3242,y LDA $322C,x STA $322C,y LDA $326E,x STA $326E,y LDA $3216,x SEC SBC #$24 STA $3216,y LDA $3258,x SBC #$00 STA $3258,y LDA $400083,x TYX STA $400083,x JSL $07F722 JSL $0187A7 LDA #$88 STA $400040,x LDX $75E9 LDA $3334,x STA $3334,y PHY TAY LDA Gen_XSpeed,y ;$B9F4,y PLY STA $30B6,y LDA #$02 STA $32B0,y LDA #$01 STA $33B8,y LDA #$20 STA $7DF9 RTS ; This never gets called. Don't know why ;$6AFF LDA $7616,x AND #$FB STA $7616,x LDY #$00 JSL SubOffScreen ;$10BB45 LDA $762C,x ORA #$80 STA $762C,x JSL $01802A LDA $14 AND #$07 BNE .arLabel034 JSL $02A9DE BMI .arLabel034 LDA $750A,x AND #$01 INC A STA $750A,x ORA #$02 JSR routine_79F8 .arLabel034 LDA $14 AND #$04 LSR A LSR A ADC #$05 STA $D8,x LDA $9E,x BMI .arLabel050 LDA $33B8,x ORA #$80 STA $33B8,x LDA $D8,x ADC #$02 STA $D8,x .arLabel050 RTS routine_6955: LDA $322C,x CLC ADC #$FC STA $04 LDA $326E,x ADC #$FF STA $0A LDA #$18 STA $06 LDY $D8,x LDA Table_Height,y ;$B9CA,y STA $07 LDA $3216,x SEC SBC Table_YPos,y ;$B9D3,y STA $05 LDA $3258,x SBC #$00 STA $0B JSR routine_6A4F LDA $3376,x ORA $71 BNE .arLabel0D2 LDA $73F9 EOR $75A4,x BNE .arLabel0D2 JSL $03B664 JSL $03B72B BCC .arLabel0D2 LDA $D3 SBC $3216,x LDY $D8,x CMP Table_YPos2,y ;$B9DC,y BPL .arLabel0A6 JMP .routine_69D7 .arLabel0A6 LDA $7497 BNE .arLabel0AE STZ $78BD .arLabel0AE LDA $32C6,x BNE .arLabel0B7 JSL $00F5B7 .arLabel0B7 LDA $322C,x STA $04 LDA $326E,x STA $0A LDA #$0F STA $06 JSL $03B72B BCC .arLabel0D2 LDA $7D BMI .arLabel0D2 JMP .routine_6A04 .arLabel0D2 RTS .routine_69D7 LDA $7D BMI .arLabel0D2 LDA #$01 STA $7471 STZ $72 LDY $D8,x LDA Table_YDisp,y ;$B9E5,y LDY $787A BEQ .arLabel0EA ADC #$0F .arLabel0EA STA $01 LDA $3216,x SEC SBC $01 STA $96 LDA $3258,x SBC #$00 STA $97 LDA #$01 STA $7471 .routine_6A04 LDA $334A,x BEQ .arLabel0D2 LDA $3284,x CMP #$04 BCC .arLabel0D2 CMP #$0A BCS .arLabel0D2 LDA $D8,x CMP #$03 BEQ .arLabel0D2 LDA $78BD ORA $32C6,x BNE .arLabel0D2 LDA $77 LSR A BCS .arLabel0D2 routine_6A27: REP #$20 LDA $B6,x ASL A ASL A ASL A ASL A SEP #$20 CLC ADC $73DA STA $73DA XBA REP #$20 PHP AND #$000F CMP #$0008 BCC .arLabel143 ORA #$FFF0 .arLabel143 PLP ADC $94 STA $94 SEP #$20 RTS routine_6A4F: LDY #$01 .arLabel14D LDA $7713,y SEC SBC #$05 ORA $32DC,x ORA $7781,y BNE .arLabel191 LDA $7727,y SEC SBC #$02 STA $00 LDA $773B,y SBC #$00 STA $08 LDA #$0C STA $02 LDA $771D,y SEC SBC #$04 STA $01 LDA $7731,y SBC #$00 STA $09 LDA #$13 STA $03 JSL $03B72B BCC .arLabel191 LDA #$01 STA $7713,y LDA #$10 STA $7777,y .arLabel191 DEY BPL .arLabel14D LDY #$15 .arLabel196 LDA $309E,y ORA $30B6,y BEQ .arLabel1A5 LDA $3242,y CMP #$09 BCS .arLabel1A9 .arLabel1A5 DEY BPL .arLabel196 RTS .arLabel1A9 PHX TYX JSL $03B6E5 PLX JSL $03B72B BCC .arLabel1A5 LDA #$40 STA $32C6,x INC $329A,x LDA $329A,x CMP #$03 BCC .arLabel1CA LDA #$04 STA $33CE,x .arLabel1CA PHX TYX JSL $01AB72 LDA #$09 JSL $02ACEF LDA #$28 STA $7DFC LDA #$02 STA $3242,x STZ $766E,x LDA #$D0 STA $9E,x LDY #$00 LDA $329A,x CMP #$05 BEQ .arLabel1F8 LDY #$10 LDA $B6,x BPL .arLabel1F8 LDY #$F0 .arLabel1F8 STY $B6,x PLX RTS ;$7BF4 routine_79F8: PHY TAY STY $0D LDA $322C,x CLC ADC Gen_XoffsetL,y ;$B9F6,y STA $00 LDA $326E,x ADC Gen_XoffsetH,y ;$B9FA,y PLY STA $326E,y LDA $00 STA $322C,y PHY LDY $0D LDA $3216,x SEC SBC Gen_Yoffset,y ;$B9FE,y PLY STA $3216,y LDA $3258,x SBC #$00 STA $3258,y LDA #$08 STA $3242,y LDA $400083,x TYX STA $400083,x JSL $07F7D2 JSL $0187A7 LDA #$88 STA $400040,x LDX $75E9 LDA $0D AND #$01 STA $3334,y LDA #$04 STA $32B0,y LDA #$05 STA $33B8,y LDA #$18 STA $32C6,y LDA $329A,x CMP #$05 BEQ .arLabel077 LDA #$09 STA $7DFC STA $7887 RTS .arLabel077 LDA #$FF STA $3284,y RTS draw_sprite: JSL GetDrawInfo LDA $32C6,x BEQ .arLabel08B AND #$06 INC A BRA .arLabel08E .arLabel08B LDA $33B8,x .arLabel08E ORA $64 STA $0F LDA $D8,x ASL A PHA LDA $3334,x ASL A TAX LDA Gfx_Prop,x STA $02 REP #$20 LDA XPtr,x STA $03 TYX PLY LDA YDisp_Ptr,y STA $05 LDA Tile_Ptr,y STA $07 LDA ($03),y STA $03 SEP #$20 LDY #$0B .loop LDA $00 CLC ADC ($03),y STA $6300,x LDA $01 CLC ADC ($05),y STA $6301,x LDA ($07),y STA $6302,x LDA $0F EOR $02 STA $6303,x INX INX INX INX DEY BPL .loop LDX $75E9 LDY #$02 LDA #$0B JSL $01B7B3 RTS draw_egg: ;? JSL GetDrawInfo LDA $33B8,x ORA $64 STA $0F LDA $3334,x ASL A PHA LDA $32C6,x LSR A AND #$0C STA $03 LDA $32B0,x AND #$02 TAX REP #$20 LDA Gfx_TilePtr,x ;$10BB41,x STA $04 PLX LDA Gfx_XPtr,x ;$10BB31,x STA $06 SEP #$20 LDA Gfx_Prop,x ;$10BB26,x STA $02 TYX LDY #$03 .arLabel124 LDA $00 CLC ADC ($06),y STA $6300,x LDA $01 CLC ADC Gfx_YDisp,y ;$BB35,y STA $6301,x LDA ($04),y SEC SBC $03 STA $6302,x LDA $0F EOR $02 STA $6303,x INX INX INX INX DEY BPL .arLabel124 LDX $75E9 LDY #$02 LDA #$03 JSL $01B7B3 RTS ;========================================== Table: dw draw_something-1,routine_1-1,routine_2-1,draw_something-1 .off_1 dw draw_sprite-1, draw_egg-1,draw_egg-1,draw_something-1 .off_2 dw routine_3-1,routine_4-1,routine_5-1,routine_6-1 dw routine_7-1,routine_7_arLabel25C-1,routine_1_arLabel051-1,draw_something-1 .XoffsetL db $08,$F8 .XoffsetH db $00,$FF .Tile db $00,$01,$02,$06 .Xspd db $1C,$E4,$24,$DC,$30,$D0,$30,$D0 .Xspd2 db $F0,$10 .Xspd3 db $0A,$F6 .Height db $3C,$3C,$3C,$34,$44,$3C,$3C,$3C,$3C .YPos db $2C,$2C,$2C,$24,$34,$2C,$2C,$2C,$2C .YPos2 db $B8,$B8,$B8,$C0,$C8,$B8,$B8,$B8,$B8 .YDisp db $4C,$4C,$4C,$44,$54,$4C,$4C,$4C,$4C E: .Xspd db $F8,$08 .XoffsetL db $08,$F8 .XoffsetH db $00,$FF Gen: .XSpeed db $20,$E0 .XoffsetL db $E0,$20,$F8,$08 .XoffsetH db $FF,$00,$FF,$00 .Yoffset db $08,$08,$20,$20 Tile: .0 db $20,$22,$30,$32 db $44,$46,$64,$02 db $04,$06,$24,$26 .1 db $20,$22,$30,$32 db $48,$4A,$68,$6A db $04,$06,$24,$26 .2 db $20,$22,$30,$32 db $44,$46,$64,$02 db $08,$0A,$28,$2A .3 db $20,$22,$30,$32 db $50,$52,$60,$62 db $04,$06,$24,$26 .4 db $20,$22,$30,$32 db $4C,$4E,$6C,$6E db $04,$06,$24,$26 .5 db $E8,$E8,$E8,$CC db $44,$46,$64,$02 db $0C,$0E,$2C,$2E .6 db $E8,$E8,$E8,$CC db $48,$4A,$68,$6A db $0C,$0E,$2C,$2E .Ptr dw .0,.1,.2,.3,.4,.5,.6,.5,.6 XDispL: .0 db $03,$F3,$03,$F3,$08,$F8,$08,$F8,$08,$F8,$08,$F8 .1 db $FF,$EF,$FF,$EF,$08,$F8,$08,$F8,$08,$F8,$08,$F8 .2 db $06,$F6,$06,$F6,$08,$F8,$08,$F8,$08,$F8,$08,$F8 .Ptr dw .0,.0,.0,.1,.1,.2,.2,.2,.2 XDispR: .0 db $FD,$0D,$FD,$0D,$F8,$08,$F8,$08,$F8,$08,$F8,$08 .1 db $01,$11,$01,$11,$F8,$08,$F8,$08,$F8,$08,$F8,$08 .2 db $FA,$0A,$FA,$0A,$F8,$08,$F8,$08,$F8,$08,$F8,$08 .Ptr dw .0,.0,.0,.1,.1,.2,.2,.2,.2 XPtr: dw XDispL_Ptr,XDispR_Ptr YDisp: .0 db $C9,$C9,$D1,$D1,$EF,$EF,$FF,$FF,$D2,$D2,$E2,$E2 .1 db $D1,$D1,$D9,$D9,$F7,$F7,$FF,$FF,$DA,$DA,$EA,$EA .2 db $C6,$C6,$CE,$CE,$EF,$EF,$FF,$FF,$CF,$CF,$DF,$DF .3 db $CA,$CA,$D2,$D2,$EF,$EF,$FF,$FF,$D2,$D2,$E2,$E2 .4 db $F7,$F7,$FF,$FF,$E2,$E2,$D2,$D2,$FF,$FF,$EF,$EF .Ptr dw .0,.0,.0,.1,.2,.3,.3,.4,.4 Gfx: .Prop db $40,$40,$00 .XDispL db $F8,$08,$F8,$08 .XDispR db $08,$F8,$08,$F8 .XPtr dw .XDispR,.XDispL .YDisp db $F8,$F8,$08,$08 .Egg db $80,$82,$A0,$A2 .Smoke db $C8,$CA,$E8,$EA .TilePtr dw .Smoke,.Egg ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; SubOffScreen - Optimized version ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; Argument ; Y : type (#$00=X0, #$02=X1 ... #$0E=X7) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; SubOffScreen: LDA $3376,x ORA $7642,x BEQ .Return2 LDA $7616,x AND #$04 BNE .Return2 LDA $5B LSR A BCS .VerticalLevel LDA $3216,x ADC #$50 LDA $3258,x ADC #$00 CMP #$02 BPL .EraseSprite LDA $326E,x XBA LDA $322C,x REP #$21 ADC .AddTable,y SEC SBC $1A CMP .CmpTable,y .Common SEP #$20 BCC .Return2 .EraseSprite LDA $3242,x CMP #$08 BCC .KillSprite LDY $7578,x CPY #$FF BRA .KillSprite LDA #$00 PHX TYX STA $418A00,x PLX .KillSprite STZ $3242,x .Return2 RTL .VerticalLevel LDA $13 LSR A BCS .CheckY LDA $326E,x XBA LDA $322C,x REP #$21 ADC.w #$0040 CMP.w #$0280 BRA .Common .CheckY LDA $3258,x XBA LDA $3216,x REP #$20 SBC $1C CLC ADC.w #$0070 CMP.w #$01D0 BRA .Common .AddTable dw $0040,$0040,$0010,$0070 dw $0090,$0050,$0080,$FFC0 .CmpTable dw $0170,$01E0,$01B0,$01D0 dw $0230,$01B0,$0220,$0160 GetDrawInfo: LDA $326E,x XBA LDA $322C,x REP #$20 SEC SBC $1A STA $00 CLC ADC.w #$0040 CMP.w #$0180 SEP #$20 LDA $01 BEQ + LDA #$01 + STA $3376,x TDC ROL A STA $7536,x BNE .Invalid LDA $3258,x XBA LDA $75EA,x AND #$20 BEQ .CheckOnce .CheckTwice LDA $3216,x REP #$21 ADC.w #$001C SEC SBC $1C SEP #$20 LDA $3258,x XBA BEQ .CheckOnce LDA #$02 .CheckOnce STA $7642,x LDA $3216,x REP #$21 ADC.w #$000C SEC SBC $1C SEP #$21 SBC #$0C STA $01 XBA BEQ .OnScreenY INC $7642,x .OnScreenY LDY $33A2,x RTL .Invalid REP #$20 PLA PLY PLA PHY PHA SEP #$20 RTL SubHorzPos: LDY #$00 LDA $D1 SEC SBC $322C,x STA $0F LDA $D2 SBC $326E,x BPL .Return INY .Return RTL