Texas Instruments MSC1210 User Manual

Page 281

Advertising
background image

Description

C-3

Boot ROM Routines

C parameters are passed to the subroutine code such that the first parameter
is passed in R7, whereas additional parameters use lower R registers (R7 first,
then R6, R5, etc.). In the case of multibyte parameters, the low byte uses the
next available R register while the high byte uses the lower R register. Thus,
the put_string routine uses R7 to receive the low byte of the address of the
string while R6 is used to receive the high byte of the address of the string.

The result or error code is returned in R7 and/or R6, with the low byte in R7
and the high byte, if any, in R6.

C.1.1 Note Regarding the put_string Function

The put_string routine was designed to print strings that are referenced when
the boot ROM is located at 0x0000 and also at 0xF800. This means that it
forces the location of the string to match the same 2K segment the program
is located in. This will lead to strange behavior if the string address is located
in a different 2K segment. For this reason it is suggested that you use the fol-
lowing code instead:

void putstring(char code * data msg)

{

while (*msg != 0)

{

tx_byte((unsigned char) *msg);

if ( *msg==\n)

tx_byte(‘\r’);

msg++

}

}

Advertising