Best viewed in 1024x768

TI-86 Keypad

The KeyPad is the set of all the keys on the TI-86 Graphic Calculator. There are three ways to read keypresses of the TI-86:

Note: Much of the info was derived from 86ports.txt by Alan Bailey

Port 1

 
7 6 5 4 3 2 1 0
6 MORE EXIT 2nd F1 F2 F3 F4 F5
5 ALPHA GRAPH LOG LN x^2 , STO --
4 x-var TABLE SIN EE 7 4 1 0
3 DEL PRGM COS ( 8 5 2 .
2 -- CUSTOM TAN ) 9 6 3 (-)
1 -- CLEAR ^ / * - + ENTER
0 -- -- -- -- UP RIGHT LEFT DOWN
This port can be represented as a 7x8 grid, as shown above. Example:
#include "ti86asm.inc"

.org _asm_exec_ram


Start:

        call _clrLCD

        ld hl, $0000        ; Set up Pen row and column locations at 0,0
        ld (_penCol), hl

        ld HL, Prompt       ; HL points to Prompt string
        call _vputs         ; Show string

Loop:

        ld a,%01110111      ; Checking Row 3 (Bit 7 unused. Bit 3 represents row 3)     
 
        out (1),a           ; Put bitmask into port
        nop                 ; Give time for the port to acknowledge
        nop             
        in a,(1)            ; A = byte. Each bit corresponds to one column
        bit 7,a             ; Checking for bit 7, which is the Col 7
                            ; Row 3, Col 7 is the DEL key

                            ; Other code can be placed here while waiting!

        jr nz, Loop         ; The bit is cleared (thus zero flag set) if the key was pressed.
                                                
Continue:                       

        ld HL, GoodBye      ; HL points to GoodBye string
        call _vputs         ; Show string (15 pixels below the previous)

        ret                 ; Return to TI-OS or shell

Prompt: .db "Waiting for DEL Key...", 0
GoodBye: .db "Pressed.", 0

.end