Mail Archives: djgpp/1999/05/31/22:40:38
Message-ID: | <37533A3A.B6A84588@hitech.net.au>
|
From: | leroy <leroy AT hitech DOT net DOT au>
|
X-Mailer: | Mozilla 4.5 [en] (Win98; I)
|
X-Accept-Language: | en,ja
|
MIME-Version: | 1.0
|
Newsgroups: | comp.os.msdos.djgpp
|
Subject: | DJGPP - real mode procedures.
|
Lines: | 50
|
Date: | Tue, 01 Jun 1999 11:41:15 +1000
|
NNTP-Posting-Host: | 203.27.197.43
|
X-Complaints-To: | abuse AT telstra DOT net
|
X-Trace: | nswpull.telstra.net 928201636 203.27.197.43 (Tue, 01 Jun 1999 11:47:16 EST)
|
NNTP-Posting-Date: | Tue, 01 Jun 1999 11:47:16 EST
|
Organization: | Customer of Telstra Big Pond Direct
|
To: | djgpp AT delorie DOT com
|
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp
|
Reply-To: | djgpp AT delorie DOT com
|
I've found some strange anomolies when calling a real mode procedure in
DJGPP.
Tell me if this is the wrong way to do things.
unsigned char *code[] = {0x5b, 0xb8, 0x10, 0x00, 0x01, 0xd8, 0xcf};
According to debug that is
pop bx
mov ax, 10
add ax, bx
iret
Now, I allocate dos memory using the dpmi function, allocating 1 more
paragraph than I need (just for safety).
I move the code to that allocated memory using the dosmemput() routine.
I checked using _farpokeb() routines that the transfer worked.
I set up the registers using
__dpmi_regs r;
r.x.ss = 0; r.x.sp = 0;
r.x.cs = seg; // the value returned from the dos allocation routine
r.x.ip = 0;
I have a variable called stack that is initialised like so
int stack[] = {0x10};
I then call the function
__dpmi_simulate_real_mode_procedure_retf_stack(&r, 4, &stack);
I'm not so sure how the values for the stack should be passed, so I did
some assumed values, like 4. Is this right?
Next thing was that when this is run, Windows says that an illegal
instruction was encountered.
It did this even when I ran a smaller procedure that was this
mov ax, 13
retf
When I changed the retf to an iret it worked.
Any ideas what's wrong?
Cheers,
leroy.
- Raw text -