So, the Commodore 64 has two special registers in locations $00 and $01. By writing to these registers, you can somehow turn on and off the ROMs and other things. The thing that I am not understanding is why there is a direction register at location $00.

So if you write a 1 or 0 to the first bit in location $01, somehow this controls whether you can read from Commodore BASIC ROM or from RAM at the same addresses (in the literature this is apparently known as the LORAM signal). And I'm interested in knowing what happens if you write a particular value to the same bit in location $00. Does that mean that LORAM is now an input? Can you use this to test if BASIC is on?

  • 6
    The question in the title and the questions in the body do not seem to match up. Can you tighten this up, and ask one primary question per post, please?
    – user12
    Commented Jul 12, 2016 at 20:42
  • I don't mind changing it of course, but because I am asking about the mechanism that allows for the system to address more than 64 kilobytes. So "How does that work" seems fine to me, so what would you suggest for a title for this question? Commented Jul 13, 2016 at 6:52
  • You ask 'how does it do it', then say how it does it, and ask a final specific question about how the mechanism can be used. The problem with this approach is that your final question about reading this register risks getting lost in the noise. Strictly, your title does not ask how does it work, I think it effectively asks what is it (where it is the mechanism for accessing memory), and that feels slightly awkward to read (in UK English at least). Commented Jul 13, 2016 at 12:33
  • Answer to title: is Banking. C64 consists of different banks that points to different areas in memory.. Commented Feb 4, 2020 at 17:27

2 Answers 2


The 6510 CPU used in the Commodore 64 has an additional built-in general purpose I/O port compared to the original 6502 CPU. Address $0000 controls the direction for each of the bits of this I/O port, address $0001 can be used to read the voltage level of the corresponding pin for inputs, or set the voltage level of this pin for output.

In the Commodore 64, the pins for the lowest three bits of this port are connected to a PLA, where they control the address space layout. All three lines are also pulled up to +5V via resistors. So if you'd change the direction of any of these port bits from output to input, the line would just be held at +5V, you could read a 1 in the corresponding position at address $0001, and the PLA would behave like a 1 is output to it.

Therefore this setting serves no purpose, it's the same as if you had kept the direction to output and wrote a 1 into the data register. In particular it can't be used to test anything.

(I'll assume that this is your real question, and you are not asking about details how the Commodore 64 uses those 3 signals to control the address space layout, i.e. ROM/RAM. If you need those details, there's a table e.g. here.)

  • I've heard that reading $0000 gives the current input/output direction settings and reading $0001 will give the current setting for pins configured as outputs (and the input value on pins configured as inputs, of course). Is that correct? Commented Jul 12, 2016 at 22:47
  • @GeorgePhillips: That would be the usual way to handle GPIO registers if you can actually read the registers (sometimes you can't). The 6510 data sheet doesn't say if you can read them, but it would be easy to find out using an actual 6510.
    – dirkt
    Commented Jul 13, 2016 at 5:00
  • Reading $00 and $01 was suggested in this thread: lemon64.com/forum/viewtopic.php?t=53259 Was hoping to get a more reliable confirmation. Commented Jul 13, 2016 at 6:16
  • @GeorgePhillips: If INC is actually used in existing programs to toggle the lowest bit on both addresses, then yes, you can read both registers. I don't own a C64, but anyone who owns one should be able to easily check, if that is not enough confirmation.
    – dirkt
    Commented Jul 13, 2016 at 6:37
  • I wonder why the 6510 implemented the I/O using addresses 0 and 1 rather than using some otherwise unused opcodes [e.g. after fetching opcode $C2, the 6502 will fetch and ignore a second byte; hardware to watch for opcode $C2 could then capture that byte].
    – supercat
    Commented Jul 21, 2016 at 17:25

The C64 BASIC ROM lives at $A000, the KERNEL ROM lives at $E000, but these ROMs also have RAM wired in 'parallel' Under normal operation this RAM is unused but you can use the LORAM/HIRAM bits to enable or disable the ROMS and switch in the equivalent RAM memory.

One fun trick is to write a quick basic program to PEEK all the addresses from $A000 to $FFFF and POKE them back into the same address. You can't write to ROM, so what the 64 will do is basically copy the PEEKed value from ROM and put it into the same address in RAM. You then flip the LORAM/HIRAM bits to 'turn off the ROM' and use the RAM exclusively and you have a C64 with 'modifiable' roms. You can add new commands to the BASIC interpreter, or tweak your ROMs. But the copy in RAM is volatile and will go away when the power gets turned off.

You can use the LORAM bit to determine if the C64 is reading addresses $A000-$BFFF from ROM or from RAM, obviously if it reports ROM then BASIC is available.

Many programs take over the entire C64 by turning off the ROMS and using the available RAM for their own program code (or resources).

Dig up a copy of Mapping the C64 by Compute! for EVERYTHING you ever wanted to know about the C64 memory map.

  • 3
    You can download Mapping the C64 from The Internet Archive. (As I understand it, they only archive books that are in the public domain.) Commented Jul 13, 2016 at 15:52
  • That tip about writes to addresses where ROM is mapped passing through to RAM is brilliant!
    – cjs
    Commented Sep 19, 2019 at 16:49

You must log in to answer this question.

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