| |
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.... |
| |
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
|
| |
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 |
| |
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 :) |
| |
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 |
| |
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. |
| |
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. |
| |
Trap
Registered: Jul 2010 Posts: 223 |
Great. Thank you.
Back to coding ;)
br
Trap |
| |
Krill
Registered: Apr 2002 Posts: 2980 |
Quoting OswaldKrill'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 |