beautypg.com

Max16 (maximum value, 16 bit), Max16s (maximum signed value, 16 bit) – Echelon Neuron User Manual

Page 188

background image

Registers Affected: None

Example:
This example uses a base of h’efe3 and an index of 10.

pushd #h’efe3 ; (h’e3, h’ef)

push #d’10 ; (d’10, h’e3, h’ef)

callf _lshift8by1_add16 ; (h’f7, h’ef)

_lshift8by2_add16 (Left Shift By 2 and Add,

Converts 8 Bits to 16 Bits)

This function takes an index, converts it to a 16-bit quantity, shifts it left twice,

and adds the result to a base value.

Stack Transformation: (index, base(2) -- base(2)+(index(2)<<2))
Location: Far
Registers Affected: None

Example:
This example uses a base of h’efe3 and an index of 5.

pushd #h’efe3 ; (h’e3, h’ef)

push #d’5 ; (d’5, h’e3, h’ef)

callf _lshift8by2_add16 ; (h’f7, h’ef)

_max16 (Maximum Value, 16 Bit)

This function computes the maximum of two unsigned 16-bit integers.

Stack Transformation: (a(2), b(2) -- max(a(2),b(2)))
Location: Near
Registers Affected: None

Example:
This example gets the maximum of 8 and 2.

pushd #d’2 ; (d’2, 0)

pushd #d’8 ; (d’8, 0, d’2, 0)

call _max16 ; (d’8, 0)

_max16s (Maximum Signed Value, 16 Bit)

This function computes the maximum of two signed 16-bit integers.

178

System-Provided Functions