Transfering control from 32bit to 16bit application
From: Davor Grguric (davor.grgruric_at_ri.hinet.hr)
Date: 10/30/03
- Next message: The Half A Wannabee: "Re: HLA suggestions"
- Previous message: The Half A Wannabee: "Re: OT:Everyone in San Jose is a Millionaire"
- Next in thread: flekso: "Re: Transfering control from 32bit to 16bit application"
- Reply: flekso: "Re: Transfering control from 32bit to 16bit application"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Thu, 30 Oct 2003 08:54:13 +0100
Hello,
I have problem with transferring control from 32-bit code, to 16-bit code.
Let me explain what I want to do. Per example I have some 16-bit assembler
code at somewhere in first 1Mb of memory. Let the starting address be
FF00:F000 and the code looks like:
FF00:F000: B4 00 MOV AH,0x00
FF00:F002: B0 12 MOV AL,0x12
FF00:F004: CD 10 INT 0x10
FF00:F006: EB FE JMP 0xF006
This simple code opens a VGA screen and after that it is running in
continues loop.
OK. Now I have program coded in Borland Builder C++ 5.0 from where I would
like to transfer control to my 16 bit assembler code at location FF00:F000
(physical address is 10E000h). For accomplish this I have to force 32 bit
processor to run in 16 bit mode, and execute far jump to the FF00:F000
addres so I did the following inline assembly code.
__asm
{
mov eax,cr0
and al,0xfe // clear protected mode bit
mov cr0,eax // now, we are out of prot mode
db 0xea // opcode byte for far jump
instruction
dw 0xf000 // offset value
dw 0xff00 // segment value
}
After executing inline assembly code under Windows98 I got the following
message:
CPU caused an invalid page fault in
module CPU.EXE at 017f:00401166.
Registers:
EAX=00000000 CS=017f EIP=00401166 EFLGS=00010246
EBX=00530000 SS=0187 ESP=0063fde8 EBP=0063fe04
ECX=00653ec4 DS=0187 ESI=0040204c FS=50e7
EDX=00652678 ES=0187 EDI=00000000 GS=0000
Bytes at CS:EIP:
ea 00 f0 00 ff ff 75 f4 68 bc 20 40 00 e8 8a 01
Stack dump:
64fe0000 0040204c 00530000 3259c94c 00000001 00000100 00000001 0063fe30
3256e29a 00000001 00653ec4 00652678 00000000 8176c040 00530000 00000000
I would like to point out that at address 017F:00401166 is byte 0xEA which
correspond with opcode byte for 16 bit far jump instruction. I know that
this opcode is not within 1st Mb of ram and maybe there is a problem but I'm
helpless.
Do you have any idea how to solve this problem. Any help will be
appreciated.
Kind Regards,
Davor
- Next message: The Half A Wannabee: "Re: HLA suggestions"
- Previous message: The Half A Wannabee: "Re: OT:Everyone in San Jose is a Millionaire"
- Next in thread: flekso: "Re: Transfering control from 32bit to 16bit application"
- Reply: flekso: "Re: Transfering control from 32bit to 16bit application"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|