 |
_rom_call_addr_concat |
Function (Macro) |
#define _rom_call_addr_concat(intindex,romindex) (__jmp_tbl [intindex]) |
Returns a void pointer to a TIOS ROM call (internal).
_rom_call_addr_concat is an internal macro which is used by
_rom_call_addr and
_rom_call.
intindex contains the index of the ROM call as a numeric constant. It
is used in this definition, as an array subscript for
__jmp_tbl, a pointer to the table of ROM calls.
romindex contains a symbol in the form _ROM_CALL_xxx
,
where xxx is the index in hexadecimal form without the '0x'
prefix.
Other header files override this definition to use romind instead.
In particular, doors.h includes a
romsymb.h
header file which defines a list of external variables
for all ROM call symbols which may appear in romindex, and changes the
definition to:
#define _rom_call_addr_concat(intindex,romindex) (&romindex)
You probably wonder why _rom_call_addr_concat exists at all, since other
header files might as well override _rom_call_addr,
which could be used directly by _rom_call.
The reason is that all arguments which are not concatenated are
scanned for macros that have to be expanded.
If _rom_call was using
_rom_call_addr, passing index to
it, then the index parameter would be scanned. This turns out to be fatal
if the user defines a macro such as A1
, and uses the ROM call with
the index 0xA1
.
Therefore, both _rom_call_addr and
_rom_call have to use concatenation on their
index parameter. Then they pass the resulting symbols to _rom_call_addr_concat.