Log inRegister an accountBrowse CSDbHelp & documentationFacts & StatisticsThe forumsAvailable RSS-feeds on CSDbSupport CSDb Commodore 64 Scene Database
You are not logged in - nap
CSDb User Forums


Forums > C64 Coding > Bank switching with fastloaders
2015-08-13 19:35
Trap

Registered: Jul 2010
Posts: 223
Bank switching with fastloaders

Hi,

I've decided that I want to use Spindle for my little project, but I can't seem to get this bank switching done right.

So, normally we bank switch using DD00, but as I read from the documentation (and pretty much everywhere else when fastloaders are mentioned) we should use DD02 for switching instead.

Now, if I just do
lda #$3d
sta $dd02
that should switch the VIC to bank 1 ($4000-$7fff) right? (according to the spindle docs anyway) but that just doesn't happen.

The topic on this over on Codebase uses DD00 too. Looking at the memory map DD02 is 'Data Direction Register' and has absolutely nothing to do with VIC bank select. I'm confused. What am I missing here?

Thanks.
/Trap
 
... 10 posts hidden. Click here to view all posts....
 
2015-08-14 11:22
doynax
Account closed

Registered: Oct 2004
Posts: 212
Off-topic but the same "trick" of relying on the pull-up in input mode applies other NMOS logic as well.

Another application is for controlling the memory configuration through either $00 or $01, thereby allowing the I/O page to be cheaply swapped in and restored from within an interrupt handler regardless of the previous configuration.

E.g.:
		lda #%00101111	;One-time initialization
		sta $00
		lda #%00110101
		sta $01

		;Main-line code
		dec $01		;Swap out the I/O page
		.
		.
		inc $01		;Restore the I/O page


interrupt:	inc $00		;Force in the I/O page
		.
		.
		dec $00		;Restore previous configuration
		rti
		
2015-08-14 13:01
chatGPZ

Registered: Dec 2001
Posts: 11386
Quote:
I wonder if you are aware of what you are doing.

i am asking that myself every time you post into a coding thread :)

doynax: thats a nice application of this "trick" indeed... saving a zeropage location and a cycle <3
2015-08-14 13:28
Oswald

Registered: Apr 2002
Posts: 5094
Quote: Didn't Krills loader have an option to put it in a mode so that it does not bother $dd00 writes? This was in some earlier Forum discussion about the subject.

There is a similar thing in the Poor/Bias Crusher fix loader. It sends a commmand to drive to put the drive code into a loop so that one do bank switching with 00 01 02 03 to $dd00 and 0 in the high bits does not bother the drive.

Drive code loop is waiting for specific value written to high bits of $dd00 and once it is received the drive code moves back to basic receiving loop.

Obviously that does not work if bank switching is needed while loading. For that one needs $dd02 or a loader that does lda bits OR #bank sta $dd00 or similar when transfering data.

Anyway, a good feature.


Krill's dd00 ignoring is for routines when you are doing stuff like sta d018 sta dd00 in the raster, so the loader in the drive will not listen as long the raster fx is going. It's the chessboard fx in soiled legacy that needed it :)
2015-08-14 19:08
Trap

Registered: Jul 2010
Posts: 223
thank you. I've played around with it and finally understood it.

Now, what are the 'rules' for dd00 when using fastloaders? I mean, should I initialize dd00 with AND #%11111100 when the demo starts and then only use dd02 for all code following that? Can I still use dd00 as long as I am not actively loading anything?

/Trap
2015-08-14 19:22
chatGPZ

Registered: Dec 2001
Posts: 11386
when not loading, it should be enough to set the other (IEC related) bits to input to not disturb the loader. and setup them properly before loading again, ofcourse :) that part is usually handled by the loader though - the problem usually only arises when trying to do bankswitching while loading.
2015-08-14 19:32
lft

Registered: Jul 2007
Posts: 369
For spindle, there is no need to initialise dd00, as this is taken care of by the bootloader. So you only ever need to touch dd02.

Perhaps you are developing an effect as a standalone program, and launch it directly without spindle. In that case, you should initialise dd00 to 0.

Writing zero to dd00 is safe between calls to spindle, so there shouldn't be any problem if you forget to remove the initialisation code later.
2015-08-14 20:20
Trap

Registered: Jul 2010
Posts: 223
Great. Thank you.

Back to coding ;)

br
Trap
2015-08-16 21:06
Krill

Registered: Apr 2002
Posts: 2980
Quoting Oswald
Krill's dd00 ignoring is for routines when you are doing stuff like sta d018 sta dd00 in the raster, so the loader in the drive will not listen as long the raster fx is going. It's the chessboard fx in soiled legacy that needed it :)
That was an older loader which didn't, as groepaz suggested, simply set all outgoing bits to input when idle, so that the $dd00 value would be irrelevant. That special "bus lock" thing isn't needed with the current one, and i went in the other direction than lft did with Spindle: you can set $dd00 normally while loading (values 0..3 only, and no masking), while the loader sets $dd02.
Previous - 1 | 2 - Next
RefreshSubscribe to this thread:

You need to be logged in to post in the forum.

Search the forum:
Search   for   in  
All times are CET.
Search CSDb
Advanced
Users Online
sln.pixelrat
Guests online: 107
Top Demos
1 Next Level  (9.7)
2 13:37  (9.7)
3 Mojo  (9.7)
4 Coma Light 13  (9.6)
5 Edge of Disgrace  (9.6)
6 What Is The Matrix 2  (9.6)
7 The Demo Coder  (9.6)
8 Uncensored  (9.6)
9 Comaland 100%  (9.6)
10 Wonderland XIV  (9.6)
Top onefile Demos
1 No Listen  (9.6)
2 Layers  (9.6)
3 Cubic Dream  (9.6)
4 Party Elk 2  (9.6)
5 Copper Booze  (9.6)
6 Dawnfall V1.1  (9.5)
7 Rainbow Connection  (9.5)
8 Onscreen 5k  (9.5)
9 Morph  (9.5)
10 Libertongo  (9.5)
Top Groups
1 Performers  (9.3)
2 Booze Design  (9.3)
3 Oxyron  (9.3)
4 Triad  (9.3)
5 Censor Design  (9.3)
Top Fullscreen Graphicians
1 Joe  (9.7)
2 Sulevi  (9.6)
3 The Sarge  (9.6)
4 Veto  (9.6)
5 Facet  (9.6)

Home - Disclaimer
Copyright © No Name 2001-2024
Page generated in: 0.068 sec.