| | |
hardware interrupt hangs
Please support our Assembly advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
Join Date: Jun 2006
Posts: 1
Reputation:
Solved Threads: 0
Hi, everyone!
I am trying to program (in assembler) a hardware interrupt at vector
72h, to beep twice.
The program seems to be running, and it looks like it is returning control to DOS. I can run it as many times as I want, the only problem is when I try to run anything else. My computer seems to hang (for some commands, such as dir, it just waits a long time, then finally shows me the contents of the current directory, but then a message is output on the screen: Cannot read from drive C).
If anyone could help, would be really great!
Here's the code:
I am trying to program (in assembler) a hardware interrupt at vector
72h, to beep twice.
The program seems to be running, and it looks like it is returning control to DOS. I can run it as many times as I want, the only problem is when I try to run anything else. My computer seems to hang (for some commands, such as dir, it just waits a long time, then finally shows me the contents of the current directory, but then a message is output on the screen: Cannot read from drive C).
If anyone could help, would be really great!
Here's the code:
Assembly Syntax (Toggle Plain Text)
;************************************************************* ;ISRSETUP.ASM - A program setting up an interrupt servive routine ; as a Teminate-and-Stay-Resident (TSR) Program, which ; can be called using Interrupt Request 72h ;************************************************************* .MODEL small .STACK 200h .DATA MASTR0 equ 20h MASTR1 equ 21h SLAVE0 equ 0A0h SLAVE1 equ 0A1h .CODE main: jmp start ToBeExec Proc Far Pushf Push dx ;places (pushes) content of register ax onto stack push ax ;places (pushes) content of register dx onto stack push bx push cx sti mov cx,2000 ;1st beep tone frequency ;call beep ;go sound the beep ;beep: mov al,10110110b ;load control word out 43h,al ;send it mov ax,cx ;tone frequency into AX out 42h,al ;send LSB mov al,ah ;move MSB to AL out 42h,al ;send it in al,61h ;get port 61 state or al,00000011b ;turn on speaker out 61h,al ;speaker on now mov bx, 600 pause1: mov cx, 65535 pause2: dec cx jne pause2 dec bx jne pause1 in al,61h and al,11111100b out 61h,al ;end_beep: mov cx,2500 ;2nd beep tone frequencybeep1: ; call beep ;go sound the beep ;beep: mov al,10110110b ;load control word out 43h,al ;send it mov ax,cx ;tone frequency into AX out 42h,al ;send LSB mov al,ah ;move MSB to AL out 42h,al ;send it in al,61h ;get port 61 state or al,00000011b ;turn on speaker out 61h,al ;speaker on now mov bx, 600 pause3: mov cx, 65535 pause4: dec cx jne pause4 dec bx jne pause3 in al,61h and al,11111100b out 61h,al ;end_beep: ;jmp end_beep ;we're done pop cx pop bx pop ax ;retrieves (pops) content of register ax from stack pop dx ;retrieves (pops) content of register dx from stack popf IRET ToBeExec Endp start: init_intctrl: mov al,11h out MASTR0,al mov al,8 out MASTR1,al mov al,4 out MASTR1,al mov al,1 out MASTR1,al mov al,11h out SLAVE0,al mov al,70h out SLAVE1,al mov al,2 out SLAVE1,al mov al,1 out SLAVE1,al ;Install the new interrupt vector 72h mov ax, cs ; get the code segment mov ds, ax mov dx, offset ToBeExec mov ah, 25h ; sets the interrupt vector ; DS:DX holds the address of the new interrupt procedure mov al, 72h ; defines the interrupt int 21h mov dx,00a0h ; this number indicates how many "paragraphs" ; of 16 bytes each will be reserved in memory ; for the TSR program mov ax, 3100h ; Program Terminates and Stays Resident in memory int 21h mov ax,4c00h int 21h END main
•
•
Join Date: Jun 2006
Posts: 1
Reputation:
Solved Threads: 0
Well go to www.google.com to check 4 what so ever u are looking 4
•
•
•
•
Originally Posted by elektroniklotto
Well go to www.google.com to check 4 what so ever u are looking 4
Let's start with your silly use of 4 and u. Such abbreviations are neither smart nor appropriate for a technical forum that non-native English speakers frequent. It also suggests that you're an idiot who is either too lazy to compose an intelligent post, or incapable of doing so. The latter is suggested by your ridiculous suggestion that Google is always the answer, and, especially in this case, that Google is some kind of source code analyzer and debugger.
You're off to a good start, and you've only made one post. :rolleyes:
I'm here to prove you wrong.
![]() |
Similar Threads
- Hardware Interrupts & 100% CPU usage (Windows NT / 2000 / XP)
- hardware interrupt eating up CPU usage - help! (Windows NT / 2000 / XP)
- Creating own interrupt vector tables and..... (Assembly)
- Reading Keystates (C)
Other Threads in the Assembly Forum
- Previous Thread: beginner compile problem
- Next Thread: Displaying numeric data
| Thread Tools | Search this Thread |






