Display files under basic

Página 1/4
| 2 | 3 | 4

Por Fabf

Champion (266)

imagem de Fabf

31-12-2010, 12:29

Hello everybody
I'm looking for a way to display disk files under basic
If someone have some code or can explain me.
I dont understand ML but I can use a routine in my basic program.

I already know files function Wink

Thancks
Fabrice

Entrar ou registrar-se para comentar

Por Manuel

Ascended (19469)

imagem de Manuel

31-12-2010, 13:52

What do you mean if you do not mean the "FILES" command?

Por Fabf

Champion (266)

imagem de Fabf

31-12-2010, 13:55

I want to put files names in an array to display them on screen

Por Manuel

Ascended (19469)

imagem de Manuel

31-12-2010, 14:32

well, there is a dirty way to do it: set colors to 1,1,1 (or disable screen), use files and vpeek the names from the screen Smile

The clean way resorts to ML.

Por JX10p

Supporter (11)

imagem de JX10p

31-12-2010, 15:30

10 '********************************
20 '* *
30 '* Files to array *
40 '* *
50 '* *
60 '* Arnold Kurzynski *
70 '* 01.09.2002 *
80 '* *
90 '********************************
100 '
110 '
120 CLEAR 2048
130 ST=0 'drive number
140 A1=60311! 'DMA address (check this address in your comp)
150 DIM F$(111) 'files array
160 L=0 'files counter
170 FOR T=0 TO 111 'spaces to array
180 F$(T)=SPACE$(12)
190 NEXT
200 A$=DSKI$(ST,1) 'drive: 360 kB or 720 kB ?
210 D=PEEK(60311!)
220 IF D=248 THEN Z=5 ELSE Z=7
230 FR=DSKF(0) 'disk free space
240 FOR SK=0 TO 6
250 AD=A1
260 A$=DSKI$(ST,SK+Z) 'sector read
270 FOR P=0 TO 15
280 IF PEEK(AD)<32 OR PEEK(AD)>126 THEN AD=AD+32:GOTO 360
290 P$=""
300 FOR W=0 TO 10 'name read
310 P$=P$+CHR$(PEEK(AD))
320 AD=AD+1
330 NEXT
340 F$(L)=LEFT$(P$,8)+"."+RIGHT$(P$,3)
350 L=L+1:AD=AD+21
360 NEXT
370 NEXT
380 FOR T=0 TO L-1 'print data
390 PRINTF$(T)
400 NEXT
410 PRINT
420 PRINT"File(s):";L
430 PRINT"Free:";FR;"kB"
440 END

Por Leo

Paragon (1236)

imagem de Leo

31-12-2010, 15:37

interesting question i think it is not easy.
I would use DSKI$ function to read the sectors where there are the file entry , i think i remember it is sector 7 commonly but in fact there is a variable in the hook section that says that.
An other way i would patch the hook in RAM the one that is called when the next directory entry is searched , i think there such an adress

Por Leo

Paragon (1236)

imagem de Leo

31-12-2010, 15:38

ah ok thanks jx10

Por NYYRIKKI

Enlighted (6067)

imagem de NYYRIKKI

31-12-2010, 16:11

I suggest using NestorBASIC or some little ML routine. I think the complex looking DSKI$ example abowe does not work with harddisks (that are actually very common today).

Por Fabf

Champion (266)

imagem de Fabf

31-12-2010, 17:45

JX10p : It's exactly what I 'm looking for but how can I check my DMA address ?

I'm loocking something for DOS1
I can use ML but it should be easy to include in a rom file

I use Nestor Basic for an other program It work fine and will post it when it will be finished

Manuel, your way is not dirty but my name is not Garcimore LOL!

Por Fabf

Champion (266)

imagem de Fabf

31-12-2010, 17:51

Work great on MSX1 but not on MSX2 nor TurboR

Por Manuel

Ascended (19469)

imagem de Manuel

31-12-2010, 17:53

Fabf? Um?

Be careful with that address. If it depends on computer, it may not work everywhere if you hardcode it.

Also, it's a shame if your software wouldn't run on harddisks, because, as NYYRIKKI said, it's not uncommon these days.

Página 1/4
| 2 | 3 | 4