flat assembler
Message board for the users of flat assembler.

Index > DOS > Hardware vs. Software Interrupts

Author
Thread Post new topic Reply to topic
Paul6253



Joined: 19 Oct 2003
Posts: 31
Location: NY
Paul6253 23 Feb 2004, 18:52
Before I ask my question,let me state that I do understand the difference
being that software interrupts are called with the 2 byte 'int nn' instruction,
whereas a hardware int is 'triggered'.
How does the hardware get triggred???
keyboard = int 9h, so thats offset 0000:0024, at which the 1st 4 bytes is the ip:cs in little endian format. so reverse and bingo, there is the address of the keyboard handler.
That doesnt answer how the 'hook' or conncection is made between hardware and the jmp to the routine.
I sort of have an idea-- hitting a key sets a pin- which in turn causes the keyboard buffer to be scanned and a signal is sent to the PIC which is pushed along with the data and the interrupt number, which is decoded,
fetched,and executed. Am I on target?

Thanks

_________________
Plez xcuce mi spelng
Post 23 Feb 2004, 18:52
View user's profile Send private message Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid 23 Feb 2004, 19:12
Keypress generates signal for PIC which triggers interrupt, but it also writes byte value at port 60, which says which key was pressed / released. For some keys, like shifts or printscreen or sys request there are more bytes buffered at port 60. For extended keys byte E0h appears on port 60 first.

That is the reason of PIC - when it gets signal from some device it stops code execution and triggers interrupt.

But I just can't remember whether it is 60d or 60h
Post 23 Feb 2004, 19:12
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
Paul6253



Joined: 19 Oct 2003
Posts: 31
Location: NY
Paul6253 23 Feb 2004, 23:17
thanks...that helped a bit Smile

_________________
Plez xcuce mi spelng
Post 23 Feb 2004, 23:17
View user's profile Send private message Reply with quote
f0dder



Joined: 19 Feb 2004
Posts: 3175
Location: Denmark
f0dder 24 Feb 2004, 07:13
The keyboard is port 60h - but iirc, port 61h is used in conjunction with the keyboard IRQ, too - something about reading byte, setting high bit, and writing back, to reset the keyboard before EOI. I could be wrong though, it's been a while since I messed with it.

Also, you can get 'hardware interrupts' not only from various devices, but from the CPU itself... single step (int1) and breakpoint (int3) interrupts/exceptions, and (in protected mode) things like page faults, doublefault, machine check exception. All these aren't (and shouldn't) be generated with INT xx, but by the CPU itself.
Post 24 Feb 2004, 07:13
View user's profile Send private message Visit poster's website Reply with quote
Paul6253



Joined: 19 Oct 2003
Posts: 31
Location: NY
Paul6253 24 Feb 2004, 21:14
Correct me if im wrong but an irq line and an int number are not the same.
The line is a wire along the bus which is used to, which on modern systems
consist of a 16 line bus. The int number is just an offset shifted twice to
derive a double pointer to the handler routine.
And the system nmi from the cpu have no wires to the bus-- so they cannnot be accessed(???)-- no sure if they can...

_________________
Plez xcuce mi spelng
Post 24 Feb 2004, 21:14
View user's profile Send private message Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid 25 Feb 2004, 16:59
you are right about IRQ and int num

about NMI - you can "invoke" NMI interrupt (forgot number) with int instruction, but it is different from normal NMI caused by power lack or whatever, because in that case processor also sets some internal stuff.
Post 25 Feb 2004, 16:59
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
Paul6253



Joined: 19 Oct 2003
Posts: 31
Location: NY
Paul6253 25 Feb 2004, 19:19



Image
ok vid---
i GOT YOUR POINT






_________________
Plez xcuce mi spelng
Post 25 Feb 2004, 19:19
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.