| Q D E V _ H L P _ L C O P Y M E M ( )
| | | | | SOURCE: qdev_macros.txt 1.16 (12/09/2014) English
INDEP - PUBLIC
----------------------------------------------------------------------------
NAME
QDEV_HLP_LCOPYMEM() - Fast memory copy macro for small
data.
SYNOPSIS
QDEV_HLP_LCOPYMEM(to, from, len);
QDEV_HLP_LCOPYMEM(void *, void *, long);
FUNCTION
This macro allows to copy data upto 59 bytes in a fast
way by being transformed into efficient assembly with
super small overhead.
INPUTS
to - Memory address where the data will be copied to.
from - Memory address where the data will be read from.
If this is contant then generated code may/will
be even faster since it may be PC relative.
len - Size of the copy. Pass integer that is known at
compilation time to benefit from this macro! If
this value is not known then call to '_bcopy()'
will be generated...
RETURNS
No output.
BASES
None.
NOTES
None.
SEE ALSO
QDEV_HLP_QUICKFILL()
EXAMPLE
...
#define TEXT "Compile and disassemble :)"
/* ^^^^^^^^^^^^^^^^^^^^^^^^^^
L L L L L L BBB */
void routine(void)
{
UBYTE buf[32];
QDEV_HLP_LCOPYMEM(buf, TEXT, sizeof(TEXT));
printf("%s\n", buf);
}
...
LC1:
.ascii "Compile and disassemble :)\0"
LC2:
.ascii "%s\12\0"
.even
.globl _routine
_routine:
link a5,#-32
movel LC1,a5@(-32)
movel LC1+4,a5@(-28)
movel LC1+8,a5@(-24)
movel LC1+12,a5@(-20)
movel LC1+16,a5@(-16)
movel LC1+20,a5@(-12)
moveb LC1+24,a5@(-8)
moveb LC1+25,a5@(-7)
moveb LC1+26,a5@(-6)
pea a5@(-32)
pea LC2
jbsr _printf
unlk a5
rts
BUGS
None known.
----------------------------------------------------------------------------
| |
| |