Re: A86: Typing in letters
[Prev][Next][Index][Thread]
Re: A86: Typing in letters
At 12:14 AM 10/30/97 -0800, you wrote:
>Brian wrote:
>>
>> Is there an easier way to detect a person pressing a any letter on
>> the the calc and then displaying that letter rather than going through
>> and checking for every letter like so
>
>Yes, by using CPIR:
>
Yeah, but comparing a to 26 values can be kind of slow. I like to use
tables. (i.e. just use the key_code as an offset into the table) It's
faster, and it doesn't take up much more space. When I was writing
JMemView, I was using almost all of the keys, and I found it took a
noticeable amount of time to do all those compares. Here's code for that
way...
call GET_KEY
ld hl,(char_table)
ld c,a
ld b,0
add hl,bc
ld a,(hl)
char_table:
.db " "
.db " "
.db "XTOJE"
.db " WS"
.db "NID "
.db "ZVRMH"
.db "C YU"
.db "QLGB "
.db " PK"
.db "FA"
note, this is NOT a complete routine, just a code fragment... And I'm not
sure the char_table is exactly right.
--Joshua
References: