beautypg.com

Push (push from offset to tos), Push1 (push short from offset to tos), Push4 (copy top 4 bytes of stack, push tostack) – Echelon Neuron User Manual

Page 199: Push4 (copy top 4 bytes of stack, push to stack)

background image

_push (Push from Offset to TOS)

This function is used to fetch a location from the stack. It can be thought of as an

extension to the instruction PUSH [DSP][offset], which reads a value from the

stack and places it in TOS. For _push, the offset is two less than what would be

used in the PUSH instruction.

Stack Transformation: (offset, …, value, … -- value, …, value, …)
Location: Near
Registers Affected: None

Example:
This example does the equivalent of a PUSH [DSP][-3].

; (a, b, c, d, e)

push #@lb(-d’5) ; (-d’5, a, b, c, d, e)

call _push ; (e, a, b, c, d, e)

_push1 (Push Short from Offset to TOS)

This function is very similar to _push. The difference is that –d’18 is added to

the offset prior to use. This allows PUSHS to be used to push the offset, and thus

it is more efficient to pass in the offset.

Stack Transformation: (offset, …, value, … -- value, …, value, …)
Location: Near
Registers Affected: None

Example:
This example does the equivalent of a PUSH [DSP][-9].

; (a, b, c, d, …, h, i, j, k)

pushs #7 ; (7, a, b, c, d, e)

call _push1 ; (k, a, b, c, d, …, j, k)

_push4 (Copy Top 4 Bytes of Stack, Push to

Stack)

This function duplicates the first four bytes on the stack.

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

Neuron Assembly Language Reference

189