cancel
Showing results for 
Search instead for 
Did you mean: 

ST7 Assembler: function/label with parameter

chill_just_chill
Associate II
Posted on April 30, 2003 at 06:55

ST7 Assembler: function/label with parameter

3 REPLIES 3
chill_just_chill
Associate II
Posted on April 10, 2003 at 09:34

Hello,

how can you pass an argument with ST7 assembler?

LED DS.B $a7,$01,$9B,.... (array in rom)

..

call function(LED)

..

function (LED)

Is this possible and how ?

tia
itsmejatinus
Associate II
Posted on April 22, 2003 at 09:06

Hi,

One way is that you can pass arguments using X,Y registers.

Other way is push the arguments on to the stack before calling the function and then in the function you can first pop PCH (program counter higher byte) then Program counter lower byte PCL , save them and then poping your arguments.

Before executing ret instruction again push the PCH & PCL values.

stephanie
Associate II
Posted on April 30, 2003 at 06:55

You can also use macros. Macros enable to have parameters.

The syntax is the following one:

macro_name MACRO [parameter_1] [, parameter_2...] [LOCAL label_name]

[Body_of_the_macro]

MEND

But take care that each time you invoke a macro to do a particular job, the whole macro assembly code is inserted into your source code. A macro is a faster way to execute code: there is no stacking for return addresses (less stack activity)