For a project I am writing a small game using the old VGA mode (accessed via int 10h,1ah). My code is currently all 16bit style and compiles and links fine with tasm/tlink.

My problem is that i would like to use the 32 bit wide registers, as well as the 32 bit memory addressing, and i am having trouble porting my code to use these things. Is it even possible to use interrupts like this in code that has the .386 directive?

Posted on 2003-09-24 17:35:43 by mictian
You can always use the full registers and addressing modes, using address size prefixes and operand size prefixes. When running in protected mode, the default size can be set to big, but you have to run all BIOS calls in real mode or V86 mode. Under DPMI this can be done with Int 31h function 300h.
Posted on 2003-09-24 17:56:40 by Sephiroth3

You need to do this from a driver or through call which I haven't devled into yet.

Here you'll find driver tutorials
Posted on 2003-09-24 18:00:59 by mrgone
Thanks guys,

So in order to use these old dos graphics mode alongside 32bit registers i need to eaither use some API, or write my own VxDs??

maybe i will just stick to 16bit in this case

Posted on 2003-09-24 18:13:33 by mictian
Okay, I don't see what those links have to do with this. :confused: But anyway, it is really simple.
You can cheat and switch to graphic mode before you go into protected mode via DPMI. But since the only way back to V86 or real mode is by terminating the program with int 21h/fct. 4ch, you have to use int 31h to call the BIOS function to go back to text mode.
It is called with:
ECX=count of words on stack
EDI=address of structure with register contents
ES=segment of above structure
The register structure contains the general registers in pushad order, then the lower half of the flag register, then ES, DS, FS, GS, 4 unused bytes, SP and SS.

Note that Windows supports int 21h in protected mode. It can be called normally, using 32-bit addresses.
Posted on 2003-09-24 18:37:44 by Sephiroth3

Thanks guys,

So in order to use these old dos graphics mode alongside 32bit registers i need to eaither use some API, or write my own VxDs??

maybe i will just stick to 16bit in this case


perhaps directx is simpler than that.
Posted on 2003-09-25 05:52:38 by dion
Well... I suppose porting the game to Windows could work. Unless the game uses VGA features that can't be accessed using DirectX, such as raster splits and hardware scrolling.
Posted on 2003-09-25 06:55:59 by Sephiroth3
actually i considered using directx, as i have used it before for some Cxx projects, however, my intent is to write some really low level code, rather than using hundreds of windows API calls, plus the pain of writing out another winmain and windowproc...
Posted on 2003-09-25 16:53:29 by mictian
"the pains of", heh. Writing a simple DirectDraw application == easy. If you want 32bit access to a framebuffer, you got serious problems. 16bit mode with prefixes to get "32 bit" mode sucks, and to go 32bit without windows support requires a dos extender (if you don't want to do a shitload of code). "my intent is to write some really low level code" - why not write some useful code instead? - or at least concentrate the lowlevel code where it's necessary/useful?
Posted on 2003-09-25 17:38:49 by f0dder
i know windows code isn't techniccally challenging, its just that i have done it maaany times before, and this time i want to do something different. Furthermore, the reason i want to be low level is that i am making this project for my "Architecture and Assembly" class i am taking, so naturally it is preferable to be low level.

Thanks nonetheless for your comments, i think i will do this the 16bit way.

Thanks again,
Posted on 2003-09-25 18:26:34 by mictian
I wish I had your brains.
Posted on 2003-09-25 19:49:23 by mrgone
If it is to be run on Windows in a DOS box, then you should have no trouble going into protected mode, since Windows is also a DOS extender.
Click here for an example.
But if it's for plain DOS, then it's probably too much trouble.
Posted on 2003-09-26 10:50:14 by Sephiroth3