/usr/include/allegro/platform/al386wat.h is in liballegro4-dev 2:4.4.2-5.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 | /* ______ ___ ___
* /\ _ \ /\_ \ /\_ \
* \ \ \L\ \\//\ \ \//\ \ __ __ _ __ ___
* \ \ __ \ \ \ \ \ \ \ /'__`\ /'_ `\/\`'__\/ __`\
* \ \ \/\ \ \_\ \_ \_\ \_/\ __//\ \L\ \ \ \//\ \L\ \
* \ \_\ \_\/\____\/\____\ \____\ \____ \ \_\\ \____/
* \/_/\/_/\/____/\/____/\/____/\/___L\ \/_/ \/___/
* /\____/
* \_/__/
*
* Inline functions (Watcom style 386 asm).
*
* By Shawn Hargreaves.
*
* See readme.txt for copyright information.
*/
#if (!defined ALLEGRO_WATCOM) || (!defined ALLEGRO_I386)
#error bad include
#endif
#ifdef ALLEGRO_IMPORT_GFX_ASM
/* _default_ds:
* Return a copy of the current %ds selector.
*/
int _default_ds(void);
#pragma aux _default_ds = \
" mov eax, 0 " \
" mov ax, ds " \
\
value [eax];
/* _my_cs:
* Return a copy of the current %cs selector.
*/
int _my_cs(void);
#pragma aux _my_cs = \
" mov eax, 0 " \
" mov ax, cs " \
\
value [eax];
/* bmp_write_line/bmp_read_line:
* Bank switch functions.
*/
uintptr_t _bmp_bank_switcher(BITMAP *bmp, int lyne, void *bank_switch);
#pragma aux _bmp_bank_switcher = \
" call ecx " \
\
parm [edx] [eax] [ecx] \
value [eax];
#define bmp_write_line(bmp, lyne) _bmp_bank_switcher(bmp, lyne, (void *)bmp->write_bank)
#define bmp_read_line(bmp, lyne) _bmp_bank_switcher(bmp, lyne, (void *)bmp->read_bank)
/* bmp_unwrite_line:
* Terminate bank switch function.
*/
void _bmp_unbank_switcher(BITMAP *bmp, void *bank_unswitcher);
#pragma aux _bmp_unbank_switcher = \
" call ecx " \
\
parm [edx] [ecx];
#define bmp_unwrite_line(bmp) _bmp_unbank_switcher(bmp, (void *)bmp->vtable->unwrite_bank)
#endif /* ALLEGRO_IMPORT_GFX_ASM */
#ifdef ALLEGRO_IMPORT_MATH_ASM
/* _set_errno_erange:
* Watcom's asm syntax doesn't provide any nice way to do this inline...
*/
AL_INLINE(void, _set_errno_erange, (void),
{
*allegro_errno = ERANGE;
})
/* fixadd:
* Fixed point (16.16) addition.
*/
fixed fixadd(fixed x, fixed y);
#pragma aux fixadd = \
" add eax, edx " \
" jno Out1 " \
" call _set_errno_erange " \
" mov eax, 0x7FFFFFFF " \
" cmp edx, 0 " \
" jg Out1 " \
" neg eax " \
" Out1: " \
\
parm [eax] [edx] \
value [eax];
/* fixsub:
* Fixed point (16.16) subtraction.
*/
fixed fixsub(fixed x, fixed y);
#pragma aux fixsub = \
" sub eax, edx " \
" jno Out1 " \
" call _set_errno_erange " \
" mov eax, 0x7FFFFFFF " \
" cmp edx, 0 " \
" jl Out1 " \
" neg eax " \
" Out1: " \
\
parm [eax] [edx] \
value [eax];
/* fixmul:
* Fixed point (16.16) multiplication.
*/
fixed fixmul(fixed x, fixed y);
#pragma aux fixmul = \
" mov eax, ebx " \
" imul ecx " \
" shrd eax, edx, 16 " \
" sar edx, 15 " \
" jz Out2 " \
" cmp edx, -1 " \
" jz Out2 " \
" call _set_errno_erange " \
" mov eax, 0x7FFFFFFF " \
" cmp ebx, 0 " \
" jge Out1 " \
" neg eax " \
" Out1: " \
" cmp ecx, 0 " \
" jge Out2 " \
" neg eax " \
" Out2: " \
\
parm [ebx] [ecx] \
modify [edx] \
value [eax];
/* fixdiv:
* Fixed point (16.16) division.
*/
fixed fixdiv(fixed x, fixed y);
#pragma aux fixdiv = \
" xor ebx, ebx " \
" or eax, eax " \
" jns Out1 " \
" neg eax " \
" inc ebx " \
" Out1: " \
" or ecx, ecx " \
" jns Out2 " \
" neg ecx " \
" inc ebx " \
" Out2: " \
" mov edx, eax " \
" shr edx, 0x10 " \
" shl eax, 0x10 " \
" cmp edx, ecx " \
" jae Out3 " \
" div ecx " \
" or eax, eax " \
" jns Out4 " \
" Out3: " \
" call _set_errno_erange " \
" mov eax, 0x7FFFFFFF " \
" Out4: " \
" test ebx, 1 " \
" je Out5 " \
" neg eax " \
" Out5: " \
\
parm [eax] [ecx] \
modify [ebx edx] \
value [eax];
/* fixfloor :
* Fixed point version of floor().
* Note that it returns an integer result (not a fixed one)
*/
int fixfloor(fixed x);
#pragma aux fixfloor = \
" sar eax, 0x10 " \
\
parm [eax] \
value [eax];
/* fixceil :
* Fixed point version of ceil().
* Note that it returns an integer result (not a fixed one)
*/
int fixceil(fixed x);
#pragma aux fixceil = \
" add eax, 0xFFFF " \
" jns Out1 " \
" jo Out2 " \
" Out1: " \
" sar eax, 0x10 " \
" jmp Out3 " \
" Out2: " \
" call _set_errno_erange " \
" mov eax, 0x7FFF " \
" Out3: " \
\
parm [eax] \
value [eax];
#endif /* ALLEGRO_IMPORT_MATH_ASM */
|