TIP: Click on subject to list as thread! ANSI
echo: 80xxx
to: DANNY CAUTAERT
from: JAN WAGEMAKERS
date: 1997-12-07 09:01:00
subject: leal

Hi Danny,
Danny Cautaert wrote to Jan Wagemakers :
 JW>> pushl $currenttime
 DC> I don't know AT&T syntax but aren't you pushing a value here?
No.
/*
movl $var, %eax
        Move the address of var into %eax
*/
I know, it is a little-bit confusing that :
        "pushl $currenttime" push the address of currenttime on the stack
and :
        "pushl $0" push the value zero on the stack
 DC> You have to push a pointer, ie, the address of the memory-location
 DC> containing the time-structure
Yes, I know... that is what I am doing ;-)
If you take a look at the following 'program' you'll see that
"pushl $message" push the address of message on the stack :
/* (prog.s)
        .globl main
main:
        pushl %ebp
        movl %esp,%ebp
        movl $20,%eax   # Maak eax gelijk aan 20
        movl $10,%ecx   # ecx = 10 voor de loop instruktie
lus:
        pushl %eax      # Bewaar eax op de stack
        pushl %ecx      # Bewaar ecx op de stack
        pushl %eax      # Zet eax op de stack voor printf
        pushl $message  # Zet het adres van message op de stack voor printf
        call printf     # doe printf
        addl $8,%esp    # pushl %eax + pushl $message = 2 * 4 = 8
        popl %ecx       # Haal originele ecx terug van de stack        
        popl %eax       # Haal originele eax terug van de stack
        incl %eax       # eax = eax +1
        loop lus        # loop ecx
        movl %ebp,%esp
        popl %ebp
        ret
message:
        .ascii "EAX heeft nu de waarde van : %d \n\0"
*/
gcc prog.s -o prog
prog
Bye.                                   - Jan Wagemakers - 
 
o_o UNIX is user friendly. It's just selective about who it's friends are. 
--- Terminate 5.00/Pro /Linux.DosEmu.JanW-DOS(PTS)
---------------
* Origin: No time to cry (2:292/854.19)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.