Allerdings funktioniert er nicht in zusammenhang mit den Block. Werde wohl einfach mit Teleportblöcken tricksen müssen.
Allerdings funktioniert er nicht in zusammenhang mit den Block. Werde wohl einfach mit Teleportblöcken tricksen müssen.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; sprite code JSL
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
dcb "INIT"
dcb "MAIN"
PHB
PHK
PLB
JSR SPRITE_CODE_START
PLB
RTL
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; main bullet bill shooter code
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
RETURN2 RTS ; return
SPRITE_CODE_START LDA $17AB,x ; \ return if it's not time to generate
BNE RETURN2 ; /
LDA #$40 ; \ set time till next generation = 40
STA $17AB,x ; /
LDA $178B,x ; \ don't generate if off screen vertically
CMP $1C ; |
LDA $1793,x ; |
SBC $1D ; |
BNE RETURN2 ; /
LDA $179B,x ; \ don't generate if off screen horizontally
CMP $1A ; |
LDA $17A3,x ; |
SBC $1B ; |
BNE RETURN2 ; /
LDA $179B,x ; \ ?? something else related to x position of generator??
SEC ; |
SBC $1A ; |
CLC ; |
ADC #$10 ; |
CMP #$10 ; |
BCC RETURN2 ; /
JSL $02A9DE ; \ get an index to an unused sprite slot, return if all slots full
BMI RETURN2 ; / after: Y has index of sprite being generated
GENERATE_SPRITE LDA #$09 ; \ play sound effect
STA $1DFC ; /
LDA #$01 ; \ set sprite status for new sprite
STA $14C8,y ; /
LDA #$9F ; \ set sprite number for new sprite
STA $009E,y ; /
LDA $179B,x ; \ set x position for new sprite
STA $00E4,y ; |
LDA $17A3,x ; |
STA $14E0,y ; /
LDA $178B,x ; \ set y position for new sprite
SEC ; | (y position of generator - 1)
SBC #$01 ; |
STA $00D8,y ; |
LDA $1793,x ; |
SBC #$00 ; |
STA $14D4,y ; /
PHX ; \ before: X must have index of sprite being generated
TYX ; | routine clears old sprite values...
JSL $07F7D2 ; | ...and loads in new values for the 6 main sprite tables
PLX ; /
LDA #$08 ;
STA $14C8,y ;
LDA $00
PHA
LDA $1783,x
AND #$40
BEQ LEFT
LDA $178B,x ; check y position and shoot up or down accordingly
AND #$10 ; todo: change this check
BNE SHOOT_UP2
LDA #$03
BRA STORE
SHOOT_UP2 LDA #$03
BRA STORE
LEFT LDA $178B,x ; check y position and shoot up or down accordingly
AND #$10 ; todo: change this check
BNE SHOOT_UP
LDA #$01
BRA STORE
SHOOT_UP LDA #$01
STORE STA $00C2,y ; 06 for down, 07 for up
STA $00
JSR SUB_SMOKE2
PLA
STA $00
RETURN RTS ; return
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; display smoke effect for diagonal shooter
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;up left, down right, down left, up right,
Y_OFFSET dcb $00,$00,$00,$00,$FA,$04,$04,$FA
X_OFFSET dcb $00,$00,$00,$00,$04,$04,$FA,$FA
SUB_SMOKE2 LDY #$03 ; \ find a free slot to display effect
FINDFREE LDA $17C0,y ; |
BEQ FOUNDONE ; |
DEY ; |
BPL FINDFREE ; |
RTS ; / return if no slots open
FOUNDONE LDA #$01 ; \ set effect graphic to smoke graphic
STA $17C0,y ; /
LDA $178B,x ; \
PHX ; |
PHA ; |
LDA $00
TAX
PLA ; | set smoke y position based on direction of shot
CLC ; |
ADC Y_OFFSET,x ; |
STA $17C4,y ; /
PLX
LDA #$1B ; \ set time to show smoke
STA $17CC,y ; /
LDA $179B,x ; \ load generator x position
PHX
PHA
LDA $00
TAX
PLA
CLC ; |
ADC X_OFFSET,x
STA $17C8,y ; /
PLX
RTS
03
FF
FF FF FF FF FF FF
FF FF
xxx.asm
;Make it act like tile 130
!Sprite = $11 ; To let pass
db $42
JMP n : JMP n : JMP n
JMP y : JMP y : JMP n : JMP n
JMP n : JMP n : JMP n
y:
LDA $9E,x ;\
CMP #!Sprite ; | Add more of these if you want more sprites to be able to pass
BEQ Pass ;/
n:
RTL
Pass:
LDY #$00 ;act like tile 130
LDA #$25
STA $1693
RTL
Now to insert it to the actual level:
1. Pick your level you want the effect to be used, e.g. level105
2. In levelinit.asm or levelmain.asm serch for level105
3. You'll most likely see a basic test code, replace that with a RTS, if
there's not one yet.
4. Now get your offset you inserted your HDMA effect to, e.g. $228000
5. Add $08 bytes (caused by the RATS tag) and it will become $228008
6. In the level105 field add this "JSL $228008" without the ""
7. Insert level.asm and the HDMA file you picked via Xkas.
org $008CB2
db $3C ; \
db $FC ; |
db $38 ; |
db $FC ; |
db $38 ; |
db $FC ; |
db $20 ; | Tilemap in status bar.
db $FC ; |
db $20 ; |
db $FC ; |
db $38 ; |
db $FC ; |
db $38 ; |
db $FC ; |
db $20 ; /
org $008CE7
db $2E ; \ Change $FC to $2E if you want the coin sign in front.
db $3C ; |
db $00 ; |
db $38 ; |
db $00 ; |
db $38 ; | More tilemap data.
db $00 ; |
db $38 ; |
db $00 ; |
db $38 ; |
db $00 ; |
db $38 ; |
db $00 ; |
db $38 ; |
db $FC ; |
db $3C ; /
org $008EE5
;@xkas
header
lorom
;=====================================;
;POINT THIS TO FREE SPACE!!!!!!!!!!!!!;
;=====================================;
!RAM_DecCoins = $7F969E ;
!ShowZeroes = $00 ; 00 - don't show leading zeroes, anything else - show them
org $10EEE0 ; <--- POINT TO FREESPACE!! REPLACE XXXXXX WITH SNES ADDRESS.
!RatsTag = RoutineEnd-RoutineStart ; RATS TAG.
db "STAR" ; DON'T REMOVE
dw !RatsTag-$01 ; THIS IF YOU WANT
dw !RatsTag-$01^$FFFF ; TO PROTECT THIS DATA.
RoutineStart: ; Don't remove label
LDA !RAM_DecCoins
BEQ EndDec
LDA $0F34
ORA $0F35
BEQ EndDec
REP #$20
LDA !RAM_DecCoins
DEC
STA !RAM_DecCoins
SEP #$20
LDA #$FF
DEC $0F34
CMP $0F34
BNE EndDec
DEC $0F35
EndDec:
LDA $13CC
BEQ NoInc
IncCoins:
DEC $13CC
REP #$20
LDA $0F34
CMP #$270F
BCC NotMax
LDA #$270F
STA $0F34
SEP #$20
BRA EndInc
NotMax:
SEP #$20
INC $0F34 ; $0F34 = Lowest 256 values.
BNE EndInc
INC $0F35 ; $0F35 = Lowest 65536 values.
EndInc:
LDA $00
JML $008F32
NoInc:
JML $008F3B
ZeroDec:
STA $7F8000
LDA #$0000
STA !RAM_DecCoins
RTL
SaveSRAMRoutine:
JSR GetSaveFile
LoadScoreData:
LDA $0F34,y ; Transfer coin counter data over...
STA $70079F,x ; to SRAM data. ($7007FD - $7007FF)
INX
INY
CPY #32
BCC LoadScoreData
LDX $010A
LDA $009CCB,x
RTL
LoadSRAMRoutine:
PHX
PHY
SEP #$10
JSR GetSaveFile
LoadSRAMData:
LDA $70079F,x ; Transfer SRAM data...
STA $0F34,y ; over to coin counter data.
INX
INY
CPY #32
BCC LoadSRAMData
REP #$10
PLY
PLX
LDA $700000,x
RTL
STZSRAMWhenGameOver:
JSR GetSaveFile
StoreZeroIntoSRAM:
LDA #$00
STA $0F34,y ; Set coins to zero.
STA $70079F,x ; Set coins in SRAM to zero.
INX
INY
CPY #32
BCC StoreZeroIntoSRAM
LDA #$0A
STA $1DFB
RTL
GetSaveFile:
LDA $010A
ASL
ASL
ASL
ASL
ASL
TAX
LDY #0
RTS
ZeroCoins:
LDA #!ShowZeroes
BNE PutZero
LDA #$FC ; hijacked routine
STA $0F29,x
LDA $0F34
ORA $0F35
ORA $0F36 ; if you have 0 coins...
BNE DontStoreZero ; put "0" on the status bar
STZ $0F2E ; 0 for the first digit
DontStoreZero:
RTL
PutZero:
CPX #$02
BCC BlankAtStart
STZ $0F29,x
RTL
BlankAtStart:
LDA #$FC
STA $0F29,x
RTL
RoutineEnd: ; Don't remove label
;=====================================;
; Values that edit status bar & score.;
;=====================================;
org $008CB2
db $3C ; \
db $FC ; |
db $38 ; |
db $FC ; |
db $38 ; |
db $FC ; |
db $20 ; | Tilemap in status bar.
db $FC ; |
db $20 ; |
db $FC ; |
db $38 ; |
db $FC ; |
db $38 ; |
db $FC ; |
db $20 ; /
org $008CE7
db $2E ; \ Change $FC to $2E if you want the coin sign in front.
db $3C ; |
db $00 ; |
db $38 ; |
db $00 ; |
db $38 ; | More tilemap data.
db $00 ; |
db $38 ; |
db $00 ; |
db $38 ; |
db $00 ; |
db $38 ; |
db $00 ; |
db $38 ; |
db $FC ; |
db $3C ; /
org $008EE5
JSL ZeroCoins
NOP
org $00802A
JSL ZeroDec
;STZ $0F29,x ; <--
org $008F1D
JML RoutineStart
LDA $00
BRA CycleSkip ;\ Skip for reducing cycles
NOP ; |
NOP ; | Useless
NOP ; |
NOP ;/
CycleSkip:
org $008F7E
BRA Skip ; \ Skip to save cycles.
NOP ; |
NOP ; |
NOP ; |
NOP ; / There isn't written to coin total.
Skip:
org $009BCC
JSL SaveSRAMRoutine ; Save data to SRAM!
NOP
NOP
org $009D14
JSL LoadSRAMRoutine ; Load data from SRAM!
org $009E4E
NOP ; Remove the first ; if you...
NOP ; want to disable the score being...
NOP ; deleted when getting to the Game Over screen.
org $009E56
NOP ; Remove the first ; if you...
NOP ; want to disable the score being...
NOP ; deleted when getting to the Game Over screen.
org $00D0DD
JSL STZSRAMWhenGameOver
NOP
org $028766
NOP ; \
NOP ; | Disable score
NOP ; /
org $028770
NOP ; \
NOP ; | Disable score
NOP ; /
org $02AE21
BRA SkipUseless ; \ Skip to save cycles.
NOP ; |
NOP ; |
NOP ; |
NOP ; | Disable score
NOP ; |
NOP ; |
NOP ; |
NOP ; |
NOP ; |
NOP ; /
NOP
NOP
NOP
NOP ; \ Yeah more semi-colons and comments...
NOP ; / Etc.
NOP
NOP
NOP
SkipUseless:
org $05CEF9
NOP ; \
NOP ; |
NOP ; |
NOP ; |
NOP ; |
NOP ; |
NOP ; | Disable score being added at level end.
NOP ; |
NOP ; |
NOP ; |
NOP ; |
NOP ; /
db $42
JMP MarioBelow : JMP MarioAbove : JMP MarioSide
JMP SpriteV : JMP SpriteH
JMP Cape : JMP Fireball
JMP MarioCorner : JMP MarioHead : JMP MarioBody
MarioBelow:
MarioAbove:
MarioSide:
JSL $00F606
SpriteV:
SpriteH:
Cape:
Fireball:
MarioCorner:
MarioHead:
MarioBody:
RTL
db $42
JMP MarioBelow : JMP MarioAbove : JMP MarioSide
JMP SpriteV : JMP SpriteH
JMP Cape : JMP Fireball
JMP MarioCorner : JMP MarioHead : JMP MarioBody
MarioBelow:
MarioAbove:
MarioSide:
JSL $00F606
RTL
SpriteV:
SpriteH:
LDA #$05
STA $14C8,X
LDA #$40
STA $1558,x
Cape:
Fireball:
MarioCorner:
MarioHead:
MarioBody:
RTL