summaryrefslogtreecommitdiff
path: root/software/ihu/math.inc
diff options
context:
space:
mode:
authorChristian Pointner <equinox@mur.at>2011-08-04 23:37:25 +0000
committerChristian Pointner <equinox@mur.at>2011-08-04 23:37:25 +0000
commited86861a1662c98a3267281e9f29cbed057ca2e5 (patch)
treeb06eb6bcdc00ae549af756bf0a96b592572d1471 /software/ihu/math.inc
parentminor cleanup (diff)
added multiplication code
git-svn-id: https://svn.spreadspace.org/mur.sat@102 7de4ea59-55d0-425e-a1af-a3118ea81d4c
Diffstat (limited to 'software/ihu/math.inc')
-rw-r--r--software/ihu/math.inc240
1 files changed, 240 insertions, 0 deletions
diff --git a/software/ihu/math.inc b/software/ihu/math.inc
new file mode 100644
index 0000000..4efd391
--- /dev/null
+++ b/software/ihu/math.inc
@@ -0,0 +1,240 @@
+ ;;
+ ;; mur.sat
+ ;;
+ ;; Somewhen in the year 2011, mur.at will have a nano satellite launched
+ ;; into a low earth orbit (310 km above the surface of our planet). The
+ ;; satellite itself is a TubeSat personal satellite kit, developed and
+ ;; launched by interorbital systems. mur.sat is a joint venture of mur.at,
+ ;; ESC im Labor and realraum.
+ ;;
+ ;; Please visit the project hompage at sat.mur.at for further information.
+ ;;
+ ;;
+ ;; Copyright (C) 2011 Christian Pointner <equinox@mur.at>
+ ;;
+ ;; This file is part of mur.sat.
+ ;;
+ ;; mur.sat is free software: you can redistribute it and/or modify
+ ;; it under the terms of the GNU General Public License as published by
+ ;; the Free Software Foundation, either version 3 of the License, or
+ ;; any later version.
+ ;;
+ ;; mur.sat is distributed in the hope that it will be useful,
+ ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+ ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ ;; GNU General Public License for more details.
+ ;;
+ ;; You should have received a copy of the GNU General Public License
+ ;; along with mur.sat. If not, see <http://www.gnu.org/licenses/>.
+ ;;
+
+ ;; -------------------------------------
+ ;; code generated by http://www.piclist.com/cgi-bin/constdivmul.exe
+mul60
+ bsf STATUS,RP1
+ movwf CALC_ACC0
+
+ bcf STATUS,C
+ rlf CALC_ACC0,f
+ clrf CALC_ACC1
+ rlf CALC_ACC1,f
+ rlf CALC_ACC0,f
+ rlf CALC_ACC1,f
+
+ movf CALC_ACC1,w
+ movwf CALC_TEMP1
+ movf CALC_ACC0,w
+ movwf CALC_TEMP0
+
+ comf CALC_ACC0,f
+ comf CALC_ACC1,f
+ incf CALC_ACC0,f
+ skpnz
+ incf CALC_ACC1,f
+
+ swapf CALC_TEMP1,f
+ swapf CALC_TEMP0,f
+ movf CALC_TEMP0,w
+ andlw b'00001111'
+ xorwf CALC_TEMP0,f
+ iorwf CALC_TEMP1,f
+
+ movf CALC_TEMP0,w
+ addwf CALC_ACC0,f
+ movf CALC_TEMP1,w
+ btfsc STATUS,C
+ incfsz CALC_TEMP1,w
+ addwf CALC_ACC1,f
+
+ bcf STATUS,RP1
+ return
+
+ ;; ----------------------
+mul3600
+ bsf STATUS,RP1
+ movwf CALC_ACC0
+
+ swapf CALC_ACC0,f
+ movf CALC_ACC0,w
+ andlw b'00001111'
+ xorwf CALC_ACC0,f
+ movwf CALC_ACC1
+
+ movf CALC_ACC1,w
+ movwf CALC_TEMP1
+ movf CALC_ACC0,w
+ movwf CALC_TEMP0
+
+ swapf CALC_TEMP1,f
+ swapf CALC_TEMP0,f
+ movf CALC_TEMP0,w
+ andlw b'00001111'
+ xorwf CALC_TEMP0,f
+ iorwf CALC_TEMP1,f
+ bcf STATUS,C
+ rlf CALC_TEMP0,f
+ rlf CALC_TEMP1,f
+ clrf CALC_TEMP2
+ rlf CALC_TEMP2,f
+
+ clrf CALC_ACC2
+ movf CALC_TEMP0,w
+ subwf CALC_ACC0,f
+ movf CALC_TEMP1,w
+ skpc
+ incfsz CALC_TEMP1,w
+ subwf CALC_ACC1,f
+ movf CALC_TEMP2,w
+ skpc
+ incfsz CALC_TEMP2,w
+ subwf CALC_ACC2,f
+
+ bcf STATUS,C
+ rlf CALC_TEMP0,f
+ rlf CALC_TEMP1,f
+ rlf CALC_TEMP2,f
+ rlf CALC_TEMP0,f
+ rlf CALC_TEMP1,f
+ rlf CALC_TEMP2,f
+ rlf CALC_TEMP0,f
+ rlf CALC_TEMP1,f
+ rlf CALC_TEMP2,f
+
+ movf CALC_TEMP0,w
+ addwf CALC_ACC0,f
+ movf CALC_TEMP1,w
+ btfsc STATUS,C
+ incfsz CALC_TEMP1,w
+ addwf CALC_ACC1,f
+ movf CALC_TEMP2,w
+ btfsc STATUS,C
+ incfsz CALC_TEMP2,w
+ addwf CALC_ACC2,f
+
+ bcf STATUS,RP1
+ return
+
+ ;; ----------------------
+mul86400
+ bsf STATUS,RP1
+
+ rrf CALC_ACC1,f
+ rrf CALC_ACC0,w
+ movwf CALC_ACC1
+ clrf CALC_ACC0
+ rrf CALC_ACC0,f
+
+ movf CALC_ACC1,w
+ movwf CALC_TEMP1
+ movf CALC_ACC0,w
+ movwf CALC_TEMP0
+
+ bcf STATUS,C
+ rlf CALC_TEMP0,f
+ rlf CALC_TEMP1,f
+ clrf CALC_TEMP2
+ rlf CALC_TEMP2,f
+
+ clrf CALC_ACC2
+ movf CALC_TEMP0,w
+ addwf CALC_ACC0,f
+ movf CALC_TEMP1,w
+ btfsc STATUS,C
+ incfsz CALC_TEMP1,w
+ addwf CALC_ACC1,f
+ movf CALC_TEMP2,w
+ btfsc STATUS,C
+ incfsz CALC_TEMP2,w
+ addwf CALC_ACC2,f
+
+ swapf CALC_TEMP2,f
+ swapf CALC_TEMP1,f
+ movf CALC_TEMP1,w
+ andlw b'00001111'
+ xorwf CALC_TEMP1,f
+ iorwf CALC_TEMP2,f
+ swapf CALC_TEMP0,f
+ movf CALC_TEMP0,w
+ andlw b'00001111'
+ xorwf CALC_TEMP0,f
+ iorwf CALC_TEMP1,f
+
+ movf CALC_TEMP0,w
+ addwf CALC_ACC0,f
+ movf CALC_TEMP1,w
+ btfsc STATUS,C
+ incfsz CALC_TEMP1,w
+ addwf CALC_ACC1,f
+ movf CALC_TEMP2,w
+ btfsc STATUS,C
+ incfsz CALC_TEMP2,w
+ addwf CALC_ACC2,f
+
+ bcf STATUS,C
+ rlf CALC_TEMP0,f
+ rlf CALC_TEMP1,f
+ rlf CALC_TEMP2,f
+ rlf CALC_TEMP0,f
+ rlf CALC_TEMP1,f
+ rlf CALC_TEMP2,f
+
+ movf CALC_TEMP0,w
+ addwf CALC_ACC0,f
+ movf CALC_TEMP1,w
+ btfsc STATUS,C
+ incfsz CALC_TEMP1,w
+ addwf CALC_ACC1,f
+ movf CALC_TEMP2,w
+ btfsc STATUS,C
+ incfsz CALC_TEMP2,w
+ addwf CALC_ACC2,f
+
+ bcf STATUS,C
+ rlf CALC_TEMP0,f
+ rlf CALC_TEMP1,f
+ rlf CALC_TEMP2,f
+ rlf CALC_TEMP0,f
+ rlf CALC_TEMP1,f
+ rlf CALC_TEMP2,f
+ clrf CALC_TEMP3
+ rlf CALC_TEMP3,f
+
+ clrf CALC_ACC3
+ movf CALC_TEMP0,w
+ addwf CALC_ACC0,f
+ movf CALC_TEMP1,w
+ btfsc STATUS,C
+ incfsz CALC_TEMP1,w
+ addwf CALC_ACC1,f
+ movf CALC_TEMP2,w
+ btfsc STATUS,C
+ incfsz CALC_TEMP2,w
+ addwf CALC_ACC2,f
+ movf CALC_TEMP3,w
+ btfsc STATUS,C
+ incfsz CALC_TEMP3,w
+ addwf CALC_ACC3,f
+
+ bcf STATUS,RP1
+ return
+ ;; -------------------------------------