Re: A86: Re: Asm questions


[Prev][Next][Index][Thread]

Re: A86: Re: Asm questions





Neither did I.  I'm not sure I do now, but I think this will work...

This routine SHOULD get a keypress and store it in the data area alled
>'string'.  It will then move the pointer to the next spot in 'string',
>and store the next character.  When enter is pressed, it stores a zero
>to the end of the string and RETurns.  This should accept capital and
>lowercase letters, and numbers.  Whether or not this really works is 
the
>question... Anybody care to check the code for me?
>
>	set shiftALock, (IY+shiftFlags)		;turn on AlphaLock
>	ld hl, string				;load address of string
>keyloop:
>	call _getkey				;get keypress
>	cp kenter
>	jp z, key_done				;if enter was pressed
>	cp kSpace				;is it space?
>	jp z, key_space				;if it is a space
>	push af					;preserve the keycode in A
>	sub $1C					;k0
if i remeber right you need to pop af if you send it in the loop 
if you don't and there are like 5 time it has to jump there you will 
have 5 entrys pushed and that would crash your calc
>	jp m, keyloop				;it's not a usefull key if negative
>	pop af					;recall the keycode
>	push af					;and save it again
>	sub $26					;k9 +1
>	jp m, key_number			;if neg, assumed to be a number key
>	pop af
>	push af
>	sub $28					;kCapA
>	jp m, keyloop				;it's not a usefull key if negative
>	pop af	
>	push af
>	sub $42					;kCapZ +1
>	jp m, key_capletter			;if negative, then assume capital letter
>	pop af
>	sub $5C					;kz +1
>	jp m, key_lowletter			;if neg, assume lower case letter
>	jp keyloop				;must be a useless key at this point
>key_space:
>	ld a, Lspace				;char code for space
>	ld (hl), a				;put into storage string at HL
>	inc hl					;forward pointer to next spot in string
>	call _vputmap				;display a space at current pen position
>	jp keyloop				;get next letter or number
>key_number:
>	pop af					;we had a PUSH, we must have a POP
>	add a, 12				;keycode-->char code
>	ld (hl), a				;store it to the string
>	inc hl					;increment string pointer
>	call _vputmap				;display the number
>	jp keyloop				;get next character
>key_capletter:
>	pop af					;we had a PUSH, must have a POP
>	add a, 25				;keycode-->char code
>	ld (hl), a				;store it to string
>	inc hl					;increment storage string pointer
>	call _vputmap				;display the letter
>	jp keyloop				;get next letter or number
>key_lowletter:
>	pop af					;we PUSHED, we have to POP
>	add a, 31				;keycode-->char code
>	ld (hl), a				;store it to string
>	inc hl					;next string spot
>	call _vputmap				;display
>	jp keyloop				;next
>key_done:
>	ld a, 0
>	ld (hl), a				;zero-terminate the string
>	ret					;exit
>
>string:
>	.db 0,0,0....				;string storage
>
and thinking of that is where anyway to get how many time something has 
been pushed (there is some thing that has the valu of the top entry or 
something like that but i forgot) so you could loop it so that your calc 
does not crash?

______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com


Follow-Ups: