Beiträge von MetalJo
Kann mir jemand bitte sagen, wie ich mache, dass diese Attacken in zufälliger Reihenfolge ausgeführt werden. (als Attacken meine ich das JSR Tele und das JSR SUB_FIRE_THROW )
Code
TO_ATTACK LDA FIRE_TIMER,x ; \ if time until spit >= $10
CMP #TIME_TO_SHOW ; | just go to normal walking code
BCS STATE_RUN ; /
INC SPRITE_IMG,x
INC SPRITE_IMG,x
LDA FIRE_TIMER,x ; throw fire if it's time
BNE NO_RESET
LDY $C2,x
LDA TIME_TILL_THROW,y
STA FIRE_TIMER,x
NO_RESET CMP #$01
BNE STATE_RUN
JSR SUB_FIRE_THROW
JSR Tele
LDA #$18
STA $1887
CMP #TIME_TO_SHOW ; | just go to normal walking code
BCS STATE_RUN ; /
INC SPRITE_IMG,x
INC SPRITE_IMG,x
LDA FIRE_TIMER,x ; throw fire if it's time
BNE NO_RESET
LDY $C2,x
LDA TIME_TILL_THROW,y
STA FIRE_TIMER,x
NO_RESET CMP #$01
BNE STATE_RUN
JSR SUB_FIRE_THROW
JSR Tele
LDA #$18
STA $1887
Ich kenne mich mit Timern wirklich nicht aus, deswegen frag ich euch. Wie kann ich machen, dass dieser Sprite erst nach 3 Sekunden wieder erscheint ?
Code
;===================================
; Init
;===================================
dcb "INIT"
LDA #$09
STA $14C8,x
RTL
dcb "MAIN"
PHB
PHK
PLB
LDA $1510,x
BNE TheEnd
JSR SpriteCode
TheEnd:
PLB
RTL
;===================================
; Main Code
;===================================
SpriteCode:
JSR Graphics
JSR WavyMotion
LDA #Gravity
STA $AA,x
BNE Return
JSL $01A7DC
BCC Return
STZ 14C8,x
BEQ Return
LDY #$0B ;\
Loop: ; |
LDA $14C8,y ; |
CMP #$0B ; |
BEQ Return ; |
DEY ; |
BPL Loop ;/
LDA #$02
STA $1DF9
LDA #$00
STA $1510,x
JSL $07FC3B ; l Zeichne Sterne
LDA #$08 ; l Spiel SFX ab
STA $1DFC
LDA #$00
STA $140D
LDA #$80
STA $7D
RTS
Return:
RTS
;===================================
; GFX Routine
;===================================
Graphics:
JSR GET_DRAW_INFO
LDA #$F0 ;\Move glitched tile
STA $0309,y ;/off screen.
LDA $00 ;\
STA $0300,y ; |This will prepare the X and Y positions so that we
LDA $01 ; |can draw the actual sprite.
STA $0301,y ;/
LDA #$A4 ;\This tells the game what tile we want to draw.
STA $0302,y ;/
LDA #%01001111 ;No Y-flip, X-flip, Lowest priority, Palette F, Page 4
ORA $64 ;\Store this stuff ^
STA $0303,y ;/
;INY ;\
;INY ; |Actually, this isn't necessary...
;INY ; |This is just necessary if we are drawing more than 1 tile (cause this just get the next tile in the OAM...)
;INY ;/
LDY #$02 ;Again, because we want the sprite to be 16 x 16.
LDA #$00 ;Something else for drawing the sprite.
JSL $01B7B3 ;This calls the routine that actually draws our sprite.
RTS
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; GET_DRAW_INFO
; This is a helper for the graphics routine. It sets off screen flags, and sets up
; variables. It will return with the following:
;
; Y = index to sprite OAM ($300)
; $00 = sprite x position relative to screen boarder
; $01 = sprite y position relative to screen boarder
;
; It is adapted from the subroutine at $03B760
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
SPR_T1: dcb $0C,$1C
SPR_T2: 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 SPR_T1,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 SPR_T2,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 ; /
;==================================================================
;Wavy Thing
;==================================================================
WavyMotion:
PHY ; Push Y in case something messes it up.
LDA $14 ; Get the sprite frame counter ..
LSR A ; 7F
LSR A ; 3F ; Tip: LSR #3.
LSR A ; 1F
AND #$07 ; Loop through these bytes during H-Blank. (WHAT?)
TAY ; Into Y.
LDA WavySpd,y ; Load Y speeds ..
STA $AA,x
JSL $01801A ; Update, with no gravity.
PLY ; Pull Y.
RTS
WavySpd: db $00,$F8,$F2,$F8,$00,$08,$0E,$08
;===================================
; EXPLOSION
;===================================
Explode:
LDA #$0D ;\Become a Bob-Omb
STA $9E,x ;/
LDA #$08 ;\Run routines normally
STA $14C8,x ;/
JSL $07F7D2 ;Reset sprite tables
LDA #$01 ;\Do something with a sprite table
STA $1534,x ;/
LDA #$40 ;\Do something with a sprite table
STA $1540,x ;/
LDA #$09 ;\Play SFX
STA $1DFC ;/
LDA #$1B ;\Set some sprite properties
STA $167A,x ;/
RTS
; Init
;===================================
dcb "INIT"
LDA #$09
STA $14C8,x
RTL
dcb "MAIN"
PHB
PHK
PLB
LDA $1510,x
BNE TheEnd
JSR SpriteCode
TheEnd:
PLB
RTL
;===================================
; Main Code
;===================================
SpriteCode:
JSR Graphics
JSR WavyMotion
LDA #Gravity
STA $AA,x
BNE Return
JSL $01A7DC
BCC Return
STZ 14C8,x
BEQ Return
LDY #$0B ;\
Loop: ; |
LDA $14C8,y ; |
CMP #$0B ; |
BEQ Return ; |
DEY ; |
BPL Loop ;/
LDA #$02
STA $1DF9
LDA #$00
STA $1510,x
JSL $07FC3B ; l Zeichne Sterne
LDA #$08 ; l Spiel SFX ab
STA $1DFC
LDA #$00
STA $140D
LDA #$80
STA $7D
RTS
Return:
RTS
;===================================
; GFX Routine
;===================================
Graphics:
JSR GET_DRAW_INFO
LDA #$F0 ;\Move glitched tile
STA $0309,y ;/off screen.
LDA $00 ;\
STA $0300,y ; |This will prepare the X and Y positions so that we
LDA $01 ; |can draw the actual sprite.
STA $0301,y ;/
LDA #$A4 ;\This tells the game what tile we want to draw.
STA $0302,y ;/
LDA #%01001111 ;No Y-flip, X-flip, Lowest priority, Palette F, Page 4
ORA $64 ;\Store this stuff ^
STA $0303,y ;/
;INY ;\
;INY ; |Actually, this isn't necessary...
;INY ; |This is just necessary if we are drawing more than 1 tile (cause this just get the next tile in the OAM...)
;INY ;/
LDY #$02 ;Again, because we want the sprite to be 16 x 16.
LDA #$00 ;Something else for drawing the sprite.
JSL $01B7B3 ;This calls the routine that actually draws our sprite.
RTS
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; GET_DRAW_INFO
; This is a helper for the graphics routine. It sets off screen flags, and sets up
; variables. It will return with the following:
;
; Y = index to sprite OAM ($300)
; $00 = sprite x position relative to screen boarder
; $01 = sprite y position relative to screen boarder
;
; It is adapted from the subroutine at $03B760
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
SPR_T1: dcb $0C,$1C
SPR_T2: 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 SPR_T1,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 SPR_T2,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 ; /
;==================================================================
;Wavy Thing
;==================================================================
WavyMotion:
PHY ; Push Y in case something messes it up.
LDA $14 ; Get the sprite frame counter ..
LSR A ; 7F
LSR A ; 3F ; Tip: LSR #3.
LSR A ; 1F
AND #$07 ; Loop through these bytes during H-Blank. (WHAT?)
TAY ; Into Y.
LDA WavySpd,y ; Load Y speeds ..
STA $AA,x
JSL $01801A ; Update, with no gravity.
PLY ; Pull Y.
RTS
WavySpd: db $00,$F8,$F2,$F8,$00,$08,$0E,$08
;===================================
; EXPLOSION
;===================================
Explode:
LDA #$0D ;\Become a Bob-Omb
STA $9E,x ;/
LDA #$08 ;\Run routines normally
STA $14C8,x ;/
JSL $07F7D2 ;Reset sprite tables
LDA #$01 ;\Do something with a sprite table
STA $1534,x ;/
LDA #$40 ;\Do something with a sprite table
STA $1540,x ;/
LDA #$09 ;\Play SFX
STA $1DFC ;/
LDA #$1B ;\Set some sprite properties
STA $167A,x ;/
RTS
Zitat von Skorme:
Musik Porten ist nicht so einfach wie du denkst.
Wenn du die haben willst musst du die 'wohl oder übel' selber porten.
Allerdings ist das nicht so ne schnelle Sache, man braucht da viel Übung und auch ein gewissen Talent...
Am besten schaust du dir ein Tutorial dazu an.
Was viele hier lernen sollten:
Man meldet sich hier nicht an damit andere die Arbeit für einen machen.
ASM schreiben (Sprites, Patches) oder auch Musik-porten ist sehr anstrengend.
Zitat von urtegurkeproj:
Das is eben auch n kleines Problemchen...ich finde nirgends eine. Ich hab ne mp3 Datei gefunden, aber die müsste man konvertieren (falls das ginge...)^^
Musik Porten ist nicht so einfach wie du denkst.
Wenn du die haben willst musst du die 'wohl oder übel' selber porten.
Allerdings ist das nicht so ne schnelle Sache, man braucht da viel Übung und auch ein gewissen Talent...
Am besten schaust du dir ein Tutorial dazu an.
Was viele hier lernen sollten:
Man meldet sich hier nicht an damit andere die Arbeit für einen machen.
ASM schreiben (Sprites, Patches) oder auch Musik-porten ist sehr anstrengend.
Sooo anstrengend ist das garnicht ;D
Ich hab mal ne ganz kleine Frage.
LDA #$DD ; \ start Custom music
STA $1DFB ; /
Eigentlich sollte das doch die Custom music starten, aber er bleibt bei No Music, aber wenn ich:
LDA #$05 ; \ start the boss music
STA $1DFB ; /
nehme funktioniert es. Wie kann ich machen , dass Custom Music abgespielt wird ?
LDA #$DD ; \ start Custom music
STA $1DFB ; /
Eigentlich sollte das doch die Custom music starten, aber er bleibt bei No Music, aber wenn ich:
LDA #$05 ; \ start the boss music
STA $1DFB ; /
nehme funktioniert es. Wie kann ich machen , dass Custom Music abgespielt wird ?
Zitat von RealLink:
Du kannst nur Musik aus der selben Bank nehmen (1 Bank = 4 Lieder). Ich weiß jetzt nicht wie die Bank in der DD ist eingeteilt ist, also hilft nur testen oder hochrechnen, es muss im Level eben schon eine der Musiken aus der selben Bank spielen.
Was ist eine Bank. Wie meinst du das ?
Ich habe mal eine Frage, was muss ich im Sprite machen, wenn temp.log das anzeigt:
Memory available: 2147483647
Starting address defined as $90B105
Pass 1
Pass 2
Error in 155.1/132: Branch out of range
Pass 3
Error in 155.1/132: Branch out of range
Source code assembled.
Although the source code was assembled, the program may not run
properly due to errors detected during the assembling process.
[$90B105-$90B54E]
Lines=607
Statements=528
Symbols=90
Errors=1
Memory available: 2147483647
Starting address defined as $90B105
Pass 1
Pass 2
Error in 155.1/132: Branch out of range
Pass 3
Error in 155.1/132: Branch out of range
Source code assembled.
Although the source code was assembled, the program may not run
properly due to errors detected during the assembling process.
[$90B105-$90B54E]
Lines=607
Statements=528
Symbols=90
Errors=1

