SuperCPU rayed - Episode 8
Well folks, after staying in GO64! 9/97 a lot about interrupt programming
have experienced on the SuperCPU, it works now full to the point: Up to 16 MB
Ram on the Commodore 64 - and just waiting to be fully exploited.
How to address the memory and you can learn more here.
First, you have to make clear how the new memory is present: as directly
addressable namely Ram. That is, after $ FFFF is not the end! In
SuperCPU processor is the highest possible address namely $ FFFFFF - to
Addressing three bytes are now used as before the low and high byte,
and additionally the bank byte. The first address after $ 00FFFF is therefore
$ 010 000 - one could describe it as an address 0 in Bank 1. Each
Memory bank contains 64K, where everything is addressed linearly.
The structure
As we all know it, we have the memory of $ 0000 - $ FFFF, and it for the
SuperCPU actually $ 000 000 - $ 00FFFF is. The Bank byte of the now
24-bit wide Program Counter is namely when it is switched on
set to zero. Maybe you have ever heard it somewhere: The SuperCPU
in itself has 128K memory. This namely the Eprom chip not
Speed ??brakes, the entire operating system from there is the
Switching copied into Ram's - in the other 64K that is not for us
are achievable. Or rather, not very accessible - because this Ram
is from $ 010,000 - $ 01FFFF to find! Cell is filled in a loop in this area,
the C64 will Helmets: then, as the Rome - or better said Ram - yes
is now empty. With a SuperRAM card however is from $ 020 000 to the new storage
free. With a 1 MB Simm you now have exactly 1 MB of memory - the last
Address is $ 0FFFFF. Some will have perhaps already noticed: It has
not 64K or 128K + 1 MB to as Bank 0 and 1 already from the internal SRAM of the
SuperCPU are occupied.
And how do you get it?
In order to pack data into the RAM and get out of there, you have no
Enter complicated chains of command, or the like. For example, a # $ 20 for
Address to write $ 058100, a sufficient
LDA # $ 20
STA 058 100 USD
That's it! The value is landed in the memory. To him from there
to pick up again, you only need a LDA instruction. If we, for example, a color
want to fetch from a table from $ 03A000, could you implement it this way:
LDX # $ 00
LDA $ 03A000, X
STA $ D020
Well, it's that simple - and that you need not even in native mode
to be! The need (you remember) only turn on when
you want to use 16-bit - of course work, the so-called
'Long' addressing (with the address of 3 bytes) even if the registers on
16 bits. Actually, the part of the course could end up here again -
Finally, you know now how to use the new store, right? :-)
But the SuperCPU would be no Herself (Hm? Did she conscious? The
would be worthy of discussion ...) if there is not all sorts of other great
Features drinsteckten that have to do with the memory of the SuperRAM Card.
About the Zero Page
Because if you codet a while, you will sooner or later stumble over it,
that an address in a bank other than 0 in a Zero Page (Direct
Page, as we know recently - the page must indeed no longer at $ 0000
lie) would like to store pointers. Usually done on the SuperCPU
yes, for example, so (assuming we are in 16 bit mode):
LDA # $ 5000
STA $ FC
And you've got the # $ 00 into $ FC and # $ 50 into $ FD and can then over LDA
($ FC), Y (or on the SuperCPU yes even without, Y) access to the address.
Cleverly, knows the 65816 processor, the address located in bank 0
should - which is now only one clear. But what now if the address eg in
Bank 2 is? For this, there's the new special 3-byte pointer. Of course,
needs of the Direct Page 3 memory locations - but it comes with it
to each byte in the entire 16-Mbyte address space (and one can with
have available the SuperRAM card completely). Suppose we want to indirectly
access to address $ 020 000 - here's how:
STZ $ FC
STZ $ FD
LDA # $ 02
STA $ FE
LDY # $ 05
LDA [$ FC], Y
Add $ FC is the low byte of our address here 0 (hence the STZ), also
the high byte is 0, so we would have $ to 0000. Then follows the bank byte, $ 02, it
results in the address $ 020 thousandth In the Y-register, we pack a 5, and the
next LDA then fetches the value from address $ 020 005! As you can see, the
Guys from Western Design Center when developing the processor again 100%
the concept of 6502 followed - this type of addressing is actually the
logical extension of the previous structure.
Thus we have the following two standard possibilities at your disposal, either
directly (via the address) or indirectly (via a pointer in the
ZERO / Direct Page) to access the memory. Let you the first on the
Endulge!
Wait just
After some thought, some questions arise. What about, for example, with
Programs from? Should we now always use the 'long' addressing, also
if we wish to access bank 0? Of course not - but you can
If technologies. Listing 1 shows a few small transfer routines.
First, a range of 'normal' memory (is let's take a part
the Screenrams for demonstration purposes) copied to the SuperRAM. Then
this still moved to another storage area, and finally
coming back to bank 0 - on the screen. If technologies you can
instead of $ 0400 $ 000 400 write too! However, one may at the lowest
64K, you can forgo the long-Addressing also because the processor,
if he finds only a 16-bit address, stored using bank assumes 0.
What now but, if you will, for example, constantly refer to as bank 3? One
brings a wide range of values ??everywhere from memory, but bank 3 is frequently
used - by linearly addressed memory is so beautiful, but still $ 03XXXX
tap is not exactly the cream of the crop. Therefore, there is the
Possibility, banking bytes that the processor automatically before the address
depends if there is none specified, pretend. As I said, it is
usually 0 - but that can Change! This namely 0 is in
so-called Data bank register. Whenever one, with an address of 2 bytes
whether absolute, indexed or indirect, works that SuperCPU adds front
the 0 from the data bank register on - the Program Counter is finally 3
Bytes. The exceptions are the stack and the Direct Page - which are always
no matter what is in the data bank register in Bank 0. To pack the Databank
Change to register, there's the commands PHB and PLB. So you always goes over
the stack. So to get register in the Data Bank, a 3, writes
you:
LDA # $ 03
PHA
PLB
And already, the data bank register = 3 Attention! Now refers to any
Standard two-byte address on bank 3! An INC $ 2000, for example, now increases
the byte in $ 032 000! By skillfully expose the data bank register can
Make the Most of memory operations even without the long 24-bit addresses
Run - but you can also let's ... as it suits. To some
PC programmer runs it safe cold down his back, because the
Segmentation of the memory is there also in 64K large areas sometimes
quite a cramp - and forward-looking in spite of the
Intel technology. When SuperCPU you can but depending on your needs
directly access any memory location or the Data Bank
Put registers on the 64K bank on which it is currently accessing the most -
if this is not anyway Bank 0. Only one must pay attention to you: A STA
$ D020 causes a write access after $ 03D020 when the data bank register
= 3 - so do not be surprised if the border color to it does not change! That does
then only when specified with STA $ 00D020 that it is in an address
Bank 0 is - how should the CPU know that too otherwise. Also you must
know that it is not for all the commands a Long Addressing: For
Although we use LDA and STA unrestrictedly, as AND and the other
Links, ADC and SBC, but not eg INC or ROL. But this is
hardly a disadvantage, because such values ??one has anyway mostly in the Zero Page
or in bank 0 Another thing it is when all you programs in a
another bank run is possible as 0 - for the SuperCPU no problem. There are also
we also -. later Listing 2 shows firstonce dealing with the Data
Bank register. This carries by the way its name from the fact that it is only on
Data refers to - a JMP $ 1000 refers as before to $ 001000 also
if in the data bank register is registered as bank 6!
Over all limits?
A simpler question is whether one about the supposed boundary
Bank also comes when you, for example, accesses with $ FFFF, X and X-register
a 1 or higher is. The answer is plain works das. Because in
Unlike other concepts of memory allocation is at the SuperCPU
the subdivision into benches really only there for the programmer's life
easier. Therefore, you also need to when indexing no
To worry: A LDA $ 02FFFF, X with X = 1, logically, gets the value
$ 030 thousandth
Alright, that should be for this time's been back first. In the next part
learn your how quickly all with the help of the block-move instructions
Storage areas through the area transferred, and as a crowning glory, there's a
small routine that run a regular music at $ 1000 is possible - but at
$ 021 000 ...
In the following, the last part of our SuperCPU course there is then a
Complete Facts about all of the new commands, their opcodes and clock cycles.[5~
(w) Malte Mundt
©1999 Go64 Redax! & Count Zero/SCS*TRC for all HTML Stuff
[ Zum 7. Teil ][ Zum Index ][ Zum 9. Teil ]