Wednesday, November 27, 2024

joystick programming with Odyssey2

I wrote a couple of examples of joystick programming with Odyssey2's Computer Intro! cart.
I also added this function to my o2 programming manual for Computer Intro!
http://mrgibson.com/o2man.php
Super simple version Joystick test
STEP HEX  Assembler Remarks
00   6B   LDV.B.05  ;sets display position with Register B
01   05             ;loading 05 for position to register B
02   0A             ;grab joystick status and save to accumulator
03   B1   UNP.1     ;Unpack to Register 1 and 2
04   C1   OUT.1
05   C2   OUT.2
06   00   NOP       ;No Operation, to cut on flicker
07   12   GTO.00    ;Goto step 00
08   00

shows characters for values of UP, Down, and Center
STEP HEX  Assembler Remarks
                    ;Set our fixed values
00   61   LDV.1.FF  ;set register 1 with value
01   FF             ;FF for center stick
02   62   LDV.2.FE  ;set register 2 with value
03   FE             ;FE for stick up
04   63   LDV.3.FB  ;set register 3 with value
05   FB             ;FB for stick down 
06   6D   LDV.D.23  ;set register D with value
07   23             ;23 Hex for C
08   6E   LDV.E.15  ;set register E with value
09   15             ;15 Hex for U
10   6F   LDV.F.1A  ;set register F with value
11   1A             ;Hex for D
                    ;this is our loop start, always resetting to position 5
12   6B   LDV.B.05  ;sets display position with Register B
13   05             ;loading 05 for position to register B
14   0A             ;grab joystick status and save to accumulator
15   31   BEQ.1.23  ;check if Accumulator and Register 1 are equal
16   23
17   32   BEQ.2.26  ;check if Accumulator and Register 2 are equal
18   26
19   33   BEQ.3.29  ;check if Accumulator and Register 1 are equal
20   29
21   12   GTO.12
22   12             ;Goto/loop back to step 12
23   CD   OUT.D     ;Display C for center from Register D 
24   12   GTO.12    ;set goto
25   12             ;Goto/loop back to step 12
26   CE   OUT.E     ;Display U for up from Register E
27   12   GTO.12    ;set goto
28   12             ;Goto/loop back to step 12
29   CF   OUT.E     ;Display D for down from Register F
30   12   GTO.12    ;set goto
31   12             ;Goto/loop back to step 12

No comments:

Post a Comment

Ford Racing Makes History with First Overall Victory and Podium Sweep at 2026 Rebelle Rally

Ford Racing Makes History with First Overall Victory and Podium Sweep at 2026 Rebelle Rally 4x4 Class Standings (Top Finishers) Rank ...