sub.s 1013 Bytes

/*	
 *
 */


 #
 # define some symbolic registers to make this clearer: (I hope)
 #
.name	s_int,		$v2
.name	s_frac,		$v3
.name	t_int,		$v4
.name	t_frac,		$v5
.name	res_int,	$v6
.name	res_frac,	$v7
.name	invres_int,	$v8
.name	invres_frac,	$v9
.name	dev_null,	$v0	

.name	in_base,	$20	
.name	in_sip,		$21	
.name	in_sfp,		$22	
.name	in_tip,		$23	
.name	in_tfp,		$24
.name	out_ip,		$25
.name	out_fp,		$26

#define	TASKDATABASE	0x3000		

	addi	in_base, $0, TASKDATABASE
	addi	in_sip, in_base, 0	# s int
	addi	in_sfp, in_base, 2	# s frac
	addi	in_tip, in_base, 4	# t int
	addi	in_tfp, in_base, 6	# t frac
	addi	out_ip, in_base, 16	# result hi
	addi	out_fp, in_base, 18	# result lo
	
main:	# get s and t:	
	lsv	s_int[0], 0(in_sip)
	lsv	s_frac[0], 0(in_sfp)
	lsv	t_int[0], 0(in_tip)
	lsv	t_frac[0], 0(in_tfp)
	nop
	nop
	nop
	nop

	vsubc	res_frac, s_frac, t_frac
	vsub	res_int, s_int, t_int
	
	nop
	nop
	nop
	nop
	nop
	nop
	vrcpdh	invres_int, res_int[0]
	vrcpdl	invres_frac, res_frac[0]
	nop
	nop
	nop
	nop
	nop
	break