This is an archived, read-only copy of the United-TI subforum , including posts and topic from May 2003 to April 2012. If you would like to discuss any of the topics in this forum, you can visit Cemetech's TI-BASIC subforum. Some of these topics may also be directly-linked to active Cemetech topics. If you are a Cemetech member with a linked United-TI account, you can link United-TI topics here with your current Cemetech topics.

This forum is locked: you cannot post, reply to, or edit topics. TI-Basic => TI-BASIC
Author Message
yugniht


Member


Joined: 29 May 2003
Posts: 167

Posted: 26 Jul 2003 04:20:28 pm    Post subject:

I've written at least a couple of programs where I'll have a lot of code then a getkey. Let's say I press the number 9 while my program is drawing a bunch of stuff, for example. Then, when the program gets to the getkey, 74 is automatically what the getkey returns, even though I pressed the button before the program encountered the getkey.

Does anyone understand what I just said? Moreover, does anyone know why it does this?
Back to top
Darth Android
DragonOS Dev Team


Bandwidth Hog


Joined: 31 May 2003
Posts: 2104

Posted: 26 Jul 2003 04:24:09 pm    Post subject:

im not an asm guru, but i asume the calc just buffers the byte until it needs it. i know the keyboard has its own personal buffer, though it is small.
Back to top
yugniht


Member


Joined: 29 May 2003
Posts: 167

Posted: 26 Jul 2003 08:48:46 pm    Post subject:

buffers? You've lost me. All I know is that I can press a button before getkey is executed and it will recognize that button.
Back to top
Arcane Wizard
`semi-hippie`


Super Elite (Last Title)


Joined: 02 Jun 2003
Posts: 8993

Posted: 27 Jul 2003 06:58:04 am    Post subject:

A buffer is a (often small) part of the memory that holds some temporary data.

This is how it helps cd-writing for example:

When writing a CD, the data has to be written continuously, i.e. there may be no breaks in the data flow. As of course the computer can not supply a constant stream of data (it transfers it block by block), the CD recorders have got a buffer which temporarily stores the data send by the computer and then sends it on to the writer at the correct speed.

If the computer does not manage to keep refilling the buffer during the write process (i.e. the buffer is emptied completely), then the write laser does not have any more data to write so the write process has to be interrupted.
Back to top
Darth Android
DragonOS Dev Team


Bandwidth Hog


Joined: 31 May 2003
Posts: 2104

Posted: 27 Jul 2003 10:57:48 am    Post subject:

i believe the keyboard buffer is 1 byte cuz it only stores one keypress...
do you agree?
Back to top
Arcane Wizard
`semi-hippie`


Super Elite (Last Title)


Joined: 02 Jun 2003
Posts: 8993

Posted: 27 Jul 2003 02:20:17 pm    Post subject:

Sounds logical, but I don't know enough about buffers.
Back to top
Darth Android
DragonOS Dev Team


Bandwidth Hog


Joined: 31 May 2003
Posts: 2104

Posted: 28 Jul 2003 02:53:03 am    Post subject:

well, im learning asm, so i need to know more about them. not that i do (key work: need)
Back to top
Arcane Wizard
`semi-hippie`


Super Elite (Last Title)


Joined: 02 Jun 2003
Posts: 8993

Posted: 28 Jul 2003 03:27:53 am    Post subject:

Make a topic about it on the asm board.
Back to top
Darth Android
DragonOS Dev Team


Bandwidth Hog


Joined: 31 May 2003
Posts: 2104

Posted: 28 Jul 2003 03:34:28 am    Post subject:

that sound the most logical. i will do that when ready
Back to top
Adm.Wiggin
aka Tianon


Know-It-All


Joined: 02 Jun 2003
Posts: 1874

Posted: 28 Jul 2003 12:51:15 pm    Post subject:

a buffer is usually just a fairly small database... the one for the norm. keyboard is probably 1 or 2 bytes like you said... but the TI-Keyboard buffer (not in the keyboard Neutral must build in urself in asm prgms) is 17 bytes or something... it needs 2 bytes for each keypress though...
Back to top
Darth Android
DragonOS Dev Team


Bandwidth Hog


Joined: 31 May 2003
Posts: 2104

Posted: 28 Jul 2003 10:48:29 pm    Post subject:

well, that would make it reasonable for the keyboard's buffer to be 2 bytes, then
Back to top
Adm.Wiggin
aka Tianon


Know-It-All


Joined: 02 Jun 2003
Posts: 1874

Posted: 28 Jul 2003 11:03:58 pm    Post subject:

i meant 2 bytes for each TI-Keyboard keypress... not normal keyboard... it only needs 1...
Back to top
Darth Android
DragonOS Dev Team


Bandwidth Hog


Joined: 31 May 2003
Posts: 2104

Posted: 28 Jul 2003 11:36:43 pm    Post subject:

oh.. i misread what u typed (i need to clean my lenses) ill read more careful next time
Back to top
Justin W.
Shattered Silence


Advanced Member


Joined: 24 May 2003
Posts: 429

Posted: 29 Jul 2003 12:08:59 am    Post subject:

My guess is this. While executing a basic program the TIOS is running an interupt that tests for a keypress. A one byte buffer would be in place for storing the keypress. Now if no key is pressed the byte would be 0. If a key was pressed it would be stored into that buffer. Now it would not overwrite it because the value is not zero. Hence the reason you can press a key and it registers as soon as it encounters the getkey command.

I have a good knowledge of asm and this is just my guess.
Back to top
NETWizz
Byte by bit


Bandwidth Hog


Joined: 20 May 2003
Posts: 2369

Posted: 29 Jul 2003 12:24:53 am    Post subject:

The interrupt is IM 1, ad it is located at 38h but doesn't really start until 3ah. It then jumps to 6ah.

Anyway, anytime a key is pressed, a two byte value is saved in a buffer because some keys are two bytes. For example, press 2nd then a key to get a different key code.

Now, in reality the interrupt uses direct input to do getcsc, which in turn is used by getkey (asm).

Your getkey in basic is a romcall (not bcall(getkey) btw) which is grabs the two byte scan code from getcsc.

Getcsc is essentially direct input where you press the key and it saves the code, and the hardware forces a flag when anykey but on is pressed.

Basically, when this flag is set, the buffer will change to 0 and stop returning the key, so your keys do not repeat.

If TI wanted, or if you were really good at IM 2, you could make your own keyboard device driver to make all your keys repeat. e.g. hold down the 9 key and get 9999999999
Back to top
Darth Android
DragonOS Dev Team


Bandwidth Hog


Joined: 31 May 2003
Posts: 2104

Posted: 29 Jul 2003 07:47:39 am    Post subject:

yeah, i wish u could hold down keys other than the arrow keys and the del key.

BTW, JBirk, do u remember the getkey prgm u were going to make back at the cirrus forum?
if was going to use direct input to detect for multiple keypresses and output like this:
for [2ND]+[DEL]: 21.23
[ON]+[CLEAR]: 101.45
[1]+[3]: 92.94

remember?
Back to top
Adm.Wiggin
aka Tianon


Know-It-All


Joined: 02 Jun 2003
Posts: 1874

Posted: 29 Jul 2003 11:06:14 am    Post subject:

i remember...

it wouldnt be too hard to make the interrupt... just have it use direct input and save the Direct Inputted key in the buffer...
Back to top
Darth Android
DragonOS Dev Team


Bandwidth Hog


Joined: 31 May 2003
Posts: 2104

Posted: 31 Jul 2003 10:29:38 am    Post subject:

and using getkey->variable would reteive it? could it pick up the [ON] key to?
Back to top
Display posts from previous:   
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
    »
» View previous topic :: View next topic  
Page 1 of 1 » All times are UTC - 5 Hours

 

Advertisement