Uxn program file

From Just Solve the File Format Problem
(Difference between revisions)
Jump to: navigation, search
(Identification of file)
(Better explanation of the first byte of a uxn program file.)
 
Line 8: Line 8:
  
 
== Identification ==
 
== Identification ==
Any valid uxn file will have the first byte being a nonzero multiple of thirty-two, other than thirty-two itself.
+
A uxn program can potentially have any sequence of bytes, since any sequence is valid (there are no errors in uxn). However, it is most likely to have the first byte being 0x40, 0x60, 0x80, 0xA0, 0xC0, or 0xE0; others are not very useful as the first byte (if it is 0x00 then the program won't do anything, and anything else will read data from the stack (will will be meaningless data if nothing has been pushed to the stack already)).
  
 
A uxn file with metadata will have {{magic|A0 xx xx 80 06 37}} as the first six bytes, where the second and third bytes are a big-endian 16-bit address of the metadata (where the beginning of the file is address 0x0100).
 
A uxn file with metadata will have {{magic|A0 xx xx 80 06 37}} as the first six bytes, where the second and third bytes are a big-endian 16-bit address of the metadata (where the beginning of the file is address 0x0100).

Latest revision as of 04:41, 16 July 2024

File Format
Name Uxn program file
Ontology
Extension(s) .rom

Uxn is a simple virtual machine. A Uxn program file is loaded into the virtual machine's memory starting at address 0x0100, and then execution starts at address 0x0100.

[edit] Identification

A uxn program can potentially have any sequence of bytes, since any sequence is valid (there are no errors in uxn). However, it is most likely to have the first byte being 0x40, 0x60, 0x80, 0xA0, 0xC0, or 0xE0; others are not very useful as the first byte (if it is 0x00 then the program won't do anything, and anything else will read data from the stack (will will be meaningless data if nothing has been pushed to the stack already)).

A uxn file with metadata will have A0 xx xx 80 06 37 as the first six bytes, where the second and third bytes are a big-endian 16-bit address of the metadata (where the beginning of the file is address 0x0100).

[edit] Links

Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox