HPlogo System Debug Reference Manual > Chapter 11 System Debug Standard Functions

func symaddr

MPE documents

Complete PDF
Table of Contents
Index

E0201 Edition 4 ♥
E0300 Edition 3
E0692 Edition 3

Returns the bit- or byte-relative offset of a component specified through the path specification, relative to the outer structure.

Syntax



   symaddr (pathspec [units])  

Formal Declaration



   symaddr:u32 (pathspec:str [units:u16=8]) 

Parameters


pathspec

A path specification, as described in chapter 5, "Symbolic Formatting/Symbolic Access."

units

Specifies the units (that is, bit width) in which the result is given. 1 means bits, 8 means bytes, 32 means words. The default is bytes.

Symbolic offsets are rounded down to the nearest whole unit.

Examples



   $nmdebug > symopen gradtyp.demo

Opens the symbolic data type file gradtyp.demo. It is assumed that the Debug variable addr contains the address of a StudentRecord data structure in virtual memory. The following code fragment is from this file:

   CONST     MINGRADES   = 1;     MAXGRADES   = 10;
             MINSTUDENTS = 1;     MAXSTUDENTS = 5;

   TYPE
      GradeRange    = MINGRADES .. MAXGRADES;
      GradesArray   = ARRAY [ GradeRange ] OF integer;

      Class         = ( SENIOR, JUNIOR, SOPHOMORE, FRESHMAN );
      NameStr       = string[8];

      StudentRecord = RECORD
                        Name      : NameStr;
                        Id        : Integer;
                        Year      : Class;
                        NumGrades : GradeRange;
                        Grades    : GradesArray;
                      END;

   $nmdebug > wl SYMADDR("StudentRecord.Name")
   $0 

Print the byte offset of the name field for StudentRecord. Since it is the first item in the record, its offset is zero.

   $nmdebug > wl SYMADDR("StudentRecord.NumGrades"  1)
   $a8 

Print the bit offset of the NumGrades field for StudentRecord.

   $nmdebug > wl SYMADDR("StudentRecord.Grades[4]" #32)
   $9 

Print the word offset of the fourth element of the grades field for StudentRecord.

Limitations, Restrictions


none




func strwrite


func symconst