I'm new to assembly / PIC / MPLABx / MPASM the whole chain, and am trying to port over some of my software knowledge from other areas, like building reusable code libraries that I will reuse in multiple projects.
I've got a delay library working, but it's still dependent on the processor #include "p12F509.inc" line because I'm checking STATUS,Z for my main loop decrement check.
Is there a way to pull these values in from the code that's using the library?
Is it safe to just redefine STATUS and Z locally, is there a concern these will change location in other processors?
Should I just use a different way to check for zero?
thanks!
my main countdown call for the delay, in my lib this is called a varying number of times for 1us, 1ms, and 100ms delays. this is where I'm using STATUS and Z:
Cntdwn DECF CntDownCounter ;decrement counter
nop
nop
nop
BTFSS STATUS, Z ;Zero flag set?
GOTO Cntdwn ;No, keep looping
retlw 0 ;Yes, timeout done