summaryrefslogtreecommitdiff
path: root/software/idm/idm.asm
diff options
context:
space:
mode:
authorChristian Pointner <equinox@mur.at>2012-06-18 01:47:35 +0000
committerChristian Pointner <equinox@mur.at>2012-06-18 01:47:35 +0000
commitc48c690da5dc8e9d70a814b8c341c8683020d95b (patch)
treee05d1b143a11969664060235fa2a8f3d9424331b /software/idm/idm.asm
parentidm cmd parsing (diff)
added output code
git-svn-id: https://svn.spreadspace.org/mur.sat@538 7de4ea59-55d0-425e-a1af-a3118ea81d4c
Diffstat (limited to 'software/idm/idm.asm')
-rw-r--r--software/idm/idm.asm56
1 files changed, 44 insertions, 12 deletions
diff --git a/software/idm/idm.asm b/software/idm/idm.asm
index 6b41e3f..6176324 100644
--- a/software/idm/idm.asm
+++ b/software/idm/idm.asm
@@ -30,6 +30,8 @@
;; -------------------------------------
;; DEFINES
+#define DEBUG 1
+
;; constants
BUF_STARTH EQU H'0020'
BUF_STARTL EQU H'0000'
@@ -165,21 +167,21 @@ int_spi
goto int_spi_0
movlw 'r'
xorwf CMD,w
- btfsc STATUS,z
+ btfsc STATUS,Z
goto int_spi_r
;; other commands
goto int_end
int_spi_0
call rbuf_next
- movf INDFR
- btfss underrun
+ movf INDFR,w
+ btfss UNDERRUN
movwf SSP1BUF
goto int_end
int_spi_r
- movf INDFR
- btfss underrun
+ movf INDFR,w
+ btfss UNDERRUN
movwf SSP1BUF
bsf CMD_READ
;; goto int_end
@@ -219,8 +221,11 @@ buf_init
movf BSR,w
clrf BSR
- bsf DBG1
- bcf DBG2
+ bsf INT
+if DEBUG == 1
+ bcf DBG1
+ bsf DBG2
+endif
movwf BSR
return
@@ -242,6 +247,13 @@ wbuf_next
inc_fsr FSRW,FSRWH,FSRWL
bcf UNDERRUN
+ movf BSR,w
+ clrf BSR
+ bcf INT
+if DEBUG == 1
+ bcf DBG2
+endif
+ movwf BSR
movf FSRRH,w
xorwf FSRWH,w
@@ -252,6 +264,12 @@ wbuf_next
btfss STATUS,Z
return
bsf OVERRUN
+if DEBUG == 1
+ movf BSR,w
+ clrf BSR
+ bsf DBG1
+ movwf BSR
+endif
return
;; -------------------
@@ -272,6 +290,12 @@ rbuf_next
inc_fsr FSRR,FSRRH,FSRRL
bcf OVERRUN
+if DEBUG == 1
+ movf BSR,w
+ clrf BSR
+ bcf DBG1
+ movwf BSR
+endif
movf FSRWH,w
xorwf FSRRH,w
@@ -282,6 +306,13 @@ rbuf_next
btfss STATUS,Z
return
bsf UNDERRUN
+ movf BSR,w
+ clrf BSR
+ bsf INT
+if DEBUG == 1
+ bsf DBG2
+endif
+ movwf BSR
return
;; -------------------------------------
@@ -295,13 +326,15 @@ init
movwf SSP1CON3
movlw b'00100100'
movwf SSP1CON1
- bsf DBG0
-
+if DEBUG == 1
+ bsf DBG0 ; Pull-up for DBG0
+endif
+
;; BANK 3
movlb b'00000011'
movlw b'00001111' ; PORTA0:3 analog, PORTA4:7, digital
- movwf ANSELA ; PORTB0:7 digital
- clrf ANSELB
+ movwf ANSELA
+ clrf ANSELB ; PORTB0:7 digital
;; BANK 2
movlb b'00000010'
@@ -331,7 +364,6 @@ init
movwf INTCON
bcf FILTER_EN
- bsf INT
call buf_init
bsf T2CON,TMR2ON