www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2002/01/14/11:15:27

X-Authentication-Warning: delorie.com: mailnull set sender to djgpp-bounces using -f
From: "Andrew Fairburn" <a DOT j DOT fairburn AT durham DOT ac DOT uk>
Newsgroups: comp.os.msdos.djgpp
Subject: ASM syntax
Date: Mon, 14 Jan 2002 16:08:32 -0000
Organization: University of Durham, Durham, UK
Lines: 35
Message-ID: <a1uvh5$bi0$1@sirius.dur.ac.uk>
NNTP-Posting-Host: secom189.dur.ac.uk
X-Trace: sirius.dur.ac.uk 1011024229 11840 129.234.207.189 (14 Jan 2002 16:03:49 GMT)
X-Complaints-To: usenet AT durham DOT ac DOT uk
NNTP-Posting-Date: Mon, 14 Jan 2002 16:03:49 +0000 (UTC)
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400
X-Priority: 3
X-Newsreader: Microsoft Outlook Express 5.50.4133.2400
X-MSMail-Priority: Normal
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

dont know if this is teh right place to put this but i was hoping someone
could give me hand with the at&t assembler syntax.

ive been writing a function in assembler code for a real mode callback. The
code needs to take the ss:sp, of where the program was when this interupt
function is called, from the register pair ds:si then. It uses this to read
the cs:ip address left on the stack when the interupt was called and then
places it back in a memory address pointed to by the register pair es:di. It
then returns with an IRET. unfortunatley my code doesnt work:-

 cld
        lodsw
        movw %ds:(%esi), %ax // gets ss:sp which should point to old IP on
stack
        movw %ax, %es:44(%edi) //mov IP into mem structure 44 b disp from
es:di
        lodsw
        movw %ds:2(%esi), %ax // gets CS which is 2 bytes disp from IP on
stack
        movw %ax, %es:46(%edi) // move into mem structure
        movw %ds:2(%esi), %ax

        movw $0x1b0, %dx
        outb %dx

The thing im unsure about is the syntax for addressing memory e.g.
%ds:2(%esi), i thought this would take the selector and offset address in
ds:si and then move on 2bytes and return the value there. Is my
understanding of the displacement, i.e. 2, correct?

any help would be very much appreciated,

Andrrew Fairburn.


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019