please dont rip this site

Microchip MPASM

Macros for useing Motorola ASM code in MPASM (!)

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

See also:


file: /Techref/microchip/mpasmmotmac.htm, 4KB, , updated: 2001/12/14 18:35, local time: 2017/9/20 09:45,
TOP NEW HELP FIND: 
54.80.137.187:LOG IN

 ©2017 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?
Please DO link to this page! Digg it! / MAKE! / 

<A HREF="http://www.piclist.com/techref/microchip/mpasmmotmac.htm"> Macros for useing Motorola ASM code in MPASM</A>

After you find an appropriate page, you are invited to your to this massmind site! (posts will be visible only to you before review) Just type in the box and press the Post button. (HTML welcomed, but not the <A tag: Instead, use the link box to link to another page. A tutorial is available Members can login to post directly, become page editors, and be credited for their posts.


Link? Put it here: 
if you want a response, please enter your email address: 
Attn spammers: All posts are reviewed before being made visible to anyone other than the poster.
Did you find what you needed?

  PICList 2017 contributors:
o List host: MIT, Site host massmind.org, Top posters @20170920 RussellMc, Van Horn, David, James Cameron, Sean Breheny, alan.b.pearce, IVP, Neil, Bob Blick, David C Brown, Denny Esterline,
* Page Editors: James Newton, David Cary, and YOU!
* Roman Black of Black Robotics donates from sales of Linistep stepper controller kits.
* Ashley Roll of Digital Nemesis donates from sales of RCL-1 RS232 to TTL converters.
* Monthly Subscribers: Gregg Rew. on-going support is MOST appreciated!
* Contributors: Richard Seriani, Sr.
 

Welcome to www.piclist.com!

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

  .