Zilog Z8F0130 User Manual
Page 266
![background image](https://www.manualsdir.com/files/771166/content/doc266.png)
Using the ANSI C-Compiler
UM013037-1212
242
Zilog Developer Studio II – Z8 Encore!
User Manual
or far data, or, if the pointer is to const data, in ROM. The naming of these functions is
straightforward, as follows:
If
foo(void* p1,const void* p2)
is a standard library function taking parameters
pointing to the default memory space, then the following the following additional library
functions are defined:
•
f_f_foo(far void* p1, const far void* p2)
takes pointers to far (12-bit)
memory
•
f_n_foo(far void* p1, const near void* p2)
takes pointers to far (12-bit)
memory and near (8-bit) memory
•
f_r_foo(rom void* p1, const near void* p2)
takes pointers to far (12-bit)
memory and rom (read-only 16-bit) memory
•
n_f_foo(near void* p1, const far void* p2)
takes pointers to near (8-bit)
memory and far (12-bit) memory
•
n_n_foo(near void* p1, const near void* p2)
takes pointers near (8-bit)
memory
•
n_r_foo(near void* p1, const near void* p2)
takes pointers to near (8-
bit) memory and rom (read-only 16-bit) memory
There are no
r_X_foo()
variants, because the first parameter to
foo()
is not
const
.
foo
is
#defined
to either
n_n_foo
or
f_f_foo
depending on memory model, but the
unadorned
foo()
function still exists in the run-time library.
In most cases, the return type must be the type of one of the parameters. One special case
is the
malloc()
function, which takes only a
size_t
parameter. In addition to
mal-
loc()
, there is
an f_malloc()
, which allocates from far memory, and
n_malloc()
,
which allocates from near memory.
Finally, the standard format strings for
printf()
,
scanf()
and their variants are
enhanced by providing a syntax to specify that a pointer parameter points into near, far, or
rom memory:
"%Ns"
formats or reads a string in near memory.
"%Fs"
formats or reads a string in far memory.
"%Rs"
formats or reads a string in ROM memory.
"%Np"
formats a pointer to near memory.
"%Fp"
formats a pointer to far memory.
"%Rp"
formats a pointer to ROM memory.
"%Nn"
saves the number of characters generated so far to an integer in near memory.
- Z8F0131 Z8F0230 Z8F0231 Z8F0430 Z8F0431 Z8F043A Z8F0830 Z8F0831 Z8F083A Z8F1232 Z8F1233 Z8F0113 Z8F011A Z8F0123 Z8F012A Z8F0213 Z8F021A Z8F0223 Z8F022A Z8F0411 Z8F0412 Z8F0413 Z8F041A Z8F0421 Z8F0422 Z8F0423 Z8F042A Z8F0811 Z8F0812 Z8F0813 Z8F081A Z8F0821 Z8F0822 Z8F0823 Z8F082A Z8F0880 Z8F1621 Z8F1622 Z8F1680 Z8F1681 Z8F1682 Z8F2421 Z8F2422 Z8F2480 Z8F3221 Z8F3222 Z8F3281 Z8F3282 Z8F4821 Z8F4822 Z8F4823 Z8F6081 Z8F6082 Z8F6421 Z8F6422 Z8F6423 Z8F6481 Z8F6482 Z8FS021A ZMOT1AHH Z8FS040B ZMOT0BHH ZMOT0BSB Z8FMC04 Z8FMC08 Z8FMC16