Page 1 of 1
idt in rm
Posted: Sun Apr 29, 2007 3:59 pm
by anon19287473
i cant find any info on idt's in real mode. I have read that a rm idt has 4 byte entries, and a pm idt has 8 byte, but i dont know what the fields are for real mode idt's, is it just the base and offset to use? could someone plz post an example real mode idt
I have read about an ivt, how can i manipulate this to use int's as syscalls? Could i pick an int, say int 0x80, multiply it by four, and put my syscall func there? It seems a bit messy.
DISREGAURD THIS, I FIGURED OUT WHERE THE IVT WAS AND DIRECTLY MODIFIED IT
Posted: Mon Apr 30, 2007 4:47 pm
by mathematician
memory in real mode is addressed by placing a sixteen bit paragraph number in a segment register and a sixteen bit offset in the ip (code seg), bp or sp (stack seg) or one of the si,di or bx registers (data seg). For example, if the cs register contained the paragraph address 0x57B4, and the ip register contained the offset 0x710D, then the absolute address as calculated by the processor would be 0x57B4 * 0x10 + 0x710D = 0x5EC4D. A real mode IDT contains 256 seg:offset pairs, each pair being the seg:offset address of the interrupt handler.
I have read about an ivt, how can i manipulate this to use int's as syscalls? Could i pick an int, say int 0x80, multiply it by four, and put my syscall func there? It seems a bit messy.
Point the int21h vector at its API entry point is what MS-DOS did, and what the real mode BIOS, with its various interrupt numbers, still does.
In the good ol' days, when the distinction between systems and application programming on the PC was distinctly blurred at the edges, anybody writing an app in real mode would be expected to know that kind of thing straight off, let alone somebody contemplating an OS.
Posted: Mon Apr 30, 2007 5:24 pm
by anon19287473
mathematician wrote:memory in real mode is addressed by placing a
In the good ol' days, when the distinction between systems and application programming on the PC was distinctly blurred at the edges, anybody writing an app in real mode would be expected to know that kind of thing straight off, let alone somebody contemplating an OS.
I learned coding quite recently (i guess im part of what you might call the next generation of coders, who grew up using perl, python etc.), so osdev is my way of learning the innards to the x86 (especially real mode). When I started high school, DOS was a thing of the past, so real mode programming was obselete.
Thanks for the help
![Very Happy :D](./images/smilies/icon_biggrin.gif)
Posted: Mon Apr 30, 2007 5:27 pm
by pcmattman
I remember when I used to use Win95... I would intentionally click on 'Restart in MS-Dos mode' and play around with the command lines
![Very Happy :D](./images/smilies/icon_biggrin.gif)
.
It was on a 90 Mhz computer with a 800 MB hard drive and only 1 PCI slot that was added via an extension card...
system timer int
Posted: Mon Apr 30, 2007 5:36 pm
by anon19287473
I can't find any info on the system timer (interrupt), i would like to use it for multitasking. Could someone point me to some info?
Posted: Tue May 01, 2007 6:17 pm
by mathematician
There are at least two system timers in the PC. In real mode, and probably in Windows, the most frequently referred to generates a type 8 interrupt 18.2 times a second. This comes from channel 0 of the 8253/8254 programmable interval timer. The latter is programmed by writing to ports 40h thru 43h. In particular you would be interested in 40h and 41h if you felt inclined to increase the 18.2Hz frequency (you can't decrease it). As ever with a hardware interrupts, you would need:
mov al,20h
out 20h,al
somewhere prior to the iret instruction.