This is a multi-part message in MIME format. ------=_NextPart_000_000B_01C401DD.841E6080 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Part2 off the code! -- http://www.piclist.com hint: The PICList is archived three different ways. See http://www.piclist.com/#archives for details. ------=_NextPart_000_000B_01C401DD.841E6080 Content-Type: application/octet-stream; name="macro84.asm" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="macro84.asm" Go_to_ macro op1=20 goto op1 endm #define then=09 #define do #define of to equ 0 ;****************************************************************** Begin_ macro endm End_ macro return endm End__ macro end endm =20 Procedure_ macro ad ad endm Program_ macro ad ad endm Exit_ macro return endm Halt_ macro ad goto ad endm =09 _ macro op1 call op1 endm =09 =09 Addi macro op1,op2 movlw op1 addwf op2 endm =09 =09 Movei macro op1,op2 ;in:op1 =3D valeur op2=3Ddestination movlw op1 if op2 !=3D wreg=20 movwf op2 endif =09 endm =09 =20 Move macro op1,op2 if op1 !=3D wreg=20 movf op1,wreg endif if op2 !=3D wreg=20 movwf op2 endif endm Inc macro op1 incf op1=20 endm Dec macro op1 decf op1 endm Clr macro op1 clrf op1 endm Ori macro op1,op2 if op1 !=3D wreg=20 movlw op2 iorwf op1 else iorlw op2 endif endm Xori macro op1,op2 if op1 !=3D wreg=20 movlw op2 xorwf op1 else xorlw op2 endif endm Andi macro op1,op2 if op1 !=3D wreg=20 movlw op2 andwf op1 else andlw op2 endif endm Or macro op1,op2 if op1 !=3D wreg=20 if op2 !=3D wreg=20 movf op2,wreg iorwf op1 else iorwf op1 endif else iorwf op2,wreg endif endm =20 =20 And macro op1,op2 if op1 !=3D wreg=20 if op2 !=3D wreg=20 movf op2,wreg andwf op1 else andwf op1 endif else andwf op2,wreg endif endm Xor macro op1,op2 if op1 !=3D wreg=20 if op2 !=3D wreg=20 movf op2,wreg xorwf op1 else xorwf op1 endif else xorwf op2,wreg endif endm ;************************************************************************= * Bset macro op1,op2 bsf op1,op2 endm Bclr macro op1,op2 bcf op1,op2 endm =09 Beq macro ad btfsc zero goto ad endm Bne macro ad btfss zero goto ad endm Brclr macro byte,bit,adr btfss byte,bit goto adr=09 endm =20 Brset macro byte,bit,adr btfsc byte,bit goto adr=09 endm ;out:wreg =3D boutons ;************************************************************************= **=09 =20 numrepeat set 0 numuntil set 0 tabrep0 set 0 tabrep1 set 0 tabrep2 set 0 tabrep3 set 0 tabrep4 set 0 tabrep5 set 0 tabrep6 set 0 tabrep7 set 0 Repeat_ macro repeat#v(numrepeat) tabrep7 set tabrep6 tabrep6 set tabrep5 tabrep5 set tabrep4 tabrep4 set tabrep3 tabrep3 set tabrep2 tabrep2 set tabrep1 tabrep1 set tabrep0 tabrep0 set numrepeat numrepeat set numrepeat+1 =09 endm Until_ macro op2,op3 numuntil set tabrep0 tabrep0 set tabrep1 tabrep1 set tabrep2 tabrep2 set tabrep3 tabrep3 set tabrep4 tabrep4 set tabrep5 tabrep5 set tabrep6 tabrep6 set tabrep7 tabrep7 set 0 btfss op2,op3 until#v(numuntil) goto repeat#v(numuntil) endm Until_eq macro op2,op3=20 local ad numuntil set tabrep0 tabrep0 set tabrep1 tabrep1 set tabrep2 tabrep2 set tabrep3 tabrep3 set tabrep4 tabrep4 set tabrep5 tabrep5 set tabrep6 tabrep6 set tabrep7 tabrep7 set 0 Move op3,wreg subwf op2,wreg Beq ad until#v(numuntil) goto repeat#v(numuntil) ad endm Until_eqi macro op2,op3 =20 local ad numuntil set tabrep0 tabrep0 set tabrep1 tabrep1 set tabrep2 tabrep2 set tabrep3 tabrep3 set tabrep4 tabrep4 set tabrep5 tabrep5 set tabrep6 tabrep6 set tabrep7 tabrep7 set 0 movlw op3 subwf op2,wreg Beq ad until#v(numuntil) goto repeat#v(numuntil) ad endm Until_not macro op2,op3 local ad numuntil set tabrep0 tabrep0 set tabrep1 tabrep1 set tabrep2 tabrep2 set tabrep3 tabrep3 set tabrep4 tabrep4 set tabrep5 tabrep5 set tabrep6 tabrep6 set tabrep7 tabrep7 set 0 btfsc op2,op3=20 until#v(numuntil) goto repeat#v(numuntil) endm Until_not_eq macro op2,op3=20 local ad numuntil set tabrep0 tabrep0 set tabrep1 tabrep1 set tabrep2 tabrep2 set tabrep3 tabrep3 set tabrep4 tabrep4 set tabrep5 tabrep5 set tabrep6 tabrep6 set tabrep7 tabrep7 set 0 Move op3,wreg subwf op2,wreg Bne ad until#v(numuntil) goto repeat#v(numuntil) ad endm Until_not_eqi macro op2,op3 =20 local ad numuntil set tabrep0 tabrep0 set tabrep1 tabrep1 set tabrep2 tabrep2 set tabrep3 tabrep3 set tabrep4 tabrep4 set tabrep5 tabrep5 set tabrep6 tabrep6 set tabrep7 tabrep7 set 0 movlw op3 subwf op2,wreg Bne ad until#v(numuntil) goto repeat#v(numuntil) ad endm ;************************************************************************= * numif set 0 numendif set 0 tabif0 set 0 tabif1 set 0 tabif2 set 0 tabif3 set 0 tabif4 set 0 tabif5 set 0 tabif6 set 0 tabif7 set 0 If_ macro op2,op3 if#v(numif) tabif7 set tabif6 tabif6 set tabif5 tabif5 set tabif4 tabif4 set tabif3 tabif3 set tabif2 tabif2 set tabif1 tabif1 set tabif0 tabif0 set numif btfss low (op2),op3 goto endif#v(numif) numif set numif+1 endm Else_ macro =09 local num num set tabif0 tabif0 set tabif1 tabif1 set tabif2 tabif2 set tabif3 tabif3 set tabif4 tabif4 set tabif5 tabif5 set tabif6 tabif6 set tabif7 tabif7 set 0 tabif7 set tabif6 tabif6 set tabif5 tabif5 set tabif4 tabif4 set tabif3 tabif3 set tabif2 tabif2 set tabif1 tabif1 set tabif0 tabif0 set numif goto endif#v(numif) numif set numif+1 endif#v(num) endm If_not macro op2,op3 if#v(numif) tabif7 set tabif6 tabif6 set tabif5 tabif5 set tabif4 tabif4 set tabif3 tabif3 set tabif2 tabif2 set tabif1 tabif1 set tabif0 tabif0 set numif btfsc low (op2),op3 goto endif#v(numif) numif set numif+1 endm If_eqi macro op1,op2 local ad if#v(numif) tabif7 set tabif6 tabif6 set tabif5 tabif5 set tabif4 tabif4 set tabif3 tabif3 set tabif2 tabif2 set tabif1 tabif1 set tabif0 tabif0 set numif movlw op2 subwf op1,wreg Beq ad goto endif#v(numif) numif set numif+1=20 ad =09 endm If_eq macro op1,op2 local ad if#v(numif) tabif7 set tabif6 tabif6 set tabif5 tabif5 set tabif4 tabif4 set tabif3 tabif3 set tabif2 tabif2 set tabif1 tabif1 set tabif0 tabif0 set numif movf op2,wreg subwf op1,wreg Beq ad goto endif#v(numif) ad =09 numif set numif+1 endm If_not_eq macro op1,op2 local ad if#v(numif) tabif7 set tabif6 tabif6 set tabif5 tabif5 set tabif4 tabif4 set tabif3 tabif3 set tabif2 tabif2 set tabif1 tabif1 set tabif0 tabif0 set numif movf op2,wreg subwf op1,wreg Bne ad goto endif#v(numif) ad =09 numif set numif+1 endm If_not_eqi macro op1,op2 local ad if#v(numif) tabif7 set tabif6 tabif6 set tabif5 tabif5 set tabif4 tabif4 set tabif3 tabif3 set tabif2 tabif2 set tabif1 tabif1 set tabif0 tabif0 set numif movlw op2 subwf op1,wreg Bne ad goto endif#v(numif) numif set numif+1=20 ad =09 endm Endif_ macro=20 numendif set tabif0 tabif0 set tabif1 tabif1 set tabif2 tabif2 set tabif3 tabif3 set tabif4 tabif4 set tabif5 tabif5 set tabif6 tabif6 set tabif7 tabif7 set 0 endif#v(numendif) endm ;*********************************************************************** While_ macro op2,op3 If_ op2,op3 endm While_not macro op2,op3 If_not op2,op3 endm While_eqi macro op2,op3 If_eqi op2,op3 endm While_not_eqi macro op2,op3 If_not_eqi op2,op3 endm While_eq macro op2,op3 If_eq op2,op3 endm While_not_eq macro op2,op3 If_not_eqmp op2,op3 endm Endw_ macro goto if#v(tabif0) Endif_ endm ;************************************************************************= ***** numfor set 0 numendfor set 0 tabfor0 set 0 tabfor1 set 0 tabfor2 set 0 tabfor3 set 0 tabfor4 set 0 tabfor5 set 0 tabfor6 set 0 tabfor7 set 0 tabram0 set 0 tabram1 set 0 tabram2 set 0 tabram3 set 0 tabram4 set 0 tabram5 set 0 tabram6 set 0 tabram7 set 0 tabmax0 set 0 tabmax1 set 0 tabmax2 set 0 tabmax3 set 0 tabmax4 set 0 tabmax5 set 0 tabmax6 set 0 tabmax7 set 0 =20 ; c1 , 1 ,to ,10 =20 For_ macro op1,op2,op3,op4 Movei op2,op1 for#v(numfor)=20 tabfor7 set tabfor6 tabfor6 set tabfor5 tabfor5 set tabfor4 tabfor4 set tabfor3 tabfor3 set tabfor2 tabfor2 set tabfor1 tabfor1 set tabfor0 tabfor0 set numfor tabram7 set tabram6 tabram6 set tabram5 tabram5 set tabram4 tabram4 set tabram3 tabram3 set tabram2 tabram2 set tabram1 tabram1 set tabram0 tabram0 set op1 tabmax7 set tabmax6 tabmax6 set tabmax5 tabmax5 set tabmax4 tabmax4 set tabmax3 tabmax3 set tabmax2 tabmax2 set tabmax1 tabmax1 set tabmax0 tabmax0 set op4 numfor set numfor+1 endm Endf_ macro=20 local adr =09 incf .#v(tabram0)=20 movf .#v(tabram0),wreg decf .#v(tabram0),wreg xorlw .#v(tabmax0) brset zero,adr =09 endfor#v(tabfor0) goto for#v(tabfor0) tabfor0 set tabfor1 tabfor1 set tabfor2 tabfor2 set tabfor3 tabfor3 set tabfor4 tabfor4 set tabfor5 tabfor5 set tabfor6 tabfor6 set tabfor7 tabfor7 set 0 tabram0 set tabram1 tabram1 set tabram2 tabram2 set tabram3 tabram3 set tabram4 tabram4 set tabram5 tabram5 set tabram6 tabram6 set tabram7 tabram7 set 0 tabmax0 set tabmax1 tabmax1 set tabmax2 tabmax2 set tabmax3 tabmax3 set tabmax4 tabmax4 set tabmax5 tabmax5 set tabmax6 tabmax6 set tabmax7 tabmax7 set 0 adr endm =09 =09 ;***************************case case case = case**************************************************** numcase set 0 numendcase set 0 tabcase0 set 0 tabcase1 set 0 tabcase2 set 0 tabcase3 set 0 tabcase4 set 0 tabcase5 set 0 tabcase6 set 0 tabcase7 set 0 =20 tabvarcase0 set 0 tabvarcase1 set 0 tabvarcase2 set 0 tabvarcase3 set 0 tabvarcase4 set 0 tabvarcase5 set 0 tabvarcase6 set 0 tabvarcase7 set 0 =20 tabvar1case0 set 0 tabvar1case1 set 0 tabvar1case2 set 0 tabvar1case3 set 0 tabvar1case4 set 0 tabvar1case5 set 0 tabvar1case6 set 0 tabvar1case7 set 0 =20 tabarobas0 set 0 tabarobas1 set 0 tabarobas2 set 0 tabarobas3 set 0 tabarobas4 set 0 tabarobas5 set 0 tabarobas6 set 0 tabarobas7 set 0 =20 Case_ macro op1 case#v(numcase) tabcase7 set tabcase6 tabcase6 set tabcase5 tabcase5 set tabcase4 tabcase4 set tabcase3 tabcase3 set tabcase2 tabcase2 set tabcase1 tabcase1 set tabcase0 tabcase0 set numcase =20 =09 tabvarcase7 set tabvarcase6 tabvarcase6 set tabvarcase5 tabvarcase5 set tabvarcase4 tabvarcase4 set tabvarcase3 tabvarcase3 set tabvarcase2 tabvarcase2 set tabvarcase1 tabvarcase1 set tabvarcase0 tabvarcase0 set op1 tabvar1case7 set tabvarcase6 tabvar1case6 set tabvarcase5 tabvarcase5 set tabvarcase4 tabvar1case4 set tabvarcase3 tabvar1case3 set tabvarcase2 tabvar1case2 set tabvarcase1 tabvar1case1 set tabvarcase0 tabvar1case0 set op1 tabarobas7 set tabarobas6 tabarobas6 set tabarobas5 tabarobas5 set tabarobas4 tabarobas4 set tabarobas3 tabarobas3 set tabarobas2 tabarobas2 set tabarobas1 tabarobas1 set tabarobas0 tabarobas0 set 0 =09 numcase set numcase+1 endm arobas set 0 =20 @ macro op1 =20 if tabarobas0 =3D=3D 1 then =20 goto endcase#v(tabcase0) Endif_ =20 endif If_eqi tabvarcase0,op1 then tabarobas0 set 1 endm =20 =09 Endcase_ macro =20 Endif_ =20 numendcase set tabcase0 tabcase0 set tabcase1 tabcase1 set tabcase2 tabcase2 set tabcase3 tabcase3 set tabcase4 tabcase4 set tabcase5 tabcase5 set tabcase6 tabcase6 set tabcase7 tabcase7 set 0 =20 =09 tabvarcase0 set tabvarcase1 tabvarcase1 set tabvarcase2 tabvarcase2 set tabvarcase3 tabvarcase3 set tabvarcase4 tabvarcase4 set tabvarcase5 tabvarcase5 set tabvarcase6 tabvarcase6 set tabvarcase7 tabvarcase7 set 0 =20 tabvar1case0 set tabvarcase1 tabvar1case1 set tabvarcase2 tabvar1case2 set tabvarcase3 tabvar1case3 set tabvarcase4 tabvar1case4 set tabvarcase5 tabvar1case5 set tabvarcase6 tabvar1case6 set tabvarcase7 tabvar1case7 set 0 tabarobas0 set tabarobas1 tabarobas1 set tabarobas2 tabarobas2 set tabarobas3 tabarobas3 set tabarobas4 tabarobas4 set tabarobas5 tabarobas5 set tabarobas6 tabarobas6 set tabarobas7 tabarobas7 set 0 endcase#v(numendcase) endm Elsecase_ macro Else_ =09 endm retnote macro op1,op2,op3,op4,op5,op6 retlw (op5*0x20)+op6 retlw (op1*0x10)+op2 retlw (op3*0x10)+op4 endm =09 =09 =09 ------=_NextPart_000_000B_01C401DD.841E6080--