advice for a game (fast)loader ?

Basic and Machine Language

Moderator: Moderators

Post Reply
User avatar
majikeyric
Vic 20 Afficionado
Posts: 350
Joined: Fri Oct 24, 2014 2:08 pm
Website: http://majikeyric.free.fr
Location: France

advice for a game (fast)loader ?

Post by majikeyric »

Hi,
I'm developing an adventure game on C64 and VIC20,
I need to access the drive during the game and often load gfx data (nearly 2Kb for each screen). What loading method / fastloader ...etc would you advise me to use accordingly to actual hardware available for the VIC20 ? I have well understood that using fastloaders is not good on the VIC but I need to load data at good speed.

I'm more aware of the C64 world. On C64, I'm using the cadaver IRQ-loader because I need to do some VIC tricks during loadings but not on the VIC20.

Any help ?

Thanks!
User avatar
Mike
Herr VC
Posts: 4831
Joined: Wed Dec 01, 2004 1:57 pm
Location: Munich, Germany
Occupation: electrical engineer

Re: advice for a game (fast)loader ?

Post by Mike »

majikeyric wrote:[...]using fastloaders is not good on the VIC[...]
Why?

You could always use the KERNAL load routine, and make use of the following setups:

- user has an installed JiffyDOS and a JD-enabled drive (which includes any SD2IEC solutions!),
- if the user doesn't have JD installed, but has a SD2IEC, you can him provide with SJLOAD,
- for an unmodified 1540/1541/1571 and PAL VIC-20, Hypra-System is a viable option,
- with a similar edge condition NTSC users can use TurboDisk.

A quick search in the forum should come up with a plenty of hits. There had been several IRQ loaders developed for the VIC-20, used mostly within demos. None of them is recognized by the current sd2iec firmware to emulate their protocol.
tlr
Vic 20 Nerd
Posts: 567
Joined: Mon Oct 04, 2004 10:53 am

Re: advice for a game (fast)loader ?

Post by tlr »

2 Kb is only 8 or 9 blocks and compressed it is usually much less so it shouldn't take too long to load. That said there is nothing preventing very fast loaders on the vic-20 assuming 1541/1571 only.

Mike touches on the subject of compatibility which may be more important on the vic-20 that on the c64 as more people seem to use devices like SD2IEC there.

Do you require loading while having interrupts? In that case you could pick a loader compatible to the GI-JOE loader which is slowish but supported by the SD2IEC firmware.
User avatar
majikeyric
Vic 20 Afficionado
Posts: 350
Joined: Fri Oct 24, 2014 2:08 pm
Website: http://majikeyric.free.fr
Location: France

Re: advice for a game (fast)loader ?

Post by majikeyric »

Yes, I want to stay as compatible as possible.

I don't need a IRQ loader on VIC20 but the display mustn't be turned off.

is TurboDisk the original "vic turbodisk" of Compute 1985/04 ? or has it been modded since ?
User avatar
Mike
Herr VC
Posts: 4831
Joined: Wed Dec 01, 2004 1:57 pm
Location: Munich, Germany
Occupation: electrical engineer

Re: advice for a game (fast)loader ?

Post by Mike »

majikeyric wrote:is TurboDisk the original "vic turbodisk" of Compute 1985/04 ? or has it been modded since ?
Yep. I'm not aware of any modified versions.
I don't need a IRQ loader on VIC20 but the display mustn't be turned off.
The DMA of the VIC-I chip in the VIC-20 doesn't 'steal' any cycles from the CPU, so there's no requirement *) to turn off the display (or more specifically, a bitmapped display) for fast loaders.

In case you've lurked into the thread 'Internal 3K expansion Mk II', where srowe and I ran into difficulties to load a picture during display even with the standard IEC routines, the graphic mode involved depends on two NMIs each frame to switch character sets. Of course the NMI routines steal cycles in a way comparable to VIC-II's badlines. **)

But a 'standard' bitmap mode with, say, 256 8x8 characters arranged in a 16x16 screen - i.e. 128x128 pixels -, can be perfectly updated with either standard IEC loads or fast loaders, without any issues. Once the (address generating) text screen is set up, and the VIC registers are programmed, VIC-I reads out and displays the screen without any further necessary intervention by the CPU.

I also do this all the time with MINIGRAFIK bitmaps (with 160x192 pixels, and which likewise don't require any interrupts to function).


*) Actually, there isn't even any way to turn off DMA like you can do with VIC-II by clearing the DEN bit in $D011. You could reduce the number of displayed text rows to zero, but that wouldn't change anything from the CPU's view, as all DMA happens only during the VIC half of the cycles.

**) The NMI routine was supposed to be rather short, so it wouldn't interfere with the standard IEC protocol as it is done by the 1541, which was slowed down compared to the 1540 exactly because of those badlines in the C64! At least with my two SD2IECs, display during load works as expected. But the byte receive routines of a fast loader are totally shot, when a NMI steps onto their feet - as they rely on a certain number of cycles for the next bit (pair) to appear on the bus, and only sync the transmission once each byte.

The reasons for the issues on srowe's combination of VIC-20 + 1541 currently are beyond my knowledge.
tlr
Vic 20 Nerd
Posts: 567
Joined: Mon Oct 04, 2004 10:53 am

Re: advice for a game (fast)loader ?

Post by tlr »

A useful approach would be selecting the protocol upon detecting which device is connected, e.g JiffyDOS for SD2IEC devices and a custom turbo for 1541 compatible devices. If IRQ loading is desired, the GI Joe protocol* could be used for SD2IEC and again a custom faster one for 1541 devices.

Note that eventhough a particular protocol is somewhat slow, the loader using it will run much faster on an SD2IEC than on a regular drive due to not having to actually wait for, and read the actual sector data from disk.

* AFAIK this protocol only supports two char filenames though.
User avatar
majikeyric
Vic 20 Afficionado
Posts: 350
Joined: Fri Oct 24, 2014 2:08 pm
Website: http://majikeyric.free.fr
Location: France

Re: advice for a game (fast)loader ?

Post by majikeyric »

Mike wrote:The DMA of the VIC-I chip in the VIC-20 doesn't 'steal' any cycles from the CPU, so there's no requirement *) to turn off the display (or more specifically, a bitmapped display) for fast loaders.
Yes! I have recently read that there are no badlines on the VIC !
tlr wrote:A useful approach would be selecting the protocol upon detecting which device is connected, e.g JiffyDOS for SD2IEC devices and a custom turbo for 1541 compatible devices.
Yes, that would be the ideal and smartest thing to do but I don't know yet if it's possible???
eg. detecting a SD2IEC, a JiffyDos equipped drive or a JiffyDos kernal.
tlr wrote:If IRQ loading is desired, the GI Joe protocol* could be used for SD2IEC and again a custom faster one for 1541 devices.
I don't need IRQ loading but I will have a look at it.
Post Reply