Originally posted by Jakester12621
YAY! BOXART!
YAY! BOXART!
If we cut out that coupon do we get $10 off? Probably not. Anyway, I can't wait for this game. I hope it's as good as I'm hoping it to be.
Your layout has been removed.
Majora252's Profile → Posts
dcb "MAIN" PHB ; \ PHK ; | main sprite function, just calls local subroutine PLB ; | JSR START_HB_CODE ; | PLB ; | RTL ; / RETURN: RTS ;The BNE cannot branch to this, even know it's so close. START_HB_CODE: JSR SUB_GFX LDA $14C8,x CMP #$08 BNE RETURN LDA $9D BNE RETURN ;cannot branch to RETURN label ;rest of code here...
JSR SetSpriteCoord1 LDA #$xx ;Sprite number JSR SpawnSprite SpawnSprite: PHX PHP SEP #$30 PHA LDX #$0B SpwnSprtTryAgain: LDA $14C8,x ;Sprite Status Table BEQ SpwnSprtSet DEX CPX #$FF BEQ SpwnSprtClear BRA SpwnSprtTryAgain SpwnSprtClear: DEC $1861 BPL SpwnSprtExist LDA #$01 STA $1861 SpwnSprtExist: LDA $1861 CLC ADC #$0A TAX SpwnSprtSet: STX $185E LDA #$08 STA $14C8,x ;Sprite Status Table PLA STA $9E,x ;Sprite Type JSL $07F7D2 ; reset sprite properties INC $15A0,x ;"Sprite off screen" flag, horizontal LDA $9A ;Sprite creation: X position (low) STA $E4,x ;Sprite Xpos Low Byte LDA $9B STA $14E0,x ;Sprite Xpos High Byte LDA $98 ;Sprite creation: Y position (low) STA $D8,x ;Sprite Ypos Low Byte LDA $99 ;Sprite creation: Y position (high) STA $14D4,x ;Sprite Ypos High Byte LDA #$3E STA $1540,x ;Sprite Spin Jump Death Frame Counter LDA #$D0 STA $AA,x ;Sprite Y Speed LDA #$2C STA $144C,x LDA $190F,x ;Sprite Properties BPL SpwnSprtProp LDA #$10 STA $15AC,x SpwnSprtProp: PLP PLX RTS SetSpriteCoord1: PHP REP #$20 LDA $98 AND #$FFF0 STA $98 LDA $9A AND #$FFF0 STA $9A PLP RTS
JSR SetSpriteCoord1 LDA #$xx ;Custom Sprite Number JSR SpawnSprite SpawnSprite: PHX PHP SEP #$30 PHA LDX #$0B SpwnSprtTryAgain: LDA $14C8,x ;Sprite Status Table BEQ SpwnSprtSet DEX CPX #$FF BEQ SpwnSprtClear BRA SpwnSprtTryAgain SpwnSprtClear: DEC $1861 BPL SpwnSprtExist LDA #$01 STA $1861 SpwnSprtExist: LDA $1861 CLC ADC #$0A TAX SpwnSprtSet: STX $185E LDA #$08 STA $14C8,x ;Sprite Status Table PLA STA $7FAB9E,x JSL $07F7D2 ; reset sprite properties JSL $0187A7 ; get table values for custom sprite LDA #$88 ; mark as initialized STA $7FAB10,x INC $15A0,x ;"Sprite off screen" flag, horizontal LDA $9A ;Sprite creation: X position (low) STA $E4,x ;Sprite Xpos Low Byte LDA $9B STA $14E0,x ;Sprite Xpos High Byte LDA $98 ;Sprite creation: Y position (low) STA $D8,x ;Sprite Ypos Low Byte LDA $99 ;Sprite creation: Y position (high) STA $14D4,x ;Sprite Ypos High Byte LDA #$3E STA $1540,x ;Sprite Spin Jump Death Frame Counter LDA #$D0 STA $AA,x ;Sprite Y Speed LDA #$2C STA $144C,x LDA $190F,x ;Sprite Properties BPL SpwnSprtProp LDA #$10 STA $15AC,x SpwnSprtProp: PLP PLX RTS SetSpriteCoord1: PHP REP #$20 LDA $98 AND #$FFF0 STA $98 LDA $9A AND #$FFF0 STA $9A PLP RTS
LDA $XX STA $1DFB
dcb "INIT" LDA #$05 STA $1528,x STZ $06A7 STZ $06A8 STZ $06A9 RTL ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; main sprite JSL ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; dcb "MAIN" PHB ; \ PHK ; | main sprite function, just calls local subroutine PLB ; | JSR START_HB_CODE ; | PLB ; | RTL ; / RETURN: RTS START_HB_CODE: JSR SUB_GFX LDA $14C8,x CMP #$08 BNE RETURN LDA $9D BNE RETURN JSR SUB_OFF_SCREEN_X3 ; only process sprite while on screen JSL $01A7DC BCC NoContact LDA $0E CMP #$E6 BPL SpriteWins JSL $01AB99 JSL $01AA33 LDA #$A0 STA $7D DEC $1528,x LDA $1528,x BEQ KillSprite LDA #$13 STA $1DF9 ; SFX When jumping on the sprite. LDA $1594,x CMP #$D5 BEQ TIME_TO_JUMP INC $1594,x BRA SHARED JSL $01A7DC LDA $06A7 CMP #$26 BEQ GEN_CUSTOM LDA $1534,x ; Load a sprite table .. CMP #$CC ; IF CC frames have passed .. BEQ Jump ; Branch to jump. INC $1534,x ; Increase $1534,x every frame. INC $06A7 LDA $06A8 CMP #$30 BEQ RESET INC $06A8 LDA $06A9 CMP #$1B BEQ RESET2 INC $06A9 RTS TIME_TO_JUMP: LDA #$C0 STA $AA,x JSL $01802A LDA #$01 STA $1DFA STZ $1594,x SHARED: RTS Jump: LDA #$0 STA $AA,x ; Set a Y speed for the sprite so that it "jumps" LDA #$01 STA $1DFA ; Play "Mario jumps" sound. JSL $01802A STZ $1534,x ; Clear timer for jumping again. RTS SpriteWins: LDA $1490 BNE NoContact ; NOTE: Don't kill the sprite when having a star. JSL $00F5B7 NoContact: RTS KillSprite: LDA #$02 STA $14C8 RTL RESET: STZ $06A8 RTS RESET2: STZ $06A9 RTS ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; generate sprite ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; RETURN68: RTS GEN_CUSTOM: JSL $02A9DE ; \ get an index to an unused sprite slot, return if all slots full BMI RETURN68 ; / after: Y has index of sprite being generated LDA #$08 ; \ set sprite status for new sprite STA $14C8,y ; / LDA #$5A STA $1DFC LDA #$1B PHX TYX STA $7FAB9E,x PLX LDA $E4,x ;\ set x position for new sprite SEC SBC $06A8 STA $00E4,y ; LDA $14E0,x ; STA $14E0,y ; / LDA $D8,x ;\ set y position for new sprite SEC SBC $06A9 STA $00D8,y ; | LDA $14D4,x ; | STA $14D4,y ; / PHX TYX JSL $07F7D2 ; JSL $0187A7 LDA #$88 ; STA $7FAB10,x PLX STZ $06A7 RTS ; return ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; graphics routine ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; TILEMAP: dcb $C4,$E4,$C6,$E6 X_OFFSET: dcb $00,$00,$10,$10 Y_OFFSET: dcb $F0,$00,$F0,$00 SUB_GFX: JSR GET_DRAW_INFO ; after: Y = index to sprite tile map ($300) PHX LDX #$03 LOOP_START: LDA X_OFFSET,x CLC ADC $00 STA $0300,y LDA Y_OFFSET,x CLC ADC $01 STA $0301,y LDA TILEMAP,x STA $0302,y PHX LDX $15E9 LDA $15F6,x ; | get palette info ORA $64 ; | put in level properties STA $0303,y ; / store tile properties PLX INY INY INY INY DEX BPL LOOP_START PLX LDY #$02 ; \Draw Mode LDA #$03 ; | A = number of tiles drawn - 1 JSL $01B7B3 ; / don't draw if offscreen RTS ; return ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; $B760 - graphics routine helper - shared ; sets off screen flags and sets index to OAM ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;org $03B75C TABLE1: dcb $0C,$1C TABLE2: dcb $01,$02 GET_DRAW_INFO: STZ $186C,x ; reset sprite offscreen flag, vertical STZ $15A0,x ; reset sprite offscreen flag, horizontal LDA $E4,x ; \ CMP $1A ; | set horizontal offscreen if necessary LDA $14E0,x ; | SBC $1B ; | BEQ ON_SCREEN_X ; | INC $15A0,x ; / ON_SCREEN_X: LDA $14E0,x ; \ XBA ; | LDA $E4,x ; | REP #$20 ; | SEC ; | SBC $1A ; | mark sprite invalid if far enough off screen CLC ; | ADC.W #$0040 ; | CMP.W #$0180 ; | SEP #$20 ; | ROL A ; | AND #$01 ; | STA $15C4,x ; / BNE INVALID ; LDY #$00 ; \ set up loop: LDA $1662,x ; | AND #$20 ; | if not smushed (1662 & 0x20), go through loop twice BEQ ON_SCREEN_LOOP ; | else, go through loop once INY ; / ON_SCREEN_LOOP: LDA $D8,x ; \ CLC ; | set vertical offscreen if necessary ADC TABLE1,y ; | PHP ; | CMP $1C ; | (vert screen boundry) ROL $00 ; | PLP ; | LDA $14D4,x ; | ADC #$00 ; | LSR $00 ; | SBC $1D ; | BEQ ON_SCREEN_Y ; | LDA $186C,x ; | (vert offscreen) ORA TABLE2,y ; | STA $186C,x ; | ON_SCREEN_Y: DEY ; | BPL ON_SCREEN_LOOP ; / LDY $15EA,x ; get offset to sprite OAM LDA $E4,x ; \ SEC ; | SBC $1A ; | $00 = sprite x position relative to screen boarder STA $00 ; / LDA $D8,x ; \ SEC ; | SBC $1C ; | $01 = sprite y position relative to screen boarder STA $01 ; / RTS ; return INVALID: PLA ; \ return from *main gfx routine* subroutine... PLA ; | ...(not just this subroutine) RTS ; / ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; off screen processing code - shared ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;org $03B83B TABLE3: dcb $40,$B0 TABLE6: dcb $01,$FF TABLE4: dcb $30,$C0,$A0,$80,$A0,$40,$60,$B0 TABLE5 dcb $01,$FF,$01,$FF,$01,$00,$01,$FF SUB_OFF_SCREEN_X0: LDA #$06 ; \ entry point of routine determines value of $03 BRA STORE_03 ; | SUB_OFF_SCREEN_X1: LDA #$04 ; | BRA STORE_03 ; | SUB_OFF_SCREEN_X2: LDA #$02 ; | STORE_03: STA $03 ; | BRA START_SUB ; | SUB_OFF_SCREEN_X3: STZ $03 ; / START_SUB: JSR SUB_IS_OFF_SCREEN ; \ if sprite is not off screen, return BEQ RETURN_2 ; / LDA $5B ; \ goto VERTICAL_LEVEL if vertical level AND #$01 ; | BNE VERTICAL_LEVEL ; / LDA $D8,x ; \ CLC ; | ADC #$50 ; | if the sprite has gone off the bottom of the level... LDA $14D4,x ; | (if adding 0x50 to the sprite y position would make the high byte >= 2) ADC #$00 ; | CMP #$02 ; | BPL ERASE_SPRITE ; / ...erase the sprite LDA $167A,x ; \ if "process offscreen" flag is set, return AND #$04 ; | BNE RETURN_2 ; / LDA $13 ; \ AND #$01 ; | ORA $03 ; | STA $01 ; | TAY ; / LDA $1A CLC ADC TABLE4,y ROL $00 CMP $E4,x PHP LDA $1B LSR $00 ADC TABLE5,y PLP SBC $14E0,x STA $00 LSR $01 BCC LABEL20 EOR #$80 STA $00 LABEL20: LDA $00 BPL RETURN_2 ERASE_SPRITE: LDA $14C8,x ; \ if sprite status < 8, permanently erase sprite CMP #$08 ; | BCC KILL_SPRITE ; / LDY $161A,x CPY #$FF BEQ KILL_SPRITE LDA #$00 STA $1938,y KILL_SPRITE: STZ $14C8,x ; erase sprite RETURN_2: RTS ; return VERTICAL_LEVEL: LDA $167A,x ; \ if "process offscreen" flag is set, return AND #$04 ; | BNE RETURN_2 ; / LDA $13 ; \ only handle every other frame?? LSR A ; | BCS RETURN_2 ; / AND #$01 STA $01 TAY LDA $1C CLC ADC TABLE3,y ROL $00 CMP $D8,x PHP LDA.W $001D LSR $00 ADC TABLE6,y PLP SBC $14D4,x STA $00 LDY $01 BEQ LABEL22 EOR #$80 STA $00 LABEL22: LDA $00