Tutorial 10
The Run indicator


What is a Run Indicator? Funny you should ask... The Run Indicator is the marker in the upper right corner of the calculator's display that comes up when the calculator's CPU is busy doing something. Sort of like the light that flashes when your computer's busy. This tutorial will show you how to turn the Run Indicator on and off.

    Let's take the Getkey program that displays the keycode of a key press program (Tutorial 8). When the program is waiting for a key press, it displays a Run Indicator in the corner of the screen. Isn't that thing annoying? Simple solution is to get rid of it.


#define B_CALL(xxxx)   rst 28h \ .dw xxxx
#define B_JUMP(xxxx)  call 50h \ .dw xxxx

_clrlcdfull                      =4540h             ;The ususal constants and defines, look at the New Commands section for more information
_homeup                      =4558h
_puts                            =450Ah
_putc                            =4504h
_getkey                        =4972h
_newline                       =452Eh
_RunIndicOff                 =4570h

            .org      9D95h

            B_CALL(_clrlcdfull)                    ; clear screen
            B_CALL(_homeup)                    ; home the cursor
            B_CALL(_RunIndicOff)               ; Turning off the Run Indicator
            ld         hl,txt1                          ; Display the message at the txt1 label
            B_CALL(_getkey)                      ; Detect key press
            push     af                                 ; Save key press in register a
            B_CALL(_clrlcdfull)                    ; clear screen again
            B_CALL(_homeup)                    ; home again
            ld         hl,txt2                          ; Display msg2
            B_CALL(_puts)                         ; Display text
            pop       af                                 ; restore reg a
            call       dishex                          ; Follow commands at label dishex to find hex key code
            B_CALL(_getkey)                      ; pause until next key press
            B_CALL(_newline)                     ; Move cursor to next line
            ret                                           ;Return to TI-OS
dishex: push     af                                 ; keep copy of value
            and       0F0h                            ; terminate lower nibble
            rra                                           ; shift nibble right 4
            ld         l,a                                ; Display the Key's hex code in Str1
            ld         h,0
            ld         de,hexStr
            push     de                                ; keep for other nibbler
add       hl,de                                        ; add offset to hexStr address
            ld         a,(hl)                            ; find correct ASCII character from string below to display hex code of key pressed.
            B_CALL(_putc)                         ; display character
            pop       de
            pop       af
            and       0Fh                              ; wipeout upper nibble
            ld         l,a
            ld         h,0
            add       hl,de
            ld         a,(hl)
            ret                                           ; Return to OS
hexStr .db       "0123456789ABCDEF"  ;These are the characters used to display the key's hex code
txt1      .db       "Push a key.",0
txt2      .db       "Key code: ",0


New Commands
    _RunIndicOff - Disables the Run Indicator

Related Commands
There is a ROM call that does exactly the opposite of the _RunIndicOff call, it is _RunIndicOn ( RunIndicOn  =  456Dh). To use it, place it at the end of a program to turn the Indicator back on, or put in in the front of the program to make sure it is on.


Tutorial 11

    Click to return to the site's menu... or here to get back to the tutorial's menu.