.equ __P24FJ64GA002,1 ;required "boiler-plate" (BP) .include "p24Fxxxx.inc" ;BP #include "xc.inc" ;BP ;the next two lines set up the actual chip for operation - required config __CONFIG2, POSCMOD_EC & I2C1SEL_SEC & IOL1WAY_OFF & OSCIOFNC_ON & FCKSM_CSECME & FNOSC_FRC & SOSCSEL_LPSOSC & WUTSEL_FST & IESO_OFF config __CONFIG1, WDTPS_PS1 & FWPSA_PR32 & WINDIS_OFF & FWDTEN_OFF & COE_ON & BKBUG_ON & GWRP_ON & GCP_ON & JTAGEN_OFF .equ NUM_ELEMENTS, 10 .bss ;put the following labels in RAM arrayA: .space 2*NUM_ELEMENTS ;declare an array of words arrayB: .space 2*NUM_ELEMENTS ;declare an array of words ;;stack: ;; .space 32 ;this will be our stack area, from var_16_bit to here .text ;BP (put the following data in ROM(program memory)) .global _main ;BP ;because we are using the C compiler to assemble our code, we need a "_main" label ;somewhere. (There's a link step that looks for it.) _main: bclr CLKDIV,#8 ;BP ;; mov #stack,w15 ;initialize the stack pointer ; asm_indirect1.s ; move NUM_ELEMENTS words from arrayA to arrayB mov #NUM_ELEMENTS,w5 mov #arrayA, w10 mov #arrayB, w11 loop: mov [w10++], [w11++] dec WREG5 bra nz, loop lpbk: bra lpbk .end