Re:Some of the error messages produced by Apple's MPW C comp...
by Max-q on Sunday August 27, 2023 @04:51PM
(#37286522)
We did a lot of loop unrolling and self modifying code back in the day, when making demos for the C64. The branch is really expensive. For example, clearing the screen you might use 16 STA adr,x and then add 16 to X before you branch to the loop.
[ Parent
| on HN ]
Re:Some of the error messages produced by Apple's MPW C comp...
by tom_ on Sunday August 27, 2023 @07:36PM
(#37287738)
Indeed, in some cases you want the unrolls. The 6502 is good in the twisties, but if you're trying to do any kind of copy or fill then the percentage of meaningful cycles is disappointingly low. A perfectly-unrolled sequence of lda abs:sta abs spends 75% of its time fetching the instruction bytes! - and if you don't have the room to spend 6 instruction bytes on every 1 byte copied, then the dex/dey/bne/bpl/etc./whatever overhead can really add up.
Also, if you're trying to keep in sync with some other piece of hardware, then just doing it step at a time can be much easier.
Anyway, I have done a lot of all of this sort of code and I am quite familiar with the 6502 tradeoffs! But for printing 15 chars by calling a ROM routine, I stand by my comments.