File Explorer Library

By cbsfox

Champion (445)

Аватар пользователя cbsfox

10-03-2023, 12:35

If you want to create you own Assembly tool, you may need to list the files from the Mass Storage Device or from the Disk Drive. And it´s a pain in the ass to do that in Assembly.

So, here is a complete library that works like a File Explorer. You can navigate through the Drives and Directories easily, choose a file and the routine returns the file name when exiting.

The library works also in Page 0, unders DOS1, DOS2 or Nextor.

Link to Download the Executable [FILES.COM] to test it:
https://1drv.ms/u/s!AlpEtfGjLbhmhvoN5FtFa2lxn9CuPw?e=0Urgj3

Link to Download the Source Code [FILES.ASM]:
https://1drv.ms/u/s!AlpEtfGjLbhmhvoOICPoB6JU8SnEQw?e=sMohBq

Just make the necessary changes here and compile it again:

; --------------------- begin | get files Main Procedure Call
mainrot: ld a,'A' ; Set Initial Drive as "A:\"
ld b,1 ; Flag Dir Type | 0 = Set Path On / 1 = Set Path Off
ld hl,0x2000 ; Set Initial Address for the Files
ld de,0x1F00 ; Set the Maximum Amount of Files
call files ; Call Main Procedure - It Returns Register [HL] that points to the Name of the Selected File
ret ; Return to DOS
PathEXT: db '*',0,0,0 ; Set the Files Extension. Instead of '*', use 'DSK' to filter DSK files.
; --------------------- end | get files Main Procedure Call

Для того, чтобы оставить комментарий, необходимо регистрация или !login

By Pencioner

Scribe (1609)

Аватар пользователя Pencioner

10-03-2023, 13:20

hey, nice stuff

btw for sake of a more general approach, would be nice to split it so you also have a non-UI call which receives an existing path like "A:\ROMS", and after he call you only have all entries put in memory so you can write your own UI on top of that Wink this would be useful for situations where you use graphic screen mode (gmes, telnet app, etc)

By cbsfox

Champion (445)

Аватар пользователя cbsfox

10-03-2023, 13:38

Pencioner wrote:

hey, nice stuff

btw for sake of a more general approach, would be nice to split it so you also have a non-UI call which receives an existing path like "A:\ROMS", and after he call you only have all entries put in memory so you can write your own UI on top of that Wink this would be useful for situations where you use graphic screen mode (gmes, telnet app, etc)

Sure, but this is a free code. So, people can use ideas likes yours to make changes in the code and create their own code.
It´s a good start.
Did you test it and like it ?

By cbsfox

Champion (445)

Аватар пользователя cbsfox

10-03-2023, 13:40

Just a correction:

ld de,0x1F00 ; Set the Maximum Amount of Bytes (Not Files)

By BadWolf359

Resident (38)

Аватар пользователя BadWolf359

10-03-2023, 15:31

@cbsfox: Very useful!
I will probably use it a few times for reference when writing an application that needs to browse disks and directories.

Thanx for posting!

By cbsfox

Champion (445)

Аватар пользователя cbsfox

10-03-2023, 17:30

Thanks my friend.
I hope it helps you a lot in the new projects.

Regards
Marcos Blanco

By cbsfox

Champion (445)

Аватар пользователя cbsfox

17-03-2023, 22:08

New update in the code!

now it sorts the names alphabetically.

Download the Compiled File (DSKPRO.COM):
https://1drv.ms/u/s!AlpEtfGjLbhmhvoN5FtFa2lxn9CuPw?e=sLJdTu

Download the Source Code (DSKPRO.ASM):
https://1drv.ms/u/s!AlpEtfGjLbhmhvoO5L4shm78lc5lFg?e=rFsDlo

MSXPEN Link to Compile the Code Online:
https://msxpen.com/codes/-NQAJVrgE3fE4_Xs1rph