Mhm ja stimmt WYE.. Ich hasse ASM
Mhm ja stimmt WYE.. Ich hasse ASM
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;Custom Sprite ? Block
;
;Set it to act like tile 129
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
db $42
JMP MarioBelow : JMP MarioAbove : JMP MarioSide : JMP SpriteV : JMP SpriteH : JMP MarioCape : JMP MarioFireBall
JMP MarioTopCorner : JMP MarioHeadIn : JMP MarioBodyIn
MarioAbove:
MarioBelow:
MarioSide:
LDA #$03
STA $85
;/
JSR SetSpriteCoord1
LDA #$D0 ;Custom Sprite Number
JSR SpawnSprite
RTL
MarioCape:
MarioHeadIn:
MarioBodyIn:
MarioFireBall:
MarioTopCorner:
SpriteV:
SpriteH:
RTL
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
print "INIT ",pc
print "MAIN ",pc
REP #$20 ;\ Set processor 16 bit
LDA #$0D02 ;| $4330 = $210D
STA $4330 ;| $4331 = Mode 02
LDA #$9E00 ;|
STA $4332 ;| Destination: $7F9E00
LDY #$7F ;| (low and high byte)
STY $4334 ;|
LDA #$0F02 ;| $4340 = $210F
STA $4340 ;| $4341 = Mode 02
LDA #$9E00 ;|
STA $4342 ;| Destination: $7F9F00
LDY #$7F ;| (low and high byte)
STY $4344 ;|
SEP #$20 ;/ Set processor 8 bit
LDA #$18 ;\ Enable HDMA
TSB $0D9F ;/ on channel 3,4
LDX #$00 ;\ Init of
LDY #$00 ;/ X and Y
SEP #$20 ;\ Set processor 8 bit
LDA $13 ;| Set speed of waves
LSR A ;| Adding more LSR A
LSR A ;| will make it slower
STA $00 ;/ Store in scratch RAM
PHB ;\ Push data bank
PHK ;| Push program bank
PLB ;/ Pull data bank
Wave_Loop:
LDA #$06 ;\ Set scanline height
STA $7F9E00,x ;| for each wave
STA $7F9F00,x
TYA ;| Transfer Y to A
ADC $00 ;| Add in scratch RAM
AND #$0F ;| and transfer #$0F bytes
PHY ;| Push Y
TAY ;/ Transfer A to Y
LDA.w Wave_Table,y ;\ Load in wave values
LSR A ;| half of waves only
CLC ;| Clear carry flag
ADC $1462 ;| Apply to layer 1
STA $7F9E01,x ;| X position low byte
LDA $1463 ;| And add nothing to
ADC #$00 ;| layer 1 X position
STA $7F9E02,x ;/ high byte
LDA.w Wave_Table,y ;\ Load in wave values
CLC ;| Clear carry flag
ADC $1466 ;| Apply to layer 2
STA $7F9F01,x ;| X position low byte
LDA $1467 ;| And add nothing to
ADC #$00 ;| layer 2 X position
STA $7F9F02,x ;/ high byte
PLY ;\ Pull Y
CPY #$25 ;| Compare with #$25 scanlines
BPL End_Wave ;| If bigger, end HDMA
INX ;| Increase X
INX ;| Increase X
INX ;| Increase X
INY ;| Increase Y
BRA Wave_Loop ;/ Do the loop
End_Wave:
PLB ;\ Pull data bank
LDA #$00 ;| End HMDA by writing
STA $7F9E03,x ;| #$00 here
STA $7F9F03,x
RTL ;/ Return
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;Table Settings
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Wave_Table:
db $00
db $01
db $02
db $03
db $04
db $05
db $06
db $07
db $07
db $06
db $05
db $04
db $03
db $02
db $01
db $00
;===============;
;New Sprite ;
;===============;
print "INIT ",pc
RTL
print "MAIN ",pc
PHB
PHK
PLB
PHX
JSR Run
PLX
PLB
RTL
Run:
REP #$20 ;\ Set processor 16 bit
LDA #$0D02 ;| $4330 = $210D
STA $4330 ;| $4331 = Mode 02
LDA #$9E00 ;|
STA $4332 ;| Destination: $7F9E00
LDY #$7F ;| (low and high byte)
STY $4334 ;|
LDA #$0F02 ;| $4340 = $210F
STA $4340 ;| $4341 = Mode 02
LDA #$9E00 ;|
STA $4342 ;| Destination: $7F9F00
LDY #$7F ;| (low and high byte)
STY $4344 ;|
SEP #$20 ;/ Set processor 8 bit
LDA #$18 ;\ Enable HDMA
TSB $0D9F ;/ on channel 3,4
LDX #$00 ;\ Init of
LDY #$00 ;/ X and Y
SEP #$20 ;\ Set processor 8 bit
LDA $13 ;| Set speed of waves
LSR A ;| Adding more LSR A
LSR A ;| will make it slower
STA $00 ;/ Store in scratch RAM
PHB ;\ Push data bank
PHK ;| Push program bank
PLB ;/ Pull data bank
Wave_Loop:
LDA #$06 ;\ Set scanline height
STA $7F9E00,x ;| for each wave
STA $7F9F00,x
TYA ;| Transfer Y to A
ADC $00 ;| Add in scratch RAM
AND #$0F ;| and transfer #$0F bytes
PHY ;| Push Y
TAY ;/ Transfer A to Y
LDA.w Wave_Table,y ;\ Load in wave values
LSR A ;| half of waves only
CLC ;| Clear carry flag
ADC $1462 ;| Apply to layer 1
STA $7F9E01,x ;| X position low byte
LDA $1463 ;| And add nothing to
ADC #$00 ;| layer 1 X position
STA $7F9E02,x ;/ high byte
LDA.w Wave_Table,y ;\ Load in wave values
CLC ;| Clear carry flag
ADC $1466 ;| Apply to layer 2
STA $7F9F01,x ;| X position low byte
LDA $1467 ;| And add nothing to
ADC #$00 ;| layer 2 X position
STA $7F9F02,x ;/ high byte
PLY ;\ Pull Y
CPY #$25 ;| Compare with #$25 scanlines
BPL End_Wave ;| If bigger, end HDMA
INX ;| Increase X
INX ;| Increase X
INX ;| Increase X
INY ;| Increase Y
BRA Wave_Loop ;/ Do the loop
End_Wave:
PLB ;\ Pull data bank
LDA #$00 ;| End HMDA by writing
STA $7F9E03,x ;| #$00 here
STA $7F9F03,x
RTS ;/ Return
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;Table Settings
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Wave_Table:
db $00
db $01
db $02
db $03
db $04
db $05
db $06
db $07
db $07
db $06
db $05
db $04
db $03
db $02
db $01
db $00
JSL $02A9DE
BMI EndSpawn
PHX
TYX
LDA #$01 ; Sprite state ($14C8,x).
STA $14C8,x
LDA #!SpriteNumber ; This the sprite number to spawn.
STA $7FAB9E,x
LDA #$00
STA $E4,x
STA $14E0,x
STA $D8,x
STA $14D4,x
JSL $07F7D2
JSL $0187A7
LDA #$08
STA $7FAB10,x
PLX
EndSpawn:
RTS
db $42
JMP MarioBelow : JMP MarioAbove : JMP MarioSide
JMP SpriteV : JMP SpriteH
JMP Cape : JMP Fireball
JMP MarioCorner : JMP MarioHead : JMP MarioBody
MarioBelow:
LDA #$30 ; \ Make this block solid.
STA $1693 ; |
LDY #$01 ; /
RTL
MarioAbove:
LDA #$25 ; \ Make this block passable.
STA $1693 ; |
LDY #$00 ; /
MarioSide:
SpriteV:
SpriteH:
Cape:
Fireball:
MarioCorner:
MarioHead:
MarioBody:
RTL
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 $2E ; \ Change $FC to $2E if you want the coin sign in front.