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 > simple disc menu?
2008-09-13 20:07
spinal
Account closed

Registered: Jan 2005
Posts: 47
simple disc menu?

Before asking my question, a little about why i'm asking...

I have recently been messing about with frodo (ported to the Nintendo DS by GPF_Error), but don't be fooled into thinking i'm a good coder, i'v just been tweaking bits here and there. One thing i noticed, is that with this emulator sometimes you have to load games by hand, especially if there is more than one on a single .d64 image. First i had though of finding an existing disc menu, something simple so i could use the joystick to select a file from the disc and load it. I couldn't however find anything (easily anyway) but i did have a slightly different idea. The emulator is able to fill the keyboard buffer up, so i was thinking (without knowing how large this buffer is)...

Does there exist already, a disc menu, that would allow the user to select a file and load+run it, written entirely in BASIC?
2008-09-14 05:03
Oswald

Registered: Apr 2002
Posts: 5094
use Vice
2008-09-14 10:27
doynax
Account closed

Registered: Oct 2004
Posts: 212
Quote: use Vice

As far as I'm aware Vice hasn't been ported to the DS, and would almost certainly be too slow to be useful at any rate.

As for the disc menu my BASIC skills aren't quite up to the challenge of writing a joystick-based selector, but here's a first version to get things started. The idea here is to sufficiently annoy some BASIC hacker to do it right ;)
0 I=I+1
1 READ N$
2 IF N$="" GOTO 5
3 PRINT I,N$
4 GOTO 0
5 RESTORE
6 INPUT C%
7 FOR I=1 TO C%
8 READ N$
9 NEXT
10 LOAD N$,8 : RUN
11 DATA "ALPHA"
12 DATA "BETA"
13 DATA "GAMMA"
14 DATA ""
At any rate I should think there are tools available to create 'all-singing, all-dancing' menus with little effort. Though I suppose you'd have to avoid turbo-loaders, which might complicate things.
2008-09-14 10:57
spinal
Account closed

Registered: Jan 2005
Posts: 47
Looks good, but the main part i was expecting to have trouble with, would be reading the filenames from the disk. I can't find anything on the internet to simply read the filenames into strings and i can't find my manual anywhere either.
2008-09-14 11:17
Oswald

Registered: Apr 2002
Posts: 5094
I remember seeing programs called like "!" which read the dir, then you can choose a file and finally it gets loaded with a fastloader.
2008-09-14 11:23
Zyron

Registered: Jan 2002
Posts: 2381
Maybe something like Fastload Menu V1.0 could work? The .t64 would still stay attached when changing disks I guess. Never used Frodo myself.
2008-09-14 11:31
tlr

Registered: Sep 2003
Posts: 1790
Turbo Menu Maker C64 is nice, but the requires the menu to be "installed" on the actual disks.
2008-09-14 12:48
Marauder/GSS
Account closed

Registered: Jul 2006
Posts: 224
try something like this...

10 C=1:DIM F$(144):PRINT "{CLR/HOME}"
20 OPEN 1,8,0,"$":GET#1,A$:GET#1,A$
30 GET#1,A$:GET#1,B$:PRINT VAL(A$);
40 FOR X=0 TO 27:GET#1,A$:PRINT A$;:NEXT:PRINT
50 GET#1,A$:GET#1,A$
60 GET#1,S$:GET#1,SH$:PRINT ASC(S$+CHR$(0))+256*ASC(SH$+CHR$(0));
70 F=0:F$(C)="":FOR X=0 TO 27:GET#1,A$:PRINT A$;
80 IF ASC(A$+CHR$(0))=34 THEN F=F+1:NEXT
90 IF F=1 THEN F$(C)=F$(C)+A$
100 NEXT:PRINT
110 IF ST=64 THEN 140
120 PRINT TAB(30)"{CRSR-UP}["C"]":C=C+1
130 GOTO 50
140 CLOSE 1:PRINT:PRINT
150 INPUT "{CRSR-UP}ENTER FILE # TO LOAD";X$:X=VAL(X$)
160 IF X<1 OR X>=C THEN 150
170 PRINT "{CLR/HOME}LOADING "CHR$(34)F$(X)CHR$(34)"..."
180 LOAD F$(X),8:RUN

2008-09-14 13:31
d0c

Registered: Apr 2006
Posts: 186
grab the c64 prg generator here..

http://www.ajordison.co.uk/

now cut&paste and generate it to a runnable prg file ;)
2008-09-14 13:43
A Life in Hell
Account closed

Registered: May 2002
Posts: 204
hrm. your menu needs more elephants.
2008-09-14 14:46
spinal
Account closed

Registered: Jan 2005
Posts: 47
Quote: grab the c64 prg generator here..

http://www.ajordison.co.uk/

now cut&paste and generate it to a runnable prg file ;)


Too late, I already typed it in (vice, pc) and what a pain that was, surely it would be better to map the c64 key to their equivalent pc ones, rather than key in the same place as them.
2008-09-14 15:17
A Life in Hell
Account closed

Registered: May 2002
Posts: 204
it can. set your keymap to symbolic instad of positional.
2008-09-14 15:46
spinal
Account closed

Registered: Jan 2005
Posts: 47
tried that, doesnt change anything.
2008-09-14 16:21
Oswald

Registered: Apr 2002
Posts: 5094
the trick to positional is to trust your c64 keying instincts, then it works nicely to me :)
2008-09-14 17:16
spinal
Account closed

Registered: Jan 2005
Posts: 47
Quote: try something like this...

10 C=1:DIM F$(144):PRINT "{CLR/HOME}"
20 OPEN 1,8,0,"$":GET#1,A$:GET#1,A$
30 GET#1,A$:GET#1,B$:PRINT VAL(A$);
40 FOR X=0 TO 27:GET#1,A$:PRINT A$;:NEXT:PRINT
50 GET#1,A$:GET#1,A$
60 GET#1,S$:GET#1,SH$:PRINT ASC(S$+CHR$(0))+256*ASC(SH$+CHR$(0));
70 F=0:F$(C)="":FOR X=0 TO 27:GET#1,A$:PRINT A$;
80 IF ASC(A$+CHR$(0))=34 THEN F=F+1:NEXT
90 IF F=1 THEN F$(C)=F$(C)+A$
100 NEXT:PRINT
110 IF ST=64 THEN 140
120 PRINT TAB(30)"{CRSR-UP}["C"]":C=C+1
130 GOTO 50
140 CLOSE 1:PRINT:PRINT
150 INPUT "{CRSR-UP}ENTER FILE # TO LOAD";X$:X=VAL(X$)
160 IF X<1 OR X>=C THEN 150
170 PRINT "{CLR/HOME}LOADING "CHR$(34)F$(X)CHR$(34)"..."
180 LOAD F$(X),8:RUN



I'm just wondering, how (in the above code) do i tell the type of file being listed? I'm planning on only showing prg files, as they are all im interested in loading.
2008-09-14 18:26
Marauder/GSS
Account closed

Registered: Jul 2006
Posts: 224
just a quick hack...try something like this... (c;

10 C=1:DIM F$(144):PRINT "{CLR/HOME}READING DIRECTORY..."
20 OPEN 1,8,0,"$":GET#1,A$,A$,A$,A$
30 FOR X=0 TO 27:GET#1,A$:NEXT
40 GET#1,A$,A$,S$,SH$
50 F=0:X$="":T$="":FOR X=0 TO 27:GET#1,A$:A=ASC(A$+CHR$(0))
60 IF A=34 THEN F=F+1:NEXT
70 IF F=1 THEN X$=X$+A$
80 IF F>1 AND A>64 AND A<91 THEN T$=T$+A$
90 NEXT
100 IF T$="PRG" THEN F$(C)=X$:C=C+1
110 IF ST<>64 THEN 40
120 CLOSE 1
130 IF C=1 THEN PRINT"SORRY, NO PRG FILES FOUND!":END
140 PRINT"{CLR/HOME}DISC-MENU:":PRINT
150 FOR I=1 TO C-1:PRINT "["I"]"TAB(8)CHR$(34)F$(I)CHR$(34):NEXT
160 INPUT "{CRSR-UP}ENTER FILE # TO LOAD";X$:X=VAL(X$)
170 IF X<1 OR X>=C THEN 160
180 PRINT "{CLR/HOME}LOADING "CHR$(34)F$(X)CHR$(34)"..."
190 LOAD F$(X),8:RUN

2008-09-14 18:28
d0c

Registered: Apr 2006
Posts: 186
ERROR : FOR without NEXT (or vice versa) line: 150 FOR I=1 TO C-1:PRINT "["I"]"TAB(8)CHR$(34)F$(I)CHR$(34):NEXT
2008-09-14 18:32
Marauder/GSS
Account closed

Registered: Jul 2006
Posts: 224
Quote: ERROR : FOR without NEXT (or vice versa) line: 150 FOR I=1 TO C-1:PRINT "["I"]"TAB(8)CHR$(34)F$(I)CHR$(34):NEXT

hm!? Does work for me in vice, maybe your parser got a bug?? (c;
2008-09-14 18:37
iAN CooG

Registered: May 2002
Posts: 3197
Quote: ERROR : FOR without NEXT (or vice versa) line: 150 FOR I=1 TO C-1:PRINT "["I"]"TAB(8)CHR$(34)F$(I)CHR$(34):NEXT

You're using the wrong tool to tokenize the prg, that line is perfectly valid in my book.
I would add that the last RUN is not needed, a LOAD from inside a basic program always cause a RUN. Also, basic pointers are NOT updated and the loaded prg will probably fail in most cases.
2008-09-14 18:47
Marauder/GSS
Account closed

Registered: Jul 2006
Posts: 224
Quote: You're using the wrong tool to tokenize the prg, that line is perfectly valid in my book.
I would add that the last RUN is not needed, a LOAD from inside a basic program always cause a RUN. Also, basic pointers are NOT updated and the loaded prg will probably fail in most cases.


like I've said it's just a quick hack, haven't really tested it with many disks. Just have saved the basic-proggy on a disk with a demo having several parts, and all loaded parts were running... but you could be right, better testing should be done by spinal, hehe (c;

@doc:
maybe the tokenizer getting fooled because of NEXT in line 60/90 or mabye change the line to NEXT I if it helps... don't know, works fine for me... (c;

[edit]
if the loaded program doesn't work because of the not updated pointers, then you still could try something like this, or?

190 PRINT"{CLR/HOME}LOAD"CHR$(34)F$(X)CHR$(34)",8"
200 PRINT"{CRSR-DOWN}{CRSR-DOWN}{CRSR-DOWN}{CRSR-DOWN}RUN"
210 POKE 198,3:POKE 631,19:POKE 632,13:POKE 633,13
2008-09-14 20:48
spinal
Account closed

Registered: Jan 2005
Posts: 47
Can someone give this a go? i cant get that converter to work and im tired of trying to type with the keyboard set up the way it is.

10 C=1:DIM F$(144):PRINT CHR$(147)
20 OPEN 1,8,0,"$":GET#1,A$:GET#1,A$
30 GET#1,A$:GET#1,B$:PRINT VAL(A$);
40 FOR X=0 TO 27:GET#1,A$:PRINT A$;:NEXT
50 GET#1,A$:GET#1,A$
60 GET#1,S$:GET#1,SH$
70 F=0:F$(C)="":FOR X=0 TO 27:GET#1,A$
80 IF ASC(A$+CHR$(0))=34 THEN F=F+1:NEXT
90 IF F=1 THEN F$(C)=F$(C)+A$
100 NEXT
110 IF ST=64 THEN 140
120 C=C+1
130 GOTO 50
140 CLOSE 1
141 T=X-5: IF T<1 THEN T=1
142 R=X+5: IF T>=C THEN T=C-1
143 PRINT CHR$(147)
144 FOR P=T TO R
145 IF P = X THEN PRINT "> " F$(P)"<"
147 IF P <>X THEN PRINT "  " F$(P)
148 NEXT P
149 J = PEEK(56320)
150 IF J = 127 THEN GOTO 149
151 IF J = 125 THEN X=X-1
155 IF X<1 THEN X=1
160 IF J = 126 THEN X=X+1
165 IF X>=C THEN X=C-1
170 IF J = 111 THEN LOAD F$(X),8:RUN
175 GOTO 141


I havent attempted any prg checking yet, i just want the menu to list the files and scroll through them etc for now.
If you cant tell, it uses the joystick in port 2.
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
Andy/AEG
Sulevi/Virtual Dreams
slimeysmine
megasoftargentina
grass/LETHARGY
Hagar/The Supply Team
t0m3000/hf^boom!^ibx
Mibri/ATL^MSL^PRX
rexbeng
BYB/Hokuto Force
Guests online: 150
Top Demos
1 Next Level  (9.7)
2 13:37  (9.7)
3 Mojo  (9.7)
4 Coma Light 13  (9.6)
5 Edge of Disgrace  (9.6)
6 What Is The Matrix 2  (9.6)
7 The Demo Coder  (9.6)
8 Uncensored  (9.6)
9 Comaland 100%  (9.6)
10 Wonderland XIV  (9.6)
Top onefile Demos
1 No Listen  (9.6)
2 Layers  (9.6)
3 Cubic Dream  (9.6)
4 Party Elk 2  (9.6)
5 Copper Booze  (9.6)
6 Dawnfall V1.1  (9.5)
7 Rainbow Connection  (9.5)
8 Onscreen 5k  (9.5)
9 Morph  (9.5)
10 Libertongo  (9.5)
Top Groups
1 Performers  (9.3)
2 Booze Design  (9.3)
3 Oxyron  (9.3)
4 Censor Design  (9.3)
5 Triad  (9.3)
Top Crackers
1 Mr. Z  (9.9)
2 Antitrack  (9.8)
3 OTD  (9.8)
4 Fungus  (9.8)
5 S!R  (9.8)

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