So, the Commander x16 RAM/ROM is banked and the VERA module's RAM as well. I must confess, I'm having a bit of a hard time to get my head wrapped around how all this works and plays together.
For example, I can set the ROM bank at Zero Page address $01. When using the ^-extractor, is the value then obtained from this particular address $01 or does the value come from somewhere else? Because, why would I need ^ when I just could load from $01?
I'm pretty sure I just don't fully understand the whole banking thing yet and thus maybe asking questions which may sound dumb. So please be patient with me asking for related tutorials, links, YT videos or anything else, that can help me to clarify the banking concept of the x16 as well as of the VERA and how to implement/work with that (setting, obtaining, ...).
Many thanks for any help
How does Bank Byte extraction work?
- JimmyDansbo
- Posts: 476
- Joined: Sun Apr 26, 2020 8:10 pm
- Location: Denmark
- Contact:
Re: How does Bank Byte extraction work?
As you can see from here: https://github.com/X16Community/x16-doc ... ked-memory
When you write to $0000 you set the RAM bank and when you read $0000 you get the currently set RAM bank.
Same thing for ROM bank
When you write to $0001 you set the ROM bank and hwne you read $0001 you get the currently set ROM bank.
You can onlye read/write a single byte to the RAM/ROM registers so there is no need to use the ^ operator.
VERA has a total of 128KB of RAM and to address that amount of memory we need 17 bits. These bits are set through the VERA address registers
https://github.com/X16Community/x16-doc ... #registers
In CA65 assembler, you can reference individual bytes of a larger value by using ^, < and >
https://www.cc65.org/doc/ca65-5.html#ss5.5
As you can see:
< = low byte
> = high byte
^ = bank byte
I hope above makes sense, otherwise ask again and I will try to clarify
When you write to $0000 you set the RAM bank and when you read $0000 you get the currently set RAM bank.
Same thing for ROM bank
When you write to $0001 you set the ROM bank and hwne you read $0001 you get the currently set ROM bank.
You can onlye read/write a single byte to the RAM/ROM registers so there is no need to use the ^ operator.
VERA has a total of 128KB of RAM and to address that amount of memory we need 17 bits. These bits are set through the VERA address registers
https://github.com/X16Community/x16-doc ... #registers
In CA65 assembler, you can reference individual bytes of a larger value by using ^, < and >
https://www.cc65.org/doc/ca65-5.html#ss5.5
As you can see:
< = low byte
> = high byte
^ = bank byte
MYADDR=$1B00C LDA #^MYADDR ; .A = $01 LDA #>MYADDR ; .A = $B0 LDA #<MYADDR ; .A = $0C
I hope above makes sense, otherwise ask again and I will try to clarify
Visit my Github repo
or my personal site with CX16/C64/6502 related information.
Feel free to contact me regarding any of my projects or even about meeting up somewhere near Denmark
or my personal site with CX16/C64/6502 related information.
Feel free to contact me regarding any of my projects or even about meeting up somewhere near Denmark
Re: How does Bank Byte extraction work?
Hi JimmyDansbo, many thanks for this explanation.
First of all let me say, that I feel really very welcome here in the CX16 community. It seems that everybody wants to help and nobody is being rude just due to some maybe weird questions. Completely other than compared with eg Stack Overflow, where almost noone gets any help for more advanced questions or gets downvoted right from the beginning. So again, which ever post I read, there seems always be patience and helpfulness.
Summarized in short: when the bank register is only 8 bit, one can easily obtain the current selected bank through this register and there is no need for the use of the ^-operator. The ^-operator has nothing to do with banks in the first place but only returns the highest (third) byte of a 24bit tripple. It is just a coincedence that this third byte is used to determine a bank. Is that correct?
Given the VERA address bus, the 17th bit is located at $9F22 at LSB, but assuming you've also set striding values via bit3 to bit7 the ^-operator wouldn't return the bank# perse, so there is no further magic behind to detect the active bank? One would have to &1 for the imaginary bank, since the VERA isn't doing classic banking but rather normal addressing via a 17bit address bus.
Again, thanks for everything and have a nice weekend
First of all let me say, that I feel really very welcome here in the CX16 community. It seems that everybody wants to help and nobody is being rude just due to some maybe weird questions. Completely other than compared with eg Stack Overflow, where almost noone gets any help for more advanced questions or gets downvoted right from the beginning. So again, which ever post I read, there seems always be patience and helpfulness.
Summarized in short: when the bank register is only 8 bit, one can easily obtain the current selected bank through this register and there is no need for the use of the ^-operator. The ^-operator has nothing to do with banks in the first place but only returns the highest (third) byte of a 24bit tripple. It is just a coincedence that this third byte is used to determine a bank. Is that correct?
Given the VERA address bus, the 17th bit is located at $9F22 at LSB, but assuming you've also set striding values via bit3 to bit7 the ^-operator wouldn't return the bank# perse, so there is no further magic behind to detect the active bank? One would have to &1 for the imaginary bank, since the VERA isn't doing classic banking but rather normal addressing via a 17bit address bus.
Again, thanks for everything and have a nice weekend
- JimmyDansbo
- Posts: 476
- Joined: Sun Apr 26, 2020 8:10 pm
- Location: Denmark
- Contact:
Re: How does Bank Byte extraction work?
- Correct!!Slevin wrote: ↑Sat Mar 16, 2024 1:00 pm Summarized in short: when the bank register is only 8 bit, one can easily obtain the current selected bank through this register and there is no need for the use of the ^-operator. The ^-operator has nothing to do with banks in the first place but only returns the highest (third) byte of a 24bit tripple. It is just a coincedence that this third byte is used to determine a bank. Is that correct?
- Correct !!Slevin wrote: ↑Sat Mar 16, 2024 1:00 pm Given the VERA address bus, the 17th bit is located at $9F22 at LSB, but assuming you've also set striding values via bit3 to bit7 the ^-operator wouldn't return the bank# perse, so there is no further magic behind to detect the active bank? One would have to &1 for the imaginary bank, since the VERA isn't doing classic banking but rather normal addressing via a 17bit address bus.
I am happy you feel welcome in our midst. I hope you get things figured out and look forward to see what you can come up with.
Visit my Github repo
or my personal site with CX16/C64/6502 related information.
Feel free to contact me regarding any of my projects or even about meeting up somewhere near Denmark
or my personal site with CX16/C64/6502 related information.
Feel free to contact me regarding any of my projects or even about meeting up somewhere near Denmark