1/* ______ ___ ___ 2 * /\ _ \ /\_ \ /\_ \ 3 * \ \ \L\ \\//\ \ \//\ \ __ __ _ __ ___ 4 * \ \ __ \ \ \ \ \ \ \ /'__`\ /'_ `\/\`'__\/ __`\ 5 * \ \ \/\ \ \_\ \_ \_\ \_/\ __//\ \L\ \ \ \//\ \L\ \ 6 * \ \_\ \_\/\____\/\____\ \____\ \____ \ \_\\ \____/ 7 * \/_/\/_/\/____/\/____/\/____/\/___L\ \/_/ \/___/ 8 * /\____/ 9 * \_/__/ 10 * 11 * Joystick driver for the Gravis GrIP. 12 * (Xterminator, GamepadPro, Stinger, ?) 13 * 14 * By Robert J. Ragno, using the Gravis SDK and the other 15 * Allegro drivers as references. 16 */ 17 18 19#include "../i386/asmdefs.inc" 20 21 22#define GRIP_CALL lcall *GLOBL(GRIP_Thunk) + 8 23 24 25.extern _GRIP_Thunk 26 27.text 28 29 30 31FUNC(_GrInitialize) 32 movw $0x84A1,%ax 33 GRIP_CALL 34ret 35 36FUNC(_GrShutdown) 37 pushl %eax 38 movw $0x84A2,%ax 39 GRIP_CALL 40 popl %eax 41ret 42 43FUNC(_GrRefresh) 44 pushl %ebp 45 movl %esp,%ebp 46 pushl %edx 47 48 movl 8(%ebp), %edx 49 50 movw $0x84A0,%ax 51 GRIP_CALL 52 53 popl %edx 54 popl %ebp 55ret 56 57FUNC(_GrGetSlotMap) 58 movw $0x84B0,%ax 59 GRIP_CALL 60ret 61 62FUNC(_GrGetClassMap) 63 pushl %ebp 64 movl %esp,%ebp 65 pushl %ebx 66 67 movb 8(%ebp), %bh 68 69 movw $0x84B1,%ax 70 GRIP_CALL 71 72 popl %ebx 73 popl %ebp 74ret 75 76FUNC(_GrGetOEMClassMap) 77 pushl %ebp 78 movl %esp,%ebp 79 pushl %ebx 80 81 movb 8(%ebp),%bh 82 83 movw $0x84B2,%ax 84 GRIP_CALL 85 86 popl %ebx 87 popl %ebp 88ret 89 90FUNC(_GrGetMaxIndex) 91 pushl %ebp 92 movl %esp,%ebp 93 pushl %ebx 94 95 movb 8(%ebp),%bh 96 movb 12(%ebp),%bl 97 98 movw $0x84B3,%ax 99 GRIP_CALL 100 101 popl %ebx 102 popl %ebp 103ret 104 105FUNC(_GrGetMaxValue) 106 pushl %ebp 107 movl %esp,%ebp 108 109 movb 8(%ebp),%bh 110 movb 12(%ebp),%bl 111 112 movw $0x84B4,%ax 113 GRIP_CALL 114 115 popl %ebp 116ret 117 118FUNC(_GrGetValue) 119 pushl %ebp 120 movl %esp,%ebp 121 pushl %ebx 122 pushl %ecx 123 124 movb 8(%ebp),%bh 125 movb 12(%ebp),%bl 126 movb 16(%ebp),%ch 127 128 movw $0x84C0,%ax 129 GRIP_CALL 130 131 popl %ecx 132 popl %ebx 133 popl %ebp 134ret 135 136FUNC(_GrGetPackedValues) 137 pushl %ebp 138 movl %esp,%ebp 139 pushl %ebx 140 pushl %ecx 141 142 movb 8(%ebp),%bh 143 movb 12(%ebp),%bl 144 movb 16(%ebp),%ch 145 movb 20(%ebp),%cl 146 147 movw $0x84C1,%ax 148 GRIP_CALL 149 150 popl %ecx 151 popl %ebx 152 popl %ebp 153ret 154 155FUNC(_GrSetValue) 156 pushl %ebp 157 movl %esp,%ebp 158 pushl %eax 159 pushl %ebx 160 pushl %ecx 161 pushl %edx 162 163 movb 8(%ebp),%bh 164 movb 12(%ebp),%bl 165 movb 16(%ebp),%ch 166 movw 20(%ebp),%dx 167 168 movw $0x84C2,%ax 169 GRIP_CALL 170 171 popl %edx 172 popl %ecx 173 popl %ebx 174 popl %eax 175 popl %ebp 176ret 177 178FUNC(_GrGetVendorName) 179 pushl %ebp 180 movl %esp,%ebp 181 pushl %esi 182 pushl %edi 183 pushl %eax 184 pushl %ebx 185 pushl %ecx 186 pushl %edx 187 188 movb 8(%ebp),%bh 189 movl 12(%ebp),%edi 190 191 movw $0x84D0,%ax 192 GRIP_CALL 193 194 movl %ebx,0x00(%edi) 195 movl %ecx,0x04(%edi) 196 movl %edx,0x08(%edi) 197 movl %esi,0x0C(%edi) 198 199 popl %edx 200 popl %ecx 201 popl %ebx 202 popl %eax 203 popl %edi 204 popl %esi 205 popl %ebp 206ret 207 208FUNC(_GrGetProductName) 209 pushl %ebp 210 movl %esp,%ebp 211 pushl %esi 212 pushl %edi 213 pushl %ebx 214 pushl %ecx 215 pushl %edx 216 217 movb 8(%ebp),%bh 218 movl 12(%ebp),%edi 219 220 movw $0x84D1,%ax 221 GRIP_CALL 222 223 movl %ebx,0x00(%edi) 224 movl %ecx,0x04(%edi) 225 movl %edx,0x08(%edi) 226 movl %esi,0x0C(%edi) 227 228 popl %edx 229 popl %ecx 230 popl %ebx 231 popl %edi 232 popl %esi 233 popl %ebp 234ret 235 236FUNC(_GrGetControlName) 237 pushl %ebp 238 movl %esp,%ebp 239 pushl %esi 240 pushl %edi 241 pushl %eax 242 pushl %ebx 243 pushl %ecx 244 pushl %edx 245 246 movb 8(%ebp),%bh 247 movb 12(%ebp),%bl 248 movb 16(%ebp),%ch 249 movl 20(%ebp),%edi 250 251 movw $0x84D2,%ax 252 GRIP_CALL 253 254 movl %ebx,0x00(%edi) 255 movl %ecx,0x04(%edi) 256 movl %edx,0x08(%edi) 257 movl %esi,0x0C(%edi) 258 259 popl %edx 260 popl %ecx 261 popl %ebx 262 popl %eax 263 popl %edi 264 popl %esi 265 popl %ebp 266ret 267 268FUNC(_GrGetCaps) 269 xorl %eax, %eax 270ret 271 272FUNC(_Gr__Link) 273 movw $0x8490,%ax 274 GRIP_CALL 275ret 276 277FUNC(_Gr__Unlink) 278 pushl %eax 279 movw $0x8491,%ax 280 GRIP_CALL 281 popl %eax 282ret 283 284FUNC(_GrGetSWVer) 285 movw $0x84F0,%ax 286 GRIP_CALL 287ret 288 289FUNC(_GrGetHWVer) 290 movw $0x84F1,%ax 291 GRIP_CALL 292ret 293 294FUNC(_GrGetDiagCnt) 295 movw $0x84F2,%ax 296 GRIP_CALL 297ret 298 299FUNC(_GrGetDiagReg) 300 pushl %ebp 301 movl %esp,%ebp 302 pushl %ebx 303 304 movb 8(%ebp),%bh 305 306 movw $0x84F3,%ax 307 GRIP_CALL 308 309 popl %ebx 310 popl %ebp 311ret 312 313/* 314;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 315;; These functions call the DPMI host to set access rights for the ;; 316;; descriptor whose selector is sent as a parameter. ;; 317;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 318*/ 319FUNC(_DPMI_SetCodeAR) 320 pushl %ebp 321 movl %esp,%ebp 322 pushl %ebx 323 pushl %ecx 324 pushf 325 326 movw 8(%ebp),%bx 327 328 movw %cs,%cx 329 larl %ecx,%ecx 330 shrw $8,%cx 331 movl $0x09,%eax 332 int $0x31 333 setcb %al 334 335 popf 336 popl %ecx 337 popl %ebx 338 popl %ebp 339ret 340 341FUNC(_DPMI_SetDataAR) 342 pushl %ebp 343 movl %esp,%ebp 344 pushl %ebx 345 pushl %ecx 346 pushf 347 348 movw 8(%ebp),%bx 349 350 movw %ds,%cx 351 larl %ecx,%ecx 352 shrw $8,%cx 353 movl $0x09,%eax 354 int $0x31 355 setcb %al 356 357 popf 358 popl %ecx 359 popl %ebx 360 popl %ebp 361ret 362 363