6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Wed May 08, 2024 7:22 pm

All times are UTC




Post new topic Reply to topic  [ 9 posts ] 
Author Message
PostPosted: Mon Feb 14, 2022 4:19 pm 
Offline

Joined: Sun Nov 14, 2021 12:53 pm
Posts: 7
Atari 2600
Switch banking 4k+4k

I declare some constants in the Bank 0.
I need to use them, even, in the Bank 1.
Is it possibile to declare them only once in the Bank 0?
Because if I declare again in the Bank 1, it is necessary to change their name.

Thanks


Top
 Profile  
Reply with quote  
PostPosted: Mon Feb 14, 2022 6:32 pm 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10800
Location: England
The answer probably depends on which assembler you are using - which is it?


Top
 Profile  
Reply with quote  
PostPosted: Tue Feb 15, 2022 10:48 am 
Offline

Joined: Tue Sep 03, 2002 12:58 pm
Posts: 298
I think some more context would be helpful. How exactly is the banking done?

The 2600 uses a 6507, which has only 13 address pins. The resulting 8K of externally addressable memory gets mirrored eight times in the 64K space that code can see. That 8K is further divided into 4K of I/O and RAM and 4K of ROM. Games that need more than 4K of ROM have to arrange some kind of banking.

But there are many ways of doing that, and I don't know which are used. There are too many options for speculation to be very helpful. I will speculate anyway.

Since the 4K ROM is mirrored throughout the 64K address space, you could assemble each bank to a different target address. So one thinks it's at $1000, another thinks it's at $3000, and so on. Even though only one is available at a time, you can still assemble them together and not worry about overlapping code confusing the assembler.

If the banking is only partial, and you're swapping 2K blocks while keeping 2K fixed, you could have common things in the fixed block. It sounds like that's not the case here though. If the whole 4K gets swapped, they have to be completely independent. If you've got anything that you need to place in more than one bank, they have to be independent copies. In that case, there's no need for the copies to be at the same locations. I think I would find it much less confusing if the banks were treated as completely independent things, with different names to make it clear what bank data is in.

But don't listen to me. I have never done 2600 development, and I don't know how the people who have do things. There must be a 2600 development community out there somewhere. They'd be the best people to ask if you want to know good ways to manage it. This is really a 2600 question, not a 6502 one: the same problems would arise whatever processor was used.


Top
 Profile  
Reply with quote  
PostPosted: Tue Feb 15, 2022 11:43 am 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10800
Location: England
John West wrote:
Since the 4K ROM is mirrored throughout the 64K address space, you could assemble each bank to a different target address. So one thinks it's at $1000, another thinks it's at $3000, and so on. Even though only one is available at a time, you can still assemble them together and not worry about overlapping code confusing the assembler.

I like this! (I suspect banking, in all its various forms, tends to stress our mental models of how things work. Which is to say, it's difficult to think about, correctly.)


Top
 Profile  
Reply with quote  
PostPosted: Tue Feb 15, 2022 1:52 pm 
Offline

Joined: Fri Jul 09, 2021 10:12 pm
Posts: 741
It seems odd to me that it would be economical to use a cut-down CPU and supplement it with custom banking logic, rather than using the full 6502 in the first place. But I guess the banking logic ICs were in the cartridges, not the main system itself, and these banked cartridges could have been made much later when the price of components or PLDs had maybe dropped a lot, making it economical after all.


Top
 Profile  
Reply with quote  
PostPosted: Tue Feb 15, 2022 1:54 pm 
Offline
User avatar

Joined: Wed Feb 14, 2018 2:33 pm
Posts: 1405
Location: Scotland
gfoot wrote:
It seems odd to me that it would be economical to use a cut-down CPU and supplement it with custom banking logic, rather than using the full 6502 in the first place. But I guess the banking logic ICs were in the cartridges, not the main system itself, and these banked cartridges could have been made much later when the price of components or PLDs had maybe dropped a lot, making it economical after all.


Early Atari 2600 games didn't need banking - nor much RAM either. The console was too successful for its own good... some would suggest it lasted longer than it ought to...

It was pretty amazing at the time though!

-Gordon

_________________
--
Gordon Henderson.
See my Ruby 6502 and 65816 SBC projects here: https://projects.drogon.net/ruby/


Top
 Profile  
Reply with quote  
PostPosted: Tue Feb 15, 2022 3:03 pm 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10800
Location: England
The idea of making a cheap-as-possible console and then having (some) of the cartridges add extra hardware, that seems like quite a good idea to me. It's true that the later and larger games needed quite complex schemes, but then the game itself can perhaps cost more. And surely the 2600 being cheap to make and cheap to buy must have been a major factor in its success.

(An ultimate example of this might be Star Fox with a 16 bit RISC in the cart. Although that's for a different platform.)


Top
 Profile  
Reply with quote  
PostPosted: Sun Mar 06, 2022 4:51 pm 
Offline
User avatar

Joined: Tue Aug 11, 2020 3:45 am
Posts: 311
Location: A magnetic field
If you, for example, define a table which can be banked out then may have to define the table in two places or do some hooky includes. To minimize wasted ROM, define all of the global constants first and then define the constants which are local to each bank.

_________________
Modules | Processors | Boards | Boxes | Beep, Beep! I'm a sheep!


Top
 Profile  
Reply with quote  
PostPosted: Tue Mar 22, 2022 12:07 pm 
Offline
User avatar

Joined: Tue Aug 11, 2020 3:45 am
Posts: 311
Location: A magnetic field
gfoot on Tue 15 Feb 2022 wrote:
It seems odd to me that it would be economical to use a cut-down CPU and supplement it with custom banking logic


This inefficiency is deliberate. Many game consoles have been sold at a loss. The profit comes from selling games but people don't buy games unless they have a console. If the console is slightly cheaper than more people buy consoles and more games are sold. This is a false economy for a customer. However, the majority of game purchases occur after the console is a sunk cost.

Actually, I presume that all of the Atari 2600 game consoles were soldered manually. Soldering 28 pin 6507 rather than 40 pin 6502 would save considerable effort. It would also reduce production line theft because 6507 is less useful with 13 address lines and no NMI.

_________________
Modules | Processors | Boards | Boxes | Beep, Beep! I'm a sheep!


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 9 posts ] 

All times are UTC


Who is online

Users browsing this forum: hoglet and 10 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: