You select on 0B5h I/O port which direction needed to read, then read it on the 0B6h port.
0B5h values for the two joystick sockets (1/2):
0/5: Fire
1/6: Up
2/7: Down
3/8: Left
4/9: Right
For the standard Ext1/Ext2 joy check the Bit 0 of the readed value from 0B6h. If it is 0 then the selected direction are active.
(Note: also possible to attach two more joysticks to both joystick sockets, these can be checked at Bit 1 and Bit 2 of 0B6h port. Then total 6 joysticks possible
or two with very lot of buttons
The Boxsoft mouse use this capatibility, one extra bits used for the second mouse button.)