原创
让EMC与PIC“和解”--利用EMC的1个"失误"
让EMC与PIC“和解”--利用EMC的1个"失误"-(精)(25496字)hotpower2004-2-12 1:16:47[50次]
;EM78PXX TO PIC16XX
W == 0
F == 1
INDF == 0
TMR0 == 1
PCL == 2
;STATUS == 3
FSR == 4
PORTA == 5
PORTB == 6
PORTC == 7
DAW MACRO
DAA
;MACEXIT;PIC->EXITM
ENDM
OPTION MACRO
CONTW
ENDM
SLEEP MACRO
SLEP
ENDM
CLRWDT MACRO
WDTC
ENDM
TRIS MACRO REGISTER
IOW REGISTER
ENDM
MOVWF MACRO REGISTER
MOV REGISTER,A
ENDM
CLRW MACRO
CLRA
ENDM
CLRF MACRO REGISTER
CLR REGISTER
ENDM
SUBWF MACRO REGISTER,DIR
IF DIR == W
SUB A,REGISTER
ELSE
SUB REGISTER,A
ENDIF
ENDM
SUBWF MACRO REGISTER
SUB REGISTER,A
ENDM
DECF MACRO REGISTER,DIR
IF DIR == W
DECA REGISTER
ELSE
DEC REGISTER
ENDIF
ENDM
DECF MACRO REGISTER
DEC REGISTER
ENDM
IORWF MACRO REGISTER,DIR
IF DIR == W
OR A,REGISTER
ELSE
OR REGISTER,A
ENDIF
ENDM
IORWF MACRO REGISTER
OR REGISTER,A
ENDM
ANDWF MACRO REGISTER,DIR
IF DIR == W
AND A,REGISTER
ELSE
AND REGISTER,A
ENDIF
ENDM
ANDWF MACRO REGISTER
AND REGISTER,A
ENDM
XORWF MACRO REGISTER,DIR
IF DIR == W
XOR A,REGISTER
ELSE
XOR REGISTER,A
ENDIF
ENDM
XORWF MACRO REGISTER
XOR REGISTER,A
ENDM
ADDWF MACRO REGISTER,DIR
IF DIR == W
ADD A,REGISTER
ELSE
ADD REGISTER,A
ENDIF
ENDM
ADDWF MACRO REGISTER
ADD REGISTER,A
ENDM
MOVF MACRO REGISTER,DIR
IF DIR == W
MOV A,REGISTER
ELSE
MOV REGISTER,REGISTER
ENDIF
ENDM
MOVF MACRO REGISTER
MOV REGISTER,REGISTER
ENDM
COMF MACRO REGISTER,DIR
IF DIR == W
COMA REGISTER
ELSE
COM REGISTER
ENDIF
ENDM
COMF MACRO REGISTER
COM REGISTER
ENDM
INCF MACRO REGISTER,DIR
IF DIR == W
INCA REGISTER
ELSE
INC REGISTER
ENDIF
ENDM
INCF MACRO REGISTER
INC REGISTER
ENDM
DECFSZ MACRO REGISTER,DIR
IF DIR == W
DJZA REGISTER
ELSE
DJZ REGISTER
ENDIF
ENDM
DECFSZ MACRO REGISTER
DJZ REGISTER
ENDM
RRF MACRO REGISTER,DIR
IF DIR == W
RRCA REGISTER
ELSE
RRC REGISTER
ENDIF
ENDM
RRF MACRO REGISTER
RRC REGISTER
ENDM
RLF MACRO REGISTER,DIR
IF DIR == W
RLCA REGISTER
ELSE
RLC REGISTER
ENDIF
ENDM
RLF MACRO REGISTER
RLC REGISTER
ENDM
SWAPF MACRO REGISTER,DIR
IF DIR == W
SWAPA REGISTER
ELSE
SWAP REGISTER
ENDIF
ENDM
SWAPF MACRO REGISTER
SWAP REGISTER
ENDM
INCFSZ MACRO REGISTER,DIR
IF DIR == W
JZA REGISTER
ELSE
JZ REGISTER
ENDIF
ENDM
INCFSZ MACRO REGISTER
JZ REGISTER
ENDM
BCF MACRO REGISTER,BIT
BC REGISTER,BIT
ENDM
BSF MACRO REGISTER,BIT
BS REGISTER,BIT
ENDM
BTFSC MACRO REGISTER,BIT
JBC REGISTER,BIT
ENDM
BTFSS MACRO REGISTER,BIT
JBS REGISTER,BIT
ENDM
GOTO MACRO JMPADDRESS
JMP JMPADDRESS
ENDM
MOVLW MACRO VALUENUMS
MOV A,@VALUENUMS
ENDM
IORLW MACRO VALUENUMS
OR A,@VALUENUMS
ENDM
ANDLW MACRO VALUENUMS
AND A,@VALUENUMS
ENDM
XORLW MACRO VALUENUMS
XOR A,@VALUENUMS
ENDM
RETLW MACRO VALUENUMS
RETL @VALUENUMS
ENDM
ADDLW MACRO VALUENUMS
ADD A,@VALUENUMS
ENDM
SUBLW MACRO VALUENUMS
SUB A,@VALUENUMS
ENDM
RETURN MACRO
RET
ENDM
RETFIE MACRO
RETI
ENDM
MOVLF MACRO REGISTER,VALUENUMS
MOV A,@VALUENUMS
MOV REGISTER,A
ENDM
CLRC MACRO
BC STATUS,C
ENDM
SETC MACRO
BS STATUS,C
ENDM
CLRDC MACRO
BC STATUS,DC
ENDM
SETDC MACRO
BS STATUS,DC
ENDM
CLRZ MACRO
BC STATUS,Z
ENDM
SETZ MACRO
BS STATUS,Z
ENDM
SKPC MACRO
JBS STATUS,C
ENDM
SKPNC MACRO
JBC STATUS,C
ENDM
SKPDC MACRO
JBS STATUS,DC
ENDM
SKPNDC MACRO
JBC STATUS,DC
ENDM
SKPZ MACRO
JBS STATUS,Z
ENDM
SKPNZ MACRO
JBC STATUS,Z
ENDM
TSTF MACRO REGISTER
MOV REGISTER,REGISTER
ENDM
MOVFW MACRO REGISTER
MOV A,REGISTER
ENDM
NEGF MACRO REGISTER,DIR
COM REGISTER
IF DIR == W
INCA REGISTER
ELSE
INC REGISTER
ENDIF
ENDM
NEGF MACRO REGISTER
COM REGISTER
INC REGISTER
ENDM
ADDCF MACRO REGISTER,DIR
JBC STATUS,C
IF DIR == W
INCA REGISTER
ELSE
INC REGISTER
ENDIF
ENDM
ADDCF MACRO REGISTER
JBC STATUS,C
INC REGISTER
ENDM
SUBCF MACRO REGISTER,DIR
JBC STATUS,C
IF DIR == W
DECA REGISTER
ELSE
DEC REGISTER
ENDIF
ENDM
SUBCF MACRO REGISTER
JBC STATUS,C
DEC REGISTER
ENDM
PUSHAF MACRO WREGISTER,SREGISTER
;...保护现场................
MOV WREGISTER,A
SWAP WREGISTER;保护A
SWAPA STATUS
MOV SREGISTER,A;保护STATUS
SWAPA WREGISTER;取A
ENDM
POPAF MACRO WREGISTER,SREGISTER
;...恢复现场................
SWAPA SREGISTER
MOV STATUS,A;恢复A
SWAPA WREGISTER;恢复STATUS
ENDM
系统注:本文被丁丁加精.
文章评论(0条评论)
登录后参与讨论