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?
 
... 10 posts hidden. Click here to view all posts....
 
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.
Previous - 1 | 2 - Next
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
CreaMD/React
Guests online: 104
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 X-Mas Demo 2024  (9.5)
7 Dawnfall V1.1  (9.5)
8 Rainbow Connection  (9.5)
9 Onscreen 5k  (9.5)
10 Morph  (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 Original Suppliers
1 Derbyshire Ram  (9.7)
2 Fungus  (9.3)
3 Black Beard  (9.2)
4 Baracuda  (9.2)
5 hedning  (9.1)

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