Notice: Trying to access array offset on value of type bool in /mnt/cpcwiki-httpdocs/includes/libs/IPSet.php on line 243

Notice: Trying to access array offset on value of type bool in /mnt/cpcwiki-httpdocs/includes/libs/IPSet.php on line 246

Notice: Trying to access array offset on value of type bool in /mnt/cpcwiki-httpdocs/includes/libs/IPSet.php on line 243

Notice: Trying to access array offset on value of type bool in /mnt/cpcwiki-httpdocs/includes/libs/IPSet.php on line 246
Changes - CPCWiki

Changes

Programming:Keyboard scanning

80 bytes added, 14 January
/* Complete keyboard scanning routine */
keyscan di ;1 ##%%## C P C VERSION ##%%##
xor a ;1
ld hl,keymap ;3
ld bc,#f782 ;3
out (c),c ;4
ld bc,#f40e ;3
ld e,b ;1
out (c),c ;4
ld e,b ;1
ld bc,#f6c0 ;3
ld d,b ;1
out (c),c ;4
xor a ld d,b ;1
out (c),a ;4
sub c ;1 a=#40 (-#C0)
ld bc,#f792 ;3
out (c),c ;4
ld a,#40 ;2 ld c,d ;1 (+4241)
loop ld b,d ;1
out (c),a ;4 select line
ld bc,#f782 ;3
out (c),c ;4
ei ;1 (+8 = 209 208 microseconds)
ret
</pre>
In addition, it is also nice if the keys could be redefined but that is not necessary.
The standard CPC can handle support 3 joystick buttonsper joystick, but though many CPC joysticks have only have 1 button.
The CPC+ and GX4000 can handle only support 2 buttons per joystick buttons only, but and the included Amstrad joypads provided with the machine have 2 different buttons.
There are some common keyboard configurations used:
* '''Q,A,O,P,SPACE''' - (Q up, A down, O left, P right, SPACE fire) This is a good solution, and it's a sort of standard (used by many games). It is best for english QWERTY keyboards, on french AZERTY it'd be A-Q-O-P (but because the decoding of the keys is done in software, normally by the OS, the bits in the keyboard matrix are actually the same).
The standard CPC has only 1 physical digital joystick port(and no analog joystick port). But it was possible to daisy chain the official Amstrad joysticks. And a common accessory, the joystick port doubler, offered 2 digital joystick ports.  The CPC+ and GX4000 have 2 digital joystick ports built-in (and 1 analog joystick port).
The CPC+ and GX4000 have 2 joystick ports built-in.== See Also ==
See the relevant cpcwiki page: * [[Digital Joysticks]]* [[Keyboard Versions]]
[[Category:Programming]][[Category:CPC Internal Components]]
28
edits