System Debug Reference Manual (32650-90888)

Chapter 10 407
System Debug Standard Functions
func ltos
func ltos
Long to short. Converts a virtual address to a short pointer.
Syntax
ltos (
virtaddr
)
The LTOS function converts a virtual address to a short pointer.
If the parameter
virtaddr
is already a short pointer, it is simply returned.
If the parameter
virtaddr
is a long pointer, or a full logical code address, a special
additional test is performed to ensure that the offset portion can be returned as the short
pointer value. The SID (space) portion must match the current value of the associated
space register. This ensures that the returned short pointer value can be successfully
converted back into the long pointer argument.
Formal Declaration
ltos:sptr (
virtaddr
:ptr)
Parameters
virtaddr
The virtual address to be converted to a short pointer.
Virtaddr
can be a short pointer, a long pointer, or a full logical code
pointer.
Examples
$nmdebug > wl pc
PROG $3c.12004
$nmdebug > wl ltos(pc)
$12004
$nmdebug > var save 42.40151025
$nmdebug > wl ltos(save)
$40151025
$nmdat > dr sr4
SR4=$a
$nmdat > wl ltos(22.200)
SID in LPTR for LTOS conversion does not match corresponding space reg.
Error evaluating a predefined function. (error #4240)
function is"ltos"
In this example SR4 contains $a. The function LTOS detects that the SID portion of the
long pointer ($22) does not match the value of the associated space register (SR4=$a), and
the conversion fails.