home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Frozen Fish 1: Amiga
/
FrozenFish-Apr94.iso
/
bbs
/
alib
/
d5xx
/
d528
/
keymenu.lha
/
KeyMenu
/
src.lzh
/
macros.i
< prev
next >
Wrap
Text File
|
1991-08-03
|
3KB
|
93 lines
*-----------------------------------------------------------------------*
* INTUITIONNAME - defines intuition library name *
*-----------------------------------------------------------------------*
INTUITIONNAME macro
dc.b 'intuition.library',0
endm
*-----------------------------------------------------------------------*
* LIBCALL - adds the _LVO prefix to the routine name *
*-----------------------------------------------------------------------*
libcall macro * functionoffset
jsr _LVO\1(a6)
endm
*-----------------------------------------------------------------------*
* LIBLINK - saves a6, sets a6 up with libbase, restores a6 after call *
*-----------------------------------------------------------------------*
liblink macro * functionoffset,librarybase
ifgt narg-2
fail ; too many arguments
endc
move.l a6,-(sp)
move.l %2,a6
libcall %1
move.l (sp)+,a6
endm
*-----------------------------------------------------------------------*
* CALL - calls LIBCALL or LIBLINK and generates xref if necessary *
*-----------------------------------------------------------------------*
Call macro * functionname,libraryname
ifnd EXTERN_%1
EXTERN_%1 set 1
extern_lib %1
endc
ifc '%2',''
libcall %1
endc
ifnc '%2',''
liblink %1,%2
endc
endm
*-----------------------------------------------------------------------*
* BITNUM - converts a binary value to its bitnumber *
* value must be a power of 2 *
*-----------------------------------------------------------------------*
BITNUM macro * name,value
bitpos set 0
value set %2
ifgt value-128
bitpos set 8
value set value>>8
endc
ifgt value-128
bitpos set bitpos+8
value set value>>8
endc
ifgt value-128
bitpos set bitpos+8
value set value>>8
endc
ifeq value-128
bitpos set bitpos+8
endc
ifeq value-64
bitpos set bitpos+7
endc
ifeq value-32
bitpos set bitpos+6
endc
ifeq value-16
bitpos set bitpos+5
endc
ifeq value-8
bitpos set bitpos+4
endc
ifeq value-4
bitpos set bitpos+3
endc
ifeq value-2
bitpos set bitpos+2
endc
ifeq value-1
bitpos set bitpos+1
endc
%1_B equ bitpos-1 ; for bxxx.l instructions
%1_R equ (bitpos-1)//8 ; for bxxx.b instructions
endm