diff options
author | Christian Pointner <equinox@mur.at> | 2012-06-12 21:28:37 +0000 |
---|---|---|
committer | Christian Pointner <equinox@mur.at> | 2012-06-12 21:28:37 +0000 |
commit | 735d4af223dcb838f833765f0d770fb473190411 (patch) | |
tree | 5338dd9cb77fe27154e14ae89c25debde45758a7 /software | |
parent | added idm-ringbuffer/ringbuffer.c, which contains test code to analyze IDM ri... (diff) |
moved fsr increment to macro
git-svn-id: https://svn.spreadspace.org/mur.sat@520 7de4ea59-55d0-425e-a1af-a3118ea81d4c
Diffstat (limited to 'software')
-rw-r--r-- | software/idm/idm.asm | 63 |
1 files changed, 26 insertions, 37 deletions
diff --git a/software/idm/idm.asm b/software/idm/idm.asm index 6ea532d..fb7b893 100644 --- a/software/idm/idm.asm +++ b/software/idm/idm.asm @@ -74,7 +74,30 @@ FLAGS EQU H'007F' #define OVERRUN FLAGS,1 ;; ------------------------------------- - ;; OFFSET + ;; Macros +inc_fsr MACRO PTR,PTRH,PTRL + LOCAL fsr_wraparound,inc_fsr_end + addfsr PTR,1 + movf PTRH,w + sublw BUF_ENDH + btfss STATUS,C + goto fsr_wraparound + btfss STATUS,Z + goto inc_fsr_end + movf PTRL,w + sublw BUF_ENDL + btfsc STATUS,C + goto inc_fsr_end +fsr_wraparound + movlw BUF_STARTH + movwf PTRH + movlw BUF_STARTL + movwf PTRL +inc_fsr_end + ENDM + + ;; ------------------------------------- + ;; Reset Vector org .0 movlb .1 ; movlw b'01011000' ; 1 MHz @@ -175,24 +198,7 @@ wbuf_move_ptr bcf DBG1 movwf BSR bcf UNDERRUN - addfsr FSRW,1 - - movf FSRWH,w - sublw BUF_ENDH - btfss STATUS,C - goto wbuf_wraparound - btfss STATUS,Z - return - movf FSRWL,w - sublw BUF_ENDL - btfsc STATUS,C - return - -wbuf_wraparound - movlw BUF_STARTH - movwf FSRWH - movlw BUF_STARTL - movwf FSRWL + inc_fsr FSRW,FSRWH,FSRWL return @@ -240,24 +246,7 @@ rbuf_move_ptr bcf DBG2 movwf BSR bcf OVERRUN - addfsr FSRR,1 - - movf FSRRH,w - sublw BUF_ENDH - btfss STATUS,C - goto rbuf_wraparound - btfss STATUS,Z - return - movf FSRRL,w - sublw BUF_ENDL - btfsc STATUS,C - return - -rbuf_wraparound - movlw BUF_STARTH - movwf FSRRH - movlw BUF_STARTL - movwf FSRRL + inc_fsr FSRR,FSRRH,FSRRL return ;; ------------------------------------- |