VIC-20 Disk Menu

Basic and Machine Language

Moderator: Moderators

Post Reply
User avatar
Schema
factor
Posts: 1430
Joined: Tue Mar 23, 2004 7:07 am
Website: http://www.jammingsignal.com
Location: Toronto, Ontario

VIC-20 Disk Menu

Post by Schema »

Hi all,

I never had a disk drive for my VIC before, and mostly used it for cartridge games anyhow. Now that I'm writing programs for it, the very wide listings when you do LOAD"$",8 and LIST really started to bug me.

So, tonight I wrote a disk menu program.

Image

Image

Features:

-Lists up to 144 program names from a disk and their sizes (1541 maximum).
-Doesn't show SEQ or USR files.
-Allows you to select one and press Return to run it off the disk.
-Refresh for new disks.
-Copy the program itself onto new disks with 1 keystroke.
-Works with all drive numbers.
-Should run in either an unexpanded or expanded VIC.
-Only 6 blocks, 100% BASIC!

So for any disk, you could LOAD"MENU",8 and run it.

Grab it here!

http://www.jammingsignal.com/vic20/menu.prg
or
http://www.jammingsignal.com/vic20/menu.zip


The reading and parsing the filenames is quite slow at the moment, so I'd appreciate any tips for speeding it up. Would compiling it help?

Also, is it possible to make 'autostart' programs on the VIC, like on the 64? This would be ideal.
Last edited by Schema on Fri Aug 13, 2004 7:10 am, edited 1 time in total.
carlsson
Class of '6502
Posts: 5516
Joined: Wed Mar 10, 2004 1:41 am

Re: VIC-20 Disk Menu

Post by carlsson »

Schema wrote:The reading and parsing the filenames is quite slow at the moment, so I'd appreciate any tips for speeding it up. Would compiling it help?

Also, is it possible to make 'autostart' programs on the VIC, like on the 64? This would be ideal.
Regarding speed, apart from the old ML suggestion - I have myself never operated disk reading in machine code, but have been told it is not rocket science - I think there is a lot of string shuffling going on. I'm not in condition to analyze exactly the operation, but maybe something can be done there. Also, I'm thinking whether a B-R/U1 operation track by track, following the directory structure would be better or worse solution - you would have to do the PRG filtering by hand.

With autostart, I suppose you mean programs loading ,8,1 into tape buffer or wherever it is, triggering automatic execution? I think it should be just as doable as on the 64. Not sure if you ever can get autorun on a program loaded into "normal" Basic memory though?
Anders Carlsson

Image Image Image Image Image
Boray
Musical Smurf
Posts: 4064
Joined: Mon May 03, 2004 10:47 am

Post by Boray »

I made an autostarting program on the C64 once by saving the
program together with the interrupts at $0314 and 0315 that was
set to run a little program that was saved together with it.
But for this to work, then the program must be at a lower address
than the interrupts in memory, or the interrupt will just jump to
something that's not loaded yet. On the C64, there are
some memory before the interrupts, but I don't think there
is any good memory position for this on the Vic20. I
haven't found any anyway.... Maybe a tiny program at
$030C. (I don't know what's in there...) Or in the
keyboard buffer at $027...?

Btw, I actually prefer the directory on the vic20 over the C64,
because on the vic20, you can write LOAD and then just go
down one line and write ,8 or ,8,1 over the "PRG". On the C64
you have to go all the way to the right to delete the "PRG"...

/Anders
PRG Starter - a VICE helper / Vic Software (Boray Gammon, SD2IEC music player, Vic Disk Menu, Tribbles, Mega Omega, How Many 8K etc.)
Boray
Musical Smurf
Posts: 4064
Joined: Mon May 03, 2004 10:47 am

Post by Boray »

I have tried your program now and I think it's quite nice,
but I have a few suggestions.

Now, it only loads ,8,1 when you press return. So you
can't load a basic program that was saved on the unexpanded
vic on an expanded one for example... So I would like to have
3 different keys instead.

One that loads ",8"
a second that loads ",8,1"
and a third that loads ",8,1" and then does a SYS64802 (for
cartridge files). You can do the last one by something like:

0 IFA=1 THENSYS64802
.
.
320 A=1:LOAD A$,8,1


Another thing you could do (to speed it up), is to
have a key for saving the whole list to disk. All
the data you have picked out from the directory
is just saved to a file. And next time you start
the menu program, it first tries to open this file
to load the data from there instead. If it doesn't
work to open it (check the ST variable), then it
loads the "$" the old "slow" way instead....

/Anders
PRG Starter - a VICE helper / Vic Software (Boray Gammon, SD2IEC music player, Vic Disk Menu, Tribbles, Mega Omega, How Many 8K etc.)
vic user
VicGyver
Posts: 1401
Joined: Thu Mar 25, 2004 9:40 am

Post by vic user »

looks nice Leif!

i have not ried it yet, but it sure might come in handy for those floppies with TONS of files on them.

a 'delete file' option would be cool too!

chris
User avatar
Schema
factor
Posts: 1430
Joined: Tue Mar 23, 2004 7:07 am
Website: http://www.jammingsignal.com
Location: Toronto, Ontario

Post by Schema »

Thanks for the excellent suggestions. I especially like Boray's idea for load ,8 or load ,8,1. I might also add a scratch file option, that's well worth it and would be short/easy.

I don't want to make the program too big, otherwise it will take too long to load every time.
vic user
VicGyver
Posts: 1401
Joined: Thu Mar 25, 2004 9:40 am

Post by vic user »

i wonder if this would be a god candidate for compiling and then burning onto a cartridge?

you could have your own vic 20 loader cart!

chris
carlsson
Class of '6502
Posts: 5516
Joined: Wed Mar 10, 2004 1:41 am

Post by carlsson »

If putting it on cartridge, I would suggest including a direct mode disk wedge too ($, @, > etc) for those who like to return to Basic mode rather than only loading from a menu. Or maybe that is a completely separate task?
Anders Carlsson

Image Image Image Image Image
User avatar
Schema
factor
Posts: 1430
Joined: Tue Mar 23, 2004 7:07 am
Website: http://www.jammingsignal.com
Location: Toronto, Ontario

Post by Schema »

Argh, feature creep to the extreme! :-)

This would be fun to put on a cartridge, actually. It wouldn't even have to be compiled - just have the cart routine copy the program from cartridge space into BASIC space and 'run' it.

Was there ever any sort of loadable DOS wedge for the VIC-20? The only cart-based one I can think of is the VICTREE, and that's ultra-super-duper rare for the VIC.
vic user
VicGyver
Posts: 1401
Joined: Thu Mar 25, 2004 9:40 am

Post by vic user »

if you ever make a cart. for this leif, and include stuff like deleting files, count me in for buying one off you!

chris
Boray
Musical Smurf
Posts: 4064
Joined: Mon May 03, 2004 10:47 am

Post by Boray »

Boray wrote: One that loads ",8"
a second that loads ",8,1"
and a third that loads ",8,1" and then does a SYS64802 (for
cartridge files).
If you like, you could save this info as a filetype value
(1,2,3 or 0 for unknown) for every file in the file list
saved to disk. Then later it's just to press return on a file
to run it regardless of what it is. To show which file
type it is in the list, they could be in different colors.
For example. If you press "B" on a file, then it turns
green and is now a file that should be loaded ,8
If you press "C" on it, then it turns blue and is
a cartridge file etc... Then you save the filelist
if you like, and then to run a program you just press return.

If you not have allready, then add this to the program:

OPEN15,8,15,"UI-":CLOSE15

It turnes the 1541 to vic20 mode and makes it a little faster.

/Anders
PRG Starter - a VICE helper / Vic Software (Boray Gammon, SD2IEC music player, Vic Disk Menu, Tribbles, Mega Omega, How Many 8K etc.)
Boray
Musical Smurf
Posts: 4064
Joined: Mon May 03, 2004 10:47 am

Post by Boray »

Schema wrote: I don't want to make the program too big, otherwise it will take too long to load every time.
But my file list file idea would make it a lot faster. At least for disks that are full and ready... Loading things in basic with INPUT# takes no time compared to GET# (that I suspect you are using now?)
PRG Starter - a VICE helper / Vic Software (Boray Gammon, SD2IEC music player, Vic Disk Menu, Tribbles, Mega Omega, How Many 8K etc.)
carlsson
Class of '6502
Posts: 5516
Joined: Wed Mar 10, 2004 1:41 am

Post by carlsson »

Yes, on the 1541 disk there is a wedge, but it would be more efficient to have it on cartridge than loading it by hand. Oh well, what I really want is an Action Replay or Final Cartridge for the VIC, complete with freezer button, ML monitor, real disk turbo if possible, wedge, maybe some new Basic commands (not really required), your loader menu, character editor, disk copier (inside the menu prg?) and maybe switchable 3/8/16K RAM expansion on top of everything. Plus RR-Net or other Ethernet module... *drool*

I know this is far from the tool you just wrote and that neither of the things would be feasible in Basic, at least not without compiling it. But it sounds like a true killer app, doesn't it?
Anders Carlsson

Image Image Image Image Image
Boray
Musical Smurf
Posts: 4064
Joined: Mon May 03, 2004 10:47 am

Post by Boray »

With Leif's permission - Here is my inproved version:

http://home.worldonline.se/boray/datormuseum/menu4.zip


It includes:

* Directory scan is 1.23 times faster

* By pressin "S", you can save the file list to disk which
makes it load really quickly next time. Probably even faster
than the ordinary LOAD "$",8 (if you don't count the
time for loading the menu program).

* By pressing "L" you can load the saved list, if you for
example change disk and want to load this disks list.

* When pressing "return", the file is loaded ,8 except
for if it's block size is 33 or 17, then it is
loaded ,8,1 (because 33 and 17 are the ordinary
cartridge file sizes)

* Cartridge files are now automatically started with
SYS64802 when loaded. This is accomplished by self
adjusting code at run time. (The first command
is changed from REM to SYS)

* By pressin "8", the file is loaded ,8

* By pressing "1", the file is loaded ,8,1

* The text is blue while loading, so you can see what is
going on.

* The UI- command is always executed to set your 1541
to the faster vic20 speed.

All the old features are also there, except for "exit".

Thanks again, Leif!

/Anders
PRG Starter - a VICE helper / Vic Software (Boray Gammon, SD2IEC music player, Vic Disk Menu, Tribbles, Mega Omega, How Many 8K etc.)
Boray
Musical Smurf
Posts: 4064
Joined: Mon May 03, 2004 10:47 am

Post by Boray »

Another update:

http://home.worldonline.se/boray/datormuseum/menu5.zip

Includes:

menu.prg

Just a minor update. I noticed that I had forgotten to
remove a line that I had moved to another place in
the program.

qmenu.prg

A stripped (and therefor quicker to load) version
of the menu. It's only 3 blocks. It only works on
saved file lists. So you need menu.prg to create
a file list first. Then you can use qmenu.prg for
a quicker load (3 blocks instead of 8 ). The keys
still working in this stripped version are:

"Up"
"Down"
"Space"
"Return"
"8"
"1"
"L"

All these works the same as in menu.prg

/Anders
PRG Starter - a VICE helper / Vic Software (Boray Gammon, SD2IEC music player, Vic Disk Menu, Tribbles, Mega Omega, How Many 8K etc.)
Post Reply