How To

Disk

1

crosoft312 2021-06-28 02:39 (Edited)

How would you read text from a disk? The text would be easily modifiable and all in one place. I know DATA is just an easier version of this, but it is sort of verbose. And eats up more memory, I think.

Is the disk accesible through PEEK and POKE?
or Does it have it's own commands?

Thank you.

Sorry if this messy or incoheriant, it is 1am and my brain is fried.


was8bit 2021-06-28 05:39 (Edited)

When you run a tool directly as you would run any game, it needs a program to edit, so it creates and uses a program called DISK so as to avoid an error message....

... usually, you use a program as a TOOL to edit the virtual data files of the program that calls the tool, like the included tools GFX DESIGNER and SOUND COMPOSER...

I have made a tool/player combo that lets it edit its own files, but you must carefully follow the instructions...

https://lowresnx.inutilis.com/topic.php?id=1777

Also, i have made a bulk data editor tool here...

https://lowresnx.inutilis.com/topic.php?id=94

With an example of how to use the bulk data here... https://lowresnx.inutilis.com/topic.php?id=93

.... making a tool is fun.... for example, you can make a map database editor that makes a game map... you just then need to make a player that can load that data and make it a playable game..

.... lots of work, but fun ;)


was8bit 2021-06-28 05:41

Here is the official HELP text on this topic...

FILES

The file commands can be used to store data on a virtual disk, which can contain up to 16 files. Its format is the same as the ROM entries part in a program file. This makes it possible to use any NX program directly as a virtual disk to edit its data.

Virtual disks are meant to be used for development tools only, for example image and map editors or music programs. Games should use persistent memory instead. Imagine that the standard LowRes NX console wouldn't have a disk drive.

LOAD

LOAD f,a[,n[,o]]
Loads the file number f from the current virtual disk to memory starting at address a.

Optionally the parameter n can be used for the maximum number of bytes that should be loaded. 0 means no limit. With the optional parameter o an offset in the file can be set.

LOAD is meant to be used for tools only. Use ROM entries for game data or persistent memory for game states.

SAVE

SAVE f,c$,a,n
Saves n bytes starting at memory address a to the current virtual disk as a file number f (0-15) with comment c$ (up to 31 characters).

If this file was loaded before, consider keeping its original comment or allow the user to edit it before saving. If the file is new, the comment should contain at least the type of data, e.g. "CHARACTERS" or "MUSIC".

SAVE is meant to be used for tools only. Use persistent memory to store game states.

FILES

FILES
Loads the current file directory for use with FILE$.

=FILE$

FILE$(f)
Returns the comment string of file number f. Call FILES before accessing the file directory to update its content, or use FILE$ directly after LOAD or SAVE.

FILES
FOR I=0 TO 15
PRINT I,FILE$(I)
NEXT I
=FSIZE

FSIZE(n)
Returns the number of bytes of file number n. Call FILES before accessing the file directory to update its content, or use FSIZE directly after LOAD or SAVE.


Timo 2021-06-28 09:21 (Edited)

Keep in mind in LowRes NX a "disk" is just a way to edit ROM entries of other programs. So inside of your program you would probably still use PEEK to access the ROM data.
You cannot access real files outside of LowRes NX's virtual world.

I really recommend DATA for texts.


was8bit 2021-06-28 13:31 (Edited)

I would agree, for 99.9% of the ordinary games, the DATA command will still be the easiest format to use for TEXT.... for flexibility, i would store the TEXT in an array, and keep your DATA text at the bottom of your code (and above the ROM files) ...

For text display options, you can check out some of the work here, which include auto wrap....

https://lowresnx.inutilis.com/user.php?id=221

... my bulk data format would restrict your text, if i remember correctly, to only 20 character per line, so on one hand you couldn't easily use longer sentences, and on the other hand it would waste space if you only needed shorter lengths of text... as is, it has a very limited use, good for pehaps for a few pages for a story, so it would be good for storing a small book of text, where you could load and display a chapter at a time...


crosoft312 2021-06-28 14:12

Thank you!


Log in to reply.