SourcePoint AMD Help

Table of Contents

define

Create a debug object.

Syntax

define debug-proc

define [global] data-type name [=expr]

define [global] data-type name [array-size]

Where:

debug-proc

specifies a debug procedure definition.

name

specifies a unique, user-defined name for the object being defined.

global

indicates that a debug variable is globally recognized. Data types are global unless defined inside a debug procedure.

data-type

specifies an emulator data type.

expr

is an expression that assigns an initial value to the object.

array-size

is an expression indicating the size of a debug variable array.

Discussion

Use the define command to define a debug variable or a debug procedure. ย A debug object name cannot be the same as a reserved keyword in the command language. If the name specified is the same as a previously defined debug object, then that object is overwritten.

An initial value may be assigned to a debug variable. If no initial value is specified, the variable is assigned a default value, depending on its data type:

Type

Default Value

ordn, intn

0

nstring

""

bool

false

ptr

invalid

Arrays of debug variables can also be created. For more information see Debug Variables. ย For more information on defining a debug procedure, see Debug Procedures.

Example 1

To define a debug variable:

Command input:

define int2 max = 400
max

Result:

0400H

Example 2

The following example shows how to define a procedure named "power." This proc returns the result of a value and its exponent.

Command input:

define proc power(arg1, arg2)

define int1 arg1

define int1 arg2

{

ย ย ย define int1 index

ย ย ย define ord4 result = 1

ย ย ย for (index = 1 ; index <= arg2 ; index += 1)

ย ย ย ย ย ย result = result * arg1

ย ย ย return result

}

power(2,4) ย ย ย ย ย ย ย ย ย ย ย // execute the proc

Result:

16T

Related Topics: