A86: Alpha-Lock, and string input
[Prev][Next][Index][Thread]
A86: Alpha-Lock, and string input
Hi, sorry for the long routine I'm including here, but this is the string
routine that someone posted for me a week or so ago. I'd like to have it put
Alpha-Lock on automatically, since it is in the variable-width font, and there
is no way to backspace. I inserted the line "set shiftALock,
(IY+shiftflags)", which someone told me should do it, but it doesn't. What do
I do? Also, how do I turn it off after this routine, and who posted this
routine for me so that I can credit you in my source. Thanx for the help on
my first asm game.
Bowser
;String Input Routine by ???
keyloop:
set shiftALock, (IY+shiftflags) ;should turn on Alpha-Lock
ld a,(_penCol) ;save cursorpos
ld c,a
ld a,Lunderscore ;maybe Lblock instead?
call _vputmap ;draw cursor
ld a,c ;restore pos
ld (_penCol),a
push hl ;_getkey kills hl
call _getkey ;get keypress
pop hl
cp kEnter ;enter key?
jr z, key_done ;then we're done
cp kExit ;exit key?
jr z, key_quit ;if so, then quit
cp kSpace ;is it space?
jr z, key_space ;if it is a space
sub $1C ;k0
jr c, keyloop ;it's not a known key if negative
sub $0A ;difference between (k9+1) and k0
jr c, key_number ;if neg, assumed to be a number key
sub $02 ;difference between kCapA and (k9+1)
jr c, keyloop ;it's not a known key if negative
sub $1A ;difference between (kCapZ+1) and kCapA
jr c, key_capletter ;if negative, then assume capital letter
sub $1B ;difference between (kz+1) and (kCapZ+1)
jr c, key_lowletter ;if neg, assume lower case letter
jr keyloop ;must be an unknown key at this point
key_space:
ld a, Lspace ;char code for space
key_add:
ld (hl), a ;store
inc hl ;inc string pointer
call _vputmap ;display the key
jr keyloop
key_number:
add a, 20+$26 ;keycode-->char code
jr key_add
key_capletter:
add a, 25+$42 ;keycode-->char code
jr key_add
key_lowletter:
add a, 31+$5d ;keycode-->char code
jr key_add
key_quit:
ld hl,string ;don't leave an unterminated string
;and clear the cursor
key_done:
ld (hl), 0 ;zero-terminate string
ld c,a ;clear cursor
ld a,$20
call _vputmap
ld a,$20
call _vputmap
ld a,$20
call _vputmap
ld a,c ;return with kEnter or kExit
ret ;quit