6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Sun Nov 24, 2024 10:13 am

All times are UTC




Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
PostPosted: Wed Jul 04, 2001 12:30 am 
Maxinum memory address is FFFF in 6502,

How to read or write data over 64K?
Can I use 'far' or 'huge' to declare a variable or a pointer?


Report this post
Top
  
Reply with quote  
PostPosted: Thu Jul 05, 2001 4:18 am 
Offline
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8546
Location: Southern California
There are many ways to address larger memory spaces. One way would be to use a one-page section of the normal 64K address space as a window into another, usually larger space, like 1MB for example. In this particular case, the low eight bits of processor's address bus would also be the low eight bits for the larger space; but the upper twelve bits of the new, larger space would have to be stored in memory-mapped output registers that would feed the upper 12 address bits of the larger memory. Then every time the high eight bits of the processor's address bus point to that window to the larger memory, the larger memory is enabled instead of the direct-access memory in the main 64K. Obviously, storing the upper bits means a few more processor instructions, but it may be a good way to have a really large data space. (It's not as practical to use as a large program space.)

The possibility of using directives called "far" or "huge", if they exist, would come from a compiler you might use-- but the 6502 itself only has 16 address bits and will not multiplex them for more. Your compiler would then add the extra instructions to take care of the overhead details above to access the extension memory bus.

The 65816 (the 6502-family processor with a 16-bit A, X, and Y) has and data- and program-bank registers that facilitate access to 16MB of memory space for both data and program. The eight additional address bits are put on the data bus while phase 2 is low, leaving the phase-2-high time for the usual data-bus functions. An external 8-bit latch holds those extra address bits during the phase-2-high time. There are still 64K boundaries that are not totally transparent, but you can do a lot of things that are either impractical or impossible to do with the 6502. It also has added addressing modes that give four-byte machine-language instructions, consisting of an op code followed by three bytes (24 bits) of address operand.

Perhaps someone else would like to describe other ways to address more than 64K with a 6502. I have not looked into how the Apple II 1MB card worked, for example. I believe the 512KB RAM cartridge the Commodore 64 used to make the GEOS GUI work 10 to 100 times as fast actually used it like a fast-access disc, using DMA to shuttle the information to and from the main memory.

Edit, May 2014 (13 years later!): My code in PIC16 microcontrollers has been overflowing the first 2048-word program page into the second, and the mickeymousities of the program-memory page-select bits have caused an awful lot of bugs, and wasted an awful lot of my time. Doing this kind of thing on a 65xx system, for data only, with only part of the memory map being a window into a much larger memory space, might work fine; but I sure wouldn't want to duplicate the PIC's problems. What a rotten design!

Garth

_________________
http://WilsonMinesCo.com/ lots of 6502 resources
The "second front page" is http://wilsonminesco.com/links.html .
What's an additional VIA among friends, anyhow?


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 23 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: