MOROS Devices
July 22, 2026 ยท View on GitHub
Creating the devices in the file system:
write /dev/
write /dev/ata/
write /dev/ata/0/
write /dev/ata/0/0 -d ata-0-0
write /dev/ata/0/1 -d ata-0-1
write /dev/ata/1/
write /dev/ata/1/0 -d ata-1-0
write /dev/ata/1/1 -d ata-1-1
write /dev/clk/
write /dev/clk/boot -d clk-boot
write /dev/clk/epoch -d clk-epoch
write /dev/clk/rtc -d clk-rtc
write /dev/console -d console
write /dev/kbd/
write /dev/kbd/buffer -d kbd-buffer
write /dev/kbd/layout -d kbd-layout
write /dev/net/
write /dev/net/tcp -d net-tcp
write /dev/net/udp -d net-udp
write /dev/net/gw -d net-gw
write /dev/net/ip -d net-ip
write /dev/net/mac -d net-mac
write /dev/net/stat -d net-stat
write /dev/null -d null
write /dev/random -d random
write /dev/speaker -d speaker
write /dev/vga/
write /dev/vga/buffer -d vga-buffer
write /dev/vga/font -d vga-font
write /dev/vga/mode -d vga-mode
write /dev/vga/palette -d vga-palette
Clock Devices
Reading the number of seconds since boot:
> read /dev/clk/boot
89.570360
Reading the number of seconds since Unix Epoch:
> read /dev/clk/epoch
1730398385.175973
Reading the real time clock (RTC):
> read /dev/clk/rtc
2024-10-31 18:20:02
Changing the system time:
> print 2025-01-01 00:00:00 => /dev/clk/rtc
[580.327629] RTC 2025-01-01 00:00:00 +0000
Console Device
Reading /dev/console with a 4 bytes buffer will return a character from the
keyboard or the serial interface. Reading with a larger buffer will return a
complete line.
Keyboard devices
Reading /dev/kbd/buffer will pop and return the earliest keyboard scancode
in the buffer if present.
Reading the current keyboard layout:
> read /dev/kbd/layout
qwerty
Changing the keyboard layout:
> print dvorak => /dev/kbd/layout
Network Devices
Network Config Devices
The prefered way to setup the network is to use the dhcp command:
> dhcp
[958.810995] NET IP 10.0.2.15/24
[958.812995] NET GW 10.0.2.2
[958.818994] NET DNS 10.0.2.3
But it is possible to do it manually with the /dev/net/ip and /dev/net/gw
device files, and the /ini/dns.ini configuration file:
> print 10.0.2.15/24 => /dev/net/ip
[975.123511] NET IP 10.0.2.15/24
> print 10.0.2.2 => /dev/net/gw
[985.646908] NET GW 10.0.2.2
> print "dns = 10.0.2.3" => /ini/dns.ini
Reading /dev/net/mac will return the MAC address:
> read /dev/net/mac
52-54-00-12-34-56
Network Statistics Device
Reading /dev/net/stat will return the network statistics:
> read /dev/net/stat
label packets bytes
rx 0 0
tx 0 0
> dhcp
[7.910795] NET IP 10.0.2.15/24
[7.911795] NET GW 10.0.2.2
[7.915795] NET DNS 10.0.2.3
> read /dev/net/stat
label packets bytes
rx 2 1180
tx 2 620
> http example.com => /dev/null
> read /dev/net/stat
label packets bytes
rx 10 3306
tx 10 1151
Network Socket Devices
Opening /dev/net/tcp or /dev/net/udp with the OPEN syscall and the device
flag will return a file handle for a TCP or UDP socket supporting the standard
READ and WRITE syscalls after establishing a connection using the
CONNECT, or LISTEN and ACCEPT syscalls.
The size of those files give the maximum size of the buffer that can be used when reading or writing to a socket:
> list /dev/net
1446 2024-09-28 09:57:55 tcp
1458 2024-09-28 09:57:55 udp
Reading a socket with a 1 byte buffer will return the status of the socket:
+-----+--------------+
| Bit | Status |
+-----+--------------+
| 0 | Is Listening |
| 1 | Is Active |
| 2 | Is Open |
| 3 | Can Send |
| 4 | May Send |
| 5 | Can Recv |
| 6 | May Recv |
| 7 | Reserved |
+-----+--------------+
Speaker Device
Playing a 440 Hz sound on the PC speaker:
> print 440 => /dev/speaker
Stopping the sound:
> print 0 => /dev/speaker
Null Device
Writing to /dev/null will discard any data sent to it:
> print hello
hello
> print hello => /dev/null
It can be used to suppress errors:
> copy none.txt some.txt
Error: Could not read file 'none.txt'
> copy none.txt some.txt [2]=> /dev/null
Random Device
Reading from /dev/random will return bytes from a cryptographically secure
random number generator that uses the HC-128 algorithm seeded from the
RDRAND instruction when available.
VGA Devices
VGA Font Device
Changing the VGA font:
> copy /ini/fonts/zap-light-8x16.psf /dev/vga/font
VGA Mode Device
Changing the VGA mode:
> print 320x200 => /dev/vga/mode
The accepted modes are:
80x25for the primary text mode with 16 colors320x200for the primary graphics mode with 256 colors640x480for the secondary graphics mode with 16 colors
It is possible to read the current mode from this device file.
VGA Palette Device
Changing the VGA palette is done by writting a 768 bytes buffer to
/dev/vga/palette containing the RGB values of 256 colors.
It is possible to read the current palette from this device file.
VGA Buffer Device
Changing the VGA framebuffer is done by writting a 64 KB buffer to
/dev/vga/buffer containing the color index of each pixel on the screen while
in 320x200 mode.