Hi,
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:
#sm/unistd.h
SYSEXIT = 1
SYSREAD = 3
SYSWRITE = 4
STDOUT = 1
EXIT_SUCCESS = 0
.align 32
.text
msg_hello: .ascii "abc"
msg_hello_len = . - msg_hello
msg_inv: .ascii " "
.global _start
_start:
mov $msg_hello, %ecx
mov $msg_hello_len, %edx
mov $3, %ebx
mov $0, %edi
movl msg_hello(,%edi,8), %eax
send_stack:
pushl %eax
dec %ebx
# cmpl $0, %ebx #jezeli flaga zero nie ustawiona to skacz
# jnz send_stack
get_stack:
pop %eax
movl %eax, msg_hello
end:
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.