Brill Tom, I will change that, many thanks for reviewing and pointing out the hard coded references, I normally hate magic numbers, missed them. I am sure the 8 bytes at &a8 will be fine. Good call with pushing the high then low bytes to stack and RTS, it's been a while since I have done 8 bit coding.Regarding the zero page useage - service ROMs aren't allowed to use the $00...$8f region - that area is reserved for the current language ROM. Smith's book describes $70...$8f as the "user area", but that's only true when using the BASIC ROM. Other language ROMs are not obliged to not use this for their own workspace. And anyway, even in the BASIC ROM case, it's still a bit rude, because the user of your ROM might be using this area for something themselves!$a8...$af would be a better region to use for TEMPPTRL, TEMPPTRH and TEMPSTORE.&0000–&008F Language workspace.
Programs should not use this area of memory unless they are allowed to do so by the current language. Some languages make part of this page available to other programs (BASIC, for example, reserves locations &70 – &8F for the user) – but this is NOT guaranteed
The hard-coded $38/$39 could go there as well - or, alternatively, push high byte of address-1 then low byte of address-1 onto the stack and do an RTS. Then no zero page required!
(If you still need more zero page, with care you can also use $b0...$bf, which is available for general use but may get overwritten by any filing system call. If you're not writing output (OSWRCH can make a filing system call when spooling!) or reading input (OSRDCH can make a filing system call when execing!) then this region can come in handy too.)
--Tom
Cheers, Neil
Statistics: Posted by Neil — Tue Mar 05, 2024 10:24 am