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

func cmentry

MPE documents

Complete PDF
Table of Contents
Index

E0201 Edition 4 ♥
E0300 Edition 3
E0692 Edition 3

Returns the CM (primary) entry point address of the CM procedure containing the specified CM logical code address.

Syntax



   cmentry (cmlogaddr)

Entry point addresses correspond to the ENTRY column in the PMAP generated by the Segmenter. See the CM program example below.

Formal Declaration



   cmentry:lcptr (cmlogaddr:lcptr)

Parameters


cmlogaddr

A CM logical code address. The entry point of the surrounding level one CM procedure is returned as a CM logical code address.

Cmlogaddr must be a full CM logical code address (LCPTR). For example:

CMPC

Current CM program counter

CMPW+4

Top of CM program window + 4

PROG(2.102)

Program file logical seg 2 offset 102

fopen+102

CM procedure fopen + %102 (assumes CM mode)

cmaddr('fopen')+%102

CM procedure fopen + %102 (NM or CM mode)

Examples


Assume that the following single segment CM program has been compiled, linked with the PMAP`` and ``FPMAP options, and is now being executed:

   PROGRAM test (input,output);

   PROCEDURE one;
   begin {one}
     writeln('ONE');
   end;  {one}

   PROCEDURE two;

       PROCEDURE three;
       begin {three}
         writeln('THREE');
       end;  {three}

   begin {two}
     writeln('TWO');
     three;
   end;  {two}

   begin {main body} { Outer block is named "ob'" by the compiler }
     one;
     two;
   end.  {main body}

   PROGRAM FILE PTEST.DEMO.TELESUP

   SEG'              0
      NAME            STT  CODE ENTRY SEG
      OB'               1     0    13
      TERMINATE'        5               ?
      P'RESET           6               ?
      P'REWRITE         7               ?
      P'CLOSEIO        10               ?
      P'INITHEAP'3000  11               ?
      TWO               2    71   123
      P'WRITELN        12               ?
      P'WRITESTR       13               ?
      ONE               3   142   155
      SEGMENT LENGTH        210

   PRIMARY DB       2   INITIAL STACK  10240   CAPABILITY      600
   SECONDARY DB   430   INITIAL DL         0   TOTAL CODE      210
   TOTAL DB       432   MAXIMUM DATA       ?   TOTAL RECORDS    11
   ELAPSED TIME   00:00:01.365         PROCESSOR TIME   00:00.740

   END OF PREPARE


   %cmdebug > wl ob'
   PROG %0.0
   %cmdebug > wl cmstart(ob')
   PROG %0.0

Two methods of displaying the start address of the procedure ob'.

   %cmdebug > wl ?ob'
   PROG %0.13
   %cmdebug > wl cmentry(ob')
   PROG %0.13

Two methods of displaying the entry address of the procedure ob'.

   %cmdebug > wl cmstart(one)
   PROG %0.142

   %cmdebug > wl cmentry(one)
   PROG %0.155

   %cmdebug > wl cmstart(two)
   PROG %0.71

   %cmdebug > wl cmentry(two)
   PROG %0.123

Limitations, Restrictions


The names and addresses of nested CM procedures, such as procedure three, are not available within the CM FPMAP records. Addresses that fall within nested procedures (three) are returned as offsets relative to the parent procedure (two).




func cmbpinstr


func cmg