Login
Back to forumReply to this topicGo to last reply

Posted By

Fuzzweed
on 2024-12-22
04:49:53
 oh no. My sample player works in yape but not on hardware

Just tried a final test of my demo that works great in Yape
I've just tried it on my C16 with 6502+4 expansion board , and the sample player doesn't make any sound.
All the other audio is fine, so it's not a broken ted or anything like that.


Thats the code - pretty straight forward I thought.
Data is just 4+4bit from Csabos wavconv.
Any ideas????

ldy #$00
tya
sta $FF01

.read_losample
lda (Sample_LSB),y
and #$0f
ora #$20
tax
-
lda $ff00
cmp #3
bcs -
txa
sta volume

.read_hisample
lda (Sample_LSB),y
lsr
lsr
lsr
lsr
ora #$20
tax
-
lda $ff00
cmp #3
bcs -
txa
sta volume

inc Sample_LSB
bne +
inc Sample_MSB
+
dec sample_counter_LSB
bne +
lda sample_counter_MSB
ora sample_counter_LSB
beq ++
dec sample_counter_MSB
+
jmp .read_losample
++

Posted By

Fuzzweed
on 2024-12-22
05:18:09
 Re: oh no. My sample player works in yape but not on hardware

Could it be some tiny difference of the 6502?

Posted By

BSZ
on 2024-12-22
06:43:34
 Re: oh no. My sample player works in yape but not on hardware

I don't fully understand your code, but what is this at the beginning?

ldy #$00
tya
sta $FF01

The timer(s) in TED are quite simple, but can be set according to a specific sequence, the above does not correspond to that. (First set the Lower BYTE, then the Upper BYTE.) But if you use the timer, it's easier to set the right speed and then watch the flag in $FF09 to see when it expires.

Addendum: the first timer counts from the set value to 0, then restarts with the set value. If the bottom half was 0 to begin with, it will never take a usable value. If you stick to your solution above, use timer 2 or 3 for this purpose, starting at $FFFF after 0.

Posted By

Fuzzweed
on 2024-12-22
08:04:51
 Re: oh no. My sample player works in yape but not on hardware

better timer and it sounds so much better in yape. so that is a huge improvement.
BUT
its still not working on my C16 (6502,64k).......???????

lda #$40
sta $FF00
ldy #$00
lda #$00
sta $FF01

.read_losample
lda (Sample_LSB),y
and #$0f
ora #$20
tax
-
lda $ff09
bit bitcheck ;;;;;;=#$08 bit 3, timer 1
beq -
sta $FF09
stx volume

.read_hisample
lda (Sample_LSB),y
lsr
lsr
lsr
lsr
ora #$20
tax
-
lda $ff09
bit bitcheck ;;;;;;=#$08 bit 3, timer 1
beq -
sta $FF09
stx volume

inc Sample_LSB
bne +
inc Sample_MSB
+
dec sample_counter_LSB
bne +
lda sample_counter_MSB
ora sample_counter_LSB
beq ++
dec sample_counter_MSB
+
jmp .read_losample
++


MORE:
so heres the sound setup:
lda #$fd
sta voice1lo
lda #$fe
sta voice2lo
lda voice1hi
and #$fc
ora #$03
sta voice1hi
lda voice2hi
and #$fc
ora #$03
sta voice2hi
lda #$BF
sta volume
lda #$3F
sta volume

In yape machine = plus4. it seems to work 100%
In yape machine = c16+hannes expansion. i works sometimes, but occasionally it is clipped, mising first seconds
in real c16 expanded it is complete silence

Posted By

BSZ
on 2024-12-22
16:55:24
 Re: oh no. My sample player works in yape but not on hardware

First: how do you start your program exactly with yape?

Second: from the test, write the border color register ($FF19) instead of the TED volume register ($FF11) to see if the loop works.

Also add here: I'm looking at your code and I still don't understand Initializing the sound can be good if you want to use a lot of volume levels. But then you would have to use a complex "level" -> "volume register value" table, but your code doesn't have one. By default, TED can produce 9 levels, but initialisation is unnecessary to use this. In this case, bits B7/5/4 of the value written to the volume register must be set to 1 (ORA #$B0), and bits B3/2/1/0 can be set to the level value (which is real in the range 0..8).

And an optimisation: the flag test could be the following:


LDA #$08 ; Timer #1 flag
- BIT $FF09 ; Check flag
BEQ - ; If not set, wait
STX $FF11 ; set volume register
STA $FF09 ; Clear flag


Edit: bugfix (correcting typo)

Posted By

Fuzzweed
on 2024-12-22
08:43:20
 Re: oh no. My sample player works in yape but not on hardware

yape: double click .prg or drag .prg to yape window if its open already
C16: SD2IEC and FB file browser

but actually I think I just found a/the fix. I changed the background notes to $3FD. Maybe my TED/CPU doesn't like the $3FE 'undocumented' note.


YES! just run it again and all is good now. But without the bug I wouldnt have the better timer and great sample quality, so there is good in all problems :)


+thankyou for tips, yes the bitcheck is better. sometimes you have to think backwards to go forwards. I will have to think through what you're saying about the volume levels (of course its probably right, but just to understand myself exactly)

Posted By

BSZ
on 2024-12-22
08:43:43
 Re: oh no. My sample player works in yape but not on hardware

yape: double click .prg or drag .prg to yape window if its open already

This can cause funny cases: In this case, the emulator is always in exactly the same state when you start the program. If the program is dependent on the current state of the machine for some reason, this test will not tell you. (This can produce exactly such cases, tested under emulator it works, but loaded on a normal machine it works differently.)

Posted By

Fuzzweed
on 2024-12-22
08:48:32
 Re: oh no. My sample player works in yape but not on hardware

ah yes. I did notice this sometimes. different results from same start which shouldn't be possible with a computer.

so always best to attach disk and load like real for the perfect test. i'll remember that,


I just need to add you to scroller shoutout now too :D




Back to topReply to this topic


Copyright © Plus/4 World Team, 2001-2024. Support Plus/4 World on Patreon