Pages: 1
|
 |
|
Author
|
Topic: Patch to retroforth.asm for handling Backspace (Read 3535 times)
|
snowrs
Member
 
Karma: +0/-0
Offline
Posts: 9
I'm a llama!
|
.a: call key ; Get a keypress cmp al, 13 ; je .cr ; cmp al, 10 ; je .cr ; cmp al, 8 jne .x mov dword eax,[tp] sub eax, 1 mov dword [tp],eax sub edi, 1 jmp .a .x: xchg edi,[tp]
|
|
|
|
|
Logged
|
|
|
|
Charles Childers
Administrator
Sr. Member
    
Karma: +2/-0
Offline
Posts: 745
|
This works perfectly. I'll add it to the 7.7 and later releases
|
|
|
|
|
Logged
|
|
|
|
snowrs
Member
 
Karma: +0/-0
Offline
Posts: 9
I'm a llama!
|
thanks for reading it. Only problem I can see is if you bs on first char of the line, but how often would one do that?
|
|
|
|
|
Logged
|
|
|
|
Charles Childers
Administrator
Sr. Member
    
Karma: +2/-0
Offline
Posts: 745
|
Not very often
|
|
|
|
|
Logged
|
|
|
|
RogerLevy
Full Member
   
Karma: +1/-0
Offline
Posts: 55
|
a new user might not understand when an output appears on the next line before the cursor and try to erase it ... it was actually one of the initial reasons i put retro down the first time i tried it, cuz it kept replying mysterious "dup?"'s and "bye?"'s
|
|
|
|
« Last Edit: January 31, 2005, 04:08:16 PM by RogerLevy »
|
Logged
|
|
|
|
|
|
|
|
ron
Contributor
Full Member
   
Karma: +0/-0
Offline
Posts: 88
|
Just my opinion, but 'key' should get the key pressed, not interpret it at all.
If you want interpretation, use something like 'accept'.
|
|
|
|
|
Logged
|
|
|
|
Helmar
Library Contributor
Full Member
   
Karma: +1/-0
Offline
Posts: 129
TUCK what??? SWAP OVER!!!
|
Hi Ron,
yes and no. "key" always interprets a little since people expect to get ascii representation. On PC standalone "key" could also return raw key codes if you want so...
Bis dann, Helmar
|
|
|
|
|
Logged
|
|
|
|
ron
Contributor
Full Member
   
Karma: +0/-0
Offline
Posts: 88
|
Hi Helmar -
People use key in a loop to get input ... they expect to get the ASCII key, you're right. They do NOT expect that pressing BS is ignored or something.
In other words, any key which generates an ASCII code should return a value from 'key'. For extended keys, one should use 'ekey' (e.g. for function keys or what-have-you).
|
|
|
|
|
Logged
|
|
|
|
Helmar
Library Contributor
Full Member
   
Karma: +1/-0
Offline
Posts: 129
TUCK what??? SWAP OVER!!!
|
Absolutely right. I prefer to have backspace available for applications that can make use of it.
Bis dann, Helmar
|
|
|
|
|
Logged
|
|
|
|
Helmar
Library Contributor
Full Member
   
Karma: +1/-0
Offline
Posts: 129
TUCK what??? SWAP OVER!!!
|
BTW: We are not talking about a modification to "key".
But also here, I prefer to have backspace if possible. 1) on Linux the systems console code handles backspace; so if backspace occurs, it means someone put the console in such a mode that allows backspace to be passed to app. 2) a common usage of ^H is to markup a character to be bold: A^HA means a bold A.
Bis dann, Helmar
|
|
|
|
|
Logged
|
|
|
|
Charles Childers
Administrator
Sr. Member
    
Karma: +2/-0
Offline
Posts: 745
|
This is a change to query, not key. query is an internal routine, and is used by the standard interpreter. (So if you define a custom "interpret" word, or use "key" somewhere, backspace will not be filtered out.)
|
|
|
|
|
Logged
|
|
|
|
Pages: 1
|
|
|
|
|