;************************************************************************* ; F ; Ready-to-Use Modules in asm ; ; "68HC11 Like" Instruction Set ; ; (F) Copywrong 1997, f@POBoxes.com ; ; Filename : HC11LIKE.MAC ; Programmer : Frans Gunawan (92101710) ; Desription : Some "68HC11 Like" Instruction Set ; History : ; Version Comment ; 1.0sx Translated for use in the Ubicom SX processors ; 1.0 Support ; --------------------- ; July 22 adddIMM ; 1997 beq ; bne ; decEXT ; incEXT ; incX ; incY ; ldwIMM ; ldwEXT ; ldwINDX ; ldwINDY ; lddIMM ; lddDIR ; lddEXT ; ldxIMM ; ldxDIR ; ldxEXT ; ldyIMM ; ldyDIR ; ldyEXT ; stwEXT ; stwINDX ; stwINDY ; stdDIR ; stdEXT ; stdINDX ; stdINDY ; xgdx ; xgdy ;--------------------------------- ; 1.0b abx ; July 23 ldabDIR ; 1997 ;--------------------------------- ; 1.0c ldabIMM ; August 02 ldaaIMM ; 1997 ;--------------------------------- ; 1.0d cpxIMM ; August 16 cpyIMM ; 1997 cpdIMM ; ; WARNING: these instructions are not 100% portable, i.e. status bit ;************************************************************************* ;************************************************************************* ; macro ;************************************************************************* movlf MACRO FILE, LITERAL mov W, #LITERAL mov FILE, W ENDM longcall MACRO SUBROUTINE MOVPF WREG, TEMP_W mov W, #HIGH SUBROUTINE MOVPF WREG, PCLATH call @LOW SUBROUTINE ENDM longgoto MACRO ADDRESS mov W, #HIGH ADDRESS ;*** WARNING: PCLATH register bits are in STATUS PAx bits. Or use PAGE/IREAD if possible ; MOVWF PCLATH mov PCLATH, W mov W, #LOW ADDRESS mov PC, W ENDM abx MACRO MOVFP REGB, WREG add (REGX+1), W mov W, #$00 ADDWFC REGX ENDM ; A jmp ; h l ;------------+ ;A+h+c B+l ; adddIMM MACRO WORD mov W, #LOW WORD add REGB, W mov W, #HIGH WORD ADDWFC REGA ENDM beq MACRO JUMP snb ALUSTA.Z jmp JUMP ENDM bne MACRO JUMP sb ALUSTA.Z jmp JUMP ENDM ; cpx result is in Zero bit ; this instruction is followed by beq or bne ; ex: ldxIMM 0x1234 ; cpxIMM 0x1234 ; beq same ; no: ; same: cpxIMM MACRO WORD LOCAL cpx_exit LOCAL same local not_same mov W, #LOW WORD CPFSEQ (REGX+1) jmp not_same mov W, #HIGH WORD CPFSEQ REGX jmp not_same same: setb ALUSTA.Z jmp cpx_exit not_same: clrb ALUSTA.Z cpx_exit: ; jmp cpx_exit ENDM cpyIMM MACRO WORD LOCAL cpy_exit LOCAL same LOCAL not_same mov W, #LOW WORD CPFSEQ (REGY+1) jmp not_same mov W, #HIGH WORD CPFSEQ REGY jmp not_same same: setb ALUSTA.Z jmp cpy_exit not_same: clrb ALUSTA.Z cpy_exit: ; jmp cpy_exit ENDM cpdIMM MACRO WORD LOCAL cpd_exit LOCAL same LOCAL not_same mov W, #LOW WORD CPFSEQ REGB jmp not_same mov W, #HIGH WORD CPFSEQ REGA jmp not_same same: setb ALUSTA.Z jmp cpd_exit not_same: clrb ALUSTA.Z cpd_exit: ; jmp cpd_exit ENDM decEXT MACRO TARGET ldwEXT TARGET dec WREG stwEXT TARGET ENDM incEXT MACRO TARGET ldwEXT TARGET inc WREG stwEXT TARGET ENDM incX MACRO mov W, #$01 add (REGX+1), W mov W, #$00 ADDWFC REGX ENDM incY MACRO mov W, #$01 add (REGY+1), W mov W, #$00 ADDWFC REGY ENDM ldabDIR MACRO SOURCE MOVFP SOURCE, WREG MOVPF WREG, REGB ENDM ldwIMM MACRO DATA mov W, #DATA ENDM ldwEXT MACRO SOURCE ; External RAM mov W, #HIGH SOURCE mov TBLPTRH, W mov W, #LOW SOURCE mov TBLPTRL, W TABLRD 0,0,WREG ;DUMMY TLRD 0,WREG ENDM ldwINDX MACRO ; (REGX) -> WREG MOVFP REGX, WREG mov TBLPTRH, W MOVFP (REGX+1), WREG mov TBLPTRL, W TABLRD 0, 0, WREG ; DUMMY TLRD 0, WREG ; HIGH ENDM ldwINDY MACRO ; (REGY) -> WREG MOVFP REGY, WREG mov TBLPTRH, W MOVFP (REGY+1), WREG mov TBLPTRL, W TABLRD 0, 0, WREG ; DUMMY TLRD 0, WREG ; HIGH ENDM ldabIMM MACRO DATA mov W, #DATA mov REGB, W ENDM ldaaIMM MACRO DATA mov W, #DATA mov REGA, W ENDM lddIMM MACRO WORD ; load Immediate mov W, #HIGH WORD mov REGA, W mov W, #LOW WORD mov REGB, W ENDM lddDIR MACRO SOURCE MOVFP SOURCE, WREG MOVPF WREG, REGA MOVFP (SOURCE+1), WREG MOVPF WREG, REGB ENDM lddEXT MACRO SOURCE mov W, #HIGH SOURCE mov TBLPTRH, W mov W, #LOW SOURCE mov TBLPTRL, W TABLRD 0, 1, WREG ; DUMMY TLRD 0, REGA ; HIGH TABLRD 0, 0, WREG ; DUMMY TLRD 0, REGB ; LOW ENDM ldxIMM MACRO WORD ; load Immediate mov W, #HIGH WORD mov REGX, W mov W, #LOW WORD mov (REGX+1), W ENDM ldxDIR MACRO SOURCE MOVFP SOURCE, WREG MOVPF WREG, REGX MOVFP (SOURCE+1), WREG MOVPF WREG, (REGX+1) ENDM ldxEXT MACRO SOURCE mov W, #HIGH SOURCE mov TBLPTRH, W mov W, #LOW SOURCE mov TBLPTRL, W TABLRD 0, 1, WREG ; DUMMY TLRD 0, REGX ; HIGH TABLRD 0, 0, WREG ; DUMMY TLRD 0, (REGX+1) ; LOW ENDM ldyIMM MACRO WORD ; load Immediate mov W, #HIGH WORD mov REGY, W mov W, #LOW WORD mov (REGY+1), W ENDM ldyDIR MACRO SOURCE MOVFP SOURCE, WREG MOVPF WREG, REGY MOVFP (SOURCE+1), WREG MOVPF WREG, (REGY+1) ENDM ldyEXT MACRO SOURCE mov W, #HIGH SOURCE mov TBLPTRH, W mov W, #LOW SOURCE mov TBLPTRL, W TABLRD 0, 1, WREG ; DUMMY TLRD 0, REGY ; HIGH TABLRD 0, 0, WREG ; DUMMY TLRD 0, (REGY+1) ; LOW ENDM stwEXT MACRO DESTINATION ; External RAM MOVPF WREG, TEMP_W mov W, #HIGH DESTINATION mov TBLPTRH, W mov W, #LOW DESTINATION mov TBLPTRL, W MOVFP TEMP_W, WREG TABLWT 0, 0, WREG ENDM stwINDX MACRO MOVFP REGX, TBLPTRH MOVFP (REGX+1), TBLPTRL TABLWT 0, 0, WREG ENDM stwINDY MACRO MOVFP REGY, TBLPTRH MOVFP (REGY+1), TBLPTRL TABLWT 0, 0, WREG ENDM stdDIR MACRO DESTINATION MOVFP REGA, WREG MOVPF WREG, DESTINATION MOVFP REGB, WREG MOVPF WREG, (DESTINATION+1) ENDM stdEXT MACRO DESTINATION ; External RAM mov W, #HIGH DESTINATION mov TBLPTRH, W mov W, #LOW DESTINATION mov TBLPTRL, W TABLWT 0, 1, REGA TABLWT 0, 0, REGB ENDM stdINDX MACRO MOVFP REGX, TBLPTRH MOVFP (REGX+1), TBLPTRL TABLWT 0, 1, REGA TABLWT 0, 0, REGB ENDM stdINDY MACRO MOVFP REGY, TBLPTRH MOVFP (REGY+1), TBLPTRL TABLWT 0, 1, REGA TABLWT 0, 0, REGB ENDM xgdx MACRO MOVFP REGA, WREG MOVPF WREG, TEMP_W MOVFP REGX, WREG MOVPF WREG, REGA MOVFP TEMP_W, WREG MOVPF WREG, REGX MOVFP REGB, WREG MOVPF WREG, TEMP_W MOVFP (REGX+1), WREG MOVPF WREG, REGB MOVFP TEMP_W, WREG MOVPF WREG, (REGX+1) ENDM xgdy MACRO MOVFP REGA, WREG MOVPF WREG, TEMP_W MOVFP REGY, WREG MOVPF WREG, REGA MOVFP TEMP_W, WREG MOVPF WREG, REGY MOVFP REGB, WREG MOVPF WREG, TEMP_W MOVFP (REGY+1), WREG MOVPF WREG, REGB MOVFP TEMP_W, WREG MOVPF WREG, (REGY+1) ENDM ; END OF FILE
file: /Techref/scenix/68HC11.htm, 11KB, , updated: 2001/12/10 15:00, local time: 2024/11/21 12:53,
owner: JMN-EFP-786,
3.145.61.199: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://techref.massmind.org/techref/scenix/68HC11.htm"> Use these macros to program the SX with a '68HC11 like' instruction set</A> |
Did you find what you needed? |
Welcome to massmind.org! |
Welcome to techref.massmind.org! |
.