I didn't mean to imply that you are doing anything incorrectly. I just wanted you to be aware of banking errors.So what you want to be doing is working in bank 0 with the variables and switching when you need to go to other banks and then switch back to bank 0 again.
For example in my code the Init routine should end ike this
Is my understand of this now correct? I am now going to incorporate your optimising code suggestions which by looking at I can see you are able to avoid switching banks too often by carefully choosing which routine uses which bank.Rich (BB code):movlb 0 return
Thank you for the help I have learnt a lot in these last few days.
Regards,
pic122
Have fun. Cheerful regards, Mike