HDMA music streaming

Discussion of hardware and software development for Super NES and Super Famicom. See the SNESdev wiki for more information.

Moderator: Moderators

Forum rules
  • For making cartridges of your Super NES games, see Reproduction.
Post Reply
psycopathicteen
Posts: 3140
Joined: Wed May 19, 2010 6:12 pm

HDMA music streaming

Post by psycopathicteen »

Okay I went back to working on Bad Apple today. I am almost done with it, but I am having difficulty getting HDMA to work. Anybody find anything wrong with my code?

Code: Select all

spc700_streaming:
php

sep #$20
rep #$10

ldx #$4001
stx $4370
ldx #{hdma_table}
stx $4372
lda #$00
sta $4374


lda #$80
sta $420c


sep #$30
ldy #$00
tyx
-;
lda #$01
sta {hdma_table},x
inx
lda [{brr_stream_address}],y
sta {hdma_table},x
tya
inx
sta {hdma_table},x
inx
iny
cpy #$99
bne -
stz {hdma_table},x
tya
rep #$20
and #$00ff
clc
adc {brr_stream_address}
sta {brr_stream_address}
bcc +
inc {brr_stream_bank}
+;

plp
rts
User avatar
Khaz
Posts: 314
Joined: Thu Dec 25, 2014 10:26 pm
Location: Canada

Re: HDMA music streaming

Post by Khaz »

I haven't tried using HDMA yet, but according to the documents I have HDMA uses $43x5 and $43x6 as a "Data address". I don't see a write to $4375 anywhere, could that be the problem?

Beyond that I don't fully understand how audio streaming works yet and can't help...
93143
Posts: 1717
Joined: Fri Jul 04, 2014 9:31 pm

Re: HDMA music streaming

Post by 93143 »

One thing I notice is that you activate the HDMA channel before proceeding to populate the table. Are you 100% sure you have enough time to get ahead of the game before the next active HBlank?

I presume your SPC700 code has a fast enough turnaround time to not miss bytes, and doesn't get confused when the data counter resets...

Other than that, I'm not sure; it looks to me like you're constructing a valid HDMA table and initializing the channel correctly... I failed pretty hard at debugging your last code sample on this project, so odds are I've missed the real problem. What does it do when you run it?
Khaz wrote:I haven't tried using HDMA yet, but according to the documents I have HDMA uses $43x5 and $43x6 as a "Data address". I don't see a write to $4375 anywhere, could that be the problem?
Those registers are for indirect addressing mode, which he's not using. They don't do anything unless bit 6 of $43x0 is set.
User avatar
Khaz
Posts: 314
Joined: Thu Dec 25, 2014 10:26 pm
Location: Canada

Re: HDMA music streaming

Post by Khaz »

93143 wrote:
Khaz wrote:I haven't tried using HDMA yet, but according to the documents I have HDMA uses $43x5 and $43x6 as a "Data address". I don't see a write to $4375 anywhere, could that be the problem?
Those registers are for indirect addressing mode, which he's not using. They don't do anything unless bit 6 of $43x0 is set.
Mmkay, I tried. Thanks for the answer, good to know.
93143
Posts: 1717
Joined: Fri Jul 04, 2014 9:31 pm

Re: HDMA music streaming

Post by 93143 »

I assume you've got a plan for the actual demo that doesn't take quite as long... By my calculations this one takes about two-thirds of active display to run.
Post Reply