Difference between revisions of "Tennis Cup 2 (cartridge)"

From CPCWiki - THE Amstrad CPC encyclopedia!
Jump to: navigation, search
(Analog Joystick)
(Analog Joystick)
Line 50: Line 50:
 
   push    bc
 
   push    bc
 
   set    6,c
 
   set    6,c
   ld      a,09h ;; keyboard line for joy 0
+
   ld      a,09h       ;keyb.row 9              ;\
   or      c
+
   or      c                                     ;
   ld      b,0f6h
+
   ld      b,0f6h                               ;
   out    (c),a
+
   out    (c),a                                 ; read digital joystick 1
   ld      b,0f4h
+
   ld      b,0f4h                               ;
   in      a,(c)
+
   in      a,(c)                                 ;
   cpl
+
   cpl                                           ;
   ld      (8082h),a                     ;; joy 0
+
   ld      (8082h),a   ;store joy 1              ;/
   push    af
+
   push    af       ;push joy 1
   ld      a,06h ;; keyboard line for joy 1
+
   ld      a,06h       ;keyb.row6                ;\
   or      c
+
   or      c                                     ;
   ld      b,0f6h
+
   ld      b,0f6h                               ;
   out    (c),a
+
   out    (c),a                                 ; read digital joystick 2
   ld      b,0f4h
+
   ld      b,0f4h                               ;
   in      a,(c)
+
   in      a,(c)                                 ;
   cpl
+
   cpl                                           ;
   ld      (8083h),a                     ;; joy 1
+
   ld      (8083h),a   ;store joy 2              ;/
   pop    de
+
   pop    de       ;pop joy 1                  ;\
   or      d
+
   or      d       ;merge joy 2                ; merge digital joystick 1+2
   ld      (8086h),a
+
   ld      (8086h),a   ;store both              ;/
   ld      a,03h
+
   ld      a,03h       ;keyb.row3                ;\
   or      c
+
   or      c                                     ; read pause button
   ld      b,0f6h
+
   ld      b,0f6h                               ; (aka "P" key)
   out    (c),a
+
   out    (c),a                                 ; (row3.bit3)
   ld      b,0f4h
+
   ld      b,0f4h                               ; (bit3 still needs to be
   in      a,(c)
+
   in      a,(c)                                ; isolated elsewhere)
   cpl
+
   cpl                                           ;
   ld      (8084h),a                     ;; pause?
+
   ld      (8084h),a   ;store pause             ;/
 
   pop    bc
 
   pop    bc
 
   ld      a,82h
 
   ld      a,82h
Line 85: Line 85:
 
   ld      bc,7fb8h
 
   ld      bc,7fb8h
 
   out    (c),c
 
   out    (c),c
   ld      c,00h
+
   ld      c,00h   ;digital-joystick-style bits
   ld      a,(6808h)             ;; analogue input channel 0
+
   ld      a,(6808h)   ;ADC0 ;+00h..+3Fh        ;\
   sub    1fh
+
   sub    1fh               ;-1Fh..+20h        ;
   cp      14h
+
   cp      14h                                   ;
   jp      p,261fh
+
   jp      p,261fh_RIGHT    ;+14h..+20h        ;
   cp      0ech
+
   cp      0ech             ;-14h              ; read analog joystick 1,
   jp      m,2623h
+
   jp      m,2623h_LEFT      ;-1Fh..-15h        ; X-axis (ADC0)
   jr      2625h
+
   jr      2625h_X_DONE      ;-14h..+13h        ;
  261f:
+
  261f_RIGHT:                                   ;
   set    3,c                           ;; right
+
   set    3,c   ;bit3=right (as on digital joy) ; convert to digital left/right
   jr      2625h
+
   jr      2625h_X_DONE                          ;
  2623:
+
  2623_LEFT:                                     ;
   set    2,c                           ;; left
+
   set    2,c   ;bit2=left (as on digital joy)  ;
  2625:
+
  2625_X_DONE:                                   ;/
   ld      a,(6809h)             ;; analogue input channel 1
+
   ld      a,(6809h)   ;ADC0 ;+00h..+3Fh        ;\
   sub    1fh
+
   sub    1fh               ;-1Fh..+20h        ;
   cp      14h
+
   cp      14h                                   ;
   jp      p,2639h
+
   jp      p,2639h_DOWN      ;+14h..+20h        ;
   cp      0ech
+
   cp      0ech             ;-14h              ; read analog joystick 1,
   jp      p,263bh
+
   jp      p,263bh_Y_DONE    ;-14h..+13h        ; Y-axis (ADC1)
  2634:
+
  2634h_UP:                 ;-1Fh..-15h        ;
   set    0,c                           ;; up
+
   set    0,c   ;bit0=up (as on digital joy)    ; convert to digital up/down
   jp      263bh
+
   jp      263bh_Y_DONE                          ;
  2639:
+
  2639h_DOWN:                                   ;
   set    1,c                           ;; down
+
   set    1,c   ;bit1=down (as on digital joy)  ;
  263b:
+
  263bh_Y_DONE:                                 ;/
   ld      a,(8082h)             ;; joy 0 fire.
+
   ld      a,(8082h) ;joy1                      ;\
   and    10h
+
   and    10h       ;joy1 fire                  ; use digital joystick 1 fire
   or      c
+
   or      c                                     ; as analog joystick 1 fire
   ld      (8085h),a
+
   ld      (8085h),a ;store A/D converted analog ;/
  
 
The keyboard is read to determine the state of the digital joysticks and the P button (pause button on gx4000 console).
 
The keyboard is read to determine the state of the digital joysticks and the P button (pause button on gx4000 console).

Revision as of 13:58, 5 February 2010

Cover

Covers from CPCmania

Cartridge

Manual

You can download in PDF from CPCmania ( See the links ).

Game

You can download in CPR for use in emulators and BIN from CPCmania ( See the links ).


Analog Joystick

This games is pehaps the only one on Amstrad GX4000/Plus range to enable the use of an Analog Joystick, for the 2nd player.

  • Player 1 can use Digital Joystick #1
  • Player 2 can use Digital Joystick #2, or alternately, Analog Joystick #1
  • [uhhhh... that can't be correct since digital-stick1 and analog-stick1 use the same fire button...?]

The game converts the analog inputs to digital-joystick-style "on/off" signals, so it isn't actually supporting "fast/slow" analog inputs.

 ld      bc,0f40eh
 out     (c),c
 ld      b,0f6h
 in      a,(c)
 and     30h
 ld      c,a
 or      0c0h
 out     (c),a
 out     (c),c
 inc     b
 ld      a,92h
 out     (c),a
 push    bc
 set     6,c
 ld      a,09h       ;keyb.row 9               ;\
 or      c                                     ;
 ld      b,0f6h                                ;
 out     (c),a                                 ; read digital joystick 1
 ld      b,0f4h                                ;
 in      a,(c)                                 ;
 cpl                                           ;
 ld      (8082h),a   ;store joy 1              ;/
 push    af       ;push joy 1
 ld      a,06h       ;keyb.row6                ;\
 or      c                                     ;
 ld      b,0f6h                                ;
 out     (c),a                                 ; read digital joystick 2
 ld      b,0f4h                                ;
 in      a,(c)                                 ;
 cpl                                           ;
 ld      (8083h),a   ;store joy 2              ;/
 pop     de       ;pop joy 1                   ;\
 or      d        ;merge joy 2                 ; merge digital joystick 1+2
 ld      (8086h),a   ;store both               ;/
 ld      a,03h       ;keyb.row3                ;\
 or      c                                     ; read pause button
 ld      b,0f6h                                ; (aka "P" key)
 out     (c),a                                 ; (row3.bit3)
 ld      b,0f4h                                ; (bit3 still needs to be
 in      a,(c)                                 ; isolated elsewhere)
 cpl                                           ;
 ld      (8084h),a   ;store pause              ;/
 pop     bc
 ld      a,82h
 out     (c),a
 dec     b
 out     (c),c
 ld      bc,7fb8h
 out     (c),c
 ld      c,00h   ;digital-joystick-style bits
 ld      a,(6808h)   ;ADC0 ;+00h..+3Fh         ;\
 sub     1fh               ;-1Fh..+20h         ;
 cp      14h                                   ;
 jp      p,261fh_RIGHT     ;+14h..+20h         ;
 cp      0ech              ;-14h               ; read analog joystick 1,
 jp      m,2623h_LEFT      ;-1Fh..-15h         ; X-axis (ADC0)
 jr      2625h_X_DONE      ;-14h..+13h         ;
261f_RIGHT:                                    ;
 set     3,c   ;bit3=right (as on digital joy) ; convert to digital left/right
 jr      2625h_X_DONE                          ;
2623_LEFT:                                     ;
 set     2,c   ;bit2=left (as on digital joy)  ;
2625_X_DONE:                                   ;/
 ld      a,(6809h)   ;ADC0 ;+00h..+3Fh         ;\
 sub     1fh               ;-1Fh..+20h         ;
 cp      14h                                   ;
 jp      p,2639h_DOWN      ;+14h..+20h         ;
 cp      0ech              ;-14h               ; read analog joystick 1,
 jp      p,263bh_Y_DONE    ;-14h..+13h         ; Y-axis (ADC1)
2634h_UP:                  ;-1Fh..-15h         ;
 set     0,c   ;bit0=up (as on digital joy)    ; convert to digital up/down
 jp      263bh_Y_DONE                          ;
2639h_DOWN:                                    ;
 set     1,c   ;bit1=down (as on digital joy)  ;
263bh_Y_DONE:                                  ;/
 ld      a,(8082h) ;joy1                       ;\
 and     10h       ;joy1 fire                  ; use digital joystick 1 fire
 or      c                                     ; as analog joystick 1 fire
 ld      (8085h),a ;store A/D converted analog ;/

The keyboard is read to determine the state of the digital joysticks and the P button (pause button on gx4000 console).

The routine reads analogue input channel 0 and 1 for the analogue joystick and performs some checking to see the range of the numbers. Based on this it sets the direction pressed.

Links

http://www.cpcmania.com/ ( on the games section : GX4000/CPC+ GAMES )