beautypg.com

High16 and low16 operators, Ftol operator, Ltof operator – Zilog Z8F0130 User Manual

Page 314

background image

Using the Macro Assembler

UM013037-1212

290

Zilog Developer Studio II – Z8 Encore!
User Manual

HIGH

<expression>

HIGH

(and

LOW

) takes the entire expression to the right of it as its operand. This means that

an expression such as

HIGH(PAOUT)|LOW(PAOUT&%f0)

is parsed as, in effect,

HIGH((PAOUT | LOW(PAOUT & %f0)))

If

HIGH

is only intended to operate on

PAOUT

in this example, its operation must be

restricted with parentheses.

For example:

(HIGH(PAOUT))|LOW(PAOUT&%f0)

HIGH16 and LOW16 Operators

The

HIGH16

and

LOW16

operators can be used to extract specific 16-bit words from an

integer expression. The

LOW16

operator extracts the word starting at bit 0 of the expres-

sion; the

HIGH16

operator extracts the word starting at bit 16 of the expression.

HIGH16

and

LOW16

can also be used to extract portions of a floating-point value.

For example:

# LOW16 (X) ; 16 least significant bits of X

# HIGH16 (X) ; 16 most significant bits of X

.FTOL Operator

The

.FTOL

operator can be used to convert a floating-point value to an integer.

For example:

fval equ 12.34

segment CODE

LD r0,#.FTOL(fval) ; 12 is loaded into r0.

.LTOF Operator

The

.LTOF

operator can be used to convert an integer value to a floating-point value.

For example:

val equ 12

fval DF .LTOF(val)