TIP: Click on subject to list as thread! ANSI
echo: 80xxx
to: JAN WAGEMAKERS
from: TOM TORFS
date: 1997-11-24 16:33:00
subject: leal

Jan Wagemakers wrote in a message to All:
 JW> I have asked in Cprog.B a question about how it is possible with
 JW> the C-programming-language to get the current time. I have get
 JW> there a really useful answer and even have learned some things
 JW> about C :-)
Thanks for the free advertising  (in case anyone wonders, I moderate the 
above mentioned echo)
 JW> I don't understand what "leal -4(%ebp),%eax" exactly do.
Load effective address of ebp-4 into eax, in other words the equivalent of 
mov eax,ebp followed by sub eax,4.
 JW>         pushl %ebp
 JW>         movl %esp,%ebp
the above code sets up a stack frame
 JW>         subl $8,%esp
assigns 8 bytes on the stack for local variables
 JW>         leal -4(%ebp),%eax
load the address of a certain local variable (t) at ebp-4 in eax
 JW>         pushl %eax
and push it as a parameter to time()
 JW>         call time
and call time()
 JW>         addl $4,%esp
free the pushed parameter
 JW>         leal -4(%ebp),%eax
load the same address again in eax
 JW>         pushl %eax
and push it again as a parameter to localtime()
 JW>         call localtime
call localtime()
 JW>         addl $4,%esp
and free the pushed parameter again
greetz,
Tom
tomtorfs@mail.dma.be
--- timEd/2 1.10+
---------------
* Origin: 80X86 BBS 32-15-24.62.32 V.34/V.FC (24h/24h) (2:292/516)

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™.