Error in E.O.S. Programmers Manual

I have discovered an error in the manual on page 78.  They have the values of the controller table mixed up. It should be this way:

If you are reading both controllers Stick 1 comes first, then Stick 0. Also you need to swap the fire buttons, Left comes first, then Right.

I have verified this with debugging and also by looking at the EOS source code (though EOS puts the Spinners first internally it puts them in the correct place when you call the routine.

Here is a code snippet showing how to access the controller:

STICK_NONE .equ 0
STICK_UP .equ 1
STICK_DOWN .equ 4
STICK_LEFT .equ 8
STICK_RIGHT .equ 2
STICK_UPRIGHT .equ 3
STICK_DOWNRIGHT .equ 6
STICK_DOWNLEFT .equ 12
STICK_UPLEFT .equ 9

; Process Joystick

; ReadStick
;
; Update the StickData table with joysticks 0 and 1
;

ReadStick:
 push hl
 push de
 push bc
 push af
 ld a,3 ; Read stick 0 and 1
 ld ix,StickData ; Where to put the results
 call 0fd3eh ; Use EOS to read the controller
 pop af
 pop bc
 pop de
 pop hl
 ret



StickData:
StickDirection1:
 .db 0
StickLeftFire1:
 .db 0
StickRightFire1:
 .db 0
StickKeypad1:
 .db 0
StickSpinner1:
 .db 0
StickDirection0:
 .db 0
StickLeftFire0:
 .db 0
StickRightFire0:
 .db 0
StickKeypad0:
 .db 0
StickSpinner0:
 .db 0

Leave a Reply

Your email address will not be published. Required fields are marked *