Alice Cambell says:
Here are some macros i've been using and fiddling with. They are not complete, and a few might not even be right, but it would get you started:alice
;motmacro.asm list p=16c84 radix dec #include p16c84.inc __CONFIG _LP_OSC & _WDT_OFF &_PWRTE_ON & _CP_OFF ;---------------------------------------------------- ;cpu equates (memory map) status equ 0x03 porta equ 0x05 portb equ 0x06 trisa equ 0x85 trisb equ 0x86 ;yes i know, but i hate uppercase. cblock 0x10 temp tempa wtemp answer endc c = 0 z = 2 w = 0 ;work reg f = 1 ;file reg _pd = 3 _to = 4 ;----------------------------------------------------- org 0x00 nop ;this program is mostly used in simulator. goto tryout ;------------------------------------------------------ ;various macros in no particular order ;macro area ;compare literal in work cmpl macro value ;nondestructive movwf wtemp sublw value swapf wtemp,f swapf wtemp,w endm ;compare file in work cmpf macro file movwf wtemp movfw file subwf wtemp,w endm ;branch not equal bne MACRO fr1,fr2,address movf fr2,W subwf fr1,W btfss 3,2 goto address ENDM ;branch if equal beq MACRO fr1,fr2,address movf fr2,W subwf fr1,W btfsc 3,2 goto address ENDM ;branch if less blo macro address btfss status,c goto address endm ;branch if higher bhi macro address btfsc status,c goto address ENDM ;branch if plus-- test bit 7 set bpl macro file,address ;???? movfw file andlw b'10000000' btfsc status,z goto address ENDM ;branch if minus-- test bit 7 set bmi macro file,address ;???? movfw file andlw b'10000000' btfss status,z goto address ENDM ;branch less than or same bls MACRO fr1,fr2,address movf fr1,W subwf fr2,W btfsc 3,0 goto address ENDM bhs MACRO fr1,fr2,address movf fr2,W subwf fr1,W btfsc 3,0 goto address ENDM cmp macro file movwf wtemp movfw file subwf wtemp,w endm txa MACRO address movfw indf ENDM ldx MACRO address movwf fsr ENDM atx MACRO address movfw indf ENDM ldaf MACRO address movfw address ENDM ldal MACRO L movlw L ENDM bra MACRO address goto address ENDM rts MACRO RETURN ENDM sta MACRO address movwf address ENDM jsr MACRO address call address EMDM jmp MACRO address goto address ENDM sub MACRO address,fr1 ;CHECK THAT FILE SUBTRACTS FROM WORK movfw fr1 subwf address,F ENDM nega MACRO MOVWF wtemp comf wtemp,w ENDM stx MACRO movwf fsr ENDM ;sta movwf whatever sbc MACRO address subwf address, F ENDM subw MACRO address subwf address,f ENDM ;---------------------------------------------------- tryout movlw .8 movwf tempa movlw .8 movwf temp movlw .5 nop cmp tempa bhi true ; bne temp,tempa,true ; movwf answer false stopit goto stopit true orbit goto orbit ;---------------------------------------- end
file: /Techref/microchip/mpasmmotmac.htm, 4KB, , updated: 2001/12/14 17:35, local time: 2024/12/22 13:08,
18.118.30.153:LOG IN
|
©2024 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions? <A HREF="http://sxlist.com/techref/microchip/mpasmmotmac.htm"> Macros for useing Motorola ASM code in MPASM</A> |
Did you find what you needed? |
Welcome to sxlist.com!sales, advertizing, & kind contributors just like you! Please don't rip/copy (here's why Copies of the site on CD are available at minimal cost. |
Welcome to sxlist.com! |
.