From b36291dd8c0b05a565892c7dce633b0c613f23a0 Mon Sep 17 00:00:00 2001 From: ian Date: Thu, 28 Oct 2004 00:01:20 +0000 Subject: [PATCH] move copybits macro into own file --- iwjpictest/copybits.asm | 18 +----------------- iwjpictest/onecopybit.inc | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+), 17 deletions(-) create mode 100644 iwjpictest/onecopybit.inc diff --git a/iwjpictest/copybits.asm b/iwjpictest/copybits.asm index 2efab6b..be1ce03 100644 --- a/iwjpictest/copybits.asm +++ b/iwjpictest/copybits.asm @@ -9,6 +9,7 @@ ; * leaves all other pins set to their default states (usually Z). include /usr/share/gputils/header/p18f458.inc + include onecopybit.inc ACCSFR equ 0x0f00 @@ -43,23 +44,6 @@ delayouter_loop delayinner_loop -copybit_mi macro sourcereg, sourcebitno, destreg, destbitvals, xorinv - movf destreg, 0, 0 ; read output latch - andlw ~destbitvals ; mask out output bit - btfsc sourcereg, sourcebitno, 0 ; skip if input clear - iorlw destbitvals ; add output bit - xorlw xorinv ; invert? - movwf destreg, 0 ; write output latch - endm ; (6cy total) - -copybiti macro sreg, sbitno, dreg, dbitvals - copybit_mi sreg, sbitno, dreg, dbitvals, dbitvals - endm - -copybit macro sreg, sbitno, dreg, dbitvals - copybit_mi sreg, sbitno, dreg, dbitvals, 0 - endm - copybiti PORTB, 5, TRISA, 0x06 ; C enable copybit PORTB, 4, LATA, 0x06 ; C data copybiti PORTB, 3, TRISA, 0x18 ; B enable diff --git a/iwjpictest/onecopybit.inc b/iwjpictest/onecopybit.inc new file mode 100644 index 0000000..eb40214 --- /dev/null +++ b/iwjpictest/onecopybit.inc @@ -0,0 +1,18 @@ +; macro for copying bits about + +copybit_mi macro sourcereg, sourcebitno, destreg, destbitvals, xorinv + movf destreg, 0, 0 ; read output latch + andlw ~destbitvals ; mask out output bit + btfsc sourcereg, sourcebitno, 0 ; skip if input clear + iorlw destbitvals ; add output bit + xorlw xorinv ; invert? + movwf destreg, 0 ; write output latch + endm ; (6cy total) + +copybiti macro sreg, sbitno, dreg, dbitvals + copybit_mi sreg, sbitno, dreg, dbitvals, dbitvals + endm + +copybit macro sreg, sbitno, dreg, dbitvals + copybit_mi sreg, sbitno, dreg, dbitvals, 0 + endm -- 2.30.2