[A83] Re: Blinking Cursor


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

[A83] Re: Blinking Cursor



This was written for ATE on the TI-86 but it should give you some idea of how 
to do an advanced getkey routine.  In terms of features, it has getkey both 
with and without a cursor, and has built-in APD as well as internal on-key 
shutdown.  All the rom calls would need bcall and you'd have to verify the 
port 3 on-checking code and display flags, but otherwise I'm pretty sure it 
should work.

Individual calls that can be made:

getkey -- getkey routine without cursor
getkey_cursor -- getkey routine with cursor, erases cursor afterward
getkey_cursor2 -- getkey routine with cursor, doesn't erase cursor afterward 
and uses preset cursor coordinates
draw_cursor -- toggle the cursor


getkey_cursor:                  ;removes cursor after a key is pressed
    ld hl,(_penCol)
    ld (cursor_col),hl
    call getkey_cursor2
    push af
    ld a,(cursor_state)
    cp 2                               ;just textUnderline?
    call nz,draw_cursor         ;if not, erase cursor
    pop af
    cp K_EXIT
    ret

getkey:
    ld a,$b7                    ;or a
    ld (cursor_toggle),a
    jr getkey_loop
getkey_cursor2:                 ;leaves cursor
    ld a,$37                    ;scf
    ld (cursor_toggle),a
getkey_loop:
    ld a,2
    ld (cursor_state),a         ;always show the cursor when you move
    ld c,200                    ;APD countdown timer
cursor_loop:
    push bc
cursor_toggle:
    or a
    call c,draw_cursor
    pop bc
    ld b,60                     ;cursor speed
getkey_wait:
    xor a
    call _getcsc
    or a
    ret nz
    in a,(3)
    bit 3,a
    jr z,shut_down
    halt
    djnz getkey_wait
    dec c
    jr nz,cursor_loop
shut_down:
    ld a,1
    out (3),a
    halt
    ld a,11
    out (3),a
release_on:
    halt
    in a,(3)
    bit 3,a
    jr z,release_on
    jr getkey_loop

draw_cursor:
    ld hl,(_penCol)
    push hl
    ld hl,0
cursor_col = $-2
cursor_row = $-1
    ld (_penCol),hl
    ld a,2                             ;bit 1 is textUnderline
cursor_state = $-1
    xor 8                              ;bit 3 is textInverse
    ld (cursor_state),a
    ld hl,_Flags+textFlags
    ld (hl),a
    call _VPUTBLANK
    ld (hl),a
    pop hl
    ld (_penCol),hl
    ret


In a message dated 5/30/2001 1:17:29 PM Eastern Daylight Time, 
caffeine43@netzero.net writes:


> On Wed, 30 May 2001 08:38:58 -0700, assembly-83@lists.ticalc.org
> wrote:
> >I think bcall(_cursoron) will do it.
> >
> 
> Thanks but B_CALL cursoron uses the large font...I forgot to say I
> need a cursor for the small font that can be positioned using penCol
> 



----
Jonah Cohen
<ComAsYuAre@aol.com>
http://jonah.ticalc.org