
484
Evaluating and Programming the 29K RISC Family
Service 260 – getargs
Return Base Address
Description
This service returns the base address of the command-line-argument vector,
argv
, in register
gr96
, as constructed by the operating system kernel when an applica-
tion program is invoked.
Arguments are stored by the operating system as a series of NULL-terminated
character strings. A pointer containing the address of each string is stored in an array
whose base address (referred to as
argv
) is returned by the
getargs
HIF service. The
last entry in the array contains a NULL pointer (an address consisting of all zero bits).
The number of arguments can be computed by counting the number of pointers in the
array, using the fact that the NULL pointer terminates the list.
Register Usage
Type
Regs
Contents
Description
Calling:
Returns:
gr121
260 (0x104)
Service number
gr96
baseaddr
Success: base address of argv
Failure: = 0 ( NULL pointer)
Logical TRUE, service successful
Error number, service not successful
(implementation dependent)
gr121
0x80000000
errcode
Example Call
argptr:
.word
const
asneq
jmpf
const
consth
store
0
gr121,260
69,gr1,gr1
gr121,bas_err
gr120,argptr
gr120,argptr
0,0,gr96,gr120
;service = 260
;call the OS
;jump if error
;set address where base
;pointer is to be stored
;store the pointer
The example calls operating system service 260 to access the command-line-ar-
gument vector address. If the service executes without error, the program continues
by storing the argument vector address in the variable
basptr
. If
gr121
contains a
boolean FALSE value upon return, the program jumps to
bas_err
to handle the error
condition.