* sound
@ 2002-06-24 21:51 philippe
2002-06-25 1:02 ` sound xlp
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: philippe @ 2002-06-24 21:51 UTC (permalink / raw)
To: Linux-assembly
hi
I am new on this list and my name is Philippe.
I used to make some programs on windows but wanted to trye on linux.
I have a problem with a small prog i had done for windows witch play
sounds on the fm chip of a sound card.
But when i translate it on linux, it doesn't work any more.
It compile and link correctly(nasm), but on execution it writes:
segmentation fault!
I post you the sources at the end of this message.
I had an other question:
Where can I find bible of all the interruptions and what is the name of
it?
Philippe
;************************************************
;* Ecriture sur SoundBlaster *
;*1-ecrire dans le adresse port0x388 *
;*2-attendre 12 cycles *
;*3-ecrire dans le data port0x389 *
;*4-attendre 84 cycles *
;compiler:
; nasm -f elf SBB.asm
; ld -s -o SBB SBB.o
section .text ;section declaration
;we must export the entry point to the ELF
linker or
global _start ;loader. They conventionally recognize _start as
their
;entry point. Use ld -e foo to override the
default.
_start:
;mettre tous les registres SB a zero
mov edx,0x388 ;port adresse
mov eax,0x20 ;registre sb 20
out dx,al
mov edx,0x389 ;data port
mov al,7
out dx,al
mov edx,0x388 ;port adresse
mov al,0x40 ;registre sb 40
out dx,al
;call WaitR
mov edx,0x389 ;data port
mov al,0x10
out dx,al
;call WaitR
mov edx,0x388 ;port adresse
mov al,0x60 ;registre sb 20
out dx,al
;call WaitR
mov edx,0x389 ;data port
mov eax,0xf0
out dx,al
;call WaitR
mov edx,0x388 ;port adresse
mov al,0x80 ;registre sb 20
out dx,al
mov edx,0x389 ;data port
mov al,70
out dx,al
mov edx,0x388 ;port adresse
mov al,0x23 ;registre sb 20
out dx,al
;call WaitR
mov edx,0x389 ;data port
mov eax,1
out dx,al
;call WaitR
mov edx,0x388 ;port adresse
mov eax,0x43 ;registre sb 20
out dx,al
;call WaitR
mov edx,0x389 ;data port
mov eax,00
out dx,al
;call WaitR
mov edx,0x388 ;port adresse
mov eax,0x63 ;registre sb 20
out dx,al
;call WaitR
mov edx,0x389 ;data port
mov eax,0xf0
out dx,al
;call WaitR
mov edx,0x388 ;port adresse
mov eax,0x83 ;registre sb 20
out dx,al
;call WaitR
mov edx,0x389 ;data port
mov eax,0x7f
out dx,al
dest3:
mov cx,0xff
dest2:
mov edx,0x388 ;port adresse
mov al,0xa0 ;frequency
out dx,al
mov edx,0x389 ;data port
mov al,cl
xor al,dl
out dx,al
;**send the sound now gogogogo go
mov edx,0x388 ;port adresse
mov eax,0xb0 ;registre sb 20
out dx,al
mov edx,0x389 ;data port
mov eax,0x31
out dx,al
call Waitc
call Waitc
call Waitc
call Waitc
loop dest2
;*******************************************************
mov edx,0x388 ;port adresse
mov eax,0xb0 ;registre sb 20
out dx,al
;CHK: ;attend qu'on appuye sur la touche espace*****
;mov ah,8
;mov dl,0xFF
;int 0x21
;cmp al,' ' ;espace
;je SUITE
;jmp CHK
;SUITE:
mov edx,0x389 ;data port
mov eax,0
out dx,al
;mov ax,0x4c
;int 0x21
mov ebx,0 ;first syscall argument: exit code
mov eax,1 ;system call number (sys_exit)
int 0x80 ;call kerne
Waitc:
push ecx
mov ecx,0x8fff
W1:
nop
loop W1
pop ecx
ret
Waitb:
push ecx
mov ecx,0x1fff
W2:
nop
loop W2
pop ecx
ret
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: sound
2002-06-24 21:51 sound philippe
@ 2002-06-25 1:02 ` xlp
2002-06-25 8:06 ` sound Rudolf Marek
2002-06-25 21:28 ` sound h-peter recktenwald
2 siblings, 0 replies; 4+ messages in thread
From: xlp @ 2002-06-25 1:02 UTC (permalink / raw)
To: philippe; +Cc: Linux-assembly
On Mon, Jun 24, 2002 at 11:51:11PM +0200, philippe wrote:
> hi
> I am new on this list and my name is Philippe.
> I used to make some programs on windows but wanted to trye on linux.
> I have a problem with a small prog i had done for windows witch play
> sounds on the fm chip of a sound card.
> But when i translate it on linux, it doesn't work any more.
> It compile and link correctly(nasm), but on execution it writes:
> segmentation fault!
> I post you the sources at the end of this message.
>
> I had an other question:
> Where can I find bible of all the interruptions and what is the name of
> it?
>
>
> Philippe
>
>
>
>
> ;************************************************
> ;* Ecriture sur SoundBlaster *
> ;*1-ecrire dans le adresse port0x388 *
> ;*2-attendre 12 cycles *
> ;*3-ecrire dans le data port0x389 *
> ;*4-attendre 84 cycles *
>
> ;compiler:
> ; nasm -f elf SBB.asm
> ; ld -s -o SBB SBB.o
>
>
> section .text ;section declaration
>
> ;we must export the entry point to the ELF
> linker or
> global _start ;loader. They conventionally recognize _start as
> their
> ;entry point. Use ld -e foo to override the
> default.
>
> _start:
>
>
> ;mettre tous les registres SB a zero
> mov edx,0x388 ;port adresse
> mov eax,0x20 ;registre sb 20
> out dx,al
> mov edx,0x389 ;data port
> mov al,7
> out dx,al
>
> mov edx,0x388 ;port adresse
> mov al,0x40 ;registre sb 40
> out dx,al
> ;call WaitR
> mov edx,0x389 ;data port
> mov al,0x10
> out dx,al
> ;call WaitR
>
> mov edx,0x388 ;port adresse
> mov al,0x60 ;registre sb 20
> out dx,al
> ;call WaitR
> mov edx,0x389 ;data port
> mov eax,0xf0
> out dx,al
> ;call WaitR
>
> mov edx,0x388 ;port adresse
> mov al,0x80 ;registre sb 20
> out dx,al
> mov edx,0x389 ;data port
> mov al,70
> out dx,al
>
> mov edx,0x388 ;port adresse
> mov al,0x23 ;registre sb 20
> out dx,al
> ;call WaitR
> mov edx,0x389 ;data port
> mov eax,1
> out dx,al
> ;call WaitR
>
> mov edx,0x388 ;port adresse
> mov eax,0x43 ;registre sb 20
> out dx,al
> ;call WaitR
> mov edx,0x389 ;data port
> mov eax,00
> out dx,al
> ;call WaitR
>
> mov edx,0x388 ;port adresse
> mov eax,0x63 ;registre sb 20
> out dx,al
> ;call WaitR
> mov edx,0x389 ;data port
> mov eax,0xf0
> out dx,al
> ;call WaitR
>
> mov edx,0x388 ;port adresse
> mov eax,0x83 ;registre sb 20
> out dx,al
> ;call WaitR
> mov edx,0x389 ;data port
> mov eax,0x7f
> out dx,al
> dest3:
> mov cx,0xff
> dest2:
>
> mov edx,0x388 ;port adresse
> mov al,0xa0 ;frequency
> out dx,al
> mov edx,0x389 ;data port
> mov al,cl
> xor al,dl
> out dx,al
> ;**send the sound now gogogogo go
> mov edx,0x388 ;port adresse
> mov eax,0xb0 ;registre sb 20
> out dx,al
> mov edx,0x389 ;data port
> mov eax,0x31
> out dx,al
> call Waitc
> call Waitc
> call Waitc
> call Waitc
>
> loop dest2
> ;*******************************************************
>
> mov edx,0x388 ;port adresse
> mov eax,0xb0 ;registre sb 20
> out dx,al
> ;CHK: ;attend qu'on appuye sur la touche espace*****
>
> ;mov ah,8
> ;mov dl,0xFF
> ;int 0x21
> ;cmp al,' ' ;espace
> ;je SUITE
> ;jmp CHK
> ;SUITE:
> mov edx,0x389 ;data port
> mov eax,0
> out dx,al
>
> ;mov ax,0x4c
> ;int 0x21
>
> mov ebx,0 ;first syscall argument: exit code
> mov eax,1 ;system call number (sys_exit)
> int 0x80 ;call kerne
>
>
>
> Waitc:
> push ecx
> mov ecx,0x8fff
> W1:
> nop
> loop W1
> pop ecx
> ret
> Waitb:
> push ecx
> mov ecx,0x1fff
> W2:
> nop
> loop W2
> pop ecx
> ret
> -
> To unsubscribe from this list: send the line "unsubscribe linux-assembly" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: sound
2002-06-24 21:51 sound philippe
2002-06-25 1:02 ` sound xlp
@ 2002-06-25 8:06 ` Rudolf Marek
2002-06-25 21:28 ` sound h-peter recktenwald
2 siblings, 0 replies; 4+ messages in thread
From: Rudolf Marek @ 2002-06-25 8:06 UTC (permalink / raw)
To: philippe; +Cc: Linux-assembly
On Mon, 24 Jun 2002, philippe wrote:
> Date: Mon, 24 Jun 2002 23:51:11 +0200
> From: philippe <pvir@freesurf.fr>
> To: Linux-assembly@vger.kernel.org
> Subject: sound
>
> hi
> I am new on this list and my name is Philippe.
> I used to make some programs on windows but wanted to trye on linux.
> I have a problem with a small prog i had done for windows witch play
> sounds on the fm chip of a sound card.
> But when i translate it on linux, it doesn't work any more.
> It compile and link correctly(nasm), but on execution it writes:
> segmentation fault!
Maybe You have no permission to write to that ports.
Use io_perm syscall to set it.
Also this king of programming is not good choice for linux. Use kernel to
do the dirty work. You can use a "services" (ioctls) of sound driver to
produce sound. I think there is an tutorial on www.linuxassembly.org
for a sound too.
> I post you the sources at the end of this message.
>
> I had an other question:
> Where can I find bible of all the interruptions and what is the name of
> it?
It is called Ralf's Brown Inetrrupt list.
Use google.com to find it (it was on Simtelnet mirrors)
Regards
Rudolf
>
>
> Philippe
>
>
>
>
> ;************************************************
> ;* Ecriture sur SoundBlaster *
> ;*1-ecrire dans le adresse port0x388 *
> ;*2-attendre 12 cycles *
> ;*3-ecrire dans le data port0x389 *
> ;*4-attendre 84 cycles *
>
> ;compiler:
> ; nasm -f elf SBB.asm
> ; ld -s -o SBB SBB.o
>
>
> section .text ;section declaration
>
> ;we must export the entry point to the ELF
> linker or
> global _start ;loader. They conventionally recognize _start as
> their
> ;entry point. Use ld -e foo to override the
> default.
>
> _start:
>
>
> ;mettre tous les registres SB a zero
> mov edx,0x388 ;port adresse
> mov eax,0x20 ;registre sb 20
> out dx,al
> mov edx,0x389 ;data port
> mov al,7
> out dx,al
>
> mov edx,0x388 ;port adresse
> mov al,0x40 ;registre sb 40
> out dx,al
> ;call WaitR
> mov edx,0x389 ;data port
> mov al,0x10
> out dx,al
> ;call WaitR
>
> mov edx,0x388 ;port adresse
> mov al,0x60 ;registre sb 20
> out dx,al
> ;call WaitR
> mov edx,0x389 ;data port
> mov eax,0xf0
> out dx,al
> ;call WaitR
>
> mov edx,0x388 ;port adresse
> mov al,0x80 ;registre sb 20
> out dx,al
> mov edx,0x389 ;data port
> mov al,70
> out dx,al
>
> mov edx,0x388 ;port adresse
> mov al,0x23 ;registre sb 20
> out dx,al
> ;call WaitR
> mov edx,0x389 ;data port
> mov eax,1
> out dx,al
> ;call WaitR
>
> mov edx,0x388 ;port adresse
> mov eax,0x43 ;registre sb 20
> out dx,al
> ;call WaitR
> mov edx,0x389 ;data port
> mov eax,00
> out dx,al
> ;call WaitR
>
> mov edx,0x388 ;port adresse
> mov eax,0x63 ;registre sb 20
> out dx,al
> ;call WaitR
> mov edx,0x389 ;data port
> mov eax,0xf0
> out dx,al
> ;call WaitR
>
> mov edx,0x388 ;port adresse
> mov eax,0x83 ;registre sb 20
> out dx,al
> ;call WaitR
> mov edx,0x389 ;data port
> mov eax,0x7f
> out dx,al
> dest3:
> mov cx,0xff
> dest2:
>
> mov edx,0x388 ;port adresse
> mov al,0xa0 ;frequency
> out dx,al
> mov edx,0x389 ;data port
> mov al,cl
> xor al,dl
> out dx,al
> ;**send the sound now gogogogo go
> mov edx,0x388 ;port adresse
> mov eax,0xb0 ;registre sb 20
> out dx,al
> mov edx,0x389 ;data port
> mov eax,0x31
> out dx,al
> call Waitc
> call Waitc
> call Waitc
> call Waitc
>
> loop dest2
> ;*******************************************************
>
> mov edx,0x388 ;port adresse
> mov eax,0xb0 ;registre sb 20
> out dx,al
> ;CHK: ;attend qu'on appuye sur la touche espace*****
>
> ;mov ah,8
> ;mov dl,0xFF
> ;int 0x21
> ;cmp al,' ' ;espace
> ;je SUITE
> ;jmp CHK
> ;SUITE:
> mov edx,0x389 ;data port
> mov eax,0
> out dx,al
>
> ;mov ax,0x4c
> ;int 0x21
>
> mov ebx,0 ;first syscall argument: exit code
> mov eax,1 ;system call number (sys_exit)
> int 0x80 ;call kerne
>
>
>
> Waitc:
> push ecx
> mov ecx,0x8fff
> W1:
> nop
> loop W1
> pop ecx
> ret
> Waitb:
> push ecx
> mov ecx,0x1fff
> W2:
> nop
> loop W2
> pop ecx
> ret
> -
> To unsubscribe from this list: send the line "unsubscribe linux-assembly" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
>
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: sound
2002-06-24 21:51 sound philippe
2002-06-25 1:02 ` sound xlp
2002-06-25 8:06 ` sound Rudolf Marek
@ 2002-06-25 21:28 ` h-peter recktenwald
2 siblings, 0 replies; 4+ messages in thread
From: h-peter recktenwald @ 2002-06-25 21:28 UTC (permalink / raw)
To: philippe; +Cc: Linux-assembly
On Mon, 24 Jun 2002 23:51:11 +0200
philippe <pvir@freesurf.fr> wrote:
> hi
> I am new on this list and my name is Philippe.
> I used to make some programs on windows but wanted to trye on linux.
> I have a problem with a small prog i had done for windows witch play
> sounds on the fm chip of a sound card.
direct port access requires 'root' rights and the concerning ports
being enabled, with sys_ioctl or sys_ioperm. - e.g <man 2 ioctl>
> But when i translate it on linux, it doesn't work any more.
> It compile and link correctly(nasm), but on execution it writes:
> segmentation fault!
> I post you the sources at the end of this message.
>
> I had an other question:
> Where can I find bible of all the interruptions and what is the name of
> it?
basically, there is one interrupt and several sub-codes, passed w. eax.
'the' bible doesn't exist, linux is in a somewhat 'fluid' state and, badly
documented. Paricularly no aequivalent to 'RBIL' but, you might get some
help from my syscall pages where i collect whatever i find fairly reliably
documented/tested.
http://www.lxhp.in-berlin.de/lhpsyscal.html
regards,
hp
--
Linux,Assembly,Forth: http://www.lxhp.in-berlin.de/index-lx.shtml en/de
NO abusive software patents http://petition.eurolinux.org/pr/pr17.html
-
To unsubscribe from this list: send the line "unsubscribe linux-assembly" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2002-06-25 21:28 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-06-24 21:51 sound philippe
2002-06-25 1:02 ` sound xlp
2002-06-25 8:06 ` sound Rudolf Marek
2002-06-25 21:28 ` sound h-peter recktenwald
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox