diff options
Diffstat (limited to 'software/idm/idm.asm')
-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 ;; ------------------------------------- |