Skip to content

Instantly share code, notes, and snippets.

@electronicayciencia
Last active June 14, 2020 19:18
Show Gist options
  • Save electronicayciencia/ccc50248c3fcbcb20526e8922dc718dd to your computer and use it in GitHub Desktop.
Save electronicayciencia/ccc50248c3fcbcb20526e8922dc718dd to your computer and use it in GitHub Desktop.
#BANKX
int buffer[BUFFER_LEN];
// Modulo addressing inicialization
XMODSRT = buffer;
XMODEND = buffer + BUFFER_LEN - 1;
MODCONbits.XWM = MODCON_WREG1;
MODCONbits.XMODEN = MODCON_ENABLED;
#ASM
mov #0,w0 // w0 is the counter: start at 0
mov buffer,w1 // w1 is the pointer: start at buffer[0]
do #100,end // repeat 100 times until "end", included
mov w0,[w1++] // store w0 at w1, post-increment pointer
end:
inc w0,w0 // increment counter
#ENDASM
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment