change an interrupt handler in real mode
Page 1 of 1 [ 6 posts ]
Sorry for the edit, but: It's a pentium D processor and the assembler I'm using is nasm. I would like to set up an interrupt table for real mode.
It's something like this:
Quote:
dw 0
dw 0x04
dw 0x08
dw 0x0c
dw 0x10
dw 0x14
dw 0x18
dw 0x1c
dw 0x20
dw 0x24
dw 0x28
dw 0x2c
dw 0x30
dw 0x34
dw 0x38
dw 0x3c
dw 0x40
dw 0x44
dw 0x48
dw 0x04
dw 0x08
dw 0x0c
dw 0x10
dw 0x14
dw 0x18
dw 0x1c
dw 0x20
dw 0x24
dw 0x28
dw 0x2c
dw 0x30
dw 0x34
dw 0x38
dw 0x3c
dw 0x40
dw 0x44
dw 0x48
Last edited by kmalloc on 15 Feb 2014, 4:00 am, edited 1 time in total.
mr_bigmouth_502
Veteran

Joined: 12 Dec 2013
Age: 31
Gender: Non-binary
Posts: 7,028
Location: Alberta, Canada
bugmenot wrote:
kmalloc wrote:
It's a pentium D processor. I will like to have more knowledge of real mode and I'm stuck.
You've posted what looks like assembler, but if it's assembler code it looks to have no instructions. Without instructions your program will not do anything.
Looks to me like he's posted pure machine code. If he posts the assembler version of the code we might better be able to help. It would also help if he said what processor he's coding for.
_________________
I've left WP indefinitely.
bugmenot wrote:
TallyMan wrote:
bugmenot wrote:
kmalloc wrote:
It's a pentium D processor. I will like to have more knowledge of real mode and I'm stuck.
You've posted what looks like assembler, but if it's assembler code it looks to have no instructions. Without instructions your program will not do anything.
Looks to me like he's posted pure machine code. If he posts the assembler version of the code we might better be able to help. It would also help if he said what processor he's coding for.
I doubt those numbers are intended to be instructions (each 4-byte dword is just the previous value plus 4)
Ah yes, hadn't noticed that. So all he's posted is a numerical sequence, it isn't even code. Back in the day (long ago) when I did assembly programming for the 6502 processor messing with interrupts was something done with great care. I had a Commodore 64 and my program code used to take over the entire computer banking out the operating system ROM to use the RAM at the same shared address. My code handled all the interrupts as necessary. That was long ago though... in a galaxy far away. LOL.
_________________
I've left WP indefinitely.
kmalloc wrote:
Sorry for the edit, but: It's a pentium D processor and the assembler I'm using is nasm. I would like to set up an interrupt table for real mode.
You're misunderstanding what the table is supposed to contain; all you've constructed is a list of numbers (constants) where you should have had a list of destination addresses.Check out the syntax of DW: http://www.nasm.us/xdoc/2.11/html/nasmd ... tion-3.2.1
Each 4-byte offset into the table points to a seg:ofs destination address - the address of the code which handles that particular interrupt.
So the first entry at offset zero is the address of the code to handle interrupt 0, the second entry at offset 4 is the address of the code to handle int 1, the third at offset 8 is the address for int 2 - and so on.
Here's a worked example in NASM of reading and altering the table:
http://computer-programming-forum.com/4 ... 10cbdb.htm
That code uses a DOS environment to allow it to be executed, but the essential parts are not OS-related; one way of writing an entry is basically this:
Code:
mov word [es:VECT_NUM * 4 + 0],handler
mov [es:VECT_NUM * 4 + 2],cs
(obviously ES and CS need to have sane values established elsewhere)mov [es:VECT_NUM * 4 + 2],cs
bugmenot wrote:
why, in the year 2014, would you want to work in real mode?! !
Because all x86 processors start in real mode when reset and in order to load an OS (the OP is working on a bootloader), certain operational conditions must be established first.
_________________
Giraffe: a ruminant with a view.
Page 1 of 1 [ 6 posts ]
Similar Topics | |
---|---|
incapable of change? |
12 Jan 2025, 6:25 am |
..what would it change if I knew I have autism? |
07 Dec 2024, 2:26 pm |
Why in the movies ASD are like this not as real life? |
27 Jan 2025, 5:17 pm |
Climate Change Is Helping Invasive Species Take Root In WA |
08 Jan 2025, 4:56 pm |