[A86] _getky flaw and weird 6-line-bug


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

[A86] _getky flaw and weird 6-line-bug




Hey, everyone!

I recently purchased a TI-86 and started programming it (I did some 82 assembly 
programming before). I want to port some 82 programs and there's this routine 
call GET_KEY, which returns immediately with either a scancode or 0 (in case no 
key was pressed) in a. call _get_key on the 86 however as all tutorials say 
waits until a key is pressed (like call CR_KHAND on the 82 again). I don't want 
my program to wait so I tried to find a GET_KEY synonym, which I thought I 
found in call _getky. Sadly the tutorials I read either use _get_key only or 
tell few more than just about _getky's existence. Well, so I just wrote this 
little test program, whose code you may find at the end of this mail. It's 
pretty simple and in a way works, but I discovered two really weird bugs (which 
most likely are results of me doing something wrong instead of being real bugs, 
anyway :-).

If I transfer the program to my TI-86 and then run it via "Asm(test", it works 
fine, except that it uses only the upper 6 lines - and even worse, after I quit 
it, TIOS as well doesn't use the last 2 lines. If I then turn off my calc and 
just on again, both TIOS and my program use all 8 lines again. I tried it a lot 
of times, it's reproduceable. Also if I delete the program, then send and run 
it again, it works with all 8 lines without me having to do the off-on-
procedure again.

The second thing that bothers me is, that if I run the program and press "ON" 
nothing happens. Actually that's correct but if I then press "ENTER" to exit 
the program, it says, that some error (06: BREAK) occured. This doesn't seem to 
do any harm though, but I think it's quite a flaw and I wouldn't want to put 
out a program which gives an error message for no specific reason, when you 
exit it. Oh, and the error message doesn't show up, if "ON" doesn't get pressed 
but in case it does, it shows up after the program has been terminated 
by "ENTER", not immediately after "ON" has been pressed.

Does anyone know how to get around that 6-line-only-bug and/or know how not to 
get this error message due to "ON" pressed? Perhaps I'm just using a bad keypad 
handler, then which one is good (and still doesn't wait in case no key has been 
pressed)?

And as this might be important, my ROM version is 1.6.

Here goes the code (I know, some unnecessary stuff in it but you never know...):

#include "ti86asm.inc"
.org _asm_exec_ram
        nop
        jp ProgStart
        .dw 0
        .dw ShellTitle
ShellTitle:
        .db "New Assembly Program",0
ProgStart:
        call    _clrLCD
        call    _homeup
        ld      b, 0
loop:
        inc     b
        ld      a, b
        call    _putc
        call    _getky
        cp      K_ENTER
        jr      nz, loop
        ret
.end

Bye, Burkart



Follow-Ups: