base:making_use_of_the_fastload_save_in_the_cartridge
no way to compare when less than two revisions
Differences
This shows you the differences between two versions of the page.
— | base:making_use_of_the_fastload_save_in_the_cartridge [2015-04-17 04:32] (current) – created - external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== Making use of the fastload/ | ||
+ | Most cartridges replaces the KERNAL load/save routines with faster stuff. Wouldn' | ||
+ | |||
+ | Note that this article is not complete, so feel free to fill in the blanks. | ||
+ | |||
+ | ====== Vectors ====== | ||
+ | |||
+ | In the memory area around $03xx you find a bunch of so-called " | ||
+ | |||
+ | < | ||
+ | $0330-$0331/ | ||
+ | $0332-$0333/ | ||
+ | </ | ||
+ | |||
+ | On a vanilla system, $0330/1 points to $F4A5 (LOAD to RAM) and $0332/3 points to $F5ED (SAVE RAM to storage media). If you have a cart inserted, the cartridge installs pointer to its own fastload/ | ||
+ | |||
+ | A description on how to set up calls to load/save routines, which goes through these vectors, can be found in the [[base: | ||
+ | |||
+ | If you have a 1541U, note that a direct DMA load of a .prg/.t64 file will circumvent the cart startup routines, even if you have a cart selected, and no fastload/ | ||
+ | |||
+ | ====== Required system state ====== | ||
+ | |||
+ | The KERNAL routines might not work if change the system state in certain ways in your program, such as changing the way interrupts are set up. This section is meant to explain how to deal with this. | ||
+ | |||
+ | You might think that you could initialize the relevant parts of the system by calling the following routines, before making your calls to the load/save routines: | ||
+ | |||
+ | < | ||
+ | JSR $FF84 ;Init I/O Devices, Ports & Timers | ||
+ | JSR $FF8A ; | ||
+ | </ | ||
+ | |||
+ | However, that is not the case, since these routines will actually overwrite any patched custom load/save routines that a cart might have installed for you. This means that you have to restore relevant parts of the system yourself. | ||
+ | |||
+ | The main things to think about is to call the system IRQ once a frame (this is done with Timer A, CIA 1 per default, on system startup) and to, of course, have KERNAL ROM enabled: | ||
+ | |||
+ | < | ||
+ | lda #$37 | ||
+ | sta $01 | ||
+ | </ | ||
+ | |||
+ | Regarding zeropage, the location $ba contains the last used device number. Make sure to store this value somewhere, if you use it for other purposes in your program, and set it back before your calls to LOAD/SAVE (if it does not happen to be equal to a value different from 8-11, then default it to 8 instead). If the user loaded your tool from device 11, then preserving this value allows you to let the user continue access the device he (most likely not she, statistically ;) loaded the tool from, which is proper behavior. | ||
+ | |||
+ | To be continued, hopefully, by me, or someone else! See [[http:// |
base/making_use_of_the_fastload_save_in_the_cartridge.txt · Last modified: 2015-04-17 04:32 by 127.0.0.1