Mail Archives: djgpp/2000/11/07/07:00:46
Message-ID: | <3A07EB2D.129F2831@math.klte.hu>
|
From: | Peter Sulyok <sulyok AT math DOT klte DOT hu>
|
X-Mailer: | Mozilla 4.06 [en] (WinNT; I)
|
MIME-Version: | 1.0
|
Newsgroups: | comp.os.msdos.djgpp
|
Subject: | MASM 6.11 problem
|
Lines: | 136
|
Date: | Tue, 07 Nov 2000 11:45:13 GMT
|
NNTP-Posting-Host: | 172.24.124.47
|
X-Complaints-To: | newsmaster AT nokia DOT com
|
X-Trace: | news1.nokia.com 973597513 172.24.124.47 (Tue, 07 Nov 2000 13:45:13 EET)
|
NNTP-Posting-Date: | Tue, 07 Nov 2000 13:45:13 EET
|
Organization: | Nokia
|
To: | djgpp AT delorie DOT com
|
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp
|
Reply-To: | djgpp AT delorie DOT com
|
--------------5AB5B87741CDD3A70D60C8AC
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Hi,
I wrote a general interrupt calling routine in assembly (don't ask me
why),
and it's working perfectly with some other real\protected C compiler
(Watcom C,
Borland C etc.).
When I started to use this code with DJGPP 2.03, I used MASM 6.11
to create COFF object file from my (Intel syntax) assembly source.
Running this code, I got some runtime error, so I had to debug this with
FSDB.
At this point, it seems the linker doesn't relocate the code properly,
because all
OFFSET expressions (see the marks in the following code) have the same
value
(= address of function __Int), and that's why my program hangs up
immediately.
__Int PROC C, \
@@n:uchar, @@inregs:fardataptr, @@outregs:fardataptr
LOCAL @@SaveDS:ushort
PUSHREGS ; Save all registers.
;
mov @@SaveDS,ds ; Save DS.
push _BP ; Save _BP register.
;
-> mov _AX,OFFSET @@3 ; Put the return address into
push _AX ; the stack.
;
-> mov _AX,OFFSET IntTable ; Calculate the address of
adequte
IFDEF __32BIT__ ; interrupt instruction in the
movzx ebx,@@n ; interrupt table.
ELSE ;
xor bh,bh ;
mov bl,@@n ;
ENDIF ;
shl _BX,2 ;
add _AX,_BX ;
push _AX ; Push address into stack.
.........
Has anybody any idea about it?
Thanks,
Peter
--------------5AB5B87741CDD3A70D60C8AC
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
Hi,
<P>I wrote a general interrupt calling routine in assembly (don't ask me
why),
<BR>and it's working perfectly with some other real\protected C compiler
(Watcom C,
<BR>Borland C etc.).
<BR>When I started to use this code with DJGPP 2.03, I used MASM 6.11
<BR>to create COFF object file from my (Intel syntax) assembly source.
<BR>Running this code, I got some runtime error, so I had to debug this
with FSDB.
<P>At this point, it seems the linker doesn't relocate the code properly,
because all
<BR>OFFSET expressions (see the marks in the following code) have the same
value
<BR>(= address of function __Int), and that's why my program hangs up immediately.
<P><TT>__Int PROC C, \</TT>
<BR><TT> @@n:uchar, @@inregs:fardataptr,
@@outregs:fardataptr</TT>
<P><TT> LOCAL
@@SaveDS:ushort</TT>
<P><TT> PUSHREGS
; Save all registers.</TT>
<BR><TT>
;</TT>
<BR><TT> mov
@@SaveDS,ds
; Save DS.</TT>
<BR><TT> push
_BP
; Save _BP register.</TT>
<BR><TT>
;</TT>
<BR><TT>-> mov
_AX,OFFSET @@3 ;
Put the return address into</TT>
<BR><TT> push
_AX
; the stack.</TT>
<BR><TT>
;</TT>
<BR><TT>-> mov
_AX,OFFSET IntTable ; Calculate the address of
adequte</TT>
<BR><TT> IFDEF __32BIT__
; interrupt instruction in the</TT>
<BR><TT> movzx
ebx,@@n
; interrupt table.</TT>
<BR><TT> ELSE
;</TT>
<BR><TT> xor
bh,bh
;</TT>
<BR><TT> mov
bl,@@n
;</TT>
<BR><TT> ENDIF
;</TT>
<BR><TT> shl
_BX,2
;</TT>
<BR><TT> add
_AX,_BX
;</TT>
<BR><TT> push
_AX
; Push address into stack.</TT>
<BR><TT> .........</TT>
<P><TT>Has anybody any idea about it?</TT>
<BR><TT>Thanks,</TT><TT></TT>
<P><TT>Peter</TT></HTML>
--------------5AB5B87741CDD3A70D60C8AC--
- Raw text -