www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/02/05/08:15:43

From: "Rylan" <rylan AT intekom DOT co DOT za>
Newsgroups: comp.os.msdos.djgpp
Subject: Parameters for NASM
Date: 5 Feb 1998 13:00:48 GMT
Organization: The South African Internet Exchange.
Lines: 43
Message-ID: <01bd3235$1bc20ec0$LocalHost@default>
NNTP-Posting-Host: pc25-01-p03.saix.net
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Hi,

I know how to pass 1 paramter to a function in NASM:

SECTION .data

	pwhere	EQU 8

and then

mov     eax,[ebp + pwhere]

to get the parameter from the stack into eax, in the NASM module. 

The C function:

extern void volatile clearhid(unsigned char pcolor);

And the call:

clearhid(1); //supposed to set the hidden page to deep blue

My question: how do you pass a second parameter to the NASM function from
C?
I've tried replacing "phwere" with a label that equals 10, 12 and 14 with
no success. What is the number to add in the "mov eax,[ebp + ????]" above
to get at the second parameter stored on the stack by the DJGPP C compiler?

I read that C stores parameters to a function on the stack in reverse
order. Should I then use an index value of 8 + ??? for the first parameter
to the function, and just 8 for the second parameter? What is the number to
use where ??? is to access second, third and n parameters?

The grand question then: how to pass multiple parameters between Nasm and
C, using the stack?

Please reply by mail if possible.

Any replies appreciated! :)
-- 
Spawned By Rylan
Is truth beauty or beauty truth?

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019