Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need help with this translation

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
hello, I am dying to know how to do this.Can some help me translate this c++ loop into assemly, please.


----- C++ ----------------
int abc[9];
for(int count=0;count<8;count++)
{
abc[count]=911; initialize each element to 911
}

for(count=0;count<8;count++)
{
cout<<abc[count]<<endl; \\now to access array and print
}

Can someone be kind enough and translate this
tiny code snipplet? thabbks

 
What OS? Presumably DOS, but what?

Code:
.MODEL SMALL

.DATA
abc     dw 9 dup (?)


.CODE
start:
        mov     si,0
loop1:
        mov     abc[si],911
        add      si,2
        cmp     si,18
        jb      loop1

;As for the second loop....
;Well, first you need to know how to output a number
;I'm pretty sure you can figure that out









;You can't??









;Okay: First, convert the number to a string.
;THEN output the string, using the OS function
;of your choice.  In a loop  of course, you're
;doing an array!












;So how do you convert a number to a string?
;Well... you can always try to find out...
;:-)

END start
&quot;Information has a tendency to be free. Which means someone will always tell you something you don't want to know.&quot;
 
Marvelous, you gave me exactly what I wanted to know.
Thanks AmkG
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top