Memotech MTX: Title
|
Memotech
keyboard layout
Keyboard matrix.
IN 5 |
IN 6 |
OUT 5 |
BIT 7
(127/#7F) |
BIT 6
(191/#BF) |
BIT 5
(223/#DF) |
BIT 4
(239/#EF) |
BIT 3
(247/#F7) |
BIT 2
(251/#FB) |
BIT 1
(253/#FD) |
BIT 0
(254/#FE) |
(128/#80) BIT 7 |
. |
KEY> |
ENT CLS |
CSRDN |
HOME |
CSRRT |
CSRLF |
CSRUP |
EOL |
PAGE |
(64/#40) BIT 6 |
. |
KEY> |
INS |
RT.SHIFT |
RET |
] } |
LINEFEED |
[ { |
^ ~ |
| \ |
(32/#20) BIT 5 |
. |
KEY> |
(UNDERSCORE) |
? / |
: * |
; + |
@ ` |
P |
0 (Zero) |
= - |
(16/#10) BIT 4 |
. |
KEY> |
. > |
, < |
L |
K |
O |
I |
8 |
9 |
(8/#08) BIT 3 |
. |
KEY> |
M |
N |
J |
H |
U |
Y |
6 |
7 |
(4/#04) BIT 2 |
. |
KEY> |
B |
V |
G |
F |
T |
R |
4 |
5 |
(2/#02) BIT 1 |
. |
KEY> |
C |
X |
D |
S |
E |
W |
2 |
3 |
(1/#01) BIT 0 |
. |
KEY> |
Z |
LF.SHIFT |
A |
ALPHALOCK |
Q |
CTRL |
ESC |
1 |
- |
(2/#02) BIT 1 |
KEY> |
F4 |
F8 |
F3 |
F7 |
F6 |
F2 |
F5 |
F1 |
- |
(1/#01) BIT 0 |
KEY> |
SPACE |
(unused) |
(unused) |
(unused) |
DEL |
TAB |
BS |
BRK |
Joystick ports are mapped to Keys:
Joystick Left Port:
M=Down
B=Up
C=Right
Z=Left
SPACE=Fire
Joystick Right Port:
CSRDN=Down
CSRUP=Up
CSRRT=Right
CSRLF=Left
HOME=Fire
|
Use the OUT opcode (from the yellow line) and use the BIT opcode to check if key
pressed. Z is set if key pressed.
Its only clever to check the output with the BIT instruction.
No need to use CP.
You can test why, in Andy Key's Mission Alphatron, try to hold down F4 and
Space, Space then dont throw any bombs anymore.
By the way who is stupid enough
to press the F4 key and Space in the same time :)
(HEHE Sorry ANDY for this example - ANDY KEY is still a way better Programmer
than me J)
Mission Alphatron.
Check Space pressed
(By Andy Key)
(This code take up #0F Bytes) |
|
LD A,#7F
OUT (5),A
PUSH AF
POP AF
IN A,(6)
AND 3
CP 2
CALL Z,#97DF
RET |
|
This way take up less Space and work also
if F4 is pressed.
(By Claus Bękkel)
(This code take up #0B Bytes) |
|
LD A,#7F
OUT (5),A
IN A,(6)
BIT 0,A
CALL Z,#97DF
RET |
|
The Z80 Instruction BIT n,A works this way: Opposite of the bit number n is
written into the Z flag.
C is preserved, N is reset, H is set, and S and P/V are
undefined.
This will loop until
HOMEkey is pressed. |
START:
|
LD A,223
OUT (5),A
IN A,(5)
BIT 7,A
JR NZ,START
RET
|
|
Reading Port 6.
This will loop until SPACE is pressed. |
START:
|
LD A,127
OUT (5),A
IN A,(6)
BIT 0,A
JR NZ,START
RET
|
|
This will loop until both S and K key
are pressed at the same time. |
START:
|
LD A,239
OUT (5),A
IN A,(5)
BIT 1,A
JR NZ,START
BIT 4,A
JR NZ,START
RET |
|
**** Join Memotech MTX500 facebook group
****
|