Input Device Determination

Basic and Machine Language

Moderator: Moderators

Post Reply
User avatar
Jeff-20
Denial Founder
Posts: 5759
Joined: Wed Dec 31, 1969 6:00 pm

Input Device Determination

Post by Jeff-20 »

In programming a multi-load game, is there a way to determine if the game was loaded from tape or disk (or whatever device number) without prompting the user? The goal is to load the subsequent part with the right device number.
High Scores, Links, and Jeff's Basic Games page.
IsaacKuo
Vic 20 Hobbyist
Posts: 147
Joined: Tue Aug 04, 2009 5:45 am

Post by IsaacKuo »

You could assume the screen looks something like this:

Code: Select all

...
LOAD"FLEAS.PRG",8

SEARCHING FOR FLEAS.PR
G
LOADING
READY.
RUN
Based on this assumption, you PEEK the screen for the LOAD command, and parse out the device number (if any).
User avatar
Jeff-20
Denial Founder
Posts: 5759
Joined: Wed Dec 31, 1969 6:00 pm

Post by Jeff-20 »

There must be a PEEK for the last input device employed. Perhaps I should ask the greater question: Do we have the patience for multi-load games outside of disk format? How many of you have the patience to play something that loads in parts from tape?
High Scores, Links, and Jeff's Basic Games page.
Alan
Vic 20 Devotee
Posts: 280
Joined: Wed Mar 24, 2004 11:20 am

Post by Alan »

If I understand you, I think PEEK(186) is what you're looking for.
Alan
User avatar
Mike
Herr VC
Posts: 4841
Joined: Wed Dec 01, 2004 1:57 pm
Location: Munich, Germany
Occupation: electrical engineer

Post by Mike »

And autostarting the next part is a one-liner:

Code: Select all

PRINT"{CLR}LOAD"CHR$(34)"<name>"CHR$(34)","PEEK(186):POKE631,19:POKE632,131:POKE198,2:END
IsaacKuo
Vic 20 Hobbyist
Posts: 147
Joined: Tue Aug 04, 2009 5:45 am

Post by IsaacKuo »

I don't understand what POKE632,131 does. Looking up my VIC20 Programmers Reference Guide, I gather that you're putting two characters into the keyboard buffer, but I don't know what CHR$(131) does. I would have guessed you'd need to put in a bunch more keys, like "{home}{return}run{return}" (that's stuffing 6 keys into the keyboard buffer).
User avatar
Mike
Herr VC
Posts: 4841
Joined: Wed Dec 01, 2004 1:57 pm
Location: Munich, Germany
Occupation: electrical engineer

Post by Mike »

The value 131 within the keyboard buffer is interpreted as if SHIFT+{STOP} (i.e. {RUN}) had been entered.

This is expanded to LOAD+{RETURN} (which overwrites the begin of the first line, but obviously does no harm), and RUN+{RETURN}.
carlsson
Class of '6502
Posts: 5516
Joined: Wed Mar 10, 2004 1:41 am

Post by carlsson »

We're eternally thankful that SHIFT+RUN/STOP doesn't yield LOAD: just like many fastloader cartridges have a function key assignment to RUN: plus Return key.
Anders Carlsson

Image Image Image Image Image
User avatar
nbla000
Salmon Run
Posts: 2582
Joined: Thu Oct 13, 2005 8:58 am
Location: Italy

Post by nbla000 »

Mike wrote:And autostarting the next part is a one-liner:

Code: Select all

PRINT"{CLR}LOAD"CHR$(34)"<name>"CHR$(34)","PEEK(186):POKE631,19:POKE632,131:POKE198,2:END
I've used this technique for almost all re-typed PaperSoft games to allow them to work for both tape or disk.
Mega-Cart: the cartridge you plug in once and for all.
Post Reply