Code: Select all
Good fix — adds PHY/PLY to preserve IP around the LDY #16 loop. Let me update it:
Done. That's the third multiply/divide routine fixed with PHY/PLY — STAR, UMSTAR, and now UMSLASHMOD. It's worth doing a quick scan to make sure SLASHMOD and the shift words LSHIFT/RSHIFT don't have the same issue before you test them:
Find LDY # instructions that might be missing PHY/PLY
Find LDY # instructions that might be missing PHY/PLY
Lines 388, 420, 467, and 544 all use LDY #16 for loops — let me check which ones are missing PHY:
Line 544 in SLASHMOD is missing PHY. Let me check line 3067 too for LSHIFT/RSHIFT:
Check line 3067 context - DOTHEX
Check line 3067 context - DOTHEX
Good — .HEX already has PHY. Now check LSHIFT and RSHIFT:
LSHIFT and RSHIFT use TAY to load the shift count into Y, which also clobbers IP. They need PHY/PLY. And SLASHMOD at line 544 also needs it. Let me fix all three:
Now fix SLASHMOD at line 544:
Done — four more PHY/PLY fixes: LSHIFT, RSHIFT, SLASHMOD, and UMSLASHMOD. The pattern to watch for is any LDY #n or TAY inside a primitive that's used as a loop counter — those always need PHY before and PLY after to protect the IP.