MOS - breakintoprogram/agon-docs GitHub Wiki
The MOS is a command line machine operating system, similar to CP/M or DOS, that provides a human interface to the Agon file system.
It also provides an API for file I/O and other common operations for BBC Basic and other third-party applications.
- A 32GB or less micro-SD card formatted FAT32
From version 1.02 of MOS, a mos
folder needs to be created in the root of the SD card. This is for any applications marked as MOS extensions that run off the SD card
If the MOS detects an autoexec.txt file in the root folder of the SD card during cold-boot, it will read the file in, and execute the MOS commands in the file sequentially from top to bottom.
For example, to set keyboard to US, load BBC BASIC from the root folder, change to the test folder, then run BASIC
SET KEYBOARD 1
LOAD bbcbasic
CD test
RUN
MOS implements a line editor that can also be used by third-party apps like BBC BASIC.
It implements the following functionality:
- Cursor keys to navigate within the block of text in the line (UP and DOWN for multi-line edits)
- Backspace to delete the character to the left of the current line
- Text is inserted at the current cursor position
- Escape is used to quit the editor without entering the text
- Enter is used to submit the line to the calling application (BBC BASIC, MOS command line, etc)
And from MOS 1.03:
- Cursoring left and right off the edge of the screen will wrap the cursor to the adjacent line
- Home and End keys will cursor to the start and end of the text being edited
And from MOS 1.03:
- Backspace now wraps correctly when backspacing off the left-hand side of the screen
- Pressing the UP arrow key when the buffer is empty will retrieve the last entered command
- Pressing CTRL+N will switch to paged mode, CTRL+O will switch it off. Screen will pause after scrolling a page. Press SHIFT to continue, or ESC to break out. Paged mode should work with any application including BBC BASIC.
And from MOS 1.04:
- Pressing UP and DOWN arrow keys will page through the command history
Press CTRL+ALT+DEL to soft-boot the Z80 (CTRL+SHIFT+ESC for MOS 1.02 or earlier)
NB:
- This assumes that MOS is still talking to the ESP32
- Commands can be abbreviated with a dot, so
DELETE myfile
andDEL. myfile
are equivalent. - Commands are case-insensitive and parameters are space delimited.
- In the syntax description, optional parameters are written as
<param>
- The dot (.) character can be used as a substitution for an optional numeric parameter
- Default LOAD and RUN address is set to 0x040000
- Numbers are in decimal and can be prefixed by '&' for hexadecimal.
- Addresses are 24-bit, unless otherwise specified
-
&000000 - &01FFFF
: MOS (Flash ROM) -
&040000 - &0BDFFF
: User RAM -
&0B0000 - &0B7FFF
: Storage for loading MOS star command executables off SD card -
&0BC000 - 0BFFFFF
: Global heap and stack
-
- The RUN command checks a header embedded from byte 64 of the executable and can run either Z80 or ADL mode executables
- MOS will also search the
mos
folder on the SD card for any executables, and will run those like built-in MOS commands
Syntax:*CAT <path>
(Aliases include DIR
and .
)
Directory listing of the current directory.
NB: The path parameter will only work in MOS 1.03 or greater.
Syntax:*CD path
Change current directory
Syntax: *CLS
Clear the screen
NB: Requires MOS 1.04 RC3 or greater
Syntax: *COPY filename1 filename2
Create a copy of a file.
NB: Requires MOS 1.03 or greater
Syntax: *CREDITS
Output credits and version numbers for third-party libraries used in the Agon firmware
NB: Requires MOS 1.03 or greater
Syntax: *DELETE filename
(Aliases include ERASE
)
Delete a file or folder (must be empty).
Syntax: *HELP <command>
- Display a list of commands if is not specified
- Displays help for a MOS command if is specified
NB: Requires MOS 1.04 RC3 or greater
Syntax:*JMP addr
: Jump to the specified address in memory
Syntax: *LOAD filename <addr>
Load a file from the SD card to the specified address. If no parameters are passed, then addr will default to &40000.
Syntax: *MKDIR filename
Create a new folder on the SD card
Syntax: *MOUNT
Remount the MicroSD card - required if you reinsert it without rebooting
Syntax: *RENAME filename1 filename2
(Aliases include MOVE
)
Rename a file in the same folder
*RENAME autoexec.txt autoexec.bak
Rename a file and move to a different folder (the destination folder must exist)
*RENAME test.bas archive/test.bas
NB: MOVE alias in MOS 1.03 or greater
Syntax: *RUN <addr>
Call an executable binary loaded in memory. If no parameters are passed, then addr will default to &40000
Syntax: *SAVE filename addr size
Save a block of memory to the SD card
Syntax: *SET option value
Set a system option
-
*SET KEYBOARD n
: Set the keyboard layout -
*SET CONSOLE n
: Set the console mode
- 0: UK
- 1: US
- 2: German
- 3: Italian
- 4: Spanish
- 5: French
- 6: Belgian
- 7: Norwegian
- 8: Japanese
NB: Keyboard layouts 2 to 8 are only available in MOS 1.03
The USB cable to the Agon also provides two-way serial comms; this is how the Arduino IDE programs it. This serial connection can also be used to send data to and from the Agon.
When console mode is on, all character output and keyboard input is echoed to this serial port.
Use case scenarios:
-
Keyboardless operation - you can place a command to switch it on in the autoexec.txt file.
-
Using the ZDI debugger - pressing CTRL+Z when in console mode switches on the ZDI debugger (more details to follow).
-
0: Console mode is off (default)
-
1: Console mode is on
NB: It is pretty dumb, and does not play nicely with the line editor.
Syntax:
*TIME
*TIME yyyy mm dd hh mm ss
Set and read the ESP32 real-time clock
NB: Requires MOS 1.03 or greater
Syntax: *TYPE <filename>
Display the contents of a file on screen
NB: Requires MOS 1.04 RC3 or greater
Syntax: *VDU <char1> <char2> ... <charN>
Write a stream of characters to the VDP
NB: Requires MOS 1.03 or greater