84PCE:OS:C Include File

From WikiTI
Revision as of 15:55, 7 September 2016 by MateoConLechuga (Talk | contribs)

Jump to: navigation, search

C Function Prototypes

// Parts from Matt "MateoConLechuga" Waltz and Jacob "jacobly" Young, in addtion to
// contributors of http://wikiti.brandonw.net/index.php?title=84PCE:OS:Include_File
// Latest as of June 2016

#ifndef TICE_H
#define TICE_H

#include <stdbool.h>
#include <stdint.h>
#include <stddef.h>

#define randInt(min, max)       ((unsigned)rand() % ((max) - (min) + 1) + (min))

/* Defines for MMIO memory areas */

/* RTC defines */
/* There’s a whole slew of bootcode RTC functions, but a lot of them are kind of pointless when you could just use these defines from MMIO */
#define rtc_GetSeconds()        (*((uint8_t*)0xF30000))
#define rtc_GetMinutes()        (*((uint8_t*)0xF30004))
#define rtc_GetHours()          (*((uint8_t*)0xF30008))
#define rtc_GetDays()           (*((uint16_t*)0xF3000C))
#define rtc_GetControl()        (*((uint8_t*)0xF30020))
#define rtc_SetControl(c)       ((*((uint8_t*)0xF30020)) = (uint8_t)(c))
#define rtc_LoadSetTime()       ((*((uint8_t*)0xF30020)) = (*((uint8_t*)0xF30020))|64)
#define rtc_SetSeconds(s)       ((*((uint8_t*)0xF30024)) = (uint8_t)(s))
#define rtc_SetMinutes(m)       ((*((uint8_t*)0xF30028)) = (uint8_t)(m))
#define rtc_SetHours(h)         ((*((uint8_t*)0xF3002C)) = (uint8_t)(h))
#define rtc_SetDays(d)          ((*((uint16_t*)0xF30030)) = (uint16_t)(d))
#define rtc_Time()              (*(volatile uint32_t*)0xF30044)

/**
 * Resets the RTC back to its original values
 * If enable is true, the RTC will be enabled during this function
 */
void boot_RTCInitialize(bool enable);

/**
 * Returns a pointer to the system stats
 */
void *os_GetSystemStats(void);

/**
 * Sets up the defualt error handlers if an OS routine encounters an error when running
 */
void os_PushErrorHandler(void *routine);
void os_PopErrorHandler(void);

/* LCD defines */
#define lcd_GetBacklightLevel()  (*((uint8_t*)0xF60024))
#define lcd_SetBacklightLevel(b) ((*((uint8_t*)0xF60024))) = (uint8_t)(b);

/**
 * OS varaible type definitions
 */
typedef struct { int8_t sign, exp; uint8_t mant[7]; } real_t;
typedef struct { real_t real, imag; } cplx_t;
typedef struct { uint16_t dim; real_t *items; } list_t;
typedef struct { uint16_t dim; cplx_t *items; } cplx_list_t;
typedef struct { uint8_t cols, rows; real_t *items; } matrix_t;
typedef struct { uint16_t size; uint8_t *data; } var_t;

/**
 * Cleans up everything and gets ready to enter back to the OS
 * when you are ready to exit your program
 */
void prgm_CleanUp(void);

/* This is here because Mateo can't spell */
#define pgrm_CleanUp prgm_CleanUp

/**
 * A faster implementation of memset
 */
void *memset_fast(void *ptr,int value,size_t num);

/**
 * Returns the Bootcode version major
 */
uint8_t boot_GetBootVerMajor(void);

/**
 * Returns the Bootcode version minor
 */
uint8_t boot_GetBootVerMinor(void);

/**
 * Returns the Harware version
 */
uint8_t boot_GetHardwareVers(void);

/**
 * Turns all of VRAM into 0xFF (white)
 */
void boot_ClearVRAM(void);

/**
 * Checks if the [on] key was pressed
 */
bool boot_CheckOnPressed(void);

/**
 * Returns extended keys as 16-bits
 */
int os_GetKey(void);

/**
 * Performs an OS call to get the keypad scan code
 * Values returned are listed below
 */
int os_GetCSC(void);
typedef uint8_t sk_key_t;
#define sk_Down       0x01
#define sk_Left       0x02
#define sk_Right      0x03
#define sk_Up         0x04
#define sk_Enter      0x09
#define sk_2nd        0x36
#define sk_Clear      0x0F
#define sk_Alpha      0x30
#define sk_Add        0x0A
#define sk_Sub        0x0B
#define sk_Mul        0x0C
#define sk_Div        0x0D
#define sk_Graph      0x31
#define sk_Trace      0x32
#define sk_Zoom       0x33
#define sk_Window     0x34
#define sk_Yequ       0x35
#define sk_Mode       0x37
#define sk_Del        0x38
#define sk_Store      0x2A
#define sk_Ln         0x2B
#define sk_Log        0x2C
#define sk_Square     0x2D
#define sk_Recip      0x2E
#define sk_Math       0x2F
#define sk_0          0x21
#define sk_1          0x22
#define sk_4          0x23
#define sk_7          0x24
#define sk_2          0x1A
#define sk_5          0x1B
#define sk_8          0x1C
#define sk_3          0x12
#define sk_6          0x13
#define sk_9          0x14
#define sk_Comma      0x25
#define sk_Sin        0x26
#define sk_Apps       0x27
#define sk_GraphVar   0x28
#define sk_DecPnt     0x19
#define sk_LParen     0x1D
#define sk_Cos        0x1E
#define sk_Pgrm       0x1F
#define sk_Stat       0x20
#define sk_Chs        0x10
#define sk_RParen     0x15
#define sk_Tan        0x16
#define sk_Vars       0x17
#define sk_Power      0x0E

/**
 * Disables the OS cursor
 */
void os_DisableCursor(void);

/**
 * Enables the OS cursor
 */
void os_EnableCursor(void);

/**
 * Set/Get the foreground color used to draw text on the graphscreen
 */
void os_SetDrawFGColor(int color);
int os_GetDrawFGColor(void);

/**
 * Set/Get the backgroundground color used to draw text on the graphscreen
 * os_GetDrawBGColor is only useable in OS 5.2 and above; use at your own risk
 */
void os_SetDrawBGColor(int color);
void os_GetDrawBGColor(int color);

/**
 * Set/Get the cursor posistion used on the homescreen
 */
void os_SetCursorPos(uint8_t curRow, uint8_t curCol);
void os_GetCursorPos(unsigned int *curRow, unsigned int *curCol);

/**
 * Selects/Gets the font to use when drawing on the graphscreen
 * 0: small font
 * 1: large monospace font
 */
void os_FontSelect(char id);
int os_FontGetID(void);

/**
 * Returns the width of a string in the varaible-width format
 * Second function is used to get the height of the characters
 */
int os_FontGetWidth(const char *string);
int os_FontGetHeight(void);

/**
 * Draws a text using the small font to the screen
 * Returns the end column
 */
int os_FontDrawText(const char *string, uint16_t col, uint8_t row);
int os_FontDrawTransText(const char *string, uint16_t col, uint8_t row);

/**
 * Puts some text at the current homescreen cursor location
 * Returns 1 if string fits on screen, 0 otherwise
 */
int os_PutStrFull(const char *string);

/**
 * Puts some text at the current homescreen cursor location
 * Returns 1 if string fits on line, 0 otherwise
 */
int os_PutStrLine(const char *string);

/**
 * Set/Get a particular flag variable
 */
void os_SetFlagByte(int offset, uint8_t set);
uint8_t os_GetFlagByte(int offset);

/**
 * Returns amount of free ram, free set to start of free ram
 */
size_t os_MemChk(void **free);

/**
 * Throws an OS error
 */
void os_ThrowError(uint8_t error);

/**
 * Returns a pointer to symtable of the OS
 */
void *os_GetSymTablePtr(void);

/**
 * Creates an appvar; and returns a pointer to the structure 
 * Returns NULL if creation failed for some reason, otherwise a pointer to the size bytes
 */
var_t *os_CreateAppVar(const char *name, uint16_t size);

/**
 * Returns next entry or NULL if no more entries, pass os_GetSymTablePtr() as first entry
 */
void *os_NextSymEntry(void *entry, uint24_t *type, uint24_t *nameLength, const char *name, void **data);

/**
 * If file exists, returns 1 and sets entry and data, otherwise returns 0.
 * entry and/or data can be NULL if you don't care
 */
int os_ChkFindSym(uint8_t type, const char *name, void **entry, void **data);

/**
 * type is set to the current varaible type in ANS, and a pointer to the data is returned
 * Returns NULL if Ans doesn't exist or type is NULL
 */
void *os_RclAns(uint8_t *type);

/**
 * Copies a real_t type to another location
 * Returns dest
 */
real_t *os_RealCopy(real_t *dest, const real_t *src);

/**
 * Urnary operations used to interact with the OS math functions
 * All return result
 */
real_t *os_RealAcosRad(real_t *result, const real_t *arg);
real_t *os_RealAsinRad(real_t *result, const real_t *arg);
real_t *os_RealAtanRad(real_t *result, const real_t *arg);
real_t *os_RealCosRad(real_t *result, const real_t *arg);
real_t *os_RealRadToDeg(real_t *result, const real_t *arg);
real_t *os_RealExp(real_t *result, const real_t *arg);
real_t *os_RealFloor(real_t *result, const real_t *arg);
real_t *os_RealFrac(real_t *result, const real_t *arg);
real_t *os_RealRoundInt(real_t *result, const real_t *arg);
real_t *os_RealLog(real_t *result, const real_t *arg);
real_t *os_RealNeg(real_t *result, const real_t *arg);
real_t *os_RealDegToRad(real_t *result, const real_t *arg);
real_t *os_RealInv(real_t *result, const real_t *arg);
real_t *os_RealSinRad(real_t *result, const real_t *arg);
real_t *os_RealSqrt(real_t *result, const real_t *arg);
real_t *os_RealTanRad(real_t *result, const real_t *arg);
real_t *os_RealInt(real_t *result, const real_t *arg);
cplx_t *os_CplxSquare(cplx_t *result, const cplx_t *arg);

/**
 * Binary operations used to interact with the OS math functions
 * All return result
 */
real_t *os_RealAdd(real_t *result, const real_t *arg1, const real_t *arg2);
real_t *os_RealDiv(real_t *result, const real_t *arg1, const real_t *arg2);
real_t *os_RealGcd(real_t *result, const real_t *arg1, const real_t *arg2);
real_t *os_RealLcm(real_t *result, const real_t *arg1, const real_t *arg2);
real_t *os_RealMax(real_t *result, const real_t *arg1, const real_t *arg2);
real_t *os_RealMin(real_t *result, const real_t *arg1, const real_t *arg2);
real_t *os_RealMul(real_t *result, const real_t *arg1, const real_t *arg2);
real_t *os_RealNcr(real_t *result, const real_t *total, const real_t *num);
real_t *os_RealNpr(real_t *result, const real_t *total, const real_t *num);
real_t *os_RealPow(real_t *result, const real_t *base, const real_t *exp);
real_t *os_RealRandInt(real_t *result, const real_t *min, const real_t *max);
real_t *os_RealMod(real_t *result, const real_t *arg1, const real_t *arg2);
real_t *os_RealSub(real_t *result, const real_t *arg1, const real_t *arg2);
/**
 * digits must be in the range 0 - 9
 */
real_t *os_RealRound(real_t *result, const real_t *arg, char digits);

/**
 * Returns -1, 0, or 1 depending on the comparison
 */
int os_RealCompare(const real_t *arg1, const real_t *arg2);

/** os_RealToStr:
  *  This converts a ti-float to a ti-ascii string.
  *  result: zero terminated string copied to this address
  *  arg: real to convert
  * maxLength: 
  *  <=0: use default max length (14)
  *  >0:  max length of result, minimum of 6
  * mode:
  *  0: Use current mode for everything (digits ignored)
  *  1: Normal mode
  *  2: Sci mode
  *  3: Eng mode
  *  >4: Use current Normal/Sci/Eng mode (digits still used)
  * digits:
  *  -1:  Float mode
  *  0-9: Fix # mode
  *  returns length of result
  */
int os_RealToStr(char *result, const real_t *arg, char maxLength, char mode, char digits);

/** os_StrToReal:
  *  This converts a ti-ascii string to a ti-float.
  *  String format regexp: / *[-\032+]?[0-9]*(\.[0-9]*)?([eE\033][-\032+]?[0-9]*)?/
  *  result: resulting ti-float stored here, on exponent overflow this is +-9.9999999999999e99
  *  string: ti-ascii string to convert
  *  end: if non-null, pointer to end of parsed number is stored here
  *  returns result
  */
real_t *os_StrToReal(real_t *result, const char *string, char **end);

/** 
 * Basically a reimplemented form of printf that prints to some debugging device
 */
void boot_DebugPrintf(const char *string);

/**
 * Turns off the calculator (probably not a good idea to use)
 */
void boot_TurnOff(void);

/**
 * Inserts a new line at the current cursor posistion on the homescreen
 */
void boot_NewLine(void);

/**
 * Prints the boot version at a really silly place on the homescreen
 */
void boot_PrintBootVersion(void);

/**
 * Sets the calculator into 6MHz mode and 48MHz modes. Note that the ones
 * suffix with I perserve the interrupt vectors
 */
void boot_Set6MHzMode(void);
void boot_Set48MHzMode(void);
void boot_Set6MHzModeI(void);
void boot_Set48MHzModeI(void);

/**
 * Returns the current battery status
 */
uint8_t boot_GetBatteryStatus(void);

/**
 * Waits for just a bit
 * Someone should really look at this to see how long it actually is
 */
void boot_WaitShort(void);

/**
 * Checks if the calculator is being powered via USB
 */
bool boot_USBPowered(void);

/**
 * Checks if there is not a USB plug of A type in the USB port
 */
bool boot_NotPlugTypeA(void);

/**
 * Set the time of the calculator
 */
void boot_SetTime(uint8_t seconds, uint8_t minutes, uint8_t hours);

/**
 * High 8 is unsigned offset, low 8 is bits to test
 * os_TestFlagBits will return a 0 or 1
 */
int os_TestFlagBits(uint16_t offset_pattern);
void os_SetFlagBits(int16_t offset_pattern);
void os_ResetFlagBits(int16_t offset_pattern);

/**
 * Whole bunch of useful timer functions
 * Use the below defines to send to boot_SetTimersControlRegister
 */
#define TIMER1_ENABLE	1 << 0	// Enables Timer 1
#define TIMER1_32K	1 << 1	// Use the 32K clock for timer 1
#define TIMER1_CPU	0 << 1	// Use the CPU clock rate for timer 1
#define TIMER1_INT	1 << 2	// Enable an interrupt for the timer 1
#define TIMER1_NOINT	0 << 2	// Disable interrupts for the timer 1
#define TIMER1_UP	1 << 9	// Timer 1 counts up
#define TIMER1_DOWN	0 << 9	// Timer 1 counts down

#define TIMER2_ENABLE	1 << 3	// Enables Timer 2
#define TIMER2_32K	1 << 4	// Use the 32K clock for timer 2
#define TIMER2_CPU	0 << 4	// Use the CPU clock rate for timer 2
#define TIMER2_INT	1 << 5	// Enable an interrupt for the timer 2
#define TIMER2_NOINT	0 << 5	// Disable interrupts for the timer 2
#define TIMER2_UP	1 << 10	// Timer 2 counts up
#define TIMER2_DOWN	0 << 10	// Timer 2 counts down

/* These defines can be used to check the status of the timer */
#define TIMER1_MATCH1	1 << 0	// Timer 1 hit the first match value
#define TIMER1_MATCH2	1 << 1	// Timer 1 hit the second match value
#define TIMER1_RELOADED	1 << 2	// Timer 1 was reloaded (Needs to have TIMER1_INT enabled)

#define TIMER2_MATCH1	1 << 3	// Timer 2 hit the first match value
#define TIMER2_MATCH2	1 << 4	// Timer 2 hit the second match value
#define TIMER2_RELOADED	1 << 5	// Timer 2 was reloaded (Needs to have TIMER2_INT enabled)

void boot_SetTimersControlRegister(uint16_t value);
uint16_t boot_GetTimersControlRegister(void);
void boot_SetTimersInterruptStatus(uint16_t value);
uint16_t boot_GetTimersInterruptStatus(void);
void boot_SetTimersInterruptMask(uint16_t value);
uint16_t boot_GetTimersInterruptMask(void);
void boot_SetTimer1Counter(uint32_t count);
uint32_t boot_GetTimer1Counter(void);
void boot_SetTimer1ReloadValue(uint32_t value);
uint32_t boot_GetTimer1ReloadValue(void);
void boot_SetTimer1MatchValue1(uint32_t value);
uint32_t boot_GetTimer1MatchValue1(void);
void boot_SetTimer1MatchValue2(uint32_t value);
uint32_t boot_GetTimer1MatchValue2(void);
void boot_SetTimer2Counter(uint32_t count);
uint32_t boot_GetTimer2Counter(void);
void boot_SetTimer2ReloadValue(uint32_t value);
uint32_t boot_GetTimer2ReloadValue(void);
void boot_SetTimer2MatchValue1(uint32_t value);
uint32_t boot_GetTimer2MatchValue1(void);
void boot_SetTimer2MatchValue2(uint32_t value);
uint32_t boot_GetTimer2MatchValue2(void);

/**
 * Things you shouldn't use unless you know what you are doing
 */
void os_ForceCmdNoChar(void);


/**
 * Use this function to call assembly functions in the OS and Bootcode
 * i.e. _OS( asm_HomeUp );
 */
void _OS(void *function);

/**
 * Assembly functions ( Don't forget to call from _OS() )
 */
void asm_MoveUp(void);
void asm_MoveDown(void);
void asm_HomeUp(void);
void asm_RunIndicOn(void);
void asm_RunIndicOff(void);
void asm_DisableAPD(void);
void asm_EnableAPD(void);

#endif

C Function Locations and definitions

; C Functions present in the CE OS and Bootcode

; === External Definitions ===================
    .assume ADL=1
    .def _boot_GetBootVerMajor
    .def _boot_GetHardwareVers
    .def _boot_GetBootVerMinor
    .def _boot_DebugPrintf
    .def _boot_ClearVRAM
    .def _boot_TurnOff
    .def _boot_NewLine
    .def _boot_PrintBootVersion
    .def _boot_Set6MHzMode
    .def _boot_Set48MHzMode
    .def _boot_Set6MHzModeI
    .def _boot_Set48MHzModeI
    .def _boot_GetBatteryStatus
    .def _boot_WaitShort
    .def _boot_DoNothing1, _boot_DoNothing2
    .def _boot_USBPowered
    .def _boot_NotPlugTypeA
    .def _boot_SetTimersControlRegister
    .def _boot_GetTimersControlRegister
    .def _boot_SetTimersInterruptStatus
    .def _boot_GetTimersInterruptStatus
    .def _boot_SetTimersInterruptMask
    .def _boot_GetTimersInterruptMask
    .def _boot_SetTimer1Counter
    .def _boot_GetTimer1Counter
    .def _boot_SetTimer1ReloadValue
    .def _boot_GetTimer1ReloadValue
    .def _boot_SetTimer1MatchValue1
    .def _boot_GetTimer1MatchValue1
    .def _boot_SetTimer1MatchValue2 
    .def _boot_GetTimer1MatchValue2
    .def _boot_SetTimer2Counter
    .def _boot_GetTimer2Counter
    .def _boot_SetTimer2ReloadValue
    .def _boot_GetTimer2ReloadValue
    .def _boot_SetTimer2MatchValue1
    .def _boot_GetTimer2MatchValue1
    .def _boot_SetTimer2MatchValue2 
    .def _boot_GetTimer2MatchValue2
    .def _boot_CheckOnPressed
    .def _boot_SetTime
    .def _os_ThrowError
    .def _os_RealCopy
    .def _os_RealAsinRad
    .def _os_RealAcosRad
    .def _os_RealAtanRad
    .def _os_RealAdd
    .def _os_CplxSquare
    .def _os_RealCompare
    .def _os_RealCosRad
    .def _os_RealRadToDeg
    .def _os_RealDiv
    .def _os_RealExp
    .def _os_RealFloor
    .def _os_RealToStr
    .def _os_RealFrac
    .def _os_RealGcd
    .def _os_RealRoundInt
    .def _os_RealLcm
    .def _os_RealLog
    .def _os_RealMax
    .def _os_RealMin
    .def _os_RealMul
    .def _os_RealNcr
    .def _os_RealNeg
    .def _os_RealNpr
    .def _os_RealPow
    .def _os_RealDegToRad
    .def _os_RealRandInt
    .def _os_RealInv
    .def _os_RealMod
    .def _os_RealRound
    .def _os_RealSinRad
    .def _os_RealSqrt
    .def _os_RealSub
    .def _os_RealTanRad
    .def _os_StrToReal
    .def _os_RealInt
    .def _os_SetFlagBits
    .def _os_ResetFlagBits
    .def _os_TestFlagBits
    .def _os_SetFlagByte
    .def _os_GetFlagByte
    .def _os_GetCursorPos
    .def _os_PutStrFull
    .def _os_PutStrLine
    .def _os_SetCursorPos
    .def _os_GetKey
    .def _os_GetCSC
    .def _os_DisableCursor
    .def _os_EnableCursor
    .def _os_FontDrawText
    .def _os_FontGetHeight
    .def _os_FontGetWidth
    .def _os_InitDrawing
    .def _os_SetDrawBGColor
    .def _os_SetDrawFGColor
    .def _os_FontSelect
    .def _os_GetDrawBGColor_BROKEN
    .def _os_GetDrawFGColor
    .def _os_FontGetID
    .def _os_ForceCmdNoChar
    .def _os_GetSymTablePtr
    .def _os_NextSymEntry
    .def _os_ChkFindSym
    .def _os_MemChk
    .def _os_FontDrawTransText
    .def _os_CreateAppVar
; ============================================

; === Location Equates =======================
_boot_GetBootVerMajor           equ 000080h
_boot_GetHardwareVers           equ 000084h
_boot_GetBootVerMinor           equ 00008Ch
_boot_DebugPrintf               equ 0000B4h
_boot_ClearVRAM                 equ 000374h
_boot_TurnOff                   equ 000388h
_boot_NewLine                   equ 000390h
_boot_PrintBootVersion          equ 000394h
_boot_Set6MHzMode               equ 00039Ch
_boot_Set48MHzMode              equ 0003A0h
_boot_Set6MHzModeI              equ 0003A4h
_boot_Set48MHzModeI             equ 0003A8h
_boot_GetBatteryStatus          equ 0003B0h
_boot_WaitShort                 equ 0003B4h
_boot_DoNothing1                equ 0003D8h
_boot_DoNothing2                equ 0003DCh
_boot_USBPowered                equ 0003E4h
_boot_NotPlugTypeA              equ 0003E8h
_boot_SetTimersControlRegister  equ 000520h
_boot_GetTimersControlRegister  equ 000524h
_boot_SetTimersInterruptStatus  equ 000528h
_boot_GetTimersInterruptStatus  equ 00052Ch
_boot_SetTimersInterruptMask    equ 000530h
_boot_GetTimersInterruptMask    equ 000534h
_boot_SetTimer1Counter          equ 000538h
_boot_GetTimer1Counter          equ 00053Ch
_boot_SetTimer1ReloadValue      equ 000540h
_boot_GetTimer1ReloadValue      equ 000544h
_boot_SetTimer1MatchValue1      equ 000548h
_boot_GetTimer1MatchValue1      equ 00054Ch
_boot_SetTimer1MatchValue2      equ 000550h
_boot_GetTimer1MatchValue2      equ 000554h
_boot_SetTimer2Counter          equ 000558h
_boot_GetTimer2Counter          equ 00055Ch
_boot_SetTimer2ReloadValue      equ 000560h
_boot_GetTimer2ReloadValue      equ 000564h
_boot_SetTimer2MatchValue1      equ 000568h
_boot_GetTimer2MatchValue1      equ 00056Ch
_boot_SetTimer2MatchValue2      equ 000570h
_boot_GetTimer2MatchValue2      equ 000574h
_boot_CheckOnPressed            equ 00057Ch
_boot_SetTime                   equ 0005B4h
_os_ThrowError                  equ 021C80h
_os_RealCopy                    equ 021C84h
_os_RealAsinRad                 equ 021C88h
_os_RealAcosRad                 equ 021C8Ch
_os_RealAtanRad                 equ 021C90h
_os_RealAdd                     equ 021C94h
_os_CplxSquare                  equ 021C98h
_os_RealCompare                 equ 021C9Ch
_os_RealCosRad                  equ 021CA0h
_os_RealRadToDeg                equ 021CA4h
_os_RealDiv                     equ 021CA8h
_os_RealExp                     equ 021CACh
_os_RealFloor                   equ 021CB0h
_os_RealToStr                   equ 021CB4h
_os_RealFrac                    equ 021CB8h
_os_RealGcd                     equ 021CBCh
_os_RealRoundInt                equ 021CC0h
_os_RealLcm                     equ 021CC4h
_os_RealLog                     equ 021CC8h
_os_RealMax                     equ 021CCCh
_os_RealMin                     equ 021CD0h
_os_RealMul                     equ 021CD4h
_os_RealNcr                     equ 021CD8h
_os_RealNeg                     equ 021CDCh
_os_RealNpr                     equ 021CE0h
_os_RealPow                     equ 021CE4h
_os_RealDegToRad                equ 021CE8h
_os_RealRandInt                 equ 021CECh
_os_RealInv                     equ 021CF0h
_os_RealMod                     equ 021CF4h
_os_RealRound                   equ 021CF8h
_os_RealSinRad                  equ 021CFCh
_os_RealSqrt                    equ 021D00h
_os_RealSub                     equ 021D04h
_os_RealTanRad                  equ 021D08h
_os_StrToReal                   equ 021D0Ch
_os_RealInt                     equ 021D10h 
_os_SetFlagBits                 equ 021D14h
_os_ResetFlagBits               equ 021D18h
_os_TestFlagBits                equ 021D1Ch
_os_SetFlagByte                 equ 021D20h
_os_GetFlagByte                 equ 021D24h
_os_GetCursorPos                equ 021D28h
_os_PutStrFull                  equ 021D2Ch
_os_PutStrLine                  equ 021D30h
_os_SetCursorPos                equ 021D34h
_os_GetKey                      equ 021D38h
_os_GetCSC                      equ 021D3Ch
_os_DisableCursor               equ 021DE4h
_os_EnableCursor                equ 021DE8h
_os_FontDrawText                equ 021E00h
_os_FontGetHeight               equ 021E14h
_os_FontGetWidth                equ 021E18h
_os_InitDrawing                 equ 021E1Ch
_os_SetDrawBGColor              equ 021E20h
_os_SetDrawFGColor              equ 021E24h
_os_FontSelect                  equ 021E28h
_os_GetDrawBGColor_BROKEN       equ 021EE4h ; doesn't work due to bug (needs to be ld hl.sis)
_os_GetDrawFGColor              equ 021EE8h
_os_FontGetID                   equ 021EECh
_os_ForceCmdNoChar              equ 021FA8h
_os_GetSymTablePtr              equ 021FB0h
_os_NextSymEntry                equ 021FB4h
_os_ChkFindSym                  equ 021FB8h
_os_MemChk                      equ 021FF0h
_os_FontDrawTransText           equ 022178h
_os_CreateAppVar                equ 022184h
; ============================================