Hey, here is my working code for making "beep" sound for ~2-3 seconds.
It's working correctly when it's working in standalone .com application, but when i use it in my INTERRUPT TAKEN CODE BLOCK then it gets crahed in line where "int 15h" is. I tryed to figure it out using/remove cli and sti, but it didn't help, what is wrong with this code ? Why I can't make int 15h inside interrupt taken, other things are working properly.
Thanks for help!
in al,61h
or al,3
out 61h,al
;-------------
mov bx,440h
mov dx,12h
mov ax,34ddh
div bx
pushf
push ax
cli
mov al,0b6h
out 43h,al
pop ax
out 42h,al
mov al,ah
out 42h,al
popf
;-------------
mov cx,0fh
mov dx,4240h
mov ah,86h
int 15h ; pauza o d?ugo?ci CX:DX mikrosekund
;-------------
in al,61h
and al,~3 ; zerujemy bity 0 i 1
out 61h,al
It's working correctly when it's working in standalone .com application, but when i use it in my INTERRUPT TAKEN CODE BLOCK then it gets crahed in line where "int 15h" is. I tryed to figure it out using/remove cli and sti, but it didn't help, what is wrong with this code ? Why I can't make int 15h inside interrupt taken, other things are working properly.
Thanks for help!
Well, a theory that I have is that the interrupt handler just takes too long, so there is a watchdog that complains. You can't just hog the system for 2-3 seconds in an int handler.
Well, a theory that I have is that the interrupt handler just takes too long, so there is a watchdog that complains. You can't just hog the system for 2-3 seconds in an int handler.
Well, do you mean i should make beep sound shorter (in time line) ?
Well, I tried it out and it didn't work. I've read right here http://webpages.charter.net/danrollins/techhelp/0221.HTM that changing CD:DX will make make my sound different in time line, but i still get crash. Should i put there some kind of constant (special) value from some range of values to make it wouldn't carsh no more while in interrupt ?
Thanks for replaying!
No, Scali is stating, rightfully, that you do not run with interrupts disabled for that long.
Thus, for example, logically do the following:
1. Clear interrupts, start your beeping, set interrupts.
2. Wait X number of seconds.
3. Clear interrupts, stop beeping, Set interrupts.
Thus, for example, logically do the following:
1. Clear interrupts, start your beeping, set interrupts.
2. Wait X number of seconds.
3. Clear interrupts, stop beeping, Set interrupts.
Aside from that there is still the obvious problem: You are using a virtualized environment, which does not behave 100% the same as an actual PC running an actual copy of MS-DOS, with an actual BIOS implementation in ROM.
Both NTVDM and Dosbox are quite poor emulators as far as compatibility goes.
I have seen code that works while it shouldn't, and code that shouldn't work, while it did.
If I want to be 100% sure that my code works, I pull out the old 486 and test.
Both NTVDM and Dosbox are quite poor emulators as far as compatibility goes.
I have seen code that works while it shouldn't, and code that shouldn't work, while it did.
If I want to be 100% sure that my code works, I pull out the old 486 and test.