[futurebasic] Re: Inline Assembly - assem. newbie Question

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : December 1997 : Group Archive : Group : All Groups

From: wave@... (M Goodes)
Date: Thu, 4 Dec 1997 17:48:02 -0500
>Ok. I'm just getting in to Assembly, to do some OSA stuff. Basically,
>before this I haven't written a lick of Assembly, and so I need some
>answers. I have figured out how to call toolbox functions (eg: CALL SysBeep
>() in assem. would be _SysBeep, and CALL Debugger () would be _Debugger,
>right?). And this much I learned from the FB Ref. Manual. :)

Actually, to call SYSBEEP you first have to put a parameter on the stack,
like this:
`  move.w #1,-(sp)
`  dc.w  $A9C8

>Well, I figured that much out, but I don't see how to pass parameters with
>the toolbox calls. Such as, in the toolbox call DebuggStr, it takes one
>parameter, a string. How would I pass Debuggstr something like "FOOBAR"?
>Would I MOVE "FOOBAR" into the a6, or a7, or what?

My assembler header files don't have this documented, so I'm not sure if
this is what we would call a stack-based call or a register-based call.  If
it is stack-based, then this should work:

clear local
dim d$,d&
local fn TestDebug
  ` move.l  ^d&,-(sp)
  ` dc.w  $ABFF
end fn

>What about functions with >1 parameters?

The chapter called "Adding New Toolbox Routines" in the FB manual explains
this very well.  But to do your own translations of Toolbox routines you
really need to have good assembler header files or the relevant IM volume
for the routine you are using.   I got my header files from LightSoft when
I bought Fantasm (an assembler environment).  But as you can see, it didn't
include everything.  In fact, it always seems to be missing the ones people
ask about here...

Use e-mail with integrity.
Mark Goodes (wave@...)