c64 memory map: dumb question

c64 memory map: dumb question

Post by Ian Kenn » Thu, 15 Jan 2004 21:51:37


Hi all

There's something bugging me about the way the 6510 uses the memory map.
This is a dumb question I'm sure. The 'OS' uses locations in page zero for
stuff like the Stack (apparently) but you can apparently use that area as
RAM too? Surely the processor can't work without a Stack so how can you use
that area. In fact you appear to be able to use the whole 64K in a certain
mode?
 
 
 

c64 memory map: dumb question

Post by sta » Thu, 15 Jan 2004 21:52:24

Hi Ian,


The stack is on page #1,at $0100-$01FF, not the zero page. But, yes,
you can use it to store data into it. Actually, the 1541 DOS _does_
use part of the CPU stack for data because there's so few RAM (2
Kbytes) in the drive. The part that is actually used for CPU stack is
only $0100-$0145; if you'd want to use more, you'd mess up the data
area at $0146-$01FF...


On the 6510, set address $01 to the value of $34 and you'll see the
complete 64 Kbytes of RAM. (Except for addresses $00 and $01 as those
are the CPU ports. You have to hack a lot to access the real RAM
"behind" them; I think, Marko Mel?wrote some docs about it...)
Bye,

Joe Forster/STA
XXXX@XXXXX.COM

 
 
 

c64 memory map: dumb question

Post by Michael J. » Thu, 15 Jan 2004 22:09:32


Nope. Page 1 is the stack. Page 0 is generally used for data that is
referred to often, because zero page access is faster than ordinary
access.


Of course you can, because it *is* RAM.


Of course it can -- as long as you write programs that don't use the
stack. Some early Z80 embedded systems hat no external RAM at all (and
hence, no stack), using only the processor registers. It's a bit hard to
do that on a 6510, as it has far less registers.


You just read from it and write to it as you usually do -- just be
careful not to overwrite data that is meaningful to other programs (say,
interrupt routines) or to the CPU itself (stack). Thus, if you are not
using any ROM routines, you have page 0 to yourself; and if you don't
have more than three levels of subroutines in your program, and don't
use the stack for anything else, you can use the rest of page 1 for
other purposes. I wouldn't recommend that, however -- if anything goes
wrong, the resulting bug will be hard to track down.


Almost. AFAIK, there's no way to use the processor port (memory
locations 0 and 1) as RAM.

Regards,
Michael
 
 
 

c64 memory map: dumb question

Post by Ian Kenn » Thu, 15 Jan 2004 22:21:25

Sorry I messed up on the zero page thing. However, it's not only the Stack.
Looking at the detailed memory mapthere appear to be all manner of 'crucial'
locations in the early addresses. Accumulator tempory storage for example.
Can the CPU work without these (if the user's using them) or does it
continue to do so? If the user manages to use the full 64K what does the
CPU use (apart from its registers)?

Thanks

Ian






for
as
use
 
 
 

c64 memory map: dumb question

Post by BlackJac » Fri, 16 Jan 2004 04:33:02


AFAIK they are written by just writing to them, i.e. whatever you write
there goes to the processor ports and the "underlying" RAM. Just like
"poke"ing to ROM writes to the underlying RAM. And reading can be done
with sprites and sprite collision detection as the VIC "sees" the RAM in
$00 and $01.

Ciao,
Marc 'BlackJack' Rintsch
 
 
 

c64 memory map: dumb question

Post by BlackJac » Fri, 16 Jan 2004 05:57:51


Either you talk about the "floating point accumulators" (FAC) or about the
one byte at $030c which stores the value of the CPU's accumulator register
before/after a SYS command. Both are used by the BASIC interpreter and
are not necessary for the CPU to work properly.


I don't get your point. The user uses the memory *through* the CPU so the
CPU uses the full 64K.

Ciao,
Marc 'BlackJack' Rintsch
 
 
 

c64 memory map: dumb question

Post by Spiro Trik » Sat, 17 Jan 2004 22:49:31

Hello Marc,





AFAIR, this is not the case. Although the CPU drives the address bus
and almost everything else, it does not drive the data bus - resulting
in something being written into this area, but not what you want.

It happens to almost always write the contents that were on the data
bus immediately before your write attempt. If you can convince the
VIC to access a specific byte immediately before your write attempt,
you can use this trick to write into these RAM locations.

See http://www.yqcomputer.com/ ~andreasg/c64/vic_artikel/vic_article_4.htm



No. In fact, writing is the more difficult part of it.


This is true.

Spiro.
 
 
 

c64 memory map: dumb question

Post by Dave » Thu, 29 Jan 2004 04:40:36

Hi,
I think the 'crucial' addresses that you refer to are only crucial when
parts of the KERNAL or BASIC ROM software are executing. For example, if you
write software that does not require KERNAL or BASIC, then you can safely
write to nearly all zero page. The stack that you refer to is used by the
CPU to store both return addresses and CPU register data. The storage works
on a last in first out (LIFO) basis. The stack "grows" down from $01FF to
$0100 at times when ever an interrupt, subroutine or the PHA, PHP
instructions are executed. If you manually write to the stack, you can
affect the instructions RTS, RTI, PLP and PLA as these instructions read
from the stack in RAM.

Here are what i call the critical addresses

$0000-$0001 Cassette control and memory map config.
$D000-$DFFF Custom chip space [only when IO is switched in].
$FFFA-$FFFB The real NMI vector.
$FFFC-$FFFD The RESET vector.
$FFFE-$FFFF The real IRQ vector.

These the rest is at your disposal.

Hope this helps.




Stack.
'crucial'


map.
zero
you
 
 
 

c64 memory map: dumb question

Post by Ian Kenn » Fri, 30 Jan 2004 04:16:25

heers. I've learnt a bit more since and realised the source of my
confusion.

"Dave" < XXXX@XXXXX.COM > wrote in message
news:bv6erk$m9g$ XXXX@XXXXX.COM ...
you
works
example.
the
area