diff code_part1/OSTC_code_asm_part1/math.asm @ 552:44e9b961f156

Compute ppO2 for pSCR diving
author heinrichsweikamp
date Sat, 04 Feb 2012 18:23:36 +0100
parents 56da3e962e98
children e3ffc6d62a63
line wrap: on
line diff
--- a/code_part1/OSTC_code_asm_part1/math.asm	Thu Feb 02 19:43:45 2012 +0100
+++ b/code_part1/OSTC_code_asm_part1/math.asm	Sat Feb 04 18:23:36 2012 +0100
@@ -44,6 +44,26 @@
 	bra		div16
 	return
 
+sub32:  ;xC:4=xC:4-sub_c:4 (Warning: sub_c+3 trashes sub_a+0!)
+	movf    sub_c+0, W
+	subwf   xC+0, F
+
+	movf    sub_c+1, W
+	BTFSS    STATUS, C
+	incfsz sub_c+1, W
+	subwf xC+1, F
+
+	movf    sub_c+2, W
+	BTFSS    STATUS, C
+	incfsz sub_c+2, W
+	subwf xC+2, F
+
+	movf    sub_c+3, W
+	BTFSS    STATUS, C
+	incfsz sub_c+3, W
+	subwf xC+3, F
+	return
+
 sub16:	;  sub_c = sub_a - sub_b (with signed values)
 	bcf		neg_flag
 	movf   	sub_b+0, W             	; Get Value to be subtracted