Fix this routine in assembler for SFX SOUND

By gasparrini

Champion (333)

gasparrini さんの画像

13-04-2021, 12:47

Hello all User's MSX of the World,

Under here, I have a routine in assembler for sound effect, but unfortunately do not work!
because inside the routine missing CALL 93$ for call bios SOUND and then missing also
the DATA here ----->

CHN_DATA:
; All data for channels

Example of a routine in assembler for SOUND FX

org $c000 - 7

	.db $fe
	.dw startProgram,endProgram,startProgram

startProgram:

SET_SOUND:
; Prepare a channel to reproduce a note with a sample and ornament
; Parameters:   A=channel number (0=A,1=B,2=C)
;               B=ornamente index | sample index
;               C=note
;--------------------------------------------------------------------------
; Obtain channel pointer
        add     a,a
        add     a,e
        ld      e,a
        add     a,a
        ld      a,e
        ld      d,0
        ld      hl,CHN_DATA
        add     hl,de
        push    hl
; Obtain sample pointer
        ld      a,b
        and     $1F
        add     a,e
        ld      e,a
        ld      hl,SMP_TABLE
        add     hl,de
        ld      e,(hl)
        inc     hl
        ld      d,(hl)
        pop     hl
        ld      (hl),e
        inc     hl
        ld      (hl),d
        inc     hl
; Obtain ornament pointer
        push    hl
        ld      a,b
        rlca
        rlca
        rlca
        and     $7
        add     a,a
        ld      hl,ORN_TABLE
        ld      e,a
        ld      d,0
        add     hl,de
        ld      e,(hl)
        inc     hl
        ld      d,(hl)
        pop     hl
        ld      (hl),e
        inc     hl
        ld      (hl),d
        inc     hl
; Store note
        ld      (hl),c
; Initialize frequency shift
        inc     hl
        xor     a
        ld      (hl),a
        inc     hl
        ld      (hl),a
; Note and sample installed in the channel
        ret
CHN_DATA:
; All data for channels

; Sample table
SMP_TABLE: 
  .dw SMP_ID_0,SMP_ID_1,SMP_ID_2,SMP_ID_3
; Silence sample
SMP_ID_0:  
  .db $00,$00,$80,$01
; User-defined samples
SMP_ID_1: 
  .db $0F,$80,$0F,$80,$0F,$80,$0F,$80,$0E,$80,$0E,$80,$0D,$80,$0C,$80
  .db $0B,$80,$0A,$80,$0A,$80,$0B,$80,$0B,$80,$0C,$80,$0C,$80,$0B,$80
  .db $0A,$80,$80,$05
SMP_ID_2:  
  .db $0D,$A1,$80,$01
SMP_ID_3:  
  .db $4F,$40,$7F,$40,$9F,$40,$BE,$40,$CE,$40,$CD,$40,$C8,$40,$00,$00 
  .db $80,$01 
; Ornament table
ORN_TABLE: 
   .dw ORN_ID_0,ORN_ID_1
; Null ornament
ORN_ID_0:  
  .db $00,$80,$01
; User-defined ornaments
ORN_ID_1:  
  .db $01,$00,$FF,$00,$80,$04

endProgram:

.end

Could you help me to make this assembler routine work
well to generate a sound effect, please?

For now is all.....
Thanks in advance
Best Regards
(^_^)
AG Italy

ログイン/登録して投稿

By Manel46

Paladin (674)

Manel46 さんの画像

13-04-2021, 13:33

By PingPong

Enlighted (4155)

PingPong さんの画像

13-04-2021, 18:40

if you know what is wrong fix it by yourself!

By gasparrini

Champion (333)

gasparrini さんの画像

13-04-2021, 20:26

引用:

if you know what is wrong fix it by yourself!

Listen to PING PONG!
I don't know who you are! But according to you!
If I was able to correct the routine myself? Would I have asked for help here?
To this forum that no one ever considers you !!!

By gasparrini

Champion (333)

gasparrini さんの画像

13-04-2021, 20:30

引用:

This works fine.
http://www.z80st.es/downloads/code/

Listen to Manuel46:

I'm not interested in getting the code from here ---> http://www.z80st.es/downloads/code/
I wish to make my assembler code work.......

By PingPong

Enlighted (4155)

PingPong さんの画像

13-04-2021, 21:16

引用:

Listen to Manuel46:

I'm not interested in getting the code from here ---> http://www.z80st.es/downloads/code/
I wish to make my assembler code work.......

So, try to learn assembler instead of doing copy paste of some source code listing borrowed somewhere that you do not understand at all, and asking MRC users to fix them for you.

By gasparrini

Champion (333)

gasparrini さんの画像

13-04-2021, 21:24

引用:

So, try to learn assembler instead of doing copy paste of some source code listing borrowed somewhere that you do not understand at all, and asking MRC users to fix them for you.

And of course! I am asking you! Otherwise what are you doing?
What is the meaning of this FORUM then? Aren't you here to help people?
But you PING PONG, aren't you selfless? Or you consider yourself a great selfish!

By ro

Scribe (5056)

ro さんの画像

13-04-2021, 21:32

Hai, have you ever read my last reply to your previous question about sfx replay?
https://www.msx.org/forum/msx-talk/development/i-need-of-an-...

By ro

Scribe (5056)

ro さんの画像

13-04-2021, 21:41

Had a quick look at your code, did not make much sense to me. Perhaps because some parts are missing. Like at the start reg E is unknown but used to add a, e. Etc. Is it an excerpt from a larger source?

By PingPong

Enlighted (4155)

PingPong さんの画像

13-04-2021, 23:17

there is a lot of difference between what you do (that you call: asking help) and what ALL others MRC people (including me) do.
you are unique in your approach that i've described more than once.

You barely surf the web and grab some source code here and there, without making the minimum effort to understand or learn something, then you paste somewhere and try this piece of code that in the majority of situations does not work as you expect, so your next step is to do a copy-paste of the source code on MRC and title the post like "I ask you to fix this or that".

No one on this forum have this behavior. there are people that post of ilarious things, others that ask about machines, others that publish they work or anything else.

The only person on this forum that do a copy-paste of asm source code borrowed some where and title this like "I ask you to fix this for me" is you.

By PingPong

Enlighted (4155)

PingPong さんの画像

14-04-2021, 00:16

ro wrote:

Had a quick look at your code, did not make much sense to me. Perhaps because some parts are missing.

This is not surprising me at all. It does not make sense because he copied from somewhere without understand at all, anything, and obviously it does not work.

And, instead of trying to write by himself something that could achieve its needings and eventually asking someone to help in its difficulties this guy continues to copy and paste (without understanding nothing) pieces of codes he then ask to fix .

There is not a single line in the source code he posted that comes from its brain