Menu

#2 BACKSPACE key not working

v1.0_(example)
open
5
2014-09-24
2014-09-24
No

When you hit [BACKSPACE] it doesn't delete the last character because the unicode for the key is not being checked. Here is a possible solution for this, please review it (see files attached):

keyboard.c

...
            if (tmp >= 0x61 && tmp <= 0x7A)
                tmp &= 0x5F;

            // Backspace
            if (tmp == 0x08)
                tmp = 0x5F;

            if (tmp < 0x60)
            {
                writeKbd((unsigned char)(tmp | 0x80));
                writeKbdCr(0xA7);
            }
...

screen.c

...
    switch (tmp)
    {
    case 0x0D:
        indexX = 0;
        indexY++;
        break;
    case 0x5F:
        // Backspace
        if (indexX > 0)
            indexX--;
        else
        {
            indexY--;
            indexX = 39;
        }
        screenTbl[indexY * 40 + indexX] = 0x20;
    default:
        // Everything else
        if (tmp >= 0x20 && tmp < 0x5F)
        {
            screenTbl[indexY * 40 + indexX] = tmp;
            indexX++;
        }
        break;
    }
...

Thank you for your work!

2 Attachments

Discussion


Log in to post a comment.

Monday.com Logo