RetroForum Welcome, Guest. Please login or register.
March 14, 2010, 02:20:43 PM
Home Help Search Calendar Login Register

RetroForth Discussion  |  Older Boards  |  Bugs  |  Topic: Patch to retroforth.asm for handling Backspace « previous next »
Pages: 1 Go Down Print
Author Topic: Patch to retroforth.asm for handling Backspace  (Read 3535 times)
snowrs
Member
**

Karma: +0/-0
Offline Offline

Posts: 9

I'm a llama!


View Profile
Patch to retroforth.asm for handling Backspace
« on: January 27, 2005, 07:49:36 PM »

.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 Offline

Posts: 745


View Profile WWW
Re:Patch to retroforth.asm for handling Backspace
« Reply #1 on: January 28, 2005, 01:06:52 AM »

This works perfectly. I'll add it to the 7.7 and later releases Wink
Logged
snowrs
Member
**

Karma: +0/-0
Offline Offline

Posts: 9

I'm a llama!


View Profile
Re:Patch to retroforth.asm for handling Backspace
« Reply #2 on: January 28, 2005, 08:02:57 AM »

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 Offline

Posts: 745


View Profile WWW
Re:Patch to retroforth.asm for handling Backspace
« Reply #3 on: January 28, 2005, 04:03:27 PM »

Not very often Smiley
Logged
RogerLevy
Full Member
****

Karma: +1/-0
Offline Offline

Posts: 55


View Profile
Re:Patch to retroforth.asm for handling Backspace
« Reply #4 on: January 31, 2005, 04:06:32 PM »

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
crc
Guest


Email
Re:Patch to retroforth.asm for handling Backspace
« Reply #5 on: February 03, 2005, 07:39:37 PM »

Quote
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

I suppose I should cover this in the documentation Smiley
Logged
Charles Childers
Administrator
Sr. Member
*****

Karma: +2/-0
Offline Offline

Posts: 745


View Profile WWW
Re:Patch to retroforth.asm for handling Backspace
« Reply #6 on: February 08, 2005, 03:37:48 AM »

Code:
.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
        drop      ; *important*  leaving this out  leaves garbage on  the stack
        jmp .a
.x:    xchg edi,[tp]

Just a quick bugfix Smiley
Logged
ron
Contributor
Full Member
****

Karma: +0/-0
Offline Offline

Posts: 88


View Profile WWW
Re:Patch to retroforth.asm for handling Backspace
« Reply #7 on: February 08, 2005, 05:00:03 PM »

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 Offline

Posts: 129

TUCK what??? SWAP OVER!!!


View Profile
Re:Patch to retroforth.asm for handling Backspace
« Reply #8 on: February 08, 2005, 05:09:36 PM »

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 Offline

Posts: 88


View Profile WWW
Re:Patch to retroforth.asm for handling Backspace
« Reply #9 on: February 08, 2005, 05:54:46 PM »

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 Offline

Posts: 129

TUCK what??? SWAP OVER!!!


View Profile
Re:Patch to retroforth.asm for handling Backspace
« Reply #10 on: February 08, 2005, 06:06:51 PM »

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 Offline

Posts: 129

TUCK what??? SWAP OVER!!!


View Profile
Re:Patch to retroforth.asm for handling Backspace
« Reply #11 on: February 08, 2005, 06:52:23 PM »

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 Offline

Posts: 745


View Profile WWW
Re:Patch to retroforth.asm for handling Backspace
« Reply #12 on: February 08, 2005, 11:18:58 PM »

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 Go Up Print 
RetroForth Discussion  |  Older Boards  |  Bugs  |  Topic: Patch to retroforth.asm for handling Backspace « previous next »
Jump to:  


Login with username, password and session length

Powered by MySQL Powered by PHP Powered by SMF 1.1 RC2 | SMF © 2001-2005, Lewis Media Valid XHTML 1.0! Valid CSS!