assembly - "RET" in MSP430 taking me to the wrong place? -


so i'm programming simple call function msp430fg4168. , it's working perfectly, except when comes time return caller, function dumps me @ beginning of callee function.

it's multiply function takes values in r13 , r14.

here's function file code:

#include "msp430.h"  extern main ;allows function aware of main public mult  0  db   0;  rseg code  mult:  push r7; store value of r7 on stack future reference clr  r7 mov  r14, r7; r14's value used counter. r13 added number of times specified in r14 , final value stored in r14.  clr r14  dec r7  f_loop:  add r13, r14 dec r7 cmp zero, r7 jge f_loop;  f_end: pop r7; bring value of r7 stack. ret end 

"ret" problem is. instead of returning me caller, brings me beginning of mult. what's going on?

you're somehow messing caller's set of registers, or isr messes stack (sp): ret not 430 instruction, implemented mov @sp+,pc, , same goes pop (which mov @sp+,destination).


Comments

Popular posts from this blog

c# - Validate object ID from GET to POST -

node.js - Custom Model Validator SailsJS -

php - Find a regex to take part of Email -