Overclock.net › Forums › Software, Programming and Coding › Coding and Programming › Implementing Backspace in Assembly
New Posts  All Forums:Forum Nav:

Implementing Backspace in Assembly

post #1 of 2
Thread Starter 
So I am designing a basic calculator, and I need to implement backspace functionality.
The assembly is for a Coldfire (M68k) processor, and I have the ability to read characters and write them (all ascii codes).

I have a crude method working, but I am wondering if there is a better way.
Currently when I do backspace, I delete the last character in the string, then carriage return, then write a lot of blank spaces, then carriage return again then output the new string.

This works for something like this:
Equation:
12+13

Then if backspace is pressed I get this:
Equation:
12+1

and if I press enter I get 13 as expected.

My problem occurs when I want to do something like this:
Equation: 12+13

Then if backspace is press I get this:
12+1

The text "Equation: " is lost. I could output "Equation: " before the modified string, but if I want that text to be variable, then it becomes a pain.

Basically I am wondering if there is a way to just back the cursor 1 character or something.
post #2 of 2
1. Make sure you are not deleting the \\0 character at the end of the string. (if you are using C style strings)

2. What kind of display are you writing to (or just to serial console)? If you are writing to a serial terminal, you might be able to use VT100 sequences to move the cursor to the beginning of a line and/or erase it (^2K erases a line if I remember correctly)
New Posts  All Forums:Forum Nav:
  Return Home
  Back to Forum: Coding and Programming
Overclock.net › Forums › Software, Programming and Coding › Coding and Programming › Implementing Backspace in Assembly