11 #define PEL_WRITE_ADR 0x3c8
12 #define PEL_READ_ADR 0x3c7
13 #define PEL_DATA 0x3c9
23 PUBLIC I_DivException_
39 PROC I_SetDivException_
40 PUBLIC I_SetDivException_
46 mov edx,OFFSET I_DivException_
66 ; Read the absolute joystick values
67 ; returns false if not connected
74 PUBLIC _joystickx, _joysticky
79 PUBLIC I_ReadJoystick_
81 pushf ; state of interrupt flag
86 out dx,al ; Clear the resistors
88 mov ah,1 ; Get masks into registers
91 xor esi,esi ; Clear count registers
93 xor ebx,ebx ; Clear high byte of bx for later
95 mov ebp,10000 ; joystick is disconnected if value is this big
98 in al,dx ; Get bits indicating whether all are finished
100 dec ebp ; Check bounding register
101 jz bad ; We have a silly value - abort
103 mov bl,al ; Duplicate the bits
104 and bl,ah ; Mask off useless bits (in [xb])
105 add esi,ebx ; Possibly increment count register
106 mov cl,bl ; Save for testing later
113 jnz jloop ; If both bits were 0, drop out
117 shr edi,1 ; because 2s were added
120 popf ; restore interrupt flag
122 mov eax,1 ; read was ok
126 popf ; restore interrupt flag
128 xor eax, eax ; read was bad