PRIMM is the only KERNAL library function left that uses abs,x addressing for stack access, thereby not working with a 65C816 in native mode where the stack page might have been moved. This PR adds an implementation that uses the 65C816's stack-relative addressing to work with arbitrary stack pointers; it also optimizes the 65C02's code path by changing the unnecessary (zp),y addressing modes with y = 0 to (zp), leaving y untouched.
PRIMM is the only KERNAL library function left that uses abs,x addressing for stack access, thereby not working with a 65C816 in native mode where the stack page might have been moved. This PR adds an implementation that uses the 65C816's stack-relative addressing to work with arbitrary stack pointers; it also optimizes the 65C02's code path by changing the unnecessary (zp),y addressing modes with y = 0 to (zp), leaving y untouched.