📄 inkey68k.lib
字号:
*
* inkey68k.lib read a character from the input device
*
* This function tests the input device for the presence of a character.
* If a character is available, this routine returns the character in
* the low byte of d0, sets bit 8, and clears all higher bytes. If no
* character is available, this routine returns 0 in d0.
*
* This is the low-level SBasic68k input routine. You can change this
* routine, if you wish, to support other input devices. Make sure,
* however, that you retain _inkey as the subroutine's name.
*
* This routine preserves all registers.
*
*
* This works with 332bug on Motorola's 68332 development
* board. Since character I/O is target platform specific,
* you need to develop your own _inkey function.
*
_inkey
movem.l d1-d7/a0-a6,-(a7) save regs
trap #15 332bug system call
dc.w $1 test serial port
beq _ink1 branch if no char
subq.l #2,a7 reserve stack space
trap #15 332bug system call
dc.w $0 get char to stack
clr.l d0 ready the 32-bit variable
move.w (a7)+,d0 fetch char to d0
lsr.w #8,d0 key is in second byte
bset.l #8,d0 force bit 8 on to flag char
bra _inkx all done
_ink1
clr.l d0 show no char
_inkx
movem.l (a7)+,d1-d7/a0-a6 restore regs
rts
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -