Thanx lionelhill, i managed to get it working, heres what i done:
.model large
.stack 100h
.data
prompt DB 'Press 1-9 to play notes in the scale of D!',13,10,'$'
exit DB 'Press x to exit!',13,10,'$'
.code
mov ax,@data
mov ds,ax
jmp firstnote
public mainroutine
mainroutine proc near
pop bx
pop ax
out 42h,al
pop ax
out 42h,al
in al,61h
or al,00000011b
out 61h,al
push bx
RET
mainroutine endp
firstnote:
mov al,10110110b
out 43h,al
mov al,011h
push ax
mov al,0cah
push ax
CALL mainroutine
CALL delay1
CALL offspeak
CALL pause
"
"
rest of code
"
"
END
obviously i have more procedures in the code than i have highlighted here.
My problem was that i was passing data between main and the procedure. I was storing them onto the stack for this. But when you call the procedure the return address gets stored on the top of the stack which would then muck up my data that i was passing. So to combat this, when i first enter the procedure i popped the return address into bx, since bx is not being used, then just before the RET command i pushed it back onto the top of the stack and this restored the return address, woo hoo!
Regarding your statement about my prompt, i never included the command in my example code that displays the code, which goes like;
mov dx, OFFSET prompt
mov ah,9
int 21h
mov dx, OFFSET exit
mov ah,9
int 21h
And they display OK, thanx for your concern and advice.