Mail Archives: djgpp/2000/02/26/20:15:25
From: | chyn0610 AT ms49 DOT url DOT com DOT tw (Lin)
|
Newsgroups: | comp.os.msdos.djgpp
|
Subject: | Problem on various DPMI host
|
Date: | Sun, 27 Feb 2000 00:57:01 GMT
|
Organization: | DCI HiNet
|
Lines: | 78
|
Message-ID: | <38b87082.65742@netnews.hinet.net>
|
NNTP-Posting-Host: | h105.s160.ts31.hinet.net
|
Mime-Version: | 1.0
|
X-Newsreader: | Forte Agent 1.5/32.452
|
To: | djgpp AT delorie DOT com
|
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp
|
Reply-To: | djgpp AT delorie DOT com
|
Hi there,
My program get some trouble on excuting the code in different DPMI
host to CREAT a new FILE. Now I spot on the problem and show it to
you:
There is a C main program like the 1st piece bellow: (named pp.c)
and a Assemly routine like the 2nd piece: (named p.asm)
I asembled 2nd one use NASM ( nasm -f coff p.asm), compile and link
both with DJGPP ( gcc -s pp.c p.o -o p1), and i get both P1.EXE and p1
(the coff file). and I use pmode12 to add a stub to p1 ( copy /b
pmodstub.exe+p1 p2.exe) and i get P2.EXE.
Now i have two identical excutable image ,both P1.EXE (it need a DPMI
host)and P2.EXE (standalone).
I can excute both code image on WIN95's DOS box without any problem.
it create a new file name RESLT.DAT ok.
but at plain DOS (both 7.0 and 6.22) both code will just show messup
code on screen.
Can someone try these through and give me some ansers ?
Forgive my poor English.
Lin. 2000-02-27
*******************************************************
int p_cal();
main()
{
int reslt;
reslt=p_cal();
return 0;
}
******************************************************
****************************************************
; 05-14-'93
piece equ 1
segment .bss
dm_buff:
resb 4*piece*1024 ; buffer contents will be write
to a file
tmp_buff: ; latter
resb 1024
;
segment .data
file_name db 'reslt.dat',0 ; the file name
;
;***********************************
;
segment .text
global _p_cal ; link with main C program
;
_p_cal:
enter 0,0 ; enter this procedure
pusha
;
; save the result to file
;
mov edx,file_name
mov ah,3ch ; create the a file and get handle
mov cx,0
int 21h
mov bx,ax
push eax
mov ecx,tmp_buff-dm_buff
mov edx,dm_buff
mov ah,40h ; write the buffer contents into the
file
int 21h
pop ebx
mov ah,3eh ; close the file
int 21h
;
popa ; restore all registers
leave ; return caller from main C program
ret
**************************************************************************
E-mail: chyn0610 AT ms49 DOT url DOT com DOT tw
- Raw text -