home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Frozen Fish 1: Amiga
/
FrozenFish-Apr94.iso
/
bbs
/
alib
/
d1xx
/
d150
/
dc10.lha
/
DC10
/
KBD.bas
(
.txt
)
< prev
next >
Wrap
AmigaBASIC Source Code
|
1987-06-15
|
2KB
|
61 lines
REM KBD_READMATRIX.BAS (annex to DC10 V 0.1f)
REM Because 'exec.library' is used from Basic, the file
REM 'exec.bmap' must be available in the 'Libs' directory
REM Run it, click left mouse button outside any window and
REM press any key combination
REM From : Jan Arkesteijn and Paul de Vries (1 feb 1988)
DECLARE FUNCTION AllocMem& LIBRARY
DECLARE FUNCTION DoIO% LIBRARY
DECLARE FUNCTION OpenDevice% LIBRARY
DECLARE FUNCTION AllocSignal% LIBRARY
DECLARE FUNCTION FindTask& LIBRARY
LIBRARY "exec.library"
mem.opt&=2^0+2^16
keyport&=AllocMem&(33,mem.opt&)
IF keyport&=0 THEN PRINT"ALLOC_MEM_TROUBLE_1"
key.sigBit%=AllocSignal%(-1)
IF key.sigBit%=-1 THEN PRINT"NO_SIGBIT_FREE"
key.sigTask&=FindTask&(0)
portname$="kbdPort"+CHR$(0)
POKE keyport&+ 8, 4 :REM type=Message Port
POKE keyport&+ 9, 0
POKEL keyport&+10, SADD(portname$)
POKE keyport&+14, 0
POKE keyport&+15, key.sigBit%
POKEL keyport&+16, key.sigTask&
POKEL keyport&+20, keyport&+24
POKEL keyport&+28, keyport&+20
CALL AddPort(keyport&)
keyreq&=AllocMem&(48,mem.opt&)
IF keyreq&=0 THEN PRINT"ALLOC_MEM_TROUBLE_2"
keymap&=AllocMem&(13,mem.opt&)
IF keymap&=0 THEN PRINT"ALLOC_MEM_TROUBLE_3"
POKE keyreq&+ 8, 5 :REM type=Message
POKE keyreq&+ 9, 0
POKEL keyreq&+14, keyport&
POKEW keyreq&+28, 10 :REM I/O command KBD_READMATRIX
POKE keyreq&+30, 1
POKEL keyreq&+36, 13 :REM io_Length, NOT 16 !!!!!!!!
POKEL keyreq&+40, keymap&
dev$="keyboard.device"+CHR$(0)
fout%=OpenDevice%(SADD(dev$),0,keyreq&,0)
IF fout%<>0 THEN PRINT"OPEN_DEVICE_TROUBLE"
kbd.rm:
result%=DoIO%(keyreq&)
IF result%<>0 THEN PRINT"DoIO_TROUBLE";
FOR x=0 TO 12
PRINT USING"####";PEEK (keymap&+x);
NEXT
PRINT
GOTO kbd.rm