3932695
3932695

Reputation: 97

How do I use DOS interrupt 21h/AH=25h (set interrupt vector)?

I prompt the user for input:

mov ah, 0Ah
mov dx, OFFSET buffer
int 21h

My assignment tells me that ctrl-c should "abort the program with an appropriate error message".

I was told that int 23h is called whenever ctrl-c is called or detected. Apparently I can register my own interrupt handler via int 21h / ah=25h.

But I don't know how to make an interrupt handler, nor do I know where this is supposed to go in my code. Assistance would be appreciated, thank you in advance.

Upvotes: 1

Views: 3893

Answers (2)

Yasin Fatullayev
Yasin Fatullayev

Reputation: 169

do followings to write your custom interrupt handler

SettingIntVector:
     mov ah,25h      ;Here set your ah register for calling Interrupt vector
     mov al,22h      ;Your Interrupt Address
     mov dx,IntHandlerCode   ;Interrupt Handler
     int 21h                 ;Dos Interrupt 



 IntHandlerCode:
    mov ah,9
    mov dx, offset our_text
     mov ah,9
    int 21h   
    iret

our_text db "new Interrupt Handler... $"

I hope this helped to figure out how stuff works. This Interrupt Just write "new Interrupt Handler " to screen

Upvotes: 3

Martin Rosenau
Martin Rosenau

Reputation: 18523

As far as I know function ah=25h does nothing but writing the interrupt vector to the interrupt vector table.

This table is located at address 0000:0000 and contains segment:offset pointers to the interrupts.

This means: Function 25h would simply write the segment (value of CS) to address 0000:008E and the offset (address of your interrupt handler) to 0000:008C.

Upvotes: 1

Related Questions