Initial commit of files related to NED architecture.
[ned1] / software / assembly_fragments / subroutines / sr_subtract.asm
CommitLineData
bc5b63cf
AT
1subtract
2# Description:
3# Performs X-Y and returns result on TOS.
4# Stack Requirements:
5# Y Operand
6# X Operand
7# Return PC <-- TOS
8
9# Place Return PC at bottom of stack.
10LDSP+2
11LDSP+1
12STSP+3
13STSP+0
14
15# Stack now looks like:
16# Return PC
17# X Operand
18# Y Operand <-- TOS
19
20# Negate Y
21NOT
22IM_1
23ADD
24
25ADD # Perform X + (-Y)
26
27SWAP # Put result behind Return PC on the stack.
28RTS
29