Kernel implementation running RCPU based on Writing an OS in Rust
- All numbers are unsigned 16 bit (u16)
- Integer overflows can occur
- For Add, Subtract, Multiply and Divide, the number wraps around (mod 2^16)
- For Left and Right Shifts, the number gets padded with zeroes
- Integer overflows can occur
- The program expects a 16bit addressable memory space with the program loaded starting at 0
- The binary contains pre-allocated space, which will be loaded with the program
- All strings are ASCII (7 bit), not Latin-1
- RCPU_OS stack grows upwards instead of downwards. RCPU has no way of reading from/writing to SP, so this should not matter to the programs.
- RCPU syscalls "return" by pushing the result to the stack
- RCPU
stream_num
is 0 for stdin, 1 for stdout- Reading from or writing to an invalid stream (everything except 0 and 1 respectively) causes a panic
- If
Getc
cannot read a character, it returnsu16::MAX
(aka -1 wrapped) Fgets
reads blocking until a null-byte is found ornum_characters
are read- If no nullbyte is found, one is put at
str_ptr + num_read
, so the target string needs to be at leastsize+1
big ifsize
characters are read - To enter a nullbyte the F1 key can be pressed
- If no nullbyte is found, one is put at