ОПРОС KEMPSTON'A B ПРОГРАММАХ
_______________________________
(C) 1997 Deton
при поддержке Flyer'а
----------------------
ZX-LEGION
Ketpston включен - хорошо,
а не включен - плохо!
Маяковский B. + Deton
Friends!!! I immediately warn nervous people
ders, owners of white horses, etc. sconce
tyu:
tiyu:
READING IS NOT RECOMMENDED!
I want to tell you about one sad thing
fact: I don’t have ketpston-joystic :( .
"So what? I don't have a GOLDEN PILLOW-
SHECHKI!" - you will notice, venerable reader -
tel. This is, of course, true, but how would you
I liked this one for example:
ZX-FORMAT 7. VGA version only.
Some programmers behave this way too.
who are simply sure that I MUST
BE the aforementioned joystick. I somehow
I've been dealing with a similar program for a long time, replacing
with the help of the unsurpassed STS everything
found commands like "IN A,(#1F)" to "XOR
A:NOP."
So, one day, sitting down to read Minskaya
So, one day, sitting down to read Minsk
press, came across "MASK #00". That's great
I was surprised whenreplaced in front of me
the text flashed. It's good that he stopped at
last page and I was able to find out the name
the author of this mockery. On the screen then-
The only thing missing was the inscription:
WELCOME TO THE HELL,
dear user without ketpston
Well, Space5, it’s too early for you to become a manufacturer
pour out "masterpieces". I would take an example from the same
LPRINT. Everything is like people: there is a joystick -
poke the button and it’s not there - no problem, I can do it
and work like that. Okay, the article was not written
in order to run into Space5. Quite a lot
people who write a program under the definition
small circle of users, but in vain! Not always
Yes, there is time to correct this mistake... Here
I decided to present it to the readers
program that can be used in
a program that can be used in
in this case. It allows you to question
both Kempston and keyboard at the same time:
=========={ prog Deton (c) }===========
IN A,(#1F) ;Prog must start -
AND %11111 ;get out of this
JR Z,$+7 ;ka.
LD A,#AF ;You can also design
LD (OPROS),A ;as a subroutine.
START .......... ;Starts here
;your program.
CALL OPROS ;Calling the op-procedure
;keyboard dew and
;joystick.
LD A,C ;Keypressure analysis
LD A,C ;Keypressure analysis
;wish.
.......... ;Your continues
;program.
OPROS IN A,(#1F) ;Interrogation procedure
LD C,A ;keyboards and joystick.
LD HL,KEYS
KBDJ1 LD A,(HL) ;Output: C=number
AND A ;(see below).
RET Z
INC HL
IN A,(#FE)
CPL
AND (HL)
INC HL
JP Z,KBDJ2
LD A,(HL)
OR C
LD C,A
KBDJ2 INC HL
KBDJ2 INC HL
JP KBDJ1
KEYS DEFB #FB,%11111,%01000 ;Таблица.
DEFB #EF,%01000,%00001
DEFB #FD,%11111,%00100 ;Формат
DEFB #EF,%10000,%00010 ;см. ниже
DEFB #DF,%00010,%00010
DEFB #EF,%00010,%01000
DEFB #DF,%00001,%00001
DEFB #EF,%00100,%00100
DEFB #7F,%11111,%10000
DEFB #FE,%11111,%10000
DEFB #BF,%00001,%10000
DEFB #EF,%00001,%10000
DEFB 0
=========================================
First, I will explain the format of the KEYS table.
First, I will explain the format of the KEYS table.
------------------------------------------
Byte number| Meaning
-----------+------------------------------
1 | Low byte of the keyboard port -
|ry (half-row).
-----------+------------------------------
2 | Mask (analyzed key
|masked 1).
-----------+------------------------------
3 | Direction code (same as
|joystick codes).
------------------------------------------
The table must end with the code "0"!
For those who don't know the meaning of the joystick bits:
------------------------------------------
7 6 5 | 4 | 3 | 2 | 1 | 0
| | | | |
| | | | |
NOT SP. |FIRE|UP|DOWN |LEFT|RIGHT
------------------------------------------
Now about the polling procedure. She reads
there is no state of the joystick (if there is one,
otherwise the battery is reset), then
table the table is scanned, fixed
pressing specified keys and in register C
the bits corresponding to the bits are set
joystick. After returning from the procedure, re-
The result is stored in reg C.
Well, that seems to be all. Use back
pobbe.
Warning!!! Attention!!! Respect!!! Attention
Use without indicating the original source
Nika is being prosecuted by law! :)
------------------------------------------
Share your thoughts about the article