At 10:26 1998-11-09 +0100, you wrote: >Hello Morgan, >> >I used the weekend to do a test of the MOAF :) Both swedish anf PICmenmonic language exercise > but I think i made an mistake when >remake the IFRXXXGO Macro. Can you eventually post these Macros ? Ok, I've given the house away, but kept the key... - Who will give me the highest price? Just kidding ;) Here follow some relevant code-pullouts, from three macro libraries: This is my whole MACROseries for 8-bit compare, in swenglish: ; ===================================================================== ;J€MF…R register med literal och om villkor uppfyllts sŒ GOTO ;om reg equal, goto IFREGO MACRO reg, literal, where movf reg,W sublw literal ifzs goto where ENDM ;om reg hšgre, goto IFRHGO MACRO reg, literal, where movf reg,W sublw literal ifcc goto where ENDM ;om reg lŠgre, goto IFRLGO MACRO reg, literal, where movf reg,W sublw literal ifzs ;Om lika goto $+3 ;hoppa till instr efter makrot ifcs goto where ENDM ;om reg1 hšgre Šn reg2, goto IFR1HGO MACRO reg1, reg2, where movf reg1,W subwf reg2,W ifcc goto where ENDM ;om reg1 hšgre Šn reg2, goto IFR1LGO MACRO reg2, reg1, where movf reg1,W subwf reg2,W ifcc goto where ENDM ; ===================================================================== ;J€MF…R unsigned 1-byte register ; SŠtter flaggor efter operationen A-B pŒ subwf vis ; LŠmnar variablerna helt oršrda CMPU1 MACRO RA,RB movf RA,W subwf RB,W ENDM ;jŠmfšr med konstant CMCU1 MACRO RA, const movf RA,W sublw const ENDM ; ===================================================================== ;ATT anv efter compare-rutin som sŠtter flaggor efter ; operationen A-B pŒ subwf vis ;If equal Z=1 om A = B ifeq MACRO btfsc STATUS,2 ;ifzs ENDM ;If different Z=0 om A <> B ifdi MACRO btfss STATUS,2 ;ifzc ENDM ;If higher or equal C=1 om A >= B ifhe MACRO btfsc STATUS,0 ;ifcs ENDM ;If lower C=0 om A < B iflo MACRO btfss STATUS,0 ;ifcc ENDM ;If higher C=0 & Z=0 om A > B IFHI MACRO btfss STATUS,0 ;ifcc ;om A < B goto $+3 ;sŒ hoppa šver fšrsta instr efter MACROt btfss STATUS,2 ;ifzc ;Om inte lika heller, sŒ... ENDM ;If lower or equal C=0 om A < B Z=1 om A = B IFLE MACRO btfss STATUS,0 ;ifcc ;om A < B goto $+2 ;sŒ hoppa till fšrsta instr efter MACROt btfsc STATUS,2 ;ifzs ;Om lika ENDM ;************************************************************** ;I belive the above might need some of theese bittest/check: ;************************************************************** ;Set bit in register s macro reg,bit bsf reg,bit ENDM ;Clear bit in register c macro reg,bit bcf reg,bit ENDM ;Set Carry sc macro bsf STATUS,0 ENDM ;Clear Carry cc macro bcf STATUS,0 ENDM ;Set Half carry shc macro bsf STATUS,1 ENDM ;Clear Half carry chc macro bcf STATUS,1 ENDM ;Set Zero flag sz macro bsf STATUS,2 ENDM ;Clear Zero flag cz macro bcf STATUS,2 ENDM ; ====================================================== ; - Bittest "IF (/not) bit is set do next instruction" - ; IF bit in register is Set ifs macro reg,bit btfsc reg,bit ENDM ; IF bit in register is Clear ifc macro reg,bit btfss reg,bit ENDM ; IF Carry Set ifcs macro btfsc STATUS,0 ENDM ; IF Carry Clear ifcc macro btfss STATUS,0 ENDM ; IF Half carry Set ifhcs macro btfsc STATUS,1 ENDM ; IF Half carry Clear ifhcc macro btfss STATUS,1 ENDM ; IF Zero flag Set ifzs macro btfsc STATUS,2 ENDM ; IF Zero flag Clear ifzc macro btfss STATUS,2 ENDM ;"Borrowflag" fšr subwf (= invers av carry) ifbs macro ;"If borrow set" btfss STATUS,0 ENDM ifbc macro btfsc STATUS,0 ENDM ;************************************************************** ; Theese are also needed ;************************************************************** ;STore Literal -> W & dest ;SŠtter ingen flagga. STL MACRO literal,dest movlw literal movwf dest ENDM ;KOPIERA REGISTER ;sourcereg -> W and destinationreg ;Z satt efter W,=source FWF MACRO source,dest movf source,W movwf dest ENDM ;************************************************************** ;And here is part of code i once used for test of MOMA with MPLAB ;Maybe reusable? ;************************************************************** start: preload: STL 0x40,tyngd_refL STL 0x80,tyngd_refH STL viktfilter, FSR ;Peka pŒ lŠgsta vŠrdet i listan, lŒgbyte n preloadloop: FWF tyngd_refL,INDF incf FSR,F FWF tyngd_refH,INDF incf FSR,F incf tyngd_refL,F FWF tyngd_refL,INDF incf FSR,F FWF tyngd_refH,INDF incf FSR,F incf tyngd_refL,F FWF tyngd_refL,INDF incf FSR,F FWF tyngd_refH,INDF incf FSR,F incf tyngd_refL,F FWF tyngd_refL,INDF incf FSR,F FWF tyngd_refH,INDF incf FSR,F incf tyngd_refL,F incf tyngd_refH,F incf tyngd_refH,F incf tyngd_refH,F incf tyngd_refH,F IFRLGO FSR,viktfilter+32,preloadloop stop goto stop Enjoy! :) /Morgan Morgan Olsson ph +46(0)414 70741 MORGANS REGLERTEKNIK fax +46(0)414 70331 H€LLEKS (in A-Z letters: "HALLEKAS") SE-277 35 KIVIK, SWEDEN mrt@iname.com ___________________________________________________________