I'm trying to decide on what I can get rid of from the zero page, so that I can keep my own data there. Looking at this page, documenting what each of the zeropage locations do, I'm trying to figure out why there are pointers to the ROM routines for converting to floating point from integers and back in locations $03 through $06.

I can't imagine we'd need to change the value of these pointers, so the addresses to those routines would be better off as operands to a jsr or whatever, wouldn't they?

  • It would have made sense if there where pointers for all float functions - or maybe a address of a table with all entry points. The way it is is an oddity. Even more so as it's only with the C64s BASIC 2.0. Neither PET Basic (1/4) or C16 BASIC V3.5 feature these pointers.
    – Raffzahn
    Commented Jan 2, 2019 at 22:12
  • unusedino.de/ec64/technical/project64/mapping_c64.html theorizes that it’s there to help devs have a consistent way of finding these routines possibly for things like USR handlers, and that it’s not used internally by BASIC. Ultimately not that useful.
    – Joe
    Commented Jan 3, 2019 at 3:54
  • 1
    If you are looking for zero page locations to use in a machine code program that eventually returns to BASIC, I would suggest the floating point accumulators between $62 and $6d, unless you want to use the C64 BASIC floating point routines, of course.
    – JeremyP
    Commented Jan 3, 2019 at 14:56
  • Not directly related, but you only need to care about what ZP locations you can use when a) your program is intended to run "in the background" or uses BASIC routines, then you only have $fb-$fe and $2 available, or b) your program makes use of KERNAL routines, then you shouldn't touch the upper half of ZP. Otherwise, you can just use the entire ZP. If a clean exit should be possible, it's easy to do a save and restore loop for ZP :) Commented Jan 7, 2019 at 14:51

2 Answers 2


According to the The Project 64 etext and Joe Forster's Commodore 64 memory map the zero page vectors $03/04 and $05/06 are actually not used by the ROM routines, except for being initialized at startup.

I made a quick test with a BASIC program using floating point and integer variables, it runs well even when I overwrite the zeropage values $03 to $06.


These function pointers are in zero page RAM because that leaves the manufacturer the ability to change the ROM without affecting software that already uses those functions through the zero page pointers. On startup, the ROM will populate the zero page pointers with its own function addresses. If there is a different revision of the ROM that has those functions in different places, then those values will be different.

  • 1
    Except it doesn't make much sense to only have the pointers for 2 of like 20 float functions being redirected.
    – Raffzahn
    Commented Jan 2, 2019 at 22:10
  • @Raffzahn: Could there be time/space trade-offs with the routines? I'd expect that in many programs the float-to-integer routine would get called a lot, and it might have been possible for the performance of a BASIC program to be improved significantly if it started by storing a faster (but later) float-to-integer routine in RAM e.g. at $C000, along with an ML routine to change the vector (changing either byte would break "poke" until the other was also set).
    – supercat
    Commented Jan 2, 2019 at 22:19
  • In a perfect world - or at least when developed in a professional manner - maybe (although other functions might be improves at least as much - just think of adding an FPU card). But the C64 (and its BASIC adaption) was done in a few weeks and afterwards not much happened. So no, I doubt any planing ahead.
    – Raffzahn
    Commented Jan 2, 2019 at 22:24
  • 1
    @Tommy No useful. Except to add that there is no JSR indirect - wich would be way more appropriate for calling routines that way. So calling a plain pointer subroutine is rather cumbersome. That's why the USR() address in commodore BASIC is prefixed by a JSR wich gets jumped upon. Interesting here thatthis is traditional within the ZP - just for C64 BASIC it got moved to $311/12- So usage of ZP was never fully thought thru either.
    – Raffzahn
    Commented Jan 3, 2019 at 0:02
  • 1
    @Raffzahn Although the C64 Basic Adaption may have been done in a few weeks, it descends from PET BASIC which is itself descended from Microsoft's 6502 BASIC. It's likely Microsoft who had the foresight to allow replacing or extending ROM routines by using a jump table stored in RAM. As for why they are in ZP, aren't JP instructions to there faster than otherwise? Commented Jan 4, 2019 at 14:52

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .