I post some source code, does anyone see what's wrong?
Has anyone coded a Realmode/Protectedmode program in Watcom? Can you
give me some examples?
Target: Dos 6.22 PM
Compiller: Watcom C 11.0c
Extender: DOS4G 2.60 Professional (which supports DPMI 301h)
Additional: only himem.sys loaded with no options
====[ Code Snippet START
]=============================================
union REGS inregs, outregs;
struct SREGS sregs;
memset(&inregs, 0, sizeof(inregs));
memset(&outregs, 0, sizeof(outregs));
// check for XMS services present
inregs.w.ax=0x4300;
int386(0x2F, &inregs, &outregs);
if (outregs.h.al!=0x80)
exit(0); // services not present
memset(&inregs, 0, sizeof(inregs));
memset(&outregs, 0, sizeof(outregs));
// get service function real mode address (ebx:esi)
inregs.w.ax=0x4310;
int386(0x2F, &inregs, &outregs);
// try to call this service to get XMS version
/* Set up real-mode call structure */
memset(&RMI,0,sizeof(RMI));
// put address into CS:IP
RMI.CS=outregs.x.ebx;
RMI.IP=outregs.x.esi;
memset(&inregs, 0, sizeof(inregs));
memset(&outregs, 0, sizeof(outregs));
memset(&sregs, 0, sizeof(sregs));
/* Use DPMI call 301h to issue the DOS function call */
inregs.x.eax=0x0301;
sregs.es = FP_SEG(&RMI);
inregs.x.edi = FP_OFF(&RMI);
int386x(0x31, &inregs, &outregs, &sregs);
// on the last line program crushes without any info
====[ Code Snippet END ]=============================================
inregs.w.ax=0x4310;
int386(0x2F, &inregs, &outregs);
memset(&RMI,0,sizeof(RMI));
RMI.CS=outregs.x.ebx;
RMI.IP=outregs.x.esi;
inregs.x.eax=0x0301;
int386x(0x31, &inregs, &outregs, &sregs);
---== Posted via the PFCGuide Web Newsreader ==---
http://www.pfcguide.com/_newsgroups/group_list.asp