Zeal8bit / Zeal-8-bit-OS

An Operating System for Z80 computers, written in assembly
Apache License 2.0
543 stars 47 forks source link

How to add a program to the filesystem? #31

Open Candid-Moe opened 1 week ago

Candid-Moe commented 1 week ago

I use "load nnn" to load a program via UART and run it. No problem.

How do I do to have that program stored permanently in the file system, like init.bin?

It's a user program, not a bootable one.

Zeal8bit commented 6 days ago

Hello @Candid-Moe ,

Sorry for the late reply! When building the OS, the romdisk is also getting build, what you can do is specify the files that you want to include inside the romdisk thanks to the environment variable EXTRA_ROMDISK_FILES, for example:

$ cat /home/path/to/your/files/hello.txt
This is a new file! I need to be part of the romdisk
$ cat /home/path/to/your/files/file.txt
This is another file...
$ cd /path/to/Zeal-8-bit-OS
$ export EXTRA_ROMDISK_FILES="/home/path/to/your/files/hello.txt /home/path/to/your/files/file.txt"
$ make
...
Packing the files
pack disk.img build/init.bin simple.txt /home/path/to/your/files/hello.txt /home/path/to/your/files/file.txt
...

The files will then be part of the romdisk!

If it's for development with the emulator (https://github.com/Zeal8bit/Zeal-WebEmulator), I just pushed (few minutes ago) a new commit that adds support for a HostFS, thanks to that, you will be able to mount a directory of your host computer inside Zeal 8-bit OS, which will be disk H:/.

EDIT: I just added a paragraph in the README to explain how to integrate files in the romdisk: https://github.com/Zeal8bit/Zeal-8-bit-OS?tab=readme-ov-file#building