Commodore 128D User Manual Page 17

  • Download
  • Add to my manuals
  • Print
  • Page
    / 31
  • Table of contents
  • BOOKMARKS
  • Rated. / 5. Based on customer reviews
Page view 16
3.1.4 Startup settings for the PIA expansion
In order to enable the operation of the machine, each of the four segments must be mapped to a unique memory block.
The Commodore 64 Kernal tests the lowmost continuous area of writeable memory and would hang up, if the same
block was mapped to both $0000 and to $4000, for instance. Modifying the startup routines would cure this problem,
but in that case the Kernal ROM chip should be changed. Also the C128 Kernal would need some patching, if you
don’t want to run any initializer program every time you start the computer up.
The bootup state can be achieved otherwise. The RESET signal sets all the PIA port lines to inputs. As input a
line has an impedance of several megaohms. A TTL chip reads such a signal as a logical 1’. IC4 can force four block
selection pins (PA0, PA1, PA5 and PB0) low, so that the memory segments of C64 point to the four upmost memory
blocks in ascending order. The port A contains the bits 1101 1100 and the port B 1111 1110. As the IC4 has open
collector outputs, it doesn’t disturb the port’s operation when outputting high state. That is why the initialization
routines
14
write the value 52 to the address 57281, which forces the IC4 outputs high by lowering the CA2 line.
3.2 Segmented memory
The address space of Commodore 128 consists of four 16 kB segments which are at the address ranges $0000$3FFF,
$4000$7FFF, $8000$BFFF and $C000$FFFF. A PIA expanded C128 uses the topmost four 16 kB blocks of each
bank after startup. It considers them as its whole world and does not know anything of the other memory blocks.
Figure 1 describes the situation. A total of twelve memory blocks of each memory bank are left out of the C128’s
world.
With expanded memory we can cheat the C128 by writing a suitable number to a known address, in order to make
it consider the lowmost block as the second segment, for example. Then all operation that the C128 does at the second
segment’s area alter in fact the lowmost block, although the computer has no idea of it. This is the idea behind the
whole PIA expansion circuit.
What is the benefit of it? The second segment (segment 1) is actually a good example of the function, because it
resides in the middle of the RAM reserved for C64 BASIC programs. If we make a little C64 BASIC program that
holds an array exactly in the third segment, we can switch another memory block to that area while the program is
running, and we have another 16 kilobytes to expand our table. In this manner all unused memory blocks (12 × 16
kilobytes) of the memory bank selected for the C64 mode (0 by default) can be taken in use, and the memory is able
to hold enormous arrays, which can be accessed simply by switching the memory block. See Example 4.1 for an
example of this technique.
Another and more useful way to exploit the extra blocks is to use them as a RAM disk. A RAM disk means that
you can copy even a whole disk to these blocks and consider it as a new disk drive, from which you can load program
and data at a very fast speed. For a RAM disk you need a smart program that redirects disk commands and executes
them on the expanded memory.
15
3.3 Critical addresses for the PIA expansion
The critical addresses of the device are 5721657343 ($DF80$DFFF). There is the PIA chip to which you POKE the
values to switch memory blocks. The PIA does not have 128 registers, as one might think. There are sixteen copies
of its 4 addresses in that memory area. For instance, the addresses 57216, 57284, 57288 and 57340 are equivalent to
each other.
57280 is a memory place whose lowmost four bits (bits 0–3, low nybble) determine, which of the sixteen memory
blocks is accessed through the lowmost segment (segment 0) of Commodore 128. The upper four bits (bits 4–7, high
nybble) specify, which of the blocks show up at the second segment (segment 1). In a similar manner the low nybble
of the address 57282 determines which block resides at segment 2, and the high nybble tells the block addressed via
the upmost segment.
These addresses have even another function. They can act as data direction registers as well, i.e. tell if the port lines
are inputs or outputs. However, this application uses only some of the PIAs characteristics. For normal operation, all
the port lines should be set to outputs. The function of these addresses depend on the bit 2 of the next address. For
instance, the function of 57280 is defined with the address 57281. If you POKE there a value with its third bit set, the
14
See Section 3.4.
15
See Section 5.4.
17
Page view 16
1 2 ... 12 13 14 15 16 17 18 19 20 21 22 ... 30 31

Comments to this Manuals

No comments