[comp.sys.amiga] amiga.lib calls...

BBOURBIN@UMDD.BITNET (02/10/88)

    Does anyone know how to all routines in the amiga.lib library from
assembly language?  I know that the parms are passed on the stack but what
is the procedure name that has to be called; is it in the form "LVOCreatPort"
or is it just "CreatePort" or "_CreatePort" and does it have to be XREF'ed at
the start of the program?

    Also, if you have created a program and have it startup instead of
Workbench, and issue a ENDCLI command afterwards, will it also release the
input.device so I do not have to do a SetMPort to a -1?

Thanks for any help you offer.

- Brett Bourbin
  President of SELGUS LTD.

  BITNET:  bbourbin @ umdd

steveb@cbmvax.UUCP (Steve Beats) (02/10/88)

In article <8802091727.AA09035@jade.berkeley.edu> BBOURBIN@UMDD.BITNET writes:
>
>    Does anyone know how to all routines in the amiga.lib library from
>assembly language?  I know that the parms are passed on the stack but what
>is the procedure name that has to be called; is it in the form "LVOCreatPort"
>or is it just "CreatePort" or "_CreatePort" and does it have to be XREF'ed at
>the start of the program?
>

Yes, just prefix whatever you want to call with '_LVO' ie. _LVOAllocMem.
You should XREF all library calls you use in any given module.

	Steve

mills-cl@cedar.cis.ohio-state.edu (christopher mills) (02/11/88)

[]

>    Does anyone know how to [c]all routines in the amiga.lib library from
>assembly language?

	I certanly hope so.

	The ones with the LVO's are called with the parameters in registers,
relative to the library base pointer in A6, ie:

	xref	LVOOpenScreen
	move.l	_IntuitionBase,a6
	lea	newscreen,a0
	jsr	LVOOpenScreen(a6)

	The ones that don't have LVO's are C calls, and have their args on
the stack.  They have an underscore in front, ie:

	xref	_OpenScreen
	pea	newscreen
	jsr	_OpenScreen

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
 _____________________           |     Christopher Mills.
(_)________________   \          |     mills-cl@polaris.cis.ohio-state.edu
  ________________|\   \         |
 (_)______________\_\   \        |     Current thought: Death before dongles.
   ______________________\       |
  (_)____________________|       |     DISCLAMER: I really wish I could blame
                                 |          my thoughts on someone else...
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

hamilton@uxc.cso.uiuc.edu (02/12/88)

BBOURBIN@UMDD.BITNET asks:
>
>    Does anyone know how to all routines in the amiga.lib library from
>assembly language?  I know that the parms are passed on the stack but what
>is the procedure name that has to be called; is it in the form "LVOCreatPort"
>or is it just "CreatePort" or "_CreatePort" and does it have to be XREF'ed at
>the start of the program?
>

steveb@cbmvax replies:
> Yes, just prefix whatever you want to call with '_LVO' ie. _LVOAllocMem.
> You should XREF all library calls you use in any given module.

    i think the original question was about the exec support functions
(CreatePort, DeletePort, etc), which are C routines, and not library
members - there aren't any LVO's for them.  i haven't tried to use them
from assembler, so i'm just guessing: use XREF's, prepend '_' to the name,
push the args in right-to-left order, JSR to the function, then "pop" the
args back off the stack.

	wayne hamilton
	U of Il and US Army Corps of Engineers CERL
UUCP:	{ihnp4,seismo,pur-ee,convex}!uiucuxc!hamilton
ARPA:	hamilton@uxc.cso.uiuc.edu	USMail:	Box 476, Urbana, IL 61801
CSNET:	hamilton%uxc@uiuc.csnet		Phone:	(217)333-8703
CIS:    [73047,544]			PLink:  w hamilton

FATQW@USU.BITNET (02/15/88)

In article <3299@cbmvax.UUCP> steveb@cbmvax.UUCP (Steve Beats) writes:
>In article <8802091727.AA09035@jade.berkeley.edu> BBOURBIN@UMDD.BITNET writes:
>>
>>    Does anyone know how to all routines in the amiga.lib library from
>>assembly language?  I know that the parms are passed on the stack but what
>>is the procedure name that has to be called; is it in the form "LVOCreatPort"
>>or is it just "CreatePort" or "_CreatePort" and does it have to be XREF'ed at
>>the start of the program?
>
>Yes, just prefix whatever you want to call with '_LVO' ie. _LVOAllocMem.
>You should XREF all library calls you use in any given module.
>
>        Steve

Er,...  I think using these routines in this way just might help your Amiga
along directly on a path to the GURU.  There are two ways you can call those
routines from assembly language.

If you want a more efficient, but a teeny bit harder to program, you can use
the _LVOxxxx routines, like "_LVOAllocMem".  However, these are only values,
they don't point to routines.  You use these values as an offset into the
library base pointer of the library you want to use.  You pass the parameters
in registers - you can find out the registers to use in the back of the
RKM: Exec, or in the .fd files on the Extras disk.

The other method is to use the C interfaces from assembly language.  You
call a routine called "_xxxx" like "_AllocMem".  The registers are passed
on the stack with the last one pushed first, so the first parameter is
on the top of the stack when the function gets control.  These routines
simply load the registers with the parameters you supply, then call the
appropriate _LVO offset.

One more thing:  The last method is the only way to access the routines
built into the Amiga.lib, such as CreatePort() and the others in the
exec_support library.  This is because these routines don't just call
_LVO routines, since there aren't any to call.

Well, hope this helps, and I certainly hope you can make sense from this!

                                Bryan

        Bryan Ford                    //// A computer does what \\\\
Snail:  1790 East 1400 North         //// you tell it to do, not \\\\
        Logan, UT 84321         \\\XX///  what you want it to do. \\\XX///
Email:  FATQW@USU.BITNET         \XXXX/ Murphy's Law Calendar 1986 \XXXX/