I've been reading all of the posts I could find here on the forum, asking questions about their getLine() functions, but I haven't been able to resolve my problem by reading any of them.
Anyway, MY problem is that my getLine() function, doesn't seem to be returning anything.
Or, nonetheless, I can't seem to make it print out the returned string..
Here's all of the functions I feel you need to see:
Code: Select all
char checkBit(char value, short position){
return (value & (1 << position)) > 0;
}
char getKey(){
char status = in(0x0064);
while(checkBit(status, 0) == 0){
status = in(0x0064);
}
return in(0x0060);
}
char* getLine(short row, short column){
short cursorPosition = column - 1;
char scanCode = 0;
char* line;
while(scanCode != 0x001c){
scanCode = getKey();
char ascii = handleScanCode(scanCode);
*line++ = ascii;
if(ascii != 0){
printChar(ascii, row, column);
column += 2;
out(0x03d4, 0x000e);
out(0x03d5, row);
out(0x03d4, 0x000f);
out(0x03d5, cursorPosition++);
}
}
return line;
}
This is how I call the function and prints out the string:
Code: Select all
char* command = (char*)getLine(0, 4);
print(command, 1, 0);