I use Open Watcom to play with 13h mode. It's just for fun :)
To init 13h mode, here is my code :
void initMode13(void)
{
_asm
{
mov ax,13h
int 10h
}
}
and to plot :
void main(void)
{
initMode13();
char far *screen = (char far*)0x0A0000000;
*screen = (char) 1;
}
colour 1 is supposed to be red (0xff0000, initialized before 13h mode). But
when I run, my program hangs. Why ?
I use this command line to compile :
wcl386 /l=dos4g test.c
Someone to help me ?
Thx
Laura
-Matt
"Laura Martignas" <laura...@libertysurf.fr> wrote in message
news:Xns93FDEBFBDB7...@213.228.0.196...
> void main(void)
"int main". Pretty please?
> {
> initMode13();
> char far *screen = (char far*)0x0A0000000;
Looks like too many zeros. Try 0xA0000.
Best,
Frank
I don't know too much about Open Watcom, but I do know
about the PC's hardware.
For compatibility reasons, the CPU of a PC has several
operating modes. DOS only knows about 16-bit, but DOS extenders
and newer operating systems know 32-bit (or 64-bit :-)
On the lowest software level, 16-bit and 32-bit aren't 100% compatible,
and that's probably what goes wrong here. The code uses 16-bit
DOS programming stuff, while being compiled for 32-bit (looking at the
command line).
I suggest you look into the manual how to target 16-bit DOS, _or_
look for their 32-bit equivalents.
Herman
I see you're linking into dos4gw.
Welcome to protected mode. You now address memory in a linear fashion.
to convert a seg:off pair to a linear address u do the following:
linear=(segment shl 4)+offset
so quite simply B800:0000 becomes 0xb8000
Segment registers under protected mode arnt used in the say way as they are
under realmode.
They are used in the form of sel:offset
you can use a DPMI call to allocate a selector and set its base address as
0xa0000
all u do is load ES with the selector, and your reference memory location
(pixel) in EDI
thats one approach (not necessarily the best)
if your DS and ES already have a base of 0, they're likely to have a limit
of 4gig, so
you can just address anything inside that space with your ESI/EDI registers
your program is hanging because of an incompatible memory pointer.
cheers
alex
/* 32-bit Watcom C with DOS/4GW extender
(*** This code is untested ***) */
int main(void) {
char *screen = (char *)0xA0000;
initMode13();
*screen = 1;
return 0;
}
/* 32-bit Watcom C with PharLap DOS extender
(*** This code is untested ***) */
#include <dos.h> /* MK_FP() */
#define PHARLAP_CONVMEM_SEL 0x34
int main(void) {
char far *screen = (char far *)MK_FP(PHARLAP_CONVMEM_SEL, 0xA0000);
initMode13();
*screen = 1;
return 0;
}
/* 16-bit Watcom C (real mode) */
#include <dos.h> /* MK_FP() */
int main(void) {
char far *screen = (char far *)MK_FP(0xA000, 0);
initMode13();
*screen = 1;
return 0;
}
>"Laura Martignas" <laura...@libertysurf.fr> wrote in message
>news:Xns93FDEBFBDB7...@213.228.0.196...
>> I use Open Watcom to play with 13h mode. It's just for fun :)
I'm new to HLLs,
I've been resisting it for years.
Now I'm trying to decide which one to learn..
After getting Open Watcom, and cuz it looks like
the basics are there,
I decided on "just enough" of C/C++ and Fortran to get a clue.
And the same for win, NT and O/S2.
- Hey .. It rhymes !!!
A few questions for all..
Re: "It's just for fun".
Sounds like an apology - If so for what?
>I see you're linking into dos4gw.
That is what got me to Watcom.
>Welcome to protected mode. You now address memory in a linear fashion.
>to convert a seg:off pair to a linear address u do the following:
Now that I'm there, Have I arrived at a good place to start?
Cuz I think I've also come to the place I want to end too..
What else is there?
OBTW - If it isn't for fun, what's it for? Money? << sucker !!
--
Ray