Dacobi Posted December 27, 2021 Share Posted December 27, 2021 Hi I'm trying to port some code to C and I've got most of it working. But I don't understand the (^ADDRESS + 2) syntax. What does it do? and what would it be in C? The code where it's used is for the address and bank. If I just use cbm_k_load(2, address); it doesn't work. Quote Link to comment Share on other sites More sharing options...
0 Greg King Posted December 27, 2021 Share Posted December 27, 2021 On 12/27/2021 at 3:29 PM, JimmyDansbo said: I would think that it should be cbm_k_load((address+2)>>16, address) No, the addition must be done last. It's used to move past numbers that Commodore already used to control Kernal's LOAD behavior: 0 -> normal load 1 -> normal verify 2 -> VRAM address high bit (0) 3 -> VRAM address high bit (1) 2 Quote Link to comment Share on other sites More sharing options...
0 JimmyDansbo Posted December 27, 2021 Share Posted December 27, 2021 Just like < and > gives you the low- and high- byte of a constant, ^ gives you the bank. The manual for CA65 has a bit of information. https://cc65.github.io/doc/ca65.html#ss5.5 Quote Link to comment Share on other sites More sharing options...
0 Dacobi Posted December 27, 2021 Author Share Posted December 27, 2021 On 12/27/2021 at 8:23 PM, JimmyDansbo said: Just like < and > gives you the low- and high- byte of a constant, ^ gives you the bank So in C that would be cbm_k_load((address>>16)+2, address) ? Quote Link to comment Share on other sites More sharing options...
0 JimmyDansbo Posted December 27, 2021 Share Posted December 27, 2021 I would think that it should be cbm_k_load((address+2)>>16, address) Quote Link to comment Share on other sites More sharing options...
Question
Dacobi
Hi
I'm trying to port some code to C and I've got most of it working.
But I don't understand the (^ADDRESS + 2) syntax. What does it do? and what would it be in C?
The code where it's used is for the address and bank.
If I just use cbm_k_load(2, address); it doesn't work.
Link to comment
Share on other sites
4 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.