Re: A86: Typing in letters
[Prev][Next][Index][Thread]
Re: A86: Typing in letters
In a message dated 97-11-01 07:09:58 EST, you write:
>
> 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
>
When I was writing Chem86, I used a similar method, but because I needed to
distinguish between letters/numbers, I just put (in hex) the number
corresponding to the letter (i.e. A=1, B=2, etc.) in the chart and had
separate charts for each. Then depending on whether I was wanting an
uppercase letter, lowercase letter, number, or subscript, I could just add
$40, $60, $30, or $80, respectively... This might work just as well, and the
tables are in the Chem86 source, if you don't want to take the time to figure
them out yourself (VERY monotinous!)...
~Steve