modules

1 view
Skip to first unread message

Patrik Tkáč

unread,
Dec 1, 2010, 1:55:38 AM12/1/10
to atala...@googlegroups.com
Hello,

How exactly shold I create my own application module?
It is not clear for me.
In rmt.atl there si a code snippet "instr call". What does it mean?
How can I create my own interface between atalan language and asm code?

patarik

rudla

unread,
Dec 1, 2010, 3:49:41 AM12/1/10
to Atalan Programming Langugage
Declare procedure without giving it a body.

For example (_sys_div8) from m6502.atl:

:::::::::::::::::::::
_TEMPW1@$32:CARD
_sys_div8:proc a@_TEMPW1:card b@_a:byte >res@_a:byte
>remainder@_x:byte
:::::::::::::::::::::

Note how arguments are placed to specified variables/registers (_a, _x
being processors registers).
This actually defines the interface to your function.

_TEMPW in this case is variable placed at specific address defined by
your routine.

Now you can write call using instr command (which is kind of build in
assembler - only with compiler instructions).

:::::::::::::::::::::
instr
let _TEMPW1, DIVIDENT
let _a, DIVISOR
call _sys_div8
let RESULT, _a
let REMAINDER, _x
:::::::::::::::::::::

This could be put in macro, which will allow nicer calls.

Important instruction used when interfacing to foreign functions is
REF.
It declares the variable as being used (without actually telling how).
So if your routine uses for example variable X, but it is not part of
the input or output arguments, you may need to specify REF x after
call to the function.


For next Atalan version, I will provide for direct calls, so you would
be able to call _sys_div8 directly like:

v,rem = _sys_div8 13 5

Rudla





rudla

unread,
Dec 1, 2010, 5:01:24 AM12/1/10
to Atalan Programming Langugage
The support for direct calls has been commited. Now you can call the
defined _sys_div8 routine like


v,rem = _sys_div8 13 5

"[v] [rem]"

and it works.

Patrik Tkáč

unread,
Dec 1, 2010, 5:04:22 AM12/1/10
to atala...@googlegroups.com
Thanx. :-)



2010/12/1 rudla <rudla...@gmail.com>
Reply all
Reply to author
Forward
0 new messages