Mail Archives: djgpp/1996/07/31/01:45:17
Xref: | news2.mv.net comp.os.msdos.djgpp:6587
|
From: | 004277a AT dragon DOT acadiau DOT ca (Hafiz Awang Pon)
|
Newsgroups: | comp.os.msdos.djgpp
|
Subject: | inline assmebly problem
|
Date: | 31 Jul 1996 03:39:20 GMT
|
Organization: | Your Organization
|
Lines: | 36
|
Message-ID: | <4tmkh8$2t3@News.Dal.Ca>
|
NNTP-Posting-Host: | slip-34.acadiau.ca
|
Mime-Version: | 1.0
|
To: | djgpp AT delorie DOT com
|
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp
|
I am attempting to write an assembly equivalent
of this c code
tmaploop = x1;
do {
arrvstep[tmaploop] = vstep;
vstep = vstep + vvar;
tmaploop++;
}while (tmaploop <= x2);
where vstep, vvar is long, arrvstep is an array of long
and tmaploop, x1 and x2 is int.
here is the code below
asm ("movw %0,%%cx":: "g" (x1):"%cx");
asm ("movw %0,%%dx":: "g" (x2):"%dx");
asm ("movl %0,%%esi":: "g" (&(arrvstep[x1])):"%esi");
asm ("movl %0,%%eax":: "g" (vstep):"%eax");
asm ("movl %0,%%ebx":: "g" (vvar):"%ebx");
asm ("prc1: movl %eax, (%esi)");
asm ("addl $0x4, %edi");
asm ("addl %ebx, %eax");
asm ("inc %cx");
asm ("cmp %dx, %cx");
asm ("jbe prc1");
the problem i'm encoutering is that the value inside the
array is not what i expected. After putting some test
variables into the program, I suspect some values
in the registers has been altered not in the manner
dictated by my code above. can someone help?
004277a AT dragon DOT acadiau DOT ca
- Raw text -