View Single Post
Old Dec 26th, 2004, 4:06 AM   #1
Lance
Programmer
 
Lance's Avatar
 
Join Date: Oct 2004
Location: Chicago, IL USA
Posts: 74
Rep Power: 5 Lance is on a distinguished road
Send a message via AIM to Lance
So I'm fairly new at Assembly, but I get the jist of it. I'm trying to learn AT&T syntax, and the sort, but it's proving a bit difficult to adjust to.

This is supposed to be an infinate loop incrementation, that just prints the numbers as they increment. That's it. Can anyone point out where I went wrong? All criticism and tips would be great, as long as their is an explaination why I did it wrong.

.bss
count:
    .long 0

.text
.globl main

main:
    movl  $5,%eax
    movl  $1,%ebx
repeat:
    movl  $count,%ecx
    movl  $count,%edx
    int   $0x80

    incl  count
    jmp   repeat

    ret

I'm pretty sure using the BSS segment as a var for a simple incrementation is stupid, but I'm trying to figure out how using variables really works. I've tried this with the %esp and #esi register just to see if my usage of $count is wrong, but it turns out the same.

Any help would be nice.
__________________
/* LANCE */
C++;  /* this makes C bigger but returns the old value */
char *site = "slackwise.net",
     *home = "lance.slackwise.net",
     *pics = "flickr.com/photos/slackwise";
Lance is offline   Reply With Quote