| 1 | #ifndef __KERNEL_H__ |
|---|
| 2 | #define __KERNEL_H__ |
|---|
| 3 | |
|---|
| 4 | #if defined(NOSTUB) || defined(KERNEL) |
|---|
| 5 | # error "kernel.h" must not be included with tigcclib.h |
|---|
| 6 | #endif |
|---|
| 7 | |
|---|
| 8 | #ifdef DOORS |
|---|
| 9 | #warning "kernel.h" has more recent capabilities is an updated kernel header. You shouldn't use "doors.h". |
|---|
| 10 | #endif |
|---|
| 11 | |
|---|
| 12 | #define KERNEL_NEW |
|---|
| 13 | |
|---|
| 14 | /* If someone uses the main function */ |
|---|
| 15 | // FIXME: push this, within #ifndef / #else / #endif guard, to default.h. |
|---|
| 16 | #define main _main |
|---|
| 17 | |
|---|
| 18 | /* Select target */ |
|---|
| 19 | // FIXME: merge with default.h. |
|---|
| 20 | #ifdef USE_TI89 |
|---|
| 21 | short _ti89; |
|---|
| 22 | #endif |
|---|
| 23 | #if defined(USE_TI92PLUS) || defined(USE_TI92P) |
|---|
| 24 | short _ti92plus; |
|---|
| 25 | #endif |
|---|
| 26 | #ifdef USE_V200 |
|---|
| 27 | short _v200; |
|---|
| 28 | #endif |
|---|
| 29 | #if !defined(USE_TI92PLUS) && !defined(USE_TI92P) && !defined(USE_TI89) && !defined(USE_V200) |
|---|
| 30 | short _ti92plus,_ti89,_v200; |
|---|
| 31 | #endif |
|---|
| 32 | |
|---|
| 33 | /* Define default value */ |
|---|
| 34 | // FIXME: use default.h instead of copying & pasting. |
|---|
| 35 | #define asm __asm__ |
|---|
| 36 | #define __ATTR_STD__ __attribute__((__stkparm__)) |
|---|
| 37 | #define __ATTR_STD_NORETURN__ __attribute__((__stkparm__,__noreturn__)) |
|---|
| 38 | #define CALLBACK __ATTR_STD__ |
|---|
| 39 | #define __ATTR_TIOS__ __ATTR_STD__ |
|---|
| 40 | #define __ATTR_TIOS_NORETURN__ __ATTR_STD_NORETURN__ |
|---|
| 41 | #define __ATTR_TIOS_CALLBACK__ CALLBACK |
|---|
| 42 | #define __ATTR_GCC__ |
|---|
| 43 | #define __ATTR_LIB_C__ __attribute__((__regparm__(4))) |
|---|
| 44 | #define __ATTR_LIB_ASM__ __ATTR_STD__ |
|---|
| 45 | #define __ATTR_LIB_ASM_NORETURN__ __ATTR_STD_NORETURN__ |
|---|
| 46 | #define __ATTR_LIB_CALLBACK_C__ CALLBACK |
|---|
| 47 | #define __ATTR_LIB_CALLBACK_ASM__ CALLBACK |
|---|
| 48 | |
|---|
| 49 | /* Float definition */ |
|---|
| 50 | // FIXME: use default.h instead of copying & pasting. |
|---|
| 51 | extern float __BC()__ATTR_LIB_ASM__; |
|---|
| 52 | #define _tios_float_1(f,x,t) ({typedef float(*__temp__type__)(short,t)__ATTR_LIB_ASM__;((__temp__type__)__BC)(4*0x##f,x);}) |
|---|
| 53 | #define _tios_float_2(f,x,y,t1,t2) ({typedef float(*__temp__type__)(short,t1,t2)__ATTR_LIB_ASM__;((__temp__type__)__BC)(4*0x##f,x,y);}) |
|---|
| 54 | |
|---|
| 55 | |
|---|
| 56 | /* Like in doors.h, #define to make romsymb.h redefine __rom_call_addr_concat */ |
|---|
| 57 | #define __REDEFINE_ALL_ROM_CALLS |
|---|
| 58 | #include <romsymb.h> |
|---|
| 59 | |
|---|
| 60 | // FIXME: use default.h instead of copying & pasting. |
|---|
| 61 | #define MIN_AMS_MAJOR (MIN_AMS/100) |
|---|
| 62 | #define MIN_AMS_MINOR (MIN_AMS%100) |
|---|
| 63 | #define __jmp_tbl (*(void***)0xC8) |
|---|
| 64 | #define _rom_call_addr_concat(intindex,romindex) (__jmp_tbl[intindex]) |
|---|
| 65 | #define _rom_call_addr_hack_concat(intindex,romindex,addr,minams,minindex) (MIN_AMS >= (minams) || TIOS_entries > (minindex) ? _rom_call_addr_concat (intindex, romindex) : ({ asm (".xdef __ref_all___reject_unofficial_os"); (void *) (addr); })) |
|---|
| 66 | #define _rom_call_addr_hack(index,addr,minams) (_rom_call_addr_hack_concat(0x##index,_ROM_CALL_##index,(addr),(minams),0x##index)) |
|---|
| 67 | #define _rom_call_addr(index) (_rom_call_addr_concat(0x##index,_ROM_CALL_##index)) |
|---|
| 68 | #define _rom_call_attr(type,args,attr,index) (*({typedef __ATTR_TIOS__ attr type(*__temp__type__)args;(__temp__type__)(__rom_call_addr_concat(0x##index,_ROM_CALL_##index));})) |
|---|
| 69 | #define _rom_call_concat(type,args,intindex,romindex) (*((type(*__ATTR_TIOS__)args)(__rom_call_addr_concat(intindex,romindex)))) |
|---|
| 70 | #define _rom_call_hack_attr_concat(type,args,attr,intindex,romindex,addr,minams,minindex) (*({ typedef __ATTR_TIOS__ attr type (*__temp__type__hack__) args; (__temp__type__hack__) (MIN_AMS >= (minams) || TIOS_entries > (minindex) ? (const void *) (&(_rom_call_concat (void, (void), (intindex), (romindex)))) : ({ asm (".xdef __ref_all___reject_unofficial_os"); (const void *) (addr); })); })) |
|---|
| 71 | #define _rom_call_hack_attr(type,args,attr,index,addr,minams) (_rom_call_hack_attr_concat(type,args,attr,0x##index,_ROM_CALL_##index,(addr),(minams),0x##index)) |
|---|
| 72 | #define _rom_call_hack(type,args,index,addr,minams) (_rom_call_hack_attr_concat(type,args,,0x##index,_ROM_CALL_##index,(addr),(minams),0x##index)) |
|---|
| 73 | #define _rom_call(type,args,index) (_rom_call_concat(type,args,0x##index,_ROM_CALL_##index)) |
|---|
| 74 | #define import_binary(filename,symname) asm(".globl "#symname"\n"#symname":\n\t.incbin \""filename"\"") |
|---|
| 75 | |
|---|
| 76 | /* Kernel RAM_CALLS */ |
|---|
| 77 | extern void |
|---|
| 78 | _RAM_CALL_0,_RAM_CALL_1,_RAM_CALL_2,_RAM_CALL_3, |
|---|
| 79 | _RAM_CALL_4,_RAM_CALL_5,_RAM_CALL_6,_RAM_CALL_7, |
|---|
| 80 | _RAM_CALL_8,_RAM_CALL_9,_RAM_CALL_A,_RAM_CALL_B, |
|---|
| 81 | _RAM_CALL_C,_RAM_CALL_D,_RAM_CALL_E,_RAM_CALL_F, |
|---|
| 82 | _RAM_CALL_10,_RAM_CALL_11,_RAM_CALL_12,_RAM_CALL_13, |
|---|
| 83 | _RAM_CALL_14,_RAM_CALL_21,_RAM_CALL_22,_RAM_CALL_23, |
|---|
| 84 | _RAM_CALL_24,_RAM_CALL_25,_RAM_CALL_26,_RAM_CALL_27, |
|---|
| 85 | _RAM_CALL_28,_RAM_CALL_2D,_RAM_CALL_2E; |
|---|
| 86 | #define __RAM_CALL(n,type) ((type)&_RAM_CALL_##n) |
|---|
| 87 | |
|---|
| 88 | /* Define Kernel values -- pass 2 */ |
|---|
| 89 | // FIXME: merge as much as possible with compat.h. What to do with the few DoorsOS / PreOS incompatibilities ? |
|---|
| 90 | #define __CALCULATOR __RAM_CALL(0, const unsigned char*) |
|---|
| 91 | #define CALCULATOR (__CALCULATOR[0]) |
|---|
| 92 | #define HW_VERSION (__CALCULATOR[1]) |
|---|
| 93 | #define EMULATOR (__CALCULATOR[3]) |
|---|
| 94 | #define font_medium __RAM_CALL(E, const void*) |
|---|
| 95 | #define font_small __RAM_CALL(22, const void*) |
|---|
| 96 | #define font_large __RAM_CALL(23, const void *) |
|---|
| 97 | #define LCD_MEM __RAM_CALL(21, void*) |
|---|
| 98 | #define LCD_WIDTH __RAM_CALL (1, unsigned long) |
|---|
| 99 | #define LCD_HEIGHT __RAM_CALL (2, unsigned long) |
|---|
| 100 | #define LCD_LINE_BYTES __RAM_CALL (4, unsigned long) |
|---|
| 101 | #define LCD_SIZE __RAM_CALL (C, unsigned long) |
|---|
| 102 | #define ROM_BASE __RAM_CALL(3, unsigned char *) |
|---|
| 103 | #define RETURN_VALUE (*(unsigned char **)_RAM_CALL_F = *(unsigned char **)_ROM_CALL_109) |
|---|
| 104 | #define Heap __RAM_CALL(11, void***) |
|---|
| 105 | #define FOLDER_LIST_HANDLE __RAM_CALL (12, unsigned long) |
|---|
| 106 | #define MainHandle __RAM_CALL (13, unsigned long) |
|---|
| 107 | #define ROM_VERSION __RAM_CALL (14, unsigned long) |
|---|
| 108 | #define kb_globals __RAM_CALL(10, void*) |
|---|
| 109 | #define KEY_PRESSED_FLAG (*(unsigned short*)(kb_globals+0x1C)) |
|---|
| 110 | #define GETKEY_CODE (*(unsigned short*)(kb_globals+0x1E)) |
|---|
| 111 | #define KEY_LEFT __RAM_CALL(5, unsigned long) |
|---|
| 112 | #define KEY_RIGHT __RAM_CALL(6, unsigned long) |
|---|
| 113 | #define KEY_UP __RAM_CALL(7, unsigned long) |
|---|
| 114 | #define KEY_DOWN __RAM_CALL(8, unsigned long) |
|---|
| 115 | #define KEY_UPRIGHT __RAM_CALL(9, unsigned long) |
|---|
| 116 | #define KEY_DOWNLEFT __RAM_CALL(A, unsigned long) |
|---|
| 117 | #define KEY_DIAMOND __RAM_CALL(B, unsigned long) |
|---|
| 118 | #define KEY_SHIFT __RAM_CALL(D, unsigned long) |
|---|
| 119 | #define ROM_BASE __RAM_CALL(3, unsigned char *) |
|---|
| 120 | #define GHOST_SPACE __RAM_CALL(2D, unsigned char *) |
|---|
| 121 | #define KERNEL_SPACE __RAM_CALL(2E, unsigned char *) |
|---|
| 122 | |
|---|
| 123 | // FIXME: use default.h instead of copying & pasting. |
|---|
| 124 | typedef unsigned short *__pushort; |
|---|
| 125 | typedef short *__pshort; |
|---|
| 126 | typedef long *__plong; |
|---|
| 127 | typedef unsigned long *__pulong; |
|---|
| 128 | |
|---|
| 129 | // FIXME: use default.h instead of copying & pasting. |
|---|
| 130 | #define AMS_1xx ((_ram_call(14,unsigned short)&0x0F00)==0x100) |
|---|
| 131 | #define AMS_2xx ((_ram_call(14,unsigned short)&0x0F00)==0x200) |
|---|
| 132 | #define AMS_3xx ((_ram_call(14,unsigned short)&0x0F00)==0x300) |
|---|
| 133 | |
|---|
| 134 | /* Define kernel functions */ |
|---|
| 135 | #define Idle _RAM_CALL_15 |
|---|
| 136 | #define kernel_Idle Idle |
|---|
| 137 | extern void Idle(void); |
|---|
| 138 | #define kernel_Exec _RAM_CALL_16 |
|---|
| 139 | extern short kernel_Exec(HANDLE hd asm("d0")); |
|---|
| 140 | #define kernel_Ptr2Hd _RAM_CALL_17 |
|---|
| 141 | extern HANDLE kernel_Ptr2Hd(void *ptr asm("a0")); |
|---|
| 142 | #define kernel_Hd2Sym _RAM_CALL_18 |
|---|
| 143 | extern SYM_ENTRY *kernel_Hd2Sym(HANDLE hd asm("d0")); |
|---|
| 144 | typedef struct _LibRef LibRef; |
|---|
| 145 | #define kernel_LibsBegin _RAM_CALL_19 |
|---|
| 146 | LibRef *kernel_LibsBegin(char *libname asm("a0"), unsigned char version asm("d1")); |
|---|
| 147 | #define kernel_LibsEnd _RAM_CALL_1A |
|---|
| 148 | void kernel_LibsEnd(LibRef *lib asm("a0")); |
|---|
| 149 | #define kernel_LibsPtr _RAM_CALL_1C |
|---|
| 150 | void *kernel_LibsPtr(LibRef *lib asm("a0"), short function asm("d0")); |
|---|
| 151 | #define kernel_LibsCall _RAM_CALL_1B |
|---|
| 152 | __attribute__((__stkparm__)) unsigned long kernel_LibsCall(LibRef *lib, short function, ...); |
|---|
| 153 | #define kernel_LibsExec _RAM_CALL_1D |
|---|
| 154 | __attribute__((__stkparm__)) void kernel_LibsExec(char *name, short function, char version, ...); |
|---|
| 155 | #define kernel_HdKeep _RAM_CALL_1E |
|---|
| 156 | void kernel_HdKeep(HANDLE hd asm("d0")); |
|---|
| 157 | #define kernel_ExtractFromPack _RAM_CALL_1F |
|---|
| 158 | HANDLE kernel_ExtractFromPack(void *pack asm("a5"), short index asm("d0")); |
|---|
| 159 | #define kernel_ExtractFile _RAM_CALL_20 |
|---|
| 160 | HANDLE kernel_ExtractFile(const char *name asm("a2")); |
|---|
| 161 | #define kernel_ExtractFileFromPack _RAM_CALL_29 |
|---|
| 162 | HANDLE kernel_ExtractFileFromPack(HANDLE hd asm("d0"), const char *name asm("a2")); |
|---|
| 163 | #define exit _RAM_CALL_2A |
|---|
| 164 | void exit(int c asm("d0")); |
|---|
| 165 | #define atexit _RAM_CALL_2B |
|---|
| 166 | int atexit(void (*func)(void) asm("a0")); |
|---|
| 167 | #define kernel_RegisterVector _RAM_CALL_2C |
|---|
| 168 | void kernel_RegisterVector (unsigned short vect asm("d0"), const void *func asm("a0")); |
|---|
| 169 | #define kernel_SystemDir _RAM_CALL_2F |
|---|
| 170 | extern const char kernel_SystemDir[]; |
|---|
| 171 | |
|---|
| 172 | /* Use other TIGCC headers */ |
|---|
| 173 | #include <alloc.h> |
|---|
| 174 | #include <args.h> |
|---|
| 175 | #include <asmtypes.h> |
|---|
| 176 | #include <assert.h> |
|---|
| 177 | #include <bascmd.h> |
|---|
| 178 | #include <basfunc.h> |
|---|
| 179 | #include <basop.h> |
|---|
| 180 | #include <cert.h> |
|---|
| 181 | // HEADER NOT INCLUED FOR NOW: compat.h (FIXME) |
|---|
| 182 | #include <ctype.h> |
|---|
| 183 | // HEADER NOT INCLUED FOR NOW: default.h (FIXME) |
|---|
| 184 | #include <dialogs.h> |
|---|
| 185 | // HEADER NOT INCLUED: dll.h |
|---|
| 186 | // HEADER IS INCOMPATIBLE WITH THIS ONE: doors.h |
|---|
| 187 | #include <error.h> |
|---|
| 188 | #include <estack.h> |
|---|
| 189 | #include <events.h> |
|---|
| 190 | #include <files.h> |
|---|
| 191 | #include <flash.h> // TODO: merge FL_getHardwareParmBlock definitions. |
|---|
| 192 | #include <float.h> |
|---|
| 193 | #include <gdraw.h> |
|---|
| 194 | #include <graph.h> |
|---|
| 195 | #include <graphing.h> |
|---|
| 196 | // HEADER NOT INCLUED: gray.h |
|---|
| 197 | #include <homescr.h> |
|---|
| 198 | #include <intr.h> |
|---|
| 199 | #include <kbd.h> |
|---|
| 200 | #include <limits.h> |
|---|
| 201 | #include <link.h> |
|---|
| 202 | #include <mem.h> |
|---|
| 203 | #include <menus.h> |
|---|
| 204 | // HEADER NOT INCLUED: nostub.h |
|---|
| 205 | #include <peekpoke.h> |
|---|
| 206 | #include <rsa.h> |
|---|
| 207 | #include <setjmp.h> |
|---|
| 208 | #include <sprites.h> |
|---|
| 209 | #include <statline.h> |
|---|
| 210 | #include <stdarg.h> |
|---|
| 211 | #include <stddef.h> |
|---|
| 212 | #include <stdint.h> |
|---|
| 213 | #include <stdio.h> |
|---|
| 214 | #include <stdlib.h> // TODO: modify the #ifndef DOORS. |
|---|
| 215 | #include <string.h> |
|---|
| 216 | #include <system.h> |
|---|
| 217 | #include <textedit.h> |
|---|
| 218 | #include <timath.h> |
|---|
| 219 | #include <unknown.h> // HEADER NOT INCLUED ?? |
|---|
| 220 | #include <values.h> |
|---|
| 221 | #include <vat.h> |
|---|
| 222 | //#include <version.h> HEADER NOT INCLUED MAYBE ? |
|---|
| 223 | #include <wingraph.h> |
|---|
| 224 | |
|---|
| 225 | |
|---|
| 226 | /* From tigcclib.h */ |
|---|
| 227 | /* The following macros are for debugging purposes; don't use them... */ |
|---|
| 228 | |
|---|
| 229 | #define __MARK(s) asm(".ascii \"" #s "\""); |
|---|
| 230 | #define __HALT asm volatile("0:bra.s 0b") |
|---|
| 231 | |
|---|
| 232 | #define __WHERE_AM_I ({register void *__p; asm("bsr 0f; 0:move.l (%%sp)+,%0":"=g"(__p)); __p;}) |
|---|
| 233 | |
|---|
| 234 | |
|---|
| 235 | |
|---|
| 236 | /* Define graphlib functions */ |
|---|
| 237 | asm("graphlib__version02: .xdef graphlib__version02"); |
|---|
| 238 | |
|---|
| 239 | #define graphlib_fill graphlib__0000 |
|---|
| 240 | void graphlib_fill(unsigned short x asm("d0"), unsigned short y asm("d1"), unsigned short width asm("d2"), unsigned short height asm("d3"), unsigned short color asm("d4")); |
|---|
| 241 | |
|---|
| 242 | #define graphlib_put_sprite graphlib__0001 |
|---|
| 243 | void graphlib_put_sprite(unsigned short x asm("d0"), unsigned short y asm("d1"), void *sprite asm("a0")); |
|---|
| 244 | |
|---|
| 245 | #define graphlib_put_sprite2 graphlib__000C |
|---|
| 246 | void graphlib_put_sprite2(unsigned short x asm("d0"), unsigned short y asm("d1"), void *sprite asm("a0"), unsigned char *mask asm("a2")); |
|---|
| 247 | |
|---|
| 248 | #define graphlib_put_sprite_mask graphlib__000B |
|---|
| 249 | void graphlib_put_sprite_mask(unsigned short x asm("d0"), unsigned short y asm("d1"), unsigned char mask asm("d3"), void *sprite asm("a0")); |
|---|
| 250 | |
|---|
| 251 | #define graphlib_smallbox graphlib__0002 |
|---|
| 252 | void graphlib_smallbox(char *title asm("a0")); |
|---|
| 253 | |
|---|
| 254 | #define graphlib_box graphlib__0003 |
|---|
| 255 | void graphlib_box(unsigned short x asm("d0"), unsigned short y asm("d1"), unsigned short width asm("d2"), unsigned short height asm("d3"), char *title asm("a0")); |
|---|
| 256 | |
|---|
| 257 | #define graphlib_frame graphlib__0004 |
|---|
| 258 | void graphlib_frame(unsigned short x asm("d0"), unsigned short y asm("d1"), unsigned short width asm("d4"), unsigned short height asm("d5")); |
|---|
| 259 | |
|---|
| 260 | #define graphlib_clrscr graphlib__0005 |
|---|
| 261 | void graphlib__clrscr(); |
|---|
| 262 | |
|---|
| 263 | #define graphlib_clrscr2 graphlib__0014 |
|---|
| 264 | void graphlib__clrscr2(); |
|---|
| 265 | |
|---|
| 266 | #define graphlib_vert graphlib__0006 |
|---|
| 267 | void graphlib_vert(unsigned short x asm("d0"), unsigned short y1 asm("d1"), unsigned short y2 asm("d2")); |
|---|
| 268 | |
|---|
| 269 | #define graphlib_horiz graphlib__0007 |
|---|
| 270 | void graphlib_horiz(unsigned short x1 asm("d0"), unsigned short y asm("d1"), unsigned short x2 asm("d2"), unsigned short color asm("d3")); |
|---|
| 271 | |
|---|
| 272 | #define graphlib_bigbox graphlib__0008 |
|---|
| 273 | void graphlib_bigbox(char *title asm("a0")); |
|---|
| 274 | |
|---|
| 275 | #define _graphlib_scrtomem graphlib__0009 |
|---|
| 276 | void _graphlib_scrtomem(unsigned short x asm("d0"), unsigned short y asm("d1"), unsigned short width asm("d2"), unsigned short height asm("d3")); |
|---|
| 277 | #define graphlib_scrtomem(_x, _y, _height, _width) ({register unsigned short __d4 asm("d4"); _graphlib_scrtomem(_x, _y, _height, _width); __d4;}) |
|---|
| 278 | |
|---|
| 279 | #define graphlib_memtoscr graphlib__000A |
|---|
| 280 | void graphlib_memtoscr(unsigned short x asm("d0"), unsigned short y asm("d1"), unsigned short width asm("d2"), unsigned short height asm("d3"), HANDLE hd asm("d4")); |
|---|
| 281 | |
|---|
| 282 | #define graphlib_line graphlib__0017 |
|---|
| 283 | void graphlib_line(unsigned short x1 asm("d0"), unsigned short y1 asm("d1"), unsigned short x2 asm("d2"), unsigned short y2 asm("d3"), void *screen asm("a0")); |
|---|
| 284 | |
|---|
| 285 | #define graphlib_choosescreen graphlib__000D |
|---|
| 286 | extern unsigned short graphlib_choosescreen; |
|---|
| 287 | |
|---|
| 288 | typedef struct { |
|---|
| 289 | unsigned short x1; |
|---|
| 290 | unsigned short y1; |
|---|
| 291 | unsigned short x2; |
|---|
| 292 | unsigned short y2; |
|---|
| 293 | unsigned short x; |
|---|
| 294 | unsigned short y; |
|---|
| 295 | char *str; |
|---|
| 296 | } dialog_struct; |
|---|
| 297 | #define graphlib_show_dialog graphlib__0015 |
|---|
| 298 | void graphlib_show_dialog(dialog_struct *d asm("a6")); |
|---|
| 299 | |
|---|
| 300 | #define graphlib_clear_dialog graphlib__0016 |
|---|
| 301 | void graphlib_clear_dialog(); |
|---|
| 302 | |
|---|
| 303 | #define graphlib_erase_rect graphlib__0018 |
|---|
| 304 | void graphlib_erase_rect(void *r); |
|---|
| 305 | |
|---|
| 306 | #define graphlib_frame_rect graphlib__0019 |
|---|
| 307 | void graphlib_frame_rect(void *r); |
|---|
| 308 | |
|---|
| 309 | #define graphlib_gray2 graphlib__000E |
|---|
| 310 | void graphlib_gray2(); |
|---|
| 311 | |
|---|
| 312 | #define graphlib_gray4 graphlib__000F |
|---|
| 313 | void graphlib_gray4(); |
|---|
| 314 | |
|---|
| 315 | #define graphlib_gray7 graphlib__0010 |
|---|
| 316 | void graphlib_gray7(); |
|---|
| 317 | |
|---|
| 318 | #define graphlib_plane0 graphlib__0011 |
|---|
| 319 | #define graphlib_plane1 graphlib__0012 |
|---|
| 320 | #define graphlib_plane2 graphlib__0013 |
|---|
| 321 | extern unsigned char *graphlib_plane0; |
|---|
| 322 | extern unsigned char *graphlib_plane1; |
|---|
| 323 | extern unsigned char *graphlib_plane2; |
|---|
| 324 | |
|---|
| 325 | /* Define userlib functions */ |
|---|
| 326 | asm("userlib__version02: .xdef userlib__version02"); |
|---|
| 327 | |
|---|
| 328 | #define userlib_idle_loop userlib__0000 |
|---|
| 329 | short userlib_idle_loop(); |
|---|
| 330 | #define userlib_random userlib__0001 |
|---|
| 331 | short userlib_random(short limit asm("d0")); |
|---|
| 332 | #define userlib_randseed userlib__0002 |
|---|
| 333 | extern short userlib__randseed; |
|---|
| 334 | #define userlib_exec userlib__0003 |
|---|
| 335 | __attribute__((__stkparm__)) short userlib_exec(HANDLE handle); |
|---|
| 336 | #define userlib_inputstr userlib__0006 |
|---|
| 337 | char *userlib_inputstr(short x asm("d1"), short y asm("d2"), short maxlen asm("d3")); |
|---|
| 338 | #define userlib_smallmenu userlib__000C |
|---|
| 339 | short userlib_samllmenu(short x asm("d0"), short y asm("d1"), char nbitem asm("d2"), char *str_list asm("a0")); |
|---|
| 340 | #define userlib_runprog userlib__0010 |
|---|
| 341 | short userlib_runprog(char *progname asm("a0")); |
|---|
| 342 | |
|---|
| 343 | // Hexlib |
|---|
| 344 | asm("hexlib__version01: .xdef hexlib__version01"); |
|---|
| 345 | |
|---|
| 346 | #define hexlib_put_char hexlib__0000 |
|---|
| 347 | void hexlib_put_char(long x asm("d2"), long y asm("d1"), long character asm("d0")); |
|---|
| 348 | #define hexlib_put_bin hexlib__0001 |
|---|
| 349 | void hexlib_put_bin(long x asm("d2"), long y asm("d1"), long number asm("d0"), long digits asm("d4")); |
|---|
| 350 | #define hexlib_put_hex hexlib__0002 |
|---|
| 351 | void hexlib_put_hex(long x asm("d2"), long y asm("d1"), long number asm("d0"), long digits asm("d4")); |
|---|
| 352 | |
|---|
| 353 | // Shrnklib |
|---|
| 354 | asm("shrnklib__version03: .xdef shrnklib__version03"); |
|---|
| 355 | |
|---|
| 356 | #define shrnklib_OpenArchive shrnklib__0000 |
|---|
| 357 | HANDLE shrnklib_OpenArchive(void *archive asm("a0")); |
|---|
| 358 | #define shrnklib_CloseArchive shrnklib__0001 |
|---|
| 359 | void shrnklib_CloseArchive(HANDLE arch_hd asm("d0")); |
|---|
| 360 | #define shrnklib_Extract shrnklib__0002 |
|---|
| 361 | void *shrnklib_Extract(HANDLE arch_hd asm("d0"), short index asm("d1"), void *dest asm("a0")); |
|---|
| 362 | #define shrnklib_Free(ptr) HeapFree(HeapPtrToHandle(ptr)) |
|---|
| 363 | |
|---|
| 364 | //Ziplib |
|---|
| 365 | asm("ziplib__version01: .xdef ziplib__version01"); |
|---|
| 366 | |
|---|
| 367 | #define ziplib_check_cmem ziplib__0000 |
|---|
| 368 | short ziplib_check_cmem(void *data asm("a0"), unsigned short len asm("d0")); |
|---|
| 369 | #define ziplib_check_emem ziplib__0001 |
|---|
| 370 | short ziplib_check_emem(void *archive asm("a0")); |
|---|
| 371 | #define ziplib_eval_cmem ziplib__0002 |
|---|
| 372 | short ziplib_eval_cmem(void *data asm("a0"), unsigned short len asm("d0")); |
|---|
| 373 | #define ziplib_eval_emem ziplib__0003 |
|---|
| 374 | short ziplib_eval_emem(void *archive asm("a0")); |
|---|
| 375 | #define ziplib_compress ziplib__0004 |
|---|
| 376 | short ziplib_compress(void *data asm("a0"), unsigned short len asm("d0"), void *dest asm("a1")); |
|---|
| 377 | #define ziplib_extract ziplib__0005 |
|---|
| 378 | short ziplib_extract(void *archive asm("a0"), void *dest asm("a1")); |
|---|
| 379 | #define ziplib_zipfile ziplib__0006 |
|---|
| 380 | char ziplib_zipfile(SYM_ENTRY *sym asm("a0"), char comment asm("d0")); |
|---|
| 381 | #define ziplib_iscomp ziplib__000B |
|---|
| 382 | short ziplib_iscomp(SYM_ENTRY *sym asm("a0")); |
|---|
| 383 | #define _ziplib_tempfile ziplib__0007 |
|---|
| 384 | long long _ziplib_tempfile(SYM_ENTRY *sym asm("a0"), char comment asm("d1")); |
|---|
| 385 | #define ziplib_tempfile(sym, comment) ({long long result__ = _ziplib_tempfile(sym, comment); (char)(result__>>32)?-(short)(char)(result__>>32):(short)result__;}) |
|---|
| 386 | #define ziplib_extract_string ziplib__0008 |
|---|
| 387 | void ziplib_extract_string(void *archive asm("a0"), short arch_index asm("d3"), short str_index asm("d4"), void *dest asm("a1")); |
|---|
| 388 | #define ziplib_write_string ziplib__0009 |
|---|
| 389 | void ziplib_write_string(void *archive asm("a0"), short x asm("d0"), short y asm("d1"), short arch_index asm("d3"), short str_index asm("d4")); |
|---|
| 390 | #define ziplib_write_string_inv ziplib__000A |
|---|
| 391 | void ziplib_write_string_inv(void *archive asm("a0"), short x asm("d0"), short y asm("d1"), short arch_index asm("d3"), short str_index asm("d4")); |
|---|
| 392 | |
|---|
| 393 | #endif |
|---|
| 394 | |
|---|