right code for music?

Go down

right code for music? Empty right code for music?

Post by Polargames Wed 27 Jun 2018 - 0:55

Hello everyone, Its Polar. I am just playing around with a rom, to get a better understanding on how asm works, When I was playing I had found this code.
Code:
$00/8442 8D 01 42 STA $4201  [$00:4201] A:00FF X:0000 Y:0000 P:eNvMXdIzC
$00/8468 8D 0D 42 STA $420D  [$00:420D] A:0001 X:0000 Y:0000 P:envMXdIzC
$00/84F7 8D 15 21 STA $2115  [$00:2115] A:0080 X:0000 Y:0000 P:eNvMXdIzC
$00/855F 8D 30 21 STA $2130  [$00:2130] A:0030 X:0000 Y:0000 P:envMXdIzC
$00/8567 8D 32 21 STA $2132  [$00:2132] A:00E0 X:0000 Y:0000 P:eNvMXdIzC
$00/85A8 9D 00 00 STA $0000,x[$00:0000] A:0000 X:0000 Y:0000 P:envmxdIZC
$00/85BA 9F 00 20 7E STA $7E2000,x[$7E:2000] A:0000 X:0000 Y:0000 P:envmxdIZC
$00/85CD 9F 00 00 7F STA $7F0000,x[$7F:0000] A:0000 X:0000 Y:0000 P:envmxdIZC
$00/85F5 85 0A STA $0A    [$00:000A] A:8000 X:0000 Y:0000 P:eNvmxdIzC
Is this the code for an audio port, If it is what letters should I find next. I think that the X[] would be the loop point. Is that right? Again I am just playing around with a rom to get a better understanding, Not trying to start a project at all. Thank you :-)
Polargames
Polargames

right code for music? Image112

Since : 2018-06-06

Back to top Go down

right code for music? Empty Re: right code for music?

Post by Conn Wed 27 Jun 2018 - 3:56

https://en.wikibooks.org/wiki/Super_NES_Programming/SNES_Hardware_Registers

Apparently not:
0x4201 Programmable I/O Port Output
0x420d Cycle Speed Designation
....

correct stuff is
0x2140 APU I/O Port
0x2141
0x2142
0x2143
Conn
Conn

right code for music? Image212

Since : 2013-06-30

Back to top Go down

right code for music? Empty Re: right code for music?

Post by Polargames Wed 27 Jun 2018 - 22:53

Conn wrote:https://en.wikibooks.org/wiki/Super_NES_Programming/SNES_Hardware_Registers

Apparently not:
0x4201 Programmable I/O Port Output
0x420d Cycle Speed Designation
....

correct stuff is
0x2140 APU I/O Port
0x2141
0x2142
0x2143

O ok, thank you Conn, I took what you had wrote from the correct stuff and this is what I had found.
Code:
$83/8BE8 8D 40 21 STA $2140  [$00:2140] A:F203 X:0037 Y:0000
$83/8C62 8D 40 21 STA $2140  [$00:2140] A:045B X:045B Y:0000

$83/8C62 8D 40 21 STA $2140  [$00:2140] A:045B X:045B Y:0000

$83/8CA7 8D 40 21 STA $2140  [$00:2140] A:5B02 X:045B Y:0000

$83/8CA7 8D 40 21 STA $2140  [$00:2140] A:5B02 X:045B Y:0000

$83/8EF9 AD 40 21 LDA $2140  [$00:2140] A:0001 X:0004 Y:0078

$83/8EF9 AD 40 21 LDA $2140  [$00:2140] A:0001 X:0004 Y:0078

$83/8E05 8D 40 21 STA $2140  [$00:2140] A:0005 X:0004 Y:0078

$83/8E05 8D 40 21 STA $2140  [$00:2140] A:0005 X:0004 Y:0078

Now I am double checking of cource, but this is what a person would look  for msued, also are LDA, and STA the same or is one of them better? The reason for that is I had found LDA 2143 and that also showed a CMP. Is a CMP music?
Polargames
Polargames

right code for music? Image112

Since : 2018-06-06

Back to top Go down

right code for music? Empty Re: right code for music?

Post by Conn Thu 28 Jun 2018 - 6:29

there is no blueprint. CMP is compare and checks if the apu is ready.
Every company has its own technique. Go with Zelda, make a breakpoint at $012c, write. This will halt whenever a new track is introduced.
$0C/CDA9 8D 2C 01 STA $012C [$00:012C] A:0C0B
Here, 0b for name select
It will then get written to $2140 to commuicate with the apu:
$00/80F3 8D 40 21 STA $2140 [$00:2140] A:000B

There are multiple writes to $214x and you need to find the correct one. As said, Nintendo are easiest and it's straight. Some companies write only a 01 to 2140 to send a play signal. That's all complex and I can't teach you because, as said every game is different and has its own rules. You need much experience to code, that is why I told you that it's not a good idea to start hacking with msu.
Conn
Conn

right code for music? Image212

Since : 2013-06-30

Back to top Go down

right code for music? Empty Re: right code for music?

Post by Polargames Thu 28 Jun 2018 - 12:46

Conn wrote:there is no blueprint. CMP is compare and checks if the apu is ready.
Every company has its own technique. Go with Zelda, make a breakpoint at $012c, write. This will halt whenever a new track is introduced.
$0C/CDA9 8D 2C 01    STA $012C  [$00:012C]   A:0C0B
Here, 0b for name select
It will then get written to $2140 to commuicate with the apu:
$00/80F3 8D 40 21    STA $2140  [$00:2140]   A:000B

There are multiple writes to $214x and you need to find the correct one. As said, Nintendo are easiest and it's straight. Some companies write only a 01 to 2140 to send a play signal.  That's all complex and I can't teach you because, as said every game is different and has its own rules. You need much experience to code, that is why I told you that it's not a good idea to start hacking with msu.

Ok, Conn I now understand it better. Thank you for letting me know and the help you have given me as well. :-)
Polargames
Polargames

right code for music? Image112

Since : 2018-06-06

Back to top Go down

Back to top

- Similar topics

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