> `.data' tells `as' to assemble the following statements onto the end
> of the data subsection numbered SUBSECTION (which is an absolute
> expression). If SUBSECTION is omitted, it defaults to zero.
Like .data 1 ??
It does sound like a bit of gobbledy-gook... Another puzzle
I've found is in using the debugger (yes, I finally got it
talking to me). I can't find the variables in the .data segment,
only the ones in the .text (aka code) segment. Why?
Also found that .labels are local to the procedure. The uses for
this will become apparent eventually. ;-)
BTW, here's my ~/asm/.gdbinit in case you are as confused as I am.
echo \n
break main
commands
info registers
end
(you can abbreviate most things, example: i r for info registers)
This assumes your code begins with 'main:'. Load up gdb with your
binary and type 'run'. It will immediately break on main and do a
register dump. That was the biggest hurdle to me, it doesn't know
anything about the program until you run. Load it up with the
program and its core file, gdb will try to tell you where it broke. :-)
; nasm aascii.asm -o aascii.o
; gcc aascii.o -o aascii
global main
extern printf
extern putchar
section .text
main:
push ebp ;Save these for gdb.
mov ebp,esp ;
mov ebx,33 ;Start with character 33, !
l1:
push ebx ; %c
push ebx ; %d
push dword msg ; The text portion: " %d=%c "
call printf ;Print the code and character
add esp,8
inc bl
cmp bl,0 ;Characters 33 to 255,
jnz l1 ; if BL rolls to 0 we are done.
mov eax,10
push eax ;Print a linefeed.
call putchar
mov esp,ebp ;Clean up and
pop ebp ; exit.
ret
section .data
msg db 9," %d=%c ",0
--- ifmail-tx (i386 Linux)
---------------
* Origin: jvahn@short.circuit.com (1:346/15.1@fidonet)
|