Initial commit of files related to NED architecture.
[ned1] / software / assembly_fragments / subroutines / sr_subtract.asm
subtract
# Description:
# Performs X-Y and returns result on TOS.
# Stack Requirements:
# Y Operand
# X Operand
# Return PC <-- TOS
# Place Return PC at bottom of stack.
LDSP+2
LDSP+1
STSP+3
STSP+0
# Stack now looks like:
# Return PC
# X Operand
# Y Operand <-- TOS
# Negate Y
NOT
IM_1
ADD
ADD # Perform X + (-Y)
SWAP # Put result behind Return PC on the stack.
RTS