1 |
39 |
Agner |
/************************* system_functions.h ***************************
|
2 |
|
|
* Author: Agner Fog
|
3 |
|
|
* Date created: 2018-03-20
|
4 |
|
|
* Last modified: 2020-11-25
|
5 |
|
|
* Version: 1.11
|
6 |
|
|
* Project: Binary tools for ForwardCom instruction set
|
7 |
|
|
* Module: system_functions.h
|
8 |
|
|
* Description:
|
9 |
|
|
* Header file for ForwardCom system function ID numbers
|
10 |
|
|
*
|
11 |
|
|
* Note: id values are preliminary, they may change
|
12 |
|
|
*
|
13 |
|
|
* Copyright 2018-2020 GNU General Public License http://www.gnu.org/licenses
|
14 |
|
|
******************************************************************************/
|
15 |
|
|
|
16 |
|
|
// Event ID's. System-specific and user-defined ID numbers may be added
|
17 |
|
|
#define EVT_NONE 0 // ignore
|
18 |
|
|
#define EVT_CONSTRUCT 1 // call static constructors and initialization procedures before calling main
|
19 |
|
|
#define EVT_DESTRUCT 2 // call static destructors and clean up after return from main
|
20 |
|
|
#define EVT_LOADLIB 3 // a library has been loaded dynamically at runtime. initialize it
|
21 |
|
|
#define EVT_UNLOADLIB 4 // a library is about to be unloaded dynamically
|
22 |
|
|
#define EVT_CLOSE 5 // a request for closing the current process
|
23 |
|
|
#define EVT_PARENTNOTIFY 6 // notification from child process to parent process
|
24 |
|
|
#define EVT_ERROR 0x10 // error handler
|
25 |
|
|
#define EVT_TIMER 0x20 // timer event
|
26 |
|
|
#define EVT_COMMAND 0x30 // user command from keyboard, menu, or icon click
|
27 |
|
|
#define EVT_MESSAGE 0x31 // keyboard or mouse message or inter-process message
|
28 |
|
|
#define EVT_CALL 0x32 // call to an add-on module
|
29 |
|
|
|
30 |
|
|
// Interrupt ID's. ID numbers for error interrupts
|
31 |
|
|
#define INT_BREAKPOINT 0x01 // debug breakpoint
|
32 |
|
|
#define INT_UNKNOWN_INST 0x80 // unknown instruction
|
33 |
|
|
#define INT_WRONG_PARAMETERS 0x81 // illegal or unsupported parameters for instruction
|
34 |
|
|
#define INT_ACCESS_READ 0x82 // memory access violation, read
|
35 |
|
|
#define INT_ACCESS_WRITE 0x83 // memory access violation, write
|
36 |
|
|
#define INT_ACCESS_EXE 0x84 // memory access violation, execute
|
37 |
|
|
#define INT_CALL_STACK 0x85 // call stack overflow or underflow
|
38 |
|
|
#define INT_ARRAY_BOUNDS 0x88 // array bounds overflow, unsigned
|
39 |
|
|
#define INT_MISALIGNED_MEM 0x89 // misaligned memory access
|
40 |
|
|
#define INT_MISALIGNED_JUMP 0x8A // jump to an address not divisible by 4
|
41 |
|
|
|
42 |
|
|
// Interrupt ID's for software traps. Note that software traps are not necessarily supported
|
43 |
|
|
#define INT_OVERFL_UNSIGN 0x101 // integer overflow, unsigned
|
44 |
|
|
#define INT_OVERFL_SIGN 0x102 // integer overflow, signed
|
45 |
|
|
#define INT_OVERFL_FLOAT 0x103 // floating point overflow
|
46 |
|
|
#define INT_FLOAT_INVALID 0x104 // floating point invalid operation
|
47 |
|
|
#define INT_FLOAT_UNDERFL 0x105 // floating point underflow or precision loss
|
48 |
|
|
#define INT_FLOAT_NAN_LOSS 0x106 // floating point nan propagation loss (nan input to compare or conversion to integer)
|
49 |
|
|
|
50 |
|
|
// module ID
|
51 |
|
|
#define SYSM_SYSTEM 0x001 // system module id
|
52 |
|
|
|
53 |
|
|
// process function IDs
|
54 |
|
|
#define SYSF_EXIT 0x010 // terminate program
|
55 |
|
|
#define SYSF_ABORT 0x011 // abort program
|
56 |
|
|
#define SYSF_TIME 0x020 // time
|
57 |
|
|
|
58 |
|
|
// input/output functions
|
59 |
|
|
#define SYSF_PUTS 0x101 // write string to stdout
|
60 |
|
|
#define SYSF_PUTCHAR 0x102 // write character to stdout
|
61 |
|
|
#define SYSF_PRINTF 0x103 // write formatted output to stdout
|
62 |
|
|
#define SYSF_FPRINTF 0x104 // write formatted output to file
|
63 |
|
|
#define SYSF_SNPRINTF 0x105 // write formatted output to string buffer
|
64 |
|
|
#define SYSF_FOPEN 0x110 // open file
|
65 |
|
|
#define SYSF_FCLOSE 0x111 // close file
|
66 |
|
|
#define SYSF_FREAD 0x112 // read from file
|
67 |
|
|
#define SYSF_FWRITE 0x113 // write to file
|
68 |
|
|
#define SYSF_FFLUSH 0x114 // flush file
|
69 |
|
|
#define SYSF_FEOF 0x115 // check if end of file
|
70 |
|
|
#define SYSF_FTELL 0x116 // get file position
|
71 |
|
|
#define SYSF_FSEEK 0x117 // set file position
|
72 |
|
|
#define SYSF_FERROR 0x118 // get file error
|
73 |
|
|
#define SYSF_GETCHAR 0x120 // read character from stdin
|
74 |
|
|
#define SYSF_FGETC 0x121 // read character from file
|
75 |
|
|
#define SYSF_FGETS 0x123 // read string from file
|
76 |
|
|
#define SYSF_GETS_S 0x124 // read string from stdin
|
77 |
|
|
#define SYSF_SCANF 0x130 // read formatted input from stdin
|
78 |
|
|
#define SYSF_FSCANF 0x131 // read formatted input from file
|
79 |
|
|
#define SYSF_SSCANF 0x132 // read formatted input from string buffer
|
80 |
|
|
#define SYSF_REMOVE 0x140 // delete file
|