i'm totally green with assembly language. Now I need to learn it, I always wanted before to to learn this language for my own, but time, never had enough of time.
Now I need to learn it from zero - to pass the laboratory at university.

Mainly I'm reffering to "Programming from the Ground Up" book, but it lacks for some basics and I'm getting lost very often.

I have 2 esscersises to do:

1. Get a text string, invert the letters and show inverted on the screen.
2. Get the 64bit dec number, save it in U2 (two's complement) in memory and show on the screen in hex.

the first one i thought to do like saving to stack, but the letters is one WORD (4bits), stack is 32 or 16bits, so I'm wasting a lot of memory.
the second idea is to double the string and exchange first with last letter and so on to the center.

i've made so, but alerts that i can't access the memory:



.align 32


msg_hello: .ascii "abc"
msg_hello_len = . - msg_hello

msg_inv: .ascii "    "

.global _start

   mov $msg_hello, %ecx
   mov $msg_hello_len, %edx
   mov $3, %ebx

   mov $0, %edi
   movl msg_hello(,%edi,8), %eax

   pushl %eax
   dec %ebx

#   cmpl $0, %ebx #jezeli flaga zero nie ustawiona to skacz
#   jnz send_stack

   pop %eax
   movl %eax, msg_hello

   mov $SYSWRITE, %eax
   mov $STDOUT, %ebx

   int $0x80

   mov $SYSEXIT, %eax
   mov $EXIT_SUCCESS, %ebx

   int $0x80 

I don't understand the Intel asm, barely AT&T.

About the second task I don't know how to start... how to export the string to the U2? Somebody said something about prefixes... Don't ask me what that mean.

Please help me to understand this and have better start.

U2 (two's complement)

2 's complement means inverting each bit (i.e. 0 becomes 1 and 1 becomes 0). And then add 1 to whatever number you get .That will give you 2's complement of that number

Edited 4 Years Ago by DJSAN10

This article has been dead for over six months. Start a new discussion instead.