1 /* 2 * Copyright 2007, Haiku, Inc. All Rights Reserved. 3 * Distributed under the terms of the MIT license. 4 * 5 * Author: 6 * François Revol, revol@free.fr. 7 */ 8 9 #ifndef _TOSCALLS_H 10 #define _TOSCALLS_H 11 12 #include <OS.h> 13 14 #ifdef __cplusplus 15 extern "C" { 16 #endif 17 18 #define DEV_PRINTER 0 19 #define DEV_AUX 1 20 #define DEV_CON 2 21 #define DEV_CONSOLE 2 22 #define DEV_MIDI 3 23 #define DEV_IKBD 4 24 #define DEV_RAW 5 25 26 #define K_RSHIFT 0x01 27 #define K_LSHIFT 0x02 28 #define K_CTRL 0x04 29 #define K_ALT 0x08 30 #define K_CAPSLOCK 0x10 31 #define K_CLRHOME 0x20 32 #define K_INSERT 0x40 33 34 #define RW_READ 0x00 35 #define RW_WRITE 0x01 36 #define RW_NOMEDIACH 0x02 37 #define RW_NORETRY 0x04 38 #define RW_NOTRANSLATE 0x08 39 40 #ifndef __ASSEMBLER__ 41 42 /* 43 * Atari BIOS calls 44 */ 45 46 extern int32 bios(uint16 nr, ...); 47 48 // cf. http://www.fortunecity.com/skyscraper/apple/308/html/bios.htm 49 50 struct tosbpb { 51 int16 recsiz; 52 int16 clsiz; 53 int16 clsizb; 54 int16 rdlen; 55 int16 fsiz; 56 int16 fatrec; 57 int16 datrec; 58 int16 numcl; 59 int16 bflags; 60 }; 61 62 63 //#define Getmpb() bios(0) 64 #define Bconstat(dev) bios(1, (uint16)dev) 65 #define Bconin(dev) bios(2, (uint16)dev) 66 #define Bconout(dev, chr) bios(3, (uint16)dev, (uint16)chr) 67 #define Rwabs(mode, buf, count, recno, dev, lrecno) bios(4, (int16)mode, (void *)buf, (int16)count, (int16)recno, (uint16)dev, (int32)lrecno) 68 //#define Setexc() bios(5, ) 69 #define Tickcal() bios(6) 70 #define Getbpb(dev) (struct tosbpb *)bios(7, (uint16)dev) 71 #define Bcostat(dev) bios(8, (uint16)dev) 72 #define Mediach(dev) bios(9, (int16)dev) 73 #define Drvmap() (uint32)bios(10) 74 #define Kbshift(mode) bios(11, (uint16)mode) 75 76 /* handy shortcut */ 77 static inline int Bconputs(int16 handle, const char *string) 78 { 79 int i, err; 80 for (i = 0; string[i]; i++) { 81 err = Bconout(handle, string[i]); 82 if (err) 83 return i; 84 } 85 return i; 86 } 87 88 /* 89 * Atari XBIOS calls 90 */ 91 92 extern int32 xbios(uint16 nr, ...); 93 94 #define IM_DISABLE 0 95 #define IM_RELATIVE 1 96 #define IM_ABSOLUTE 2 97 #define IM_KEYCODE 4 98 99 #define NVM_READ 0 100 #define NVM_WRITE 1 101 #define NVM_RESET 2 102 103 #define Initmous(mode, param, vec) xbios(0, (int16)mode, (void *)param, (void *)vec) 104 #define Physbase() (void *)xbios(2) 105 #define Logbase() (void *)xbios(3) 106 //#define Getrez() xbios(4) 107 #define Setscreen(log, phys, mode) xbios(5, (void *)log, (void *)phys, (int16)mode) 108 #define VsetScreen(log, phys, mode, modecode) xbios(5, (void *)log, (void *)phys, (int16)mode) 109 //#define Mfpint() xbios(13, ) 110 #define Rsconf(speed, flow, ucr, rsr, tsr, scr) xbios(15, (int16)speed, (int16)flow, (int16)ucr, (int16)rsr, (int16)tsr, (int16)scr) 111 //#define Keytbl(unshift, shift, caps) (KEYTAB *)xbios(16, (char *)unshift, (char *)shift, (char *)caps) 112 #define Random() xbios(17) 113 #define Gettime() (uint32)xbios(23) 114 #define Jdisint(intno) xbios(26, (int16)intno) 115 #define Jenabint(intno) xbios(27, (int16)intno) 116 #define Supexec(func) xbios(38, (void *)func) 117 //#define Puntaes() xbios(39) 118 #define DMAread(sect, count, buf, dev) xbios(42, (int32)sect, (int16)count, (void *)buf, (int16)dev) 119 #define DMAwrite(sect, count, buf, dev) xbios(43, (int32)sect, (int16)count, (void *)buf, (int16)dev) 120 #define NVMaccess(op, start, count, buffer) xbios(46, (int16)op, (int16)start, (int16)count, (char *)buffer) 121 #define VsetMode(mode) xbios(88, (int16)mode) 122 #define VgetMonitor() xbios(89) 123 #define Locksnd() xbios(128) 124 #define Unlocksnd() xbios(129) 125 126 /* 127 * Atari GEMDOS calls 128 */ 129 130 extern int32 gemdos(uint16 nr, ...); 131 132 // official names 133 #define Pterm0() gemdos(0) 134 #define Cconin() gemdos(1) 135 #define Super(a) gemdos(0x20, (uint32)a) 136 #define Pterm(retcode) gemdos(76, (int16)retcode) 137 138 /* 139 * error mapping 140 * in debug.c 141 */ 142 143 extern status_t toserror(int32 err); 144 145 #endif /* __ASSEMBLER__ */ 146 147 #ifdef __cplusplus 148 } 149 #endif 150 151 #endif /* _TOSCALLS_H */ 152