Tetris & Dr.Mario

Page 1 of 2 1, 2  Next

Go down

Tetris & Dr.Mario

Post by Polargames on Sat 4 Aug 2018 - 23:44

Hello Everyone.

I have been working on a test project to sharpen my codeing skills. I have read a lot of helpful links to information on asm and SPC700, but when I put it to use, I am stuck. I have found 4 areas that I think are but I am not sure how to test them. What are some ways that I could use to see if they are right or if all of them do not work. Again I am just looking for ways for help to get out of this rut that is all. I am trying my best to become better at codeing. Thank you.

Theme map:
https://docs.google.com/spreadsheets/d/1EcGdH_kLMhZoYzHLMTh7zJP1hC0Sd_HxNbOPgEi79Qk/edit?usp=sharing

Patch v3 (added non-loop tracks)
http://bszelda.zeldalegends.net/stuff/Con/tdm_msu1.zip
avatar
Polargames
Crystal Maiden
Crystal Maiden

Since : 2018-06-06

Back to top Go down

Re: Tetris & Dr.Mario

Post by pepillopev on Sun 5 Aug 2018 - 0:35

@Polar Where are you stuck?

pepillopev



Since : 2017-10-16

Back to top Go down

Re: Tetris & Dr.Mario

Post by Polargames on Sun 5 Aug 2018 - 0:39

pepillopev wrote:@Polar Where are you stuck?

I am stuck on the code for a mute point. I have 4 areas that I think could work for the mute point, but I do not know which one/ if any are the right one. I have my log with me would that help you understand where I am at?

Here is my log, The game is Dr.Mario

85C, 85D, 85E, 85F are the places I think are the mute points.
Attachments
new 2.zip You don't have permission to download attachments.(78 Kb) Downloaded 1 times
avatar
Polargames
Crystal Maiden
Crystal Maiden

Since : 2018-06-06

Back to top Go down

Where do I go?

Post by pepillopev on Sun 5 Aug 2018 - 0:47

Hmm are you looking at STA $2140 commands or specific read/writes to RAM (like STA $00B3 as an example). The numbers you listed have no meaning to me.

pepillopev



Since : 2017-10-16

Back to top Go down

Re: Tetris & Dr.Mario

Post by Polargames on Sun 5 Aug 2018 - 0:51

Yes, That is it, $2140 commands. I have my log up above that if you want to look at you can. The codes I have list are the ones in my text I think would work.
avatar
Polargames
Crystal Maiden
Crystal Maiden

Since : 2018-06-06

Back to top Go down

Re: Tetris & Dr.Mario

Post by pepillopev on Sun 5 Aug 2018 - 0:53

In bSnes++, use the trace dump just when music starts then immediately stop after music plays. Look at the log file (will be a log file in same folder as ROM). Look for APU specific commands like STA $2140 thru $2143. Grab the address for those instructions and trace them.

Once it stops at a command you are interesting in, put a 00 for A. Sometimes, Nintendo games use 00, F1 thru F4 for mute triggers in A. It’s pretty much trial an error. It may do a full mute, partial, or even crash. Just keep experimenting.

pepillopev



Since : 2017-10-16

Back to top Go down

Re: Tetris & Dr.Mario

Post by Polargames on Sun 5 Aug 2018 - 0:55

pepillopev wrote:In bSnes++, use the trace dump just when music starts then immediately stop after music plays. Look at the log file (will be a log file in same folder as ROM). Look for APU specific commands like STA $2140 thru $2143. Grab the address for those instructions and trace them.

Once it stops at a command you are interesting in, put a 00 for A. Sometimes, Nintendo games use 00, F1 thru F4 for mute triggers in A. It’s pretty much trial an error. It may do a full mute, partial, or even crash. Just keep experimenting.

Sweet, Thank you so much Pepv. This is a big help. You Rock Very Happy
avatar
Polargames
Crystal Maiden
Crystal Maiden

Since : 2018-06-06

Back to top Go down

Re: Tetris & Dr.Mario

Post by pepillopev on Sun 5 Aug 2018 - 0:56

@Polar It is late for me now, otherwise, I’d help more (need to sleep). Sometime tomorrow, I can make a video of what I explained above.

pepillopev



Since : 2017-10-16

Back to top Go down

Re: Tetris & Dr.Mario

Post by Polargames on Sun 5 Aug 2018 - 1:01

pepillopev wrote:@Polar It is late for me now, otherwise, I’d help more (need to sleep). Sometime tomorrow, I can make a video of what I explained above.

That is more then fair Pepv, Thank you very much again and have a good nights sleep as well. :-)
avatar
Polargames
Crystal Maiden
Crystal Maiden

Since : 2018-06-06

Back to top Go down

Re: Tetris & Dr.Mario

Post by pepillopev on Sun 5 Aug 2018 - 17:35

@Polar So how is your Dr Mario going along?

pepillopev



Since : 2017-10-16

Back to top Go down

Re: Tetris & Dr.Mario

Post by Conn on Sun 5 Aug 2018 - 18:14

Out of curiousity, which debugger did you use for your attached trace log above?
The translation of the opcodes reminds on apu 8bit-address machine (mov  a,00 instead of LDA #$00). I can read it, but Geiger or bsnes is much more user-friendly to read - esp. if you start...
avatar
Conn



Since : 2013-06-30

Back to top Go down

Re: Tetris & Dr.Mario

Post by Polargames on Sun 5 Aug 2018 - 19:43

pepillopev wrote:@Polar So how is your Dr Mario going along?

Well, I be working on it today. I have been a little busy with everyday things, had to get a new tire for my car, but now I can play around with it. I will let you know what I have found. :-)
avatar
Polargames
Crystal Maiden
Crystal Maiden

Since : 2018-06-06

Back to top Go down

Re: Tetris & Dr.Mario

Post by Polargames on Sun 5 Aug 2018 - 19:47

Conn wrote:Out of curiousity, which debugger did you use for your attached trace log above?
The translation of the opcodes reminds on apu 8bit-address machine (mov  a,00 instead of LDA #$00). I can read it, but Geiger or bsnes is much more user-friendly to read - esp. if you start...

The debuger that I used is one called NO$SNS. Its a new one that I had found and I wanted to give it a try. I have used a liked bsnes and Geiger I had used but I am still learning on it. If you would like to me I am more then happy to make a trace log for you Conn, for some light reading. :-)

I have it here for you, and thanks to bsnes out of my 5 point, I know have one. But I have marked it for you. I hope that helps.
Attachments
Dr. M trace.zip You don't have permission to download attachments.(7 Kb) Downloaded 3 times
avatar
Polargames
Crystal Maiden
Crystal Maiden

Since : 2018-06-06

Back to top Go down

Re: Tetris & Dr.Mario

Post by Polargames on Sun 5 Aug 2018 - 20:50

I got it to work, The code that seem to do it was 808bcd F2. I have played it and it works so far, but I know there could be more, So do I run through more of them, or if one works does that mean thats the one? Feel free to let me know if I am worng or there are more that I have missed. This one for me at least does the trick.
avatar
Polargames
Crystal Maiden
Crystal Maiden

Since : 2018-06-06

Back to top Go down

Where do I go?

Post by pepillopev on Sun 5 Aug 2018 - 20:52

Usually only way to tell is to play through the game. Sometimes one mute sticks for the whole game. Sometimes, you might have to continuously mute it in code. Trial and error.

Every game is different. Some do APU resets that may mess with the initial mute code.

Hmm, seems to me like you are doing a hard core mute. Hard core meaning, you are permanently disabling SPC audio with no SPC fallback possible. Just one byte for that address?

pepillopev



Since : 2017-10-16

Back to top Go down

Re: Tetris & Dr.Mario

Post by Conn on Sun 5 Aug 2018 - 21:03

Ah, didn't know that no$sns also has debug. Thanks. However, as said before, I have no time to do any more projects or teach asm... I only jump in if some projects are advanced and need bug assistance (like it happened (to an unwelcomed extensive work) with Fighter History recently.



Also, generally. Sending a trace will not help people. You'd need to tell what you traced and why you suspect what. As what you marked as mute point in your asm, I can't tell why you marked it.

I shortly traced.... and wonder why you didn't follow Pev's suggestion to go for the sound channels $214x?

Here:
$80/8DD6 8D 40 21    STA $2140  [$83:2140]   A:0000
$80/8DD6 8D 40 21    STA $2140  [$83:2140]   A:0001
$80/8DD6 8D 40 21    STA $2140  [$83:2140]   A:0002
$80/8DD6 8D 40 21    STA $2140  [$83:2140]   A:0003
You can easily map the themes using the value in A, for example 01 is title screen, 02 is game select, 03 tetris intro...... if you then store a 00 here instead of the theme you'll have mute.
No problem at all, that's one of the easiest game to msu existing.

I'll not help further because it, in the end would lead to that I make the complete project (like it happened in Kirby and Wolf3d). To safe me from such stuff, I am really not helping further but you now should have all info you need to make your first patch Wink
Much luck!
avatar
Conn



Since : 2013-06-30

Back to top Go down

Re: Tetris & Dr.Mario

Post by Polargames on Sun 5 Aug 2018 - 23:47

pepillopev wrote:Usually only way to tell is to play through the game. Sometimes one mute sticks for the whole game. Sometimes, you might have to continuously mute it in code. Trial and error.

Every game is different. Some do APU resets that may mess with the initial mute code.

Hmm, seems to me like you are doing a hard core mute. Hard core meaning, you are permanently disabling SPC audio with no SPC fallback possible. Just one byte for that address?

Well, That is where I do not know, I do understand from other projects that have been worked on that a hardcore mute is the last resort. So that is why I had posted to feel free to let me know of other ways of finding them. I will still use your advice to do the trial and error method. I will save the hard mute as my last resort. Thank you again for your guidence in this and @Conn as well. Smile
avatar
Polargames
Crystal Maiden
Crystal Maiden

Since : 2018-06-06

Back to top Go down

Re: Tetris & Dr.Mario

Post by Polargames on Mon 6 Aug 2018 - 0:12

Conn wrote:Ah, didn't know that no$sns also has debug. Thanks. However, as said before, I have no time to do any more projects or teach asm... I only jump in if some projects are advanced and need bug assistance (like it happened (to an unwelcomed extensive work) with Fighter History recently.



Also, generally. Sending a trace will not help people. You'd need to tell what you traced and why you suspect what. As what you marked as mute point in your asm, I can't tell why you marked it.

I shortly traced.... and wonder why you didn't follow Pev's suggestion to go for the sound channels $214x?

Here:
$80/8DD6 8D 40 21    STA $2140  [$83:2140]   A:0000
$80/8DD6 8D 40 21    STA $2140  [$83:2140]   A:0001
$80/8DD6 8D 40 21    STA $2140  [$83:2140]   A:0002
$80/8DD6 8D 40 21    STA $2140  [$83:2140]   A:0003
You can easily map the themes using the value in A, for example 01 is title screen, 02 is game select, 03 tetris intro...... if you then store a 00 here instead of the theme you'll have mute.
No problem at all, that's one of the easiest game to msu existing.

I'll not help further because it, in the end would lead to that I make the complete project (like it happened in Kirby and Wolf3d). To safe me from such stuff, I am really not helping further but you now should have all info you need to make your first patch Wink
Much luck!

Why thank you Conn, That really means a lot to me. I know you do not have anymore time for a project and thats fine. I am trying to see if I can do it, if I cannot I will stop. I was trying to follow Pepvs suggestion, I had checked the cpu box by mistake and not the APU, My bad on that one. Thank you for the new info. You guys really Rock. Very Happy
avatar
Polargames
Crystal Maiden
Crystal Maiden

Since : 2018-06-06

Back to top Go down

Re: Tetris & Dr.Mario

Post by Conn on Mon 6 Aug 2018 - 10:20

I hope you can help yourself from this point.

ASM will look like this:

Code:
lorom

org $808DD6
JSL msu
NOP
NOP

org $9FF000 ;(some free space
PHA
lda $2002
CMP #$53
BEQ nomsu
PLA
CMP #$00
beq endmsu
STZ $2006
STA $2004
STZ $2005
loop:
bit $2000
BVS loop
LDA #$FF
STA $2006
LDA #$03
STA $2007
endmsu:
LDA #$00  ;mute spc
STA $2140
STA $0C5D
RTL
nomsu:
PLA
STA $2140
STA $0C5D
RTL
avatar
Conn



Since : 2013-06-30

Back to top Go down

Re: Tetris & Dr.Mario

Post by Polargames on Mon 6 Aug 2018 - 13:11

Conn wrote:I hope you can help yourself from this point.

ASM will look like this:

Code:
lorom

org $808DD6
JSL msu
NOP
NOP

org $9FF000 ;(some free space
PHA
lda $2002
CMP #$53
BEQ nomsu
PLA
CMP #$00
beq endmsu
STZ $2006
STA $2004
STZ $2005
loop:
bit $2000
BVS loop
LDA #$FF
STA $2006
LDA #$03
STA $2007
endmsu:
LDA #$00  ;mute spc
STA $2140
STA $0C5D
RTL
nomsu:
PLA
STA $2140
STA $0C5D
RTL

Thank you very much, and yes I can. Now from what I had read in the links you sent me, It suggested I use asar to compile it to make the ips and or bps patch. Is that the one you would use and is bps better then ips?
avatar
Polargames
Crystal Maiden
Crystal Maiden

Since : 2018-06-06

Back to top Go down

Re: Tetris & Dr.Mario

Post by Conn on Mon 6 Aug 2018 - 13:45

I use xkas.
Attached is all you need

xkas.exe
tdm_msu1.asm (, open with text editor, the code from above pasted)
insertasm.bat (open it with a text editor, self-explaning).

rename your Tetris & Dr. Mario (USA).sfc into tdm_msu1.sfc, run insertasm.bat

have now an empty tdm_msu1.msu, some tdm_msu1-x.pcm and release the patch. You managed again to make me the patch completely Smile
(but I didn't test it).

I'll really stop replying to help requests. It every time takes this way Sad ... but that's not your fault, it's mine so please no apology. Just try to learn what I did, and try to make the patch yourself! So you don't need help next time.
avatar
Conn



Since : 2013-06-30

Back to top Go down

Re: Tetris & Dr.Mario

Post by Polargames on Mon 6 Aug 2018 - 16:41

Conn wrote:I use xkas.
Attached is all you need

xkas.exe
tdm_msu1.asm (, open with text editor, the code from above pasted)
insertasm.bat (open it with a text editor, self-explaning).

rename your Tetris & Dr. Mario (USA).sfc into tdm_msu1.sfc, run insertasm.bat

have now an empty tdm_msu1.msu, some tdm_msu1-x.pcm and release the patch. You managed again to make me the patch completely Smile
(but I didn't test it).

I'll really stop replying to help requests. It every time takes this way Sad ... but that's not your fault, it's mine so please no apology. Just try to learn what I did, and try to make the patch yourself! So you don't need help next time.

Again thank you very much Conn. I was not expecting that from you, I was just trying to use what I had read from the links you had provided me and trying to apply them to the info you had provided me. Again thank you very much Smile
avatar
Polargames
Crystal Maiden
Crystal Maiden

Since : 2018-06-06

Back to top Go down

Re: Tetris & Dr.Mario

Post by Conn on Mon 6 Aug 2018 - 20:32

OK, I moved the topic and also updated the patch and put it to the first message of this forum (re-download it from there).

The reason is that each of the 3 games uses the same theme numbers, so I had to add a code to add #$20 to Dr. Mario and #$40 to Mixed Game to be able to differ the pcm (tetris uses the native offset $00). Theme $01, $02 are the same for each game.

To map the themes you need to
----------------------
1st option: use the native rom
Make a breakpoint X at $808DD6
If you play
Tetris the 3rd theme (A:0003) is pcm $03 (dec-03),
Dr. Mario 3rd theme (A:0003) is pcm $23 (dec -35),
Mixed game 3rd theme (A:0003) is pcm $43 (dec -67)


You can also check the themes (without having to play the game) by manipulating the value in A:
Select e.g., Dr. Mario, wait until 03 is written into A and then change the A box to any other theme so that you can easily map the themes (in this example, I manipulated theme 3 to theme 4, so that the select theme is played on the intro):


----------------------
2nd option: use the patched rom
make breakpoint at 2004 W hook and play through all games (dr.mario, tetris)...
Here's the example for mixed game, that uses offset $40:



The game really got complex... polar, you chose a difficult one, though it looked very easy at the beginning. But since it is 3 games in one, the code would not be manageable by you.
avatar
Conn



Since : 2013-06-30

Back to top Go down

Re: Tetris & Dr.Mario

Post by Polargames on Mon 6 Aug 2018 - 20:53

Conn wrote:OK, I moved the topic and also updated the patch and put it to the first message of this forum (re-download it from there).

The reason is that each of the 3 games uses the same theme numbers, so I had to add a code to add #$20 to Dr. Mario and #$40 to Mixed Game to be able to differ the pcm (tetris uses the native offset $00). Theme $01, $02 are the same for each game.

To map the themes you need to
----------------------
1st option: use the native rom
Make a breakpoint X at $808DD6
If you play
Tetris the 3rd theme (A:0003) is pcm $03 (dec-03),
Dr. Mario 3rd theme (A:0003) is pcm $23 (dec -35),
Mixed game 3rd theme (A:0003) is pcm $43 (dec -67)


You can also check the themes (without having to play the game) by manipulating the value in A:
Select e.g., Dr. Mario, wait until 03 is written into A and then change the A box to any other theme so that you can easily map the themes (in this example, I manipulated theme 3 to theme 4, so that the select theme is played on the intro):


----------------------
2nd option: use the patched rom
make breakpoint at 2004 W hook and play through all games (dr.mario, tetris)...
Here's the example for mixed game, that uses offset $40:



The game really got complex... polar, you chose a difficult one, though it looked very easy at the beginning. But since it is 3 games in one, the code would not be manageable by you.

Dang, I did it again, I really have a knack to pick a complex game for sure Doh . I guess this is my new skill, but I agree it looked easy, well at leat for someone thats new like me. That would explain why I was getting different codes from the debugger. Again thank you very much Conn.
avatar
Polargames
Crystal Maiden
Crystal Maiden

Since : 2018-06-06

Back to top Go down

Re: Tetris & Dr.Mario

Post by Polargames on Tue 7 Aug 2018 - 0:53

Game is done, Here is the maping
Code:
9ff038 sta $2004     [832004] A:0001 Mani game start screen
9ff038 sta $2004     [832004] A:0002 Clicking start
9ff038 sta $2004     [832004] A:0023 Dr.Mario Picked
9ff038 sta $2004     [832004] A:0024 Player one
9ff038 sta $2004     [832004] A:0022 Game settings picked, Music feaver
9ff038 sta $2004     [832004] A:cc25 Level 0 beat
9ff038 sta $2004     [832004] A:0022 Start new level, 0022 0-21+ Level start
9ff038 sta $2004     [832004] A:cc25 Level 1 beat
9ff038 sta $2004     [832004] A:0022 Level 2 beat
9ff038 sta $2004     [832004] A:cc25 Level 3 beat
9ff038 sta $2004     [832004] A:cc25 Level 4 beat
9ff038 sta $2004     [832004] A:cc25 Level 5 beat
9ff038 sta $2004     [832004] A:cc25 Leavel 6 beat
9ff038 sta $2004     [832004] A:cc25 Level 7 beat
9ff038 sta $2004     [832004] A:cc25 Level 8 beat
9ff038 sta $2004     [832004] A:cc25 Level 9 beat
9ff038 sta $2004     [832004] A:cc25 Level 10 beat
9ff038 sta $2004     [832004] A:cc25 level 11 beat
9ff038 sta $2004     [832004] A:cc25 level 12 beat
9ff038 sta $2004     [832004] A:cc25 level 13 beat
9ff038 sta $2004     [832004] A:cc25 level 14 beat
9ff038 sta $2004     [832004] A:cc25 level 15 beat
9ff038 sta $2004     [832004] A:cc25 level 16 beat
9ff038 sta $2004     [832004] A:cc25 level 17 beat
9ff038 sta $2004     [832004] A:cc25 level 18 beat
9ff038 sta $2004     [832004] A:cc25 level 19 beat
9ff038 sta $2004     [832004] A:cc25 level 20 beat
9ff038 sta $2004     [832004] A:cc25 level 21 beat I belive this keeps repeating.
9ff038 sta $2004     [832004] A:0028 Dr.Mario beaten/ congrats
9ff038 sta $2004     [832004] A:cc29 Game Over
9ff038 sta $2004     [832004] A:0024 Level setting

Dr.Mario with chilled music.
9ff038 sta $2004     [832004] A:0024 Level setting
9ff038 sta $2004     [832004] A:0021 Level start 0-21+ Level Start
9ff038 sta $2004     [832004] A:cc26 Beat level 0
9ff038 sta $2004     [832004] A:cc26 Beat Level 1
9ff038 sta $2004     [832004] A:cc26 Beat Level 2
9ff038 sta $2004     [832004] A:cc26 Beat Level 3
9ff038 sta $2004     [832004] A:cc26 Beat Level 4
9ff038 sta $2004     [832004] A:cc26 Beat Level 5
9ff038 sta $2004     [832004] A:cc26 Beat Level 6
9ff038 sta $2004     [832004] A:cc26 Beat Level 7
9ff038 sta $2004     [832004] A:cc26 Beat Level 8
9ff038 sta $2004     [832004] A:cc26 Beat Level 9
9ff038 sta $2004     [832004] A:cc26 Beat Level 10
9ff038 sta $2004     [832004] A:cc26 Beat Level 11
9ff038 sta $2004     [832004] A:cc26 Beat Level 12
9ff038 sta $2004     [832004] A:cc26 Beat Level 13
9ff038 sta $2004     [832004] A:cc26 Beat Level 14
9ff038 sta $2004     [832004] A:cc26 Beat Level 15
9ff038 sta $2004     [832004] A:cc26 Beat Level 16
9ff038 sta $2004     [832004] A:cc26 Beat Level 17
9ff038 sta $2004     [832004] A:cc26 Beat Level 18
9ff038 sta $2004     [832004] A:cc26 Beat Level 19
9ff038 sta $2004     [832004] A:cc26 Beat level 20
9ff038 sta $2004     [832004] A:cc26 Beat Level 21 I belive this keeps repeating.
9ff038 sta $2004     [832004] A:0028 Congrats.

Tetris
9ff038 sta $2004     [832004] A:0001 Music one
9ff038 sta $2004     [832004] A:0002 Music 2
9ff038 sta $2004     [832004] A:0003 Music 3
9ff038 sta $2004     [832004] A:0004 Music 4
9ff038 sta $2004     [832004] A:0005 Music 5
9ff038 sta $2004     [832004] A:0006 Music 6
9ff038 sta $2004     [832004] A:0007 Music 7
9ff038 sta $2004     [832004] A:0008 Music 8
9ff038 sta $2004     [832004] A:0009 Music 9
9ff038 sta $2004     [832004] A:000a Music 10

9ff038 sta $2004     [832004] A:0003 Main tetris level, Player one
9ff038 sta $2004     [832004] A:0004 Level setting to pick
9ff038 sta $2004     [832004] A:0005 Level music pick 2
9ff038 sta $2004     [832004] A:0004  Level Music pick 1
9ff038 sta $2004     [832004] A:0006 Level Music pick 3
9ff038 sta $2004     [832004] A:c008 Game Over Level A
9ff038 sta $2004     [832004] A:0009 Game Over Level B, Name for high score.

Mix and Match
9ff038 sta $2004     [832004] A:0041 Mix and Match start menu
9ff038 sta $2004     [832004] A:0041 Music 1
9ff038 sta $2004     [832004] A:0042 Music 2
9ff038 sta $2004     [832004] A:0043 Music 3
9ff038 sta $2004     [832004] A:0044 Music 4
9ff038 sta $2004     [832004] A:0045 Music 5
9ff038 sta $2004     [832004] A:0046 Music 6
9ff038 sta $2004     [832004] A:0047 Music 7







Funny thing is nothing poped up for tetris when you play with the shapes, and Mix and Match was the same way as well. The only game to make anything a go was Dr.Mario. For tetris the music for level picked was back wards because I stumbled upon it by mistake and then quickly worte it down. Sorry about that.
avatar
Polargames
Crystal Maiden
Crystal Maiden

Since : 2018-06-06

Back to top Go down

Re: Tetris & Dr.Mario

Post by Sponsored content


Sponsored content


Back to top Go down

Page 1 of 2 1, 2  Next

Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum