hello...can anybody add a code to this program to make this a memory resident program...please...
*sound progam*
jmp input
beat db 8
nota dw 3531
nota1 dw 3032
nota2 dw 4030
nota3 dw 2728
nota4 dw 2425
nota5 dw 2023
nota6 dw 1520
nota7 dw 1313


music:
mov si,0
balik_sound:
mov ax,0040h
mov es,ax
in al,61h
or al,00000011xb
out 61h,al
mov al,0b6h
out 43h,al
ret


sound1:

;1
call music
lea bx,nota2
call note
call music
lea bx,nota
call note
call music
lea bx,nota2
call note
call music
lea bx,nota3
call note
call music
lea bx,nota1
call note
call delay
call long_delay
;2
call music
lea bx,nota2
call note
call music
lea bx,nota
call note
call music
lea bx,nota2
call note
call music
lea bx,nota3
call note
call music
lea bx,nota1
call note
call delay
call long_delay

;3
call music
lea bx,nota2
call note
call music
lea bx,nota5
call note
call music
lea bx,nota4
call note
call delay
call long_delay
call delay
call long_delay
call delay
call long_delay

;4
call music
lea bx,nota2
call note
call music
lea bx,nota5
call note
call music
lea bx,nota4
call note
call delay
call long_delay
call delay
call long_delay

;5
call music
lea bx,nota2
call note
call long_delay
call music
lea bx,nota4
call note
call long_delay
call music
lea bx,nota4
call note
call long_delay
call music
lea bx,nota3
call note
call music
lea bx,nota1
call long_delay
call note

input:
mov ah,7
int 21h
cmp al,'1'
if e call sound1
cmp al,'2'
je exit
jmp input

note:
mov ah,0
dec ax
shl ax,1
mov dx,w[bx]
mov al,dl
out 42h,al
mov al,dh
out 42h,al
mov bx,offset beat
mov cl,b[bx+si]
mov ch,0
mov bx,es:[6ch]
add bx,cx

still:
mov dx,es:[6ch]
cmp dx,bx
if ne jmp still
in al,61h
and al,0fch
out 61h,al
ret
exit:
in al,61h
and al,0fch
out 61h,al
int 20h
delay:
mov cx,2aaaaaaaah
call long_delay
long_delay:
mov cx,0fffffffffh
ret

Depends on what operating system you want to use. If MS-DOS version 6.X or earlier then you need to make it a TSR. There is quite a bit about that on the net, just google for it. MS-Windows doesn't use memory resident programs like that. It uses DLLs and device drivers, neither of which you would want to write in pure assembly. C or C++ are recommended languages for that. And if you do that, the code you posted simply can not be used at all because the os will not permit it.

This article has been dead for over six months. Start a new discussion instead.