Function Names correspond to those used in docs/SystemCalls.txt

Colours
~~~~~~~

	#include <menuet/colour.h>

	/* Form colour with components r, g and b (0 - 255). */
	int RGB(int r, int g, int b);

	/* Pre-defined colours. */
	C_WHITE, C_RED, C_GREEN, C_BLUE, C_BLACK, C_ORANGE, C_YELLOW,
	C_MAGENTA, C_CYAN, C_GREY


Drawing
~~~~~~~

	#include <menuet/msys.h>
	#include <menuet/button.h>
	#include <menuet/colour.h>
	#include <menuet/pxset.h>
	#include <menuet/wnum.h>

	/* Define a window, standard and new styles (currently equivalent).
	   The gbarcolour can be OR'ed with GLIDE??. */
	void msys__DefineWindow(int x, int y, int width, int height,
	   int bodycolour, int gbarcolour, int framecolour);
	void msys__DefineNewWindow(int x, int y, int width, int height,
	   int bodycolour, int gbarcolour, int framecolour);

	/* Define a button. */
	void msys__DefineButton(int x, int y, int width, int height,
	   int colour, int id);

	/* Choose redraw type??. */
	void msys__SetRedrawType(int type);

	/* Change buttons to given type BUTTON_3D or BUTTON_FLAT. */
	void msys__SetButtonType(int type);

	/* Write a message to the screen. */
	void msys__WriteText(int x, int y, int colour, const char *msg,
	   int len);

	/* Write a number to the screen. Base can be BASE_HEX, BASE_BIN
	   or BASE_DEC. Type can be VAL_NUM or VAL_PTR. */
	void msys__WriteNum(int x, int y, int colour, int val, int base,
	   int type, int ndigits);

	/* Place an image on the screen. */
	int msys__PutImage(int x, int y, int width, int height, void *img);

	/* Change the shape of a window. */
	void msys__SetRandomShapedWindow(void *data);

	/* Change the scale of a randomly-shaped window (default 1). */
	void msys__SetRandomShapedWindowScale(int scale);

	/* Obtain the extent of the screen. */
	void msys__GetScreenSize(int *width, int *height);

	/* Changes colour of a particular pixel. Colour should be OR'ed 
	   with PX_NEG to invert. */
	void msys__SetPixel(int x, int y, int colour);

	/* Returns colour of a particular pixel. */
	int msys__GetPixel(int x, int y);

	/* Call prior to redrawing. */
	void msys__BeginDraw(void);

	/* Call at end of redraw. */
	void msys__EndDraw(void);

	/* Draw a line from (x1, y1) to (x2, y2) in ?? colour. */
	void msys__DrawLine(int x1, int y1, int x2, int y2);

	/* Draw a rectangle. */
	void msys__DrawRect(int x, int y, int width, int height, int colour);


Background
~~~~~~~~~~

	#include <menuet/msys.h>
	#include <menuet/bkground.h>

	/* Redraw the desktop background. */
	void msys__DrawBackground(void);

	/* Read data from the desktop background image. */
	int msys__GetBackgroundData(int pos);

	/* Obtain the size of the background image. */
	void msys__GetBackgroundSize(int *width, int *height);

	/* Choose the method by which the background image is drawn. Method can
	   be BACKGROUND_TILE or BACKGROUND_STRETCH. */
	int msys__GetBackgroundType(void);

	/* Unknown Background function. */
	void msys__UnknownBackgroundFunction(void);


Process Management
~~~~~~~~~~~~~~~~~~

	#include <menuet/msys.h>
	#include <menuet/process.h>
	#include <menuet/apphdr.h>

	/* Access the header of the application. */
	struct menuet_apphdr * msys__GetAppHeader(void);

	/* Start application from ramdisk image. */
	int msys__StartApp(const char *name, const char *params);

	/* Start application from hard-disk. */
	void msys__StartHdApp(void *file, int filelen, void *workarea);

	/* Obtain information about a specified process. Returns number of
	   processes in system. */
	int msys__ProcessInfo(struct process_info *buf, int pid);

	/* Returns the CPU Idle time. */
	int msys__GetIdle(void);

	/* Kill a specified process. */
	void msys__KillApp(int pid);

	/* Initiate system shutdown. */
	void msys__Shutdown(void);

	/* Suspend current process for a given delay in hundredths of
	   a second. */
	void msys__DelayHs(int hs);

	/* Close current process. */
	void msys__EndApp(void);

	/* ??? */
	void msys__AppInts(void);

	/* Return the CPU task-switch count??. */
	int msys__GetTsc(void);


Event Management
~~~~~~~~~~~~~~~~

	#include <menuet/events.h>
	#include <menuet/wevents.h>

	/* Suspend process until an event arrives. Returns type of event
	   (not EV_NULL). */
	int msys__WaitForEvent(void);

	/* Suspend process until an event arrives or a given delay
	   (in hundredths of a success) expires. Returns type of event
	   (EV_NULL for timeout). */
	int msys__TimeoutWaitForEvent(int hs);

	/* Specify mask of event types the process wishes to be alerted
	   about. Possible values to be bitwise OR'ed are:

		WEV_REDRAW_REQ		request for window to be redrawn
		WEV_KEY			key pressed
		WEV_BUTTON		button pressed
		WEV_END_REQUEST		??
		WEV_BACKGROUND_DRAW	background redrawn
		WEV_MOUSE_CHANGE	mouse status changed
		WEV_IRQ0 ... WEV_IRQ15	irq status changed

	   Default mask is (WEV_REDRAW_REQ | WEV_KEY | WEV_BUTTON). */
	void msys__WantEvents(int evmask);

	/* See if any events are pending. Returns event type
	   (EV_NULL if none). */
	int msys__CheckForEvent(void);

	/* Returns the value?? of a pressed key. Use when a EV_KEY event
	   arrives. */
	int msys__GetKey(int *k);

	/* Returns the id of a pressed button. Use when a EV_BUTTON event
	   arrives. */
	int msys__GetButton(void);


Time
~~~~

	#include <menuet/time.h>
	#include <menuet/msys.h>

	/* Read system clock. */
	void msys__GetClock(struct menuet_clock *c);

	/* Obtain the current date. */
	void msys__GetDate(struct menuet_date *d);


File I/O
~~~~~~~~

	#include <menuet/msys.h>
	#include <menuet/fmode.h>

	/* Write a file to the Fat32 partition. */
	void msys__WriteFat32File(void);

	/* Read a file to the Fat32 partition. */
	void msys__ReadFat32File(void);

	/* Remove a file from the ramdisk image. */
	void msys__DelRamdiskFile(const char *name);

	/* Save a file to the ramdisk image. Blocks are 512 bytes.
	   Mode should be MODE_CREATE or MODE_APPEND. */
	void msys__SaveRamdiskFile(const char *name, void *buf,
	   int nblocks, int mode);

	/* Flush the floppy cache??. */
	void msys__FlushFloppyCache(void);

	/* Read a file from the hard-drive. Blocks are 512 bytes. */
	void msys__ReadHd(void *file, int filelen, int startblock,
	   int nblocks, void *workarea);

	/* Set the Fat32 data. */
	void msys__SetFat32Data(void);


Drives
~~~~~~

	#include <menuet/msys.h>
	#include <menuet/ide.h>

	/* Returns the drive number of the CD drive. Possible values are
	   PRI_MASTER, PRI_SLAVE, SEC_MASTER and SEC_SLAVE. */
	int msys__GetCdBase(void);

	/* Set the drive number of the CD drive. */
	void msys__SetCdBase(int dev);

	/* Returns the drive number of the hard-drive. */
	int msys__GetHdBase(void);

	/* Set the drive number of the hard-drive. */
	void msys__SetHdBase(int dev);

	/* Returns the number of the Fat32 partition on the hard-drive. */
	int msys__GetFat32Partition(void);

	/* Set the number of the Fat32 partition on the hard-drive. */
	void msys__SetFat32Partition(int p);



Language
~~~~~~~~

	#include <menuet/msys.h>
	#include <menuet/language.h>

	/* Obtain the current system language.
	   Possible values are LANG_ENGLISH, LANG_FINNISH, LANG_GERMAN and
	   LANG_RUSSIAN. */
	int msys__GetSysLanguage(void);

	/* Change the current system language. Default LANG_ENGLISH. */
	void msys__SetSysLanguage(int lang);


Mouse
~~~~~

	#include <menuet/msys.h>
	#include <menuet/mouse.h>

	/* Get mouse pointer position relative to the screen. */
	void msys__GetMousePosition_ScreenRelative(int *x, int *y);

	/* Get mouse pointer position relative to the window. */
	void msys__GetMousePosition_WinRelative(int *x, int *y);

	/* Obtain the current status (buttons pressed) of the mouse.
	  Returns bitwise OR of some of these values ?? */
	int msys__GetMouseStatus(void);


Sound
~~~~~

	#include <menuet/msys.h>

	/* Get the I/O address of the Roland MPU-401 midi chip. */
	int msys__GetMidiBase(void);

	/* Set the I/O address of the Roland MPU-401 midi chip. */
	void msys__SetMidiBase(int iobase);

	/* Reset the Roland MPU-401 midi chip. */
	void msys__ResetMidi(void);

	/* Output data to the Roland MPU-401 midi chip. */
	void msys__OutputMidi(int data);

	/* Get the I/O address of the SoundBlaster-16 chip. */
	int msys__GetSb16Base(void);

	/* Set the I/O address of the SoundBlaster-16 chip. */
	void msys__SetSb16Base(int iobase);

	/* Get the I/O address of the Windows Sound System chip. */
	int msys__GetWssBase(void);

	/* Set the I/O address of the Windows Sound System chip. */
	void msys__SetWssBase(int iobase);

	/* Set the main volume for the SoundBlaster-16 Mixer I. */
	void msys__SetSb16MixerIMainvol(int left, int right);

	/* Set the CD volume for the SoundBlaster-16 Mixer I. */
	void msys__SetSb16MixerICdvol(int left, int right);

	/* Set the main volume for the SoundBlaster-16 Mixer II. */
	void msys__SetSb16MixerIIMainvol(int vol);

	/* Set the CD volume for the SoundBlaster-16 Mixer II. */
	void msys__SetSb16MixerIICdvol(int vol);

	/* Set the main volume for the Windows Sound System chip. */
	void msys__SetWssMainvol(int vol);

	/* Set the CD volume for the Windows Sound System chip. */
	void msys__SetWssCdvol(int vol);

	/* Load music for the SoundBlaster-16 from a 64k buffer. */
	void msys__LoadSb16Music(void *data);

	/* Play music previously loaded into the SoundBlaster-16. */
	void msys__PlaySb16Music(void);


CD
~~

	#include <menuet/msys.h>

	/* Obtain list of songs on a CD???. */
	int msys__GetCdPlaylist(int size, void *buf);

	/* Stop CD playing. */
	int msys__StopCd(void);

	/* Play CD track from given start time. */
	int msys__PlayCdTrack(int track, int minute, int sec);


Keyboard Setup
~~~~~~~~~~~~~~

	#include <menuet/msys.h>
	#include <menuet/klayout.h>

	/* Obtain the current keyboard layout setting.
	   Possible values are KLAYOUT_ENGLISH, KLAYOUT_FINNISH,
	   KLAYOUT_GERMAN and KLAYOUT_RUSSIAN. */
	int msys__GetKeyLayout(int country);

	/* Change the current keyboard layout setting. */
	void msys__SetKeyLayout(int country);

	/* Returns a pointer to the current base keymap. */
	void * msys__GetKeymap(void);

	/* Change the base keymap. */
	void msys__SetKeymap(void *map);

	/* Returns a pointer to the shifted keymap. */
	void * msys__GetShiftKeymap(void);

	/* Change the shifted keymap. */
	void msys__SetShiftKeymap(void *map);


IRQs and Devices
~~~~~~~~~~~~~~~~

	#include <menuet/msys.h>

	/* Reserve an IRQ. */
	void msys__ReserveIrq(void);

	/* Free a reserved IRQ. */
	void msys__FreeIrq(int irq);

	/* Read data from a given IRQ. */
	void msys__GetIrqData(int irq);

	/* Query owner of an IRQ. */
	void msys__GetIrqOwner(void);

	/* Program IRQs. */
	void msys__ProgramIrqs(int irq, void *table);

	/* Write to a device. */
	int msys__SendDeviceData(int port, int data);
