I ASK HELP FOR ROUTINE IN ASSEMBLER FOR SOUND SFX

Page 1/2
| 2

By gasparrini

Champion (298)

gasparrini's picture

02-06-2018, 18:20

Hello to all we user of MSX world,

I ASK HELP FOR ROUTINE IN ASSEMBLER FOR SOUND SFX:

The original routine it was done by Danysoft, but unfortunately it
doesn't work!! EVEN--> when I loaded the binary file,
I receive an error BAD FILE NAME !!

Therefore I tried fix his source assembler corrupt.......
certainly, it's not my fault, if the original program was
developed with "pasta and potatoes ...."

Here under there is my assembler code for CHAOS
ASSEMBLER 3. but must be adjusted well!

; 
;
; Prog: SFX SOUND
; Code: Danysoft and AGsoftware
; Date: 2/5/2018
;
; cmnt: ??????
;
; Coded in TeddyWareZ' Chaos Assembler 3
;
; (C) 2018 EDIZIONI DATAPRINT MAGAZINE


	.org $D000 - 7

	.db $fe
	.dw startProgram,endProgram,startProgram

startProgram:

START:

      RET  ; RETURN in BASIC

CALL_SFX1:
	ld hl,sfx1
	jp sound


soundoff:
	call $90
	jp START	
	ret

sound:
	ld a,(hl)
	inc hl
	ld b,a
sound0:
	push bc
	ld b,13
	ld d,0
send:
	ld a,d
	ld e,(hl)
	call $93
	inc hl
	inc d
	djnz send	
	pop bc	
	djnz sound0
	jp START 
	
SFX1:
  ; SOUND_1
 .db 42 
 .db 53,2,0,0,0,0,0,184,0,63,0,11,0,0 
 .db 63,2,0,0,0,0,0,184,13,0,0,11,0,0 
 .db 247,2,0,0,0,0,0,184,13,0,0,11,0,0 
 .db 239,2,0,0,0,0,0,184,13,0,0,11,0,0 
 .db 231,63,0,0,0,0,0,184,13,0,0,11,0,0 
 .db 223,2,0,0,0,0,0,184,13,0,0,11,0,0 
 .db 215,2,0,0,0,0,0,184,13,0,0,11,0,0 
 .db 207,2,63,0,0,0,0,184,13,0,0,11,0,0 
 .db 199,2,63,0,0,0,0,184,13,0,0,11,0,0 
 .db 191,2,0,0,0,0,0,184,13,0,0,11,0,0 
 .db 183,2,0,0,0,0,0,184,13,0,0,11,0,0 
 .db 175,2,0,63,0,0,0,184,13,0,0,11,0,0 
 .db 167,2,0,63,0,0,0,184,13,0,0,11,0,0 
 .db 159,2,0,63,0,0,0,184,13,0,0,11,0,0 
 .db 151,2,0,63,0,0,0,184,13,0,0,11,0,0 
 .db 143,2,0,63,0,0,0,184,13,0,0,11,0,0 
 .db 135,2,0,0,0,0,0,184,13,0,0,11,0,0 
 .db 127,2,0,0,0,0,0,184,13,0,0,11,0,0 
 .db 119,2,0,0,0,0,0,184,13,0,0,11,0,0 
 .db 111,2,0,0,63,0,0,184,13,0,0,11,0,0 
 .db 103,2,0,0,63,0,0,184,13,0,0,11,0,0 
 .db 95,2,0,0,63,0,0,184,13,0,0,11,0,0 
 .db 87,2,0,0,63,0,0,184,13,0,0,11,0,0 
 .db 79,2,0,0,63,0,0,184,13,0,0,11,0,0 
 .db 71,2,0,0,0,0,0,184,13,0,0,11,0,0 
 .db 63,2,0,0,0,0,0,184,13,0,0,11,0,0 
 .db 55,2,0,0,0,0,0,184,13,0,0,11,0,0 
 .db 50,2,0,0,0,0,0,184,13,0,0,11,0,0 
 .db 41,2,0,0,0,0,0,184,13,0,0,11,63,0 
 .db 32,2,0,0,0,0,0,184,13,0,0,11,63,0 
 .db 23,2,0,0,0,0,0,184,13,0,0,11,0,0 
 .db 14,2,0,0,0,0,0,184,13,0,0,11,0,0 
 .db 5,2,0,0,0,0,0,184,13,0,0,11,0,63 
 .db 5,2,0,0,0,0,0,184,10,0,0,11,0,63 
 .db 50,2,0,0,0,0,0,184,10,0,0,11,0,63 
 .db 41,2,0,0,0,0,0,184,10,0,0,11,0,63 
 .db 32,2,0,0,0,0,0,184,10,0,0,11,0,0 
 .db 23,2,0,0,0,0,0,184,10,0,0,11,0,0 
 .db 14,2,0,0,0,0,0,184,10,0,0,11,0,0 
 .db 5,2,0,0,0,0,0,184,10,0,0,11,0,0 
 .db 5,2,0,0,0,0,0,184,2,0,0,11,0,0 
 .db 0,0,0,0,0,0,0,184,2,0,0,11,0,0 
 .db 0,0,0,0,0,0,0,0,0,0,0,0,0,0 
	
endProgram:

.end

For loading from BASIC:

10 CLEAR300,&HCFFF
20 BLOAD"SOUND.BIN"
30 DEFUSR=&HD000
40 A=USR(0)
50 END

For now is all.....
I hope to receive a positive response from you soon
Best Regards
(^_^)
Andrea Gasparrini

Login or register to post comments

By ro

Guardian (4012)

ro's picture

02-06-2018, 21:21

The prog does nothing. It just RETurns to basic. Right?

By gasparrini

Champion (298)

gasparrini's picture

02-06-2018, 22:29

Quote:

The prog does nothing. It just RETurns to basic. Right?

Hello Ro,

Yes, of course, unfotunately this my programm routine in
code assembler does nothing !!! And in fact not work!!!
And at the end return in BASIC and stop!
No sound effect can be heard from the PSG.

Therefore I ask please still your help for me, because I alone
I'm not able, still being for me the Z80 assembler code for me
still difficult as a low level programming language.

I wait still your positive response from you
See you to soon and thanks for your answer
(^_^)
Andrea Gasparrini from Italy

By santiontanon

Hero (607)

santiontanon's picture

03-06-2018, 00:47

It's as ro says. The problem is that this program returns immediately after starting. Try moving the "START:" and the "RET ; RETURN in BASIC" lines to the end of the program (for example, right before the SFX1 label) and see what happens! Otherwise, as soon as you run it, it hits that "RET" line, and it returns immediately, doing nothing!

By sdsnatcher73

Master (215)

sdsnatcher73's picture

03-06-2018, 05:29

I’m. not an assembler programmer but my guess would be to start by adding a jp CALL_SFX1 in startProgram block (before START:. CALL_SFX1 will load the data and output it through the jump to sound. Then you prpbaby need a jp to soundoff somewhere before the RET...

By ro

Guardian (4012)

ro's picture

03-06-2018, 08:54

;
; Prog: SFX SOUND
; Code: Danysoft and AGsoftware
; Date: 2/5/2018
;
; cmnt: ??????
;
; Coded in TeddyWareZ' Chaos Assembler 3
;
; (C) 2018 EDIZIONI DATAPRINT MAGAZINE


	.org $D000 - 7

	.db $fe
	.dw startProgram,endProgram,startProgram

startProgram:

START:
	ld hl,sfx1
	call sound
Call soundoff

      RET  ; RETURN in BASIC


soundoff:
	call $90
	ret

sound:
	ld a,(hl)
	inc hl
	ld b,a
sound0:
	push bc
	ld b,13
	ld d,0
send:
	ld a,d
	ld e,(hl)
	call $93
	inc hl
	inc d
	djnz send	
	pop bc	
	djnz sound0
	ret
	
SFX1:
  ; SOUND_1
 .db 42 
 .db 53,2,0,0,0,0,0,184,0,63,0,11,0,0 
 .db 63,2,0,0,0,0,0,184,13,0,0,11,0,0 
 .db 247,2,0,0,0,0,0,184,13,0,0,11,0,0 
 .db 239,2,0,0,0,0,0,184,13,0,0,11,0,0 
 .db 231,63,0,0,0,0,0,184,13,0,0,11,0,0 
 .db 223,2,0,0,0,0,0,184,13,0,0,11,0,0 
 .db 215,2,0,0,0,0,0,184,13,0,0,11,0,0 
 .db 207,2,63,0,0,0,0,184,13,0,0,11,0,0 
 .db 199,2,63,0,0,0,0,184,13,0,0,11,0,0 
 .db 191,2,0,0,0,0,0,184,13,0,0,11,0,0 
 .db 183,2,0,0,0,0,0,184,13,0,0,11,0,0 
 .db 175,2,0,63,0,0,0,184,13,0,0,11,0,0 
 .db 167,2,0,63,0,0,0,184,13,0,0,11,0,0 
 .db 159,2,0,63,0,0,0,184,13,0,0,11,0,0 
 .db 151,2,0,63,0,0,0,184,13,0,0,11,0,0 
 .db 143,2,0,63,0,0,0,184,13,0,0,11,0,0 
 .db 135,2,0,0,0,0,0,184,13,0,0,11,0,0 
 .db 127,2,0,0,0,0,0,184,13,0,0,11,0,0 
 .db 119,2,0,0,0,0,0,184,13,0,0,11,0,0 
 .db 111,2,0,0,63,0,0,184,13,0,0,11,0,0 
 .db 103,2,0,0,63,0,0,184,13,0,0,11,0,0 
 .db 95,2,0,0,63,0,0,184,13,0,0,11,0,0 
 .db 87,2,0,0,63,0,0,184,13,0,0,11,0,0 
 .db 79,2,0,0,63,0,0,184,13,0,0,11,0,0 
 .db 71,2,0,0,0,0,0,184,13,0,0,11,0,0 
 .db 63,2,0,0,0,0,0,184,13,0,0,11,0,0 
 .db 55,2,0,0,0,0,0,184,13,0,0,11,0,0 
 .db 50,2,0,0,0,0,0,184,13,0,0,11,0,0 
 .db 41,2,0,0,0,0,0,184,13,0,0,11,63,0 
 .db 32,2,0,0,0,0,0,184,13,0,0,11,63,0 
 .db 23,2,0,0,0,0,0,184,13,0,0,11,0,0 
 .db 14,2,0,0,0,0,0,184,13,0,0,11,0,0 
 .db 5,2,0,0,0,0,0,184,13,0,0,11,0,63 
 .db 5,2,0,0,0,0,0,184,10,0,0,11,0,63 
 .db 50,2,0,0,0,0,0,184,10,0,0,11,0,63 
 .db 41,2,0,0,0,0,0,184,10,0,0,11,0,63 
 .db 32,2,0,0,0,0,0,184,10,0,0,11,0,0 
 .db 23,2,0,0,0,0,0,184,10,0,0,11,0,0 
 .db 14,2,0,0,0,0,0,184,10,0,0,11,0,0 
 .db 5,2,0,0,0,0,0,184,10,0,0,11,0,0 
 .db 5,2,0,0,0,0,0,184,2,0,0,11,0,0 
 .db 0,0,0,0,0,0,0,184,2,0,0,11,0,0 
 .db 0,0,0,0,0,0,0,0,0,0,0,0,0,0 
	
endProgram:

.end

Should do the trick. Mind the little changes like RET at the end of subrouts. And the start routine. How 'bout it?

By gasparrini

Champion (298)

gasparrini's picture

03-06-2018, 15:29

Quote:

Should do the trick. Mind the little changes like RET at the end of subrouts. And the start routine. How 'bout it?

Hello ro,

Then........

I tried your new modification at the my old routine wrong, and
for fortunately something it work enough well but not too....!!
Because unfortunately the sound in out on the audio MSX in PSG
it is obsolete!!, that is, from the code of the LABEL SFX1:
it should generate a beautiful sound and not like
I heard it now.

I hope I have explained myself well......

I repeat, unfortunately it's not your dear RO's fault, and it's my fault, but
unfortunately this code was generated by
Danysoft with "pasta and potatoes" ......

In conclusion:

The present source code must still be correct,
because I think that the present LABEL that inside
contains the code of:

SOUND:
SOUND0:
SEND:

They are wrong, and must be fix !!

However, thanks again for your help
For now is all......
See you to soon and Happy MSX....
(^_^)
Andrea Gasparrini from Italy

By RetroTechie

Paragon (1461)

RetroTechie's picture

03-06-2018, 17:26

gasparrini wrote:

(..) that is, from the code of the LABEL SFX1:
it should generate a beautiful sound and not like
I heard it now.

Let's start there: WHAT is the code supposed to do? (not how!). And I see a big block of data, what's in it & what's the structure of that data? Question

I'm able to follow what various bits of the code do, but a) too lazy for that right now, and b) asking to make sure you yourself understand what that data is, and what the code is supposed to do with it.

Design first - code later!

By Grauw

Enlighted (7525)

Grauw's picture

03-06-2018, 17:59

There does not seem to be a wait loop in there? (for JIFFY?)

By Manuel

Ascended (14782)

Manuel's picture

03-06-2018, 21:14

He didn't create or design this code, RetroTechie. He got it from Danysoft... and apparently he has no clue how it works.

Why not ask Danysoft about the design and purpose of this code, AG?

By max_iwamoto

Champion (404)

max_iwamoto's picture

03-06-2018, 22:32

Grauw wrote:

There does not seem to be a wait loop in there? (for JIFFY?)

I would assume code should be called from INT subroutine? Otherwise it would not sound very nice?

Page 1/2
| 2
My MSX profile