beautypg.com

Sub16 (subtract, 16 bit), Sub16s (subtract signed, 16 bit) – Echelon Neuron User Manual

Page 203

background image

_sign_extend16 (Convert 8 Bit to 16 Bit, Preserve

Sign)

This function sign extends an 8-bit value. If the most-significant byte (MSB) of

the value is 1, then the high byte is 255; otherwise it is 0.

Stack Transformation: (value -- valuelo, valuehi)
Location: Near
Registers Affected: None

Example:
This example sign extends -2.

push #@lb(-d’2) ; (h’fe)

call _sign_extend16 ; (h’fe, h’ff)

_sub16 (Subtract, 16 Bit)

This function subtracts two 16-bit integers.

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

Example:
This example subtracts 50 from 300.

pushd #d’300 ; (d’44, 1)

pushd #d’50 ; (d’50, 0, d’44, 1)

call _sub16 ; (d’250, 0)

_sub16s (Subtract Signed, 16 Bit)

This function subtracts two signed 16-bit integers.

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

Example:
This example subtracts 50 from 300.

pushd #d’300 ; (d’44, 1)

Neuron Assembly Language Reference

193