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 > Quick loading without an IRQ-loader!
2009-03-12 06:41
JackAsser

Registered: Jun 2002
Posts: 1989
Quick loading without an IRQ-loader!

Hey guys!

I know my ways around the various IRQ-loaders normally used today, but what about the non-IRQ-loaders (no music, $d011=0, sei, no-NMIs)?

- Which one can you recommend?

- Are there any that comes with source so that I can easily relocate them?

- How much faster are (can) a non-IRQ-loader be compared to an IRQ-loader?

- Any that perhaps easily can be connected to pucrunch or exo and thus load and decrunch at the same time?

- Is this stupid? Are the modern IRQ-loaders as fast or faster than the old legacy non-IRQ-loaders anyway?

/JackAsser
2009-03-12 07:07
Radiant

Registered: Sep 2004
Posts: 639
Non-IRQ loaders are a lot faster (several multitudes) IIRC. There's one on Plushdos, but as you know, Krill gets mad if you use it. ;-)

2009-03-12 07:26
Ninja

Registered: Jan 2002
Posts: 404
The routines getting data from the disk to the drive are not faster, but the transfer to the c64 is speeded up a lot as no handshaking is needed (think of synchronous against asynchronous).

Dunno what you are up to, have you tried thinking about just using the LOAD-vector as most people have some sort of cart (which is probably faster anyhow)? Plus, no compatibility problems then.
2009-03-12 08:19
JackAsser

Registered: Jun 2002
Posts: 1989
Quote: The routines getting data from the disk to the drive are not faster, but the transfer to the c64 is speeded up a lot as no handshaking is needed (think of synchronous against asynchronous).

Dunno what you are up to, have you tried thinking about just using the LOAD-vector as most people have some sort of cart (which is probably faster anyhow)? Plus, no compatibility problems then.


Just fixing old stuff. That old stuff uses some loader but it's quite slow. I did use the LOAD-vector at some places and thought that it would be nice to replace the fast loader with something really quick. But sure, I can change all loading places to normal LOAD and rely on the cart.

/JackAsser
2009-03-12 08:59
Graham
Account closed

Registered: Dec 2002
Posts: 990
In cases of normal fastloading, it is best to rely on the DOS vectors so cartridge fastloaders and other stuff like ide64 etc can be use.
2009-03-12 09:05
JackAsser

Registered: Jun 2002
Posts: 1989
Quote: In cases of normal fastloading, it is best to rely on the DOS vectors so cartridge fastloaders and other stuff like ide64 etc can be use.


As I do it now I first 'fix' the KERNEL by doing:
JSR $FF84
JSR $FF8A

Then I load using the technique you described in http://www.codebase64.org/doku.php?id=base:loading_a_file i.e. by calling $FFBD, $FFBA and $FFD5.

This works totally fine. Is this 'cart-compatible'? Or should I load via some other soft-vector?

/JackAsser
2009-03-12 09:59
iopop

Registered: Dec 2001
Posts: 317
It will use the "cart" fastloader if you keep $0330/$0331 intact.
2009-03-12 13:03
AlexC

Registered: Jan 2008
Posts: 293
I'd opt for cart fast loader as it makes it working with MMC and other (both current and future) hardware extensions possible. Also not everyone is using 1541 (I'm thinking about C128D users for example) as their number 8 disk drive.
2009-03-12 14:13
Graham
Account closed

Registered: Dec 2002
Posts: 990
Quote:
JSR $FF84
JSR $FF8A

Disables all cartridge fastloaders and hardware drivers.
2009-03-12 14:29
JackAsser

Registered: Jun 2002
Posts: 1989
Quote: Quote:
JSR $FF84
JSR $FF8A

Disables all cartridge fastloaders and hardware drivers.


Hmms, ok. So, what do I need to preserve to make sure LOAD works when I need it too (and that it will use the fastloader on the cart)?
2009-03-12 15:42
j0x

Registered: Mar 2004
Posts: 215
$0330-$0331 should be enough.
2009-03-12 15:42
chatGPZ

Registered: Dec 2001
Posts: 11108
make sure you do not reset the vectors, ever :)
2009-03-12 15:54
Oswald

Registered: Apr 2002
Posts: 5017
you can reinit everything through kernal subs, but god knows which one you need for load. probably easyer to figure tho :)
2009-03-12 16:22
chatGPZ

Registered: Dec 2001
Posts: 11108
Quote:
you can reinit everything through kernal subs


NO! if a cartridge is inserted, then calling the kernal functions will reset the vectors to their "normal" values. to be able to use cartridge loaders you must NOT call i/o reset (might disable cartridge), and NOT touch the vectors whatsoever.

said kernal functions beeing called is pretty much the number one reason for cartridge fastloaders NOT working with a lot of programs =P
2009-03-12 17:10
JackAsser

Registered: Jun 2002
Posts: 1989
Quote: Quote:
you can reinit everything through kernal subs


NO! if a cartridge is inserted, then calling the kernal functions will reset the vectors to their "normal" values. to be able to use cartridge loaders you must NOT call i/o reset (might disable cartridge), and NOT touch the vectors whatsoever.

said kernal functions beeing called is pretty much the number one reason for cartridge fastloaders NOT working with a lot of programs =P


So what exactly must I do to be safe using the cart loader? Keeping $0330 and $0331 is simple enough, but is that enough? How must ZP and other stuff be set prior to calling LOAD, can it be anything?

/JackAsser
2009-03-12 17:10
MagerValp

Registered: Dec 2001
Posts: 1055
Quote: Hmms, ok. So, what do I need to preserve to make sure LOAD works when I need it too (and that it will use the fastloader on the cart)?

Do you need to mess with $03xx at all? Not touching them and just using LOAD means that it'll use AR6 or JiffyDOS or whatever.

Emulator users are screwed though. Flirt with GRG and use n0sd0s?
2009-03-12 17:48
chatGPZ

Registered: Dec 2001
Posts: 11108
Quote:
So what exactly must I do to be safe using the cart loader? Keeping $0330 and $0331 is simple enough, but is that enough? How must ZP and other stuff be set prior to calling LOAD, can it be anything?


- don't touch the vectors (not just load, but also chrin etc, just incase) or restore them
- not call the kernal routines for resetting i/o (these also rewrite vectors, but not with the one that are used by the cart so effectivly they disable cart fastloaders)
- not do any other fancy stuff that stops carts from banking in their ram into i/o area (thats were the vectors point to)
2009-03-12 17:55
JackAsser

Registered: Jun 2002
Posts: 1989
Quote: Quote:
So what exactly must I do to be safe using the cart loader? Keeping $0330 and $0331 is simple enough, but is that enough? How must ZP and other stuff be set prior to calling LOAD, can it be anything?


- don't touch the vectors (not just load, but also chrin etc, just incase) or restore them
- not call the kernal routines for resetting i/o (these also rewrite vectors, but not with the one that are used by the cart so effectivly they disable cart fastloaders)
- not do any other fancy stuff that stops carts from banking in their ram into i/o area (thats were the vectors point to)


Hmms ok. Really, is that all?

- Exactly what memory area is 'the vectors'? $03xx?
- What about SEI/CLI? Ok if SEI?
- What about the CIA-chips? Any state they need to be in?
- What about zero page, anything I need to consider there?
- Will is also work without a cart? Iirc the normal KERNEL is quite picky about timers and CIA in general hence my call to reset IO.

It will be quite tricky for me to preserve the whole $03xx area, possible to pin point exactly like how Groepaz started?

And FYI I'm 'cracking' an old demo.

/JackAsser
2009-03-12 18:08
chatGPZ

Registered: Dec 2001
Posts: 11108
- Exactly what memory area is 'the vectors'? $03xx?

yes

- What about SEI/CLI? Ok if SEI?

not sure, but it should not matter - the kernal routines sei/cli internally and you should expect them to do it too.

- What about the CIA-chips? Any state they need to be in?

probably :) i'd check if it works with normal kernal, then it should be ok with carts too

- What about zero page, anything I need to consider there?

setnam, chkout etc should set up the required ZP ... i think :)

- Will is also work without a cart? Iirc the normal KERNEL is quite picky about timers and CIA in general hence my call to reset IO.

yes. you should always test against the original kernal. cracks often use a clone of the kernals reset-i/o function, with the unwanted stuff removed.

- It will be quite tricky for me to preserve the whole $03xx area

like jox said, only the LOAD vector _should_ be enough. for a demo that only ever uses the load call anyway :)
2009-03-12 18:40
JackAsser

Registered: Jun 2002
Posts: 1989
Quote: - Exactly what memory area is 'the vectors'? $03xx?

yes

- What about SEI/CLI? Ok if SEI?

not sure, but it should not matter - the kernal routines sei/cli internally and you should expect them to do it too.

- What about the CIA-chips? Any state they need to be in?

probably :) i'd check if it works with normal kernal, then it should be ok with carts too

- What about zero page, anything I need to consider there?

setnam, chkout etc should set up the required ZP ... i think :)

- Will is also work without a cart? Iirc the normal KERNEL is quite picky about timers and CIA in general hence my call to reset IO.

yes. you should always test against the original kernal. cracks often use a clone of the kernals reset-i/o function, with the unwanted stuff removed.

- It will be quite tricky for me to preserve the whole $03xx area

like jox said, only the LOAD vector _should_ be enough. for a demo that only ever uses the load call anyway :)


@Groepaz: Hmmz. :) Thanx for the good input.

Basically I'll take the bits and pieces of information and dis-information from you guys and start experimenting my self. :D I have a good idea what research I need to do know, so thanx!

/JackAsser
2009-03-12 18:44
Frantic

Registered: Mar 2003
Posts: 1627
A tool which I am coding uses cartridge for fastloading/saving. Regarding the state of the CIA's I basically just make sure that there is a timer interrupt (Timer A, CIA 1, I believe) which goes off once a frame, pointing to the vectors at $03xx, and I enable the interrupts (dunno if that is necessary).

I don't really know about required ZP variables, apart from the ones you explicitly set up when calling the load/save routines, since I don't touch ZP much in my tool.
2009-03-12 19:36
Mace

Registered: May 2002
Posts: 1799
In reply to the original question (I haven't read this thread completely): my favourite speedloader was Gigaload.

It's embedded in at least one Secure demo I made.
Don't know where I got it from...
I vaguely remember seeing it on a GEOS disk, once, though.
2009-03-13 03:03
Graham
Account closed

Registered: Dec 2002
Posts: 990
Also important: $BA should not be destroyed. It's the last used device number. If someone loaded your program from device 11, your program should continue to do so too. Don't default everything to device 8.
2009-03-13 06:02
JackAsser

Registered: Jun 2002
Posts: 1989
Quote: Also important: $BA should not be destroyed. It's the last used device number. If someone loaded your program from device 11, your program should continue to do so too. Don't default everything to device 8.


Noted. Thanx!
2009-03-13 06:22
Oswald

Registered: Apr 2002
Posts: 5017
Quote: Quote:
you can reinit everything through kernal subs


NO! if a cartridge is inserted, then calling the kernal functions will reset the vectors to their "normal" values. to be able to use cartridge loaders you must NOT call i/o reset (might disable cartridge), and NOT touch the vectors whatsoever.

said kernal functions beeing called is pretty much the number one reason for cartridge fastloaders NOT working with a lot of programs =P


just store / restore 330/331 before after kernal resets :P and dont touch it otherwise.
2009-03-13 06:25
j0x

Registered: Mar 2004
Posts: 215
To answer your first question in #18: "the vectors" are $0300-$0333, inclusive.

.. and what Graham said. Will it work on device 1 ? :D

> Any that perhaps easily can be connected to pucrunch or exo and thus load and decrunch at the same time?

Loading while decrunching will make better use of the otherwise idle cycles on the c64-side, but may make you more sensitive to nonoptimal sector interleave, since you'll need your data to be loaded in order. A bit of thinking can solve most of this problem, giving you a "semi-inorder" loading scheme that combines loading while decrunching with an interleave-tolerant loader. This explanation is pretty poor -- sorry.

Alsö alsö nöte:

* While many carts init $ba to 8, the original rom init does not. This is only important for your first load, of course.
* If you're finding it difficult to preserve the vectors, it'll probably be hard to find a (decent) fastloader that'll fit in memory.
* When it comes to compatible CIA settings, you can't make sure each and every hard/firmware loader works. Going with default CIA settings is your best bet. The same goes for SEI/CLI. Clearing the flag is your best bet.

2009-03-13 07:31
HCL

Registered: Feb 2003
Posts: 716
Loading without IRQ is not "several multitudes" faster really.. Many IRQ-loaders manage to load with a sector interleave of 5 (read every 5:th sector), while a non-irq loader can manage sector interleave of 3 (afaik) without parallell cabele or other HW-extentions.

So.. the multitide there is like 66% faster.
2009-03-13 08:47
Devia

Registered: Oct 2004
Posts: 401
if $ba is #$00 you should set it to #$08 otherwise keep it intact as j0x and graham pointed out.
But if it is 00, your program got loaded via "other means" and there might be a physical or emulated floppy device present with the actual content on it, only this device didn't set $ba when it loaded via "other means".
I've seen some devices do this, can't remember which tho ;-) -- maybe 1541U?
2009-03-13 09:11
Graham
Account closed

Registered: Dec 2002
Posts: 990
I'd guess IDE64 (I remember stories about compability problems due to no support for STATUS etc). CodeNet also doesn't set $BA.

And concerning using $BA for loading:

    LDA #$01
    LDY #$01
    LDX $BA
    BNE .skip
    LDX #$08
.skip
    JSR SETLFS


does the trick.
2009-03-13 09:40
Frantic

Registered: Mar 2003
Posts: 1627
I made a first start on an article about this topic on Codebase, since it is a recurrently asked question here on CSDb:

http://codebase64.org/doku.php?id=base:making_use_of_the_fastlo..

Feel very free to fill in with more details here!

//Frantic
2009-03-13 10:15
JackAsser

Registered: Jun 2002
Posts: 1989
Quote: I made a first start on an article about this topic on Codebase, since it is a recurrently asked question here on CSDb:

http://codebase64.org/doku.php?id=base:making_use_of_the_fastlo..

Feel very free to fill in with more details here!

//Frantic


I'm currently writing a test program that I want you guys to test on various more or less exotic devices. Then when it works I'll post my findings and the code example on codebase.
2009-03-13 12:56
Burglar

Registered: Dec 2004
Posts: 1031
things you should ask yourself:

- am I gonna use only that kernel loader or will I use an irq loader later on that breaks compatibility with those mcc/ide64 lamers anyway?

- is the speed gain really that much?

- some cartridge loaders are plain suckage (ie: unable to load under rom, slow and fiddle with more registers that could possibly break your program)

imho using a kernel loader should be an option, not a fixed feature.
2009-03-13 14:00
Graham
Account closed

Registered: Dec 2002
Posts: 990
Quote:
- some cartridge loaders are plain suckage (ie: unable to load under rom, slow and fiddle with more registers that could possibly break your program)

Never seen a cartridge loader which cannot load under ROM. But most cartridge loaders cannot load below I/O area, just like the kernal loader.
2009-03-13 14:15
Burglar

Registered: Dec 2004
Posts: 1031
Quote: Quote:
- some cartridge loaders are plain suckage (ie: unable to load under rom, slow and fiddle with more registers that could possibly break your program)

Never seen a cartridge loader which cannot load under ROM. But most cartridge loaders cannot load below I/O area, just like the kernal loader.


yea, you're correct, the d000-dfff bit is the bitch
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
t0m3000/ibex-crew
pcollins/Quantum
Freeze/Blazon
kbs/Pht/Lxt
Pad/G★P
Sentinel/Excess/TREX
Guests online: 129
Top Demos
1 Next Level  (9.8)
2 Mojo  (9.7)
3 Coma Light 13  (9.7)
4 Edge of Disgrace  (9.6)
5 Comaland 100%  (9.6)
6 No Bounds  (9.6)
7 Uncensored  (9.6)
8 The Ghost  (9.6)
9 Wonderland XIV  (9.6)
10 Bromance  (9.6)
Top onefile Demos
1 It's More Fun to Com..  (9.7)
2 Party Elk 2  (9.7)
3 Cubic Dream  (9.6)
4 Copper Booze  (9.5)
5 Rainbow Connection  (9.5)
6 TRSAC, Gabber & Pebe..  (9.5)
7 Onscreen 5k  (9.5)
8 Wafer Demo  (9.5)
9 Dawnfall V1.1  (9.5)
10 Quadrants  (9.5)
Top Groups
1 Oxyron  (9.3)
2 Nostalgia  (9.3)
3 Booze Design  (9.3)
4 Censor Design  (9.3)
5 Crest  (9.3)
Top Fullscreen Graphicians
1 Carrion  (9.8)
2 Joe  (9.8)
3 Duce  (9.8)
4 Mirage  (9.7)
5 Facet  (9.7)

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