DANKE an aller Helfer! Durch viel probieren und Überlegungen hat es jetzt funktioniert. Man muss wirklich ein bisschen um die Ecke denken.
; Double Jump
; HuFlungDu
; Basically it's what the name says. It will allow mario to double jump. The second jump height is configurable
; if you look farther down in the patch. It requires some free RAM, and the one I gave it is the most
; overused free RAM ever, so I suggest you repoint it.
; No credit necessary
macro RATS_start(id)
db "STAR"
dw RATS_Endcode-RATS_Startcode
dw RATS_Endcode-RATS_Startcode ^#$FFFF
RATS_Startcode:
endmacro
macro RATS_end(id)
RATS_Endcode:
endmacro
lorom ;\ ROM is LoRom
header ;/ and has a header.
!freeram = $0660 ; Your pobably gonna want to point this elsewhere
!secondjumpheight = $C0 ; This is the speed stored to mario's Y speed (HEX).
; The lower it is, the higher you go.
!freespace = $218015 ; If you don't know what this means... go find a tutorial
org $A21B ;\ Hijack routine that runs every frame (you can change this
;/ if you know what you are doing, otherwise, leave this alone)
JSL Djump ;Then jump to the code
org !freespace
%RATS_start(0) ; A RAT tag to keep LM from overwiting our code
Djump:
LDA $77 ;
AND #$04 ; Check if mario is on ground
BNE reset
LDA $75 ; Check if mario is in water
BEQ notwater
STZ !freeram
BRA reset
notwater:
LDA !freeram ;\ Check if you've already jumped (doesn't allow you to jump twice in the air)
BNE reset ;/
LDA $16 ;\ check if either B or A is pressed
AND #$80 ; |
BEQ return ;/ if neither, return
LDA $18 ;\ check if it's B that's pressed
AND #$80 ; |if A, not B,
BNE return ;/ return
LDA $7D ;Don't jump if mario is going down
BPL return ;(just comment out these lines if you want him to be able to)
LDA #!secondjumpheight ;\ Make mario jump
STA $7D ;/
LDA #$01 ;\Make sound effect
STA $1DFA ;/
INC !freeram ; Increase the freeram, telling the game that you
;just jumped and can't do it again
reset:
LDA $77 ; |
AND #$04 ; Check if mario is on ground
BEQ return
STZ !freeram ; Reset the freeram if mario is touching the ground
return:
LDA $16 ;\ Restore Hijacked code
AND #$10 ;/ (Don't touch unless you know what you are doing)
RTL
%RATS_end(0)
header
lorom
;################################################
; DEFINITIONS
;################################################
; \ Point to some free ROM space!!!!!
; | (Note: If our ROM is at least 1MB
!FreeSpace = $1C8000 ; | and you haven't applied any other
; | patches before, you don't need to
; / change this.)
!LevelNum = $010B ; Where the current level number is stored at
; \ Change this to $01
!AlwaysShwPwrup = $00 ; | to always show your current powerup
; / in the status bar
;################################################
; LEVELNUM.IPS DISASSEMBLY
;################################################
org $05D8B9 ; \
JSR Levelnummain ; |
; | Store current level number
org $05DC46 ; | to $010B and $010C
Levelnummain: ; |
LDA $0E ; | (Code by BMF54123,
STA !LevelNum ; | disassembled by Ersanio)
ASL A ; |
RTS ; /
;################################################
; STATUS BAR HIJACKS
;################################################
org $008CC9
db $FC,$2C,$FC,$3C ; \ Change the palettes of some empty tiles
db $FC,$28,$FC,$28 ; | and move bonus star counter
db $64,$28,$26,$38 ; / to the right
org $008CAB
db $FC,$3C,$76,$38 ; \ Use the clock tile instead of the "TIME" text
db $FC,$3C ; / so we can use that for custom GFX
;################################################
; ROUTINE HIJACKS
;################################################
org $008F49
JSL CustomCode ; Custom code that makes you invisible, stay on Yoshi etc.
org $01F71D
JML RunAway ; handles sprite contact
NOP ; ("hurt Yoshi or make him run away?")
org $02A481
JML RunAwayExt ; handles extended sprite contact
NOP
org !FreeSpace
db "STAR" ; \
dw End-Start-$01 ; | Write RAT / RATS Tag / whatever
dw End-Start-$01^$FFFF ; /
Start:
RunAway:
PHB ; \
PHK ; |
PLB ; |
PHY ; |
PHX ; |
REP #$30 ; |
LDA !LevelNum ; |
PHA ; |
LSR #3 ; | Code by Roy:
TAY ; | Load the bit that corresponds
PLA ; | to the current level
AND #$0007 ; |
TAX ; |
SEP #$20 ; |
LDA.w LevelTable,y ; |
AND.w ANDTable,x ; |
SEP #$10 ; |
PLX ; |
PLY ; /
CMP #$00 ; \ If zero,
BEQ .UseOldRoutine ; / use the old routine
JSL $00F5B7 ; \ If not zero, hurt Mario/Yoshi
PLB : JML $01F74B ; / and return from the routine
.UseOldRoutine ; \
LDA #$13 ; | If zero, restore some hijacked code
STA $1DFC ; | and continue the routine normally
PLB : JML $01F722 ; /
RunAwayExt:
PHB ; \
PHK ; |
PLB ; |
PHY ; |
PHX ; |
REP #$30 ; |
LDA !LevelNum ; |
PHA ; |
LSR #3 ; | Code by Roy:
TAY ; | Load the bit that corresponds
PLA ; | to the current level
AND #$0007 ; |
TAX ; |
SEP #$20 ; |
LDA.w LevelTable,y ; |
AND.w ANDTable,x ; |
SEP #$10 ; |
PLX ; |
PLY ; /
CMP #$00 ; \ If zero,
BEQ .UseOldRoutine ; / use the old routine
JSL $00F5B7 ; \ If not zero, hurt Mario/Yoshi
PLB : JML $02A4AC ; / and return from the routine
.UseOldRoutine ; \
LDA #$13 ; | If zero, restore some hijacked code
STA $1DFC ; | and continue the routine normally
PLB : JML $02A486 ; /
CustomCode:
LDA #!AlwaysShwPwrup ; \
BEQ + ; | Always display powerup
JSR DispPowerup ; | in the status bar
+ ; /
PHB ; \
PHK ; |
PLB ; |
PHY ; |
PHX ; |
REP #$30 ; |
LDA !LevelNum ; |
PHA ; |
LSR #3 ; | Code by Roy:
TAY ; | Load the bit that corresponds
PLA ; | to the current level
AND #$0007 ; |
TAX ; |
SEP #$20 ; |
LDA.w LevelTable,y ; |
AND.w ANDTable,x ; |
SEP #$10 ; |
PLX ; |
PLY ; /
CMP #$00 ; \ If zero,
BEQ Return ; / do nothing
LDA #!AlwaysShwPwrup ; \
BNE + ; | Display powerup
JSR DispPowerup ; | in the status bar
+ ; /
LDA #$40 ; \
STA $13E0 ; | Make Mario
LDA #$9D ; | invisible
STA $13DF ; /
REP #$20 ; \
LDA $17 ; |
AND #$7F7F ; | Disable A button (spin jump)
STA $17 ; |
SEP #$20 ; /
LDA #$22 ; \
STA $0EF9 ; |
LDA #$18 ; |
STA $0EFA ; |
LDA #$1C ; | Display "YOSHI" as the player name
STA $0EFB ; | in the status bar
LDA #$11 ; |
STA $0EFC ; |
LDA #$12 ; |
STA $0EFD ; /
Return:
LDA $0DBE ; \ Hijacked code
INC A ; / (don't touch this)
PLB : RTL ; Return
DispPowerup:
LDA #$FC ; \
STA $0F19 ; | Clear all tiles in the powerup section
STA $0F1A ; | before drawing new ones so that no two
STA $0F1B ; | powerups are shown at the same time
STA $0F1C ; /
PHX ; \
LDX $19 ; |
CPX #$00 ; | Display current powerup in the
BEQ DontDisp ; | status bar (so that you know what
DEX ; | powerup you are - Mario is invisible,
LDA.l PowerupTiles,x ; | after all - and if you're going to
STA $0F19,x ; | die on the next hit or not)
DontDisp: ; |
PLX ; /
RTS ; Return from subroutine
PowerupTiles: db $3D,$3F,$3E ; Tiles used as powerup symbols
ANDTable:
db $80,$40,$20,$10,$08,$04,$02,$01 ; Don't change.
;################################################
; LEVEL TABLE (Change this)
;################################################
LevelTable:
db %00000000,%00000000 ; Levels 0-F
db %00000000,%00000000 ; Levels 10-1F
db %00000000,%00000000 ; Levels 20-2F
db %00000000,%00000000 ; Levels 30-3F
db %00000000,%00000000 ; Levels 40-4F
db %00000000,%00000000 ; Levels 50-5F
db %00000000,%00000000 ; Levels 60-6F
db %00000000,%00000000 ; Levels 70-7F
db %00000000,%00000000 ; Levels 80-8F
db %00000000,%00000000 ; Levels 90-9F
db %00000000,%00000000 ; Levels A0-AF
db %00000000,%00000000 ; Levels B0-BF
db %00000000,%00000000 ; Levels C0-CF
db %00000000,%00000000 ; Levels D0-DF
db %00000000,%00000000 ; Levels E0-EF
db %00000000,%00000000 ; Levels F0-FF
db %00000100,%00000000 ; Levels 100-10F
db %00000000,%00000000 ; Levels 110-11F
db %00000000,%00000000 ; Levels 120-12F
db %00000000,%00000000 ; Levels 130-13F
db %00000000,%00000000 ; Levels 140-14F
db %00000000,%00000000 ; Levels 150-15F
db %00000000,%00000000 ; Levels 160-16F
db %00000000,%00000000 ; Levels 170-17F
db %00000000,%00000000 ; Levels 180-18F
db %00000000,%00000000 ; Levels 190-19F
db %00000000,%00000000 ; Levels 1A0-1AF
db %00000000,%00000000 ; Levels 1B0-1BF
db %00000000,%00000000 ; Levels 1C0-1CF
db %00000000,%00000000 ; Levels 1D0-1DF
db %00000000,%00000000 ; Levels 1E0-1EF
db %00000000,%00000000 ; Levels 1F0-1FF
End: ; This is the end. Don't remove this.
;==============;
;Shop Block ;
;By Iceguy ;
;Act Like 130 ;
;==============;
!Ram = $0DBF ; $0DBF -> Coin counter.
; $1422 -> Yoshi Coins.
; $0F48 -> Bonus stars.
; $0DBE -> Lives.
!Price = 12 ; Price of the item in decimal, with the Ram defined above.
!1ups = 02 ; How many 1ups to give the player.
!SoundWrong = $2A
!PushSpeed = $20
!ActLike = $29 ; If $29, it will turn into a used-block after hitting it (when the item is purchased).
; If $30, the block will stay intact after hitting it (when the item is purchased).
!PlayMsg = $01 ; Whether a message is played if the player has too few coins. 00 = no, any other value = yes.
!MsgNum = $01 ; Which message to use (1 or 2) if the above is set to $01.
db $42
JMP MarioBelow : JMP Return : JMP Return : JMP Return : JMP Return : JMP Return : JMP Return
JMP Return : JMP Return : JMP Return
MarioBelow:
LDA #!PushSpeed
STA $7D
LDA !Ram
CMP #!Price
BCC +
SEC
SBC #!Price
STA !Ram
LDA #!SoundRight
STA $1DFC
LDA #1!ups
STA $18E4
LDY #$01
LDA #!ActLike
STA $1693
RTL
+ LDA #!SoundWrong
STA $1DFC
LDA #!PlayMsg
BEQ Return
LDA #!MsgNum
STA $1426
Return:
RTL
01 22 0,0,400 Das ist ein Koopa der Mario wegweht