Skip to content

1 ‐ Usage

QualityCroissant edited this page Jan 15, 2025 · 3 revisions

Important: as of v0.4-alpha, FVM now supports graphics, via GLFW + OpenGL. However, due to GLFW being a dependency, you must have it installed to use FVM.

FVM is split into two parts: the assembler, and the virtual machine. One does not need to use the assembler to write programs, though it is provided to abstract machine-code writing whilst there are no high-level languages that use FVM as a backend! The creation of such things would be very welcomed.

The virtual machine is called fvmr, for Fox Virtual Machine Runtime, whilst the assembler is called fvma, for Fox Virtual Machine Assembler. Currently, the runtime sources two files for usage: the disk file, and the rom file. These are located in the hardware directory.

When running fvma, it expects an assembly file name to be provided via the CLI as the first argument to the program. This file should end in the extension .fa, for Fox Assembly. For example, running fvma myProgram.fa will try to assembly the source file myProgram.fa. By default, fvma writes the generated binary to a file called a.fb, the extension .fb standing for Fox Binary. Any specified output file must end in this extension, as a safety feature to prevent an unintentional overwrite of the wrong file. The output file can be changed from its default of a.fb by providing it as the second argument to the program, after the assembly source file. For example, fvma myProgram.fa myBinary.fb will try to assemble the source myProgram.fa into the binary myBinary.fb.

On the contrary, fvmr currently does not accept any arguments to operate. This will be changed in the future. It will attempt to use the files in the hardware directory to load rom into Main Memory and use disk as the secondary storage area for the program during its runtime. So, at the moment, in order to run a .fb program, its contents need to be written to hardware/rom before it can be processed.

Here is an example of the full process of compiling and running a .fa application, on a Linux system:

$ ./fvma myProgram.fa myProgram.fb

$ cp myProgram.fb hardware/rom

$ ./fvmr

Clone this wiki locally