Yeah... the problem with int 10h (or any other real mode interrupt) is that it's 16-bit code, and there's no way it'll run with the processor in 32-bit mode.
There's a sys_vm86 old (113), and a sys_vm86 (166), used by dosemu, I think, that might allow you to do it. I have *no* idea how to use these - if anyone has an example, please post!
Sending ascii 7 (BELL) to stdout in the usual way (sys_write) beeps the speaker, if that'll satisfy you...
If you want a "fancier beep", I've got an example that gets permission to diddle the ports with sys_ioperm, and beeps the speaker (in a "tune", of sorts) using ports... I can post that, if anyone's interested.
Here's the "easy way"...
Best,
Frank
;--------------------------
; nasm -f elf beep.asm
; ld -s -o beep beep.o
global _start
section .text
_start:
mov eax,4 ; sys_write
mov ebx,1 ; stdout
mov ecx,beep ; buffer
mov edx, 1 ; length
int 80h
mov eax,1 ; sys_exit
xor ebx, ebx ; I didn't see an error, did you see an error? :)
int 80h
;section .data
; hell, put it in the code section...
beep db 7 ; "BELL"
;--------------------------