I always thought the PBP author put his routines closest to zero vector
for the reason I gave. Now, since you sorted me out on that,
I think it's to avoid bank or page switching in his asm code to both
make it smaller, and if he didn't always know the internal variables were in bank0,
timings of the routines would be a pain, just as it can be here.
There are often only a few loops where timing is an issue, like in the first example of this thread.If the calling line (the GOSUB in your "main" routine) ends up in Page 1 while the sub is in Page 0 it STILL needs to switch pages - that's what I'm saying.
or, for example, something that is sending or receiving bytes at a time in a for next loop can be
called from anywhere and contained in the first 2K.
I haven't found the post, but it's cheaper to write a zero value than anything else,Page 1 to Page 0 does indeed take one instruction less than the other way around - go figure.
that is done with a single clrf instruction, but writing a one takes two instructions.
That one's got me stumped. I would like to see the disassembly.if everything fits within the same page (Page 0) then that same GOSUB now takes 3 instructions instead of 2. Go figure.
A jump from page 0 to page 0 should just be a gosub as if you are using a 2K chip.
You'll notice in the code above there are no asm gosubs.
Only returns to the gosubs that called the routines.
I think they must be more expensive, but that doesn't explain the difference.
Bookmarks