Page 1 of 1

Real mode problem..

Posted: Sat Feb 12, 2011 12:54 am
by 444
Hi!
I am trying to begin to code some emulator for my BIOS routines. I calculate the offset and the segment for the ISR, then I read the instruction at this place and it is near jump to 10002D, there never was nothing from the start of the computer. I guess the BIOS routine is trying to fire some exception but the only exception I can suppose is CS overrun and after this invalid opcode. As long as I know the invalid opcode handler is in vector 06h of the IVT, but I can't find the CS overrun vector. And yes, I have to define another question: Is expected to BIOS code to do things like this, or I need to keep searching the error in another direction. BTW there is one instruction in the ROM area that jump to above the 1MB, so there is some piece of code that want to fire exception, or there are some important detail about I dont know.
Thanks!


PD: What I get in Hex is:

........5BF8E95CF8E95DF8 | E93A11000000EA8F.....

The place marked with "|" is the absolute address FEEF3h(from segment: F000h and offset: EEF3h)

Re: Real mode problem..

Posted: Fri Mar 04, 2011 10:34 am
by Czernobyl
Hi 444...

Actually [assuming the instruction is at FEEF3 and executed in real mode with CS=F000] it is a "near" or intra-segment jump to F000:0030h. In 16-bit mode (including 8086 compatible "real address mode") the processor (80386 and above) zeroes the higher part of EIP automagically at the end of the effective jump offset calculation - this is for compatibility with 16-bit processors up to and including 80286, which only had 16-bit IP. You cannot jump to an offset higher than 0FFFF in real or 16-bit protected mode unless using a data size prefix (66h, not 67h!).

This is in addition to, and independent from, the fact that in real mode, segment limits especially the code segment's limit, are 0FFFFh (upon reset, and hardly ever changed for CS in real mode).

HTH

--
Czerno the Passer-by