I'm not the biggest assambl-progger, most of my code will be in c
but there's one thing i don't know
when i create my [tt]INTX[/tt] interrupt proc in assambly, how can i tell the system that this is the interrupt function for interrupt X?
i saw following on a page i don't know now...
[tt]
mov es:[16h], offset MyInt16
[/tt]
but i get error: comma or end line expected...
(i use NASM)
GreeZ
LOneWoolF
interrupts
- Pype.Clicker
- Member
- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
Re:interrupts
if you are in real mode, you can redefine your interrupt handler by just writing a far pointer in the Interrupt Vector Table. For interrupt X, that far pointer is located at 0000:X*4
note that both the offset and the segment of the code must be added there.
If you're in protected mode, what you have to do is define the right descriptor in your IDT (but i suggest you read the Intel manual about Interrupts before you attempt this)
note that both the offset and the segment of the code must be added there.
If you're in protected mode, what you have to do is define the right descriptor in your IDT (but i suggest you read the Intel manual about Interrupts before you attempt this)
Re:interrupts
mov es:[16h], offset MyInt16
The correct form for that particular instruction wouldn't use OFFSET, as NASM doesn't need it. Also, you need to specify the data size, e.g.:
MOV ES:[16h],WORD MyInt16
If I'm right that you're trying to setup INT 16h's vector in realmode, use this code:
xor bp,bp
mov ax,MyInt16h
mov es,bp
cli
stosw
mov es:[16h * 4 + 2],seg MyInt16h
sti
The correct form for that particular instruction wouldn't use OFFSET, as NASM doesn't need it. Also, you need to specify the data size, e.g.:
MOV ES:[16h],WORD MyInt16
If I'm right that you're trying to setup INT 16h's vector in realmode, use this code:
xor bp,bp
mov ax,MyInt16h
mov es,bp
cli
stosw
mov es:[16h * 4 + 2],seg MyInt16h
sti
Re:interrupts
but i'm in pmode :'(
now i need to set up real mode and use the code u gave me
thx
GreeZ
LOneWoolF
now i need to set up real mode and use the code u gave me
thx
GreeZ
LOneWoolF
Re:interrupts
you need to set up an Interrupt Description Table. Have you read the Intel docs? If not, you should.
Re:interrupts
some questions:
where can i find the intel docs?
i also would like some more docs about idts
i bet there is an interrupt for keyboard... dunno the number, where can i find a list?
where can i find the intel docs?
i also would like some more docs about idts
i bet there is an interrupt for keyboard... dunno the number, where can i find a list?
Re:interrupts
http://developer.intel.com/design/pentium4/manuals/245470.htmwhere can i find the intel docs?
Bona Fide OS Development. Great site heaps of tutorials:i also would like some more docs about idts
http://osdev.neopages.net/tutorials/interrupts.1.php
Ralf Browns Interrupt List:i bet there is an interrupt for keyboard... dunno the number, where can i find a list?
http://www.ctyme.com/rbrown.htm
- Pype.Clicker
- Member
- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
Re:interrupts
what do you mean with "i bet there is an interrupt for keyboard..." ? are you talking of the IRQ1 (hardware interrupt issued every time a key is pressed) or of the BIOS INT16h (which is a real-mode BIOS service and therefore not available in pmode) ?
The IRQ1 will be where you will re-program it (in realmode, the PIC maps IRQ0..7 to INT 8..F, but those interrupts are reserved for exceptions in pmode, so you have to re-map the interrupts using the 8259A -- iirc -- and move them to some other interrupts like, say, INT 0x20..0x27)
The IRQ1 will be where you will re-program it (in realmode, the PIC maps IRQ0..7 to INT 8..F, but those interrupts are reserved for exceptions in pmode, so you have to re-map the interrupts using the 8259A -- iirc -- and move them to some other interrupts like, say, INT 0x20..0x27)
Re:interrupts
irq1, interrupt 09
can i use the interrupt number INT9, set to 0x20 in the IDT?
and a better question,
as I said
[tt]I'm not the biggest assambl-progger, most of my code will be in c[tt]:
how can i tell the assambler where the function shall be?
i have
and the c function adds what happened in a queue and later it's printed...
can i use the interrupt number INT9, set to 0x20 in the IDT?
and a better question,
as I said
[tt]I'm not the biggest assambl-progger, most of my code will be in c[tt]:
how can i tell the assambler where the function shall be?
i have
Code: Select all
int_key:
...
call _interrupt_keyb
...