HPlogo System Debug Reference Manual > Chapter 4 System Debug Command Specifications

=

MPE documents

Complete PDF
Table of Contents
Index

E0201 Edition 4 ♥
E0300 Edition 3
E0692 Edition 3

The calculator command.

Calculates the value of an expression and displays the result in the specified base.

Syntax



   = expression [base]

Parameters


expression

The expression to evaluate.

base

The desired representation mode for output values:

% or octal

Octal representation

# or decimal

Decimal representation

$ or hexadecimal

Hexadecimal representation

ASCII

ASCII representation

This parameter can be abbreviated to a single character.

If omitted, the current output base is used. Refer to the SET command to change the current output base.

String expressions (of four or fewer characters) are automatically coerced into a numeric value when the display base of octal, decimal, or hexadecimal is specified.

Examples



   %cmdebug > = 12 + #10 + $a, d
   #30

What is octal 12 (current input base) plus decimal 10 plus hex a, in decimal?

   %cmdebug > = 5 + (-2)
   %3

Negative values that follow immediately after an operator (+, -, *, /) must be placed within parentheses.

   %cmdebug > = 'ABCD'
   'ABCD'
   %cmdebug > = 'ABCD',h
   $41424344

In the second example, the string is coerced into a hexadecimal value.

   %cmdebug > = [dst 12.100] + [db+4], $
   $4820

The sum of the contents of data segment 12.100 plus the contents of DB+4, displayed in hexadecimal.

   %cmdebug > = fopen
   SYS %22.4774

What is the start address of the CM procedure FOPEN?
The address is returned as logical code address.

   %cmdebug > = ?fopen
   SYS %22.5000

What is the entry point address of the CM procedure FOPEN?
The question mark is used (CM) to indicate entry point, rather than start address.

   $nmdebug > = [r12]
   $c04

The indirect contents of register 12.

   $nmdebug > = vtor (c.c0000000)

   $0020800
   $nmdebug > = rtov (20800)
   $c.c0000000

Translate a virtual address to a real address and then back again.

   $nmdebug > = 1 << 2
   $4

The value 1, left-shifted by two bits.

   $nmdebug > = $1234 band $ff
   $34

The value $1234, Bit-ANDed with the mask $ff.

   $nmdebug > = sendio
   SYS $a.$219ef0

What is the start address of NM procedure sendio?

   $nmdebug > = ?sendio
   SYS $a.$217884

What is the address of the export stub for NM procedure sendio?
Note the different use of "?" in CM and NM. In CM "?" is used for entry address, while in NM "?" is used for export stub.

   $nmdebug > = strup("super") + 'duper'
   "SUPERduper"

The calculator accepts string expressions as well as numeric expressions.

Limitations, Restrictions


none




:


ABORT