YO! THIS IS REALLY ANNOYING!!! (MESSED UP KBD ROUTINE)

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Mastermind

Re:YO! THIS IS REALLY ANNOYING!!! (MESSED UP KBD ROUTINE)

Post by Mastermind »

Pype.Clicker wrote: Are you in protected mode ? We do not even know ...
No. I am in Pmode.
Mastermind

Re:YO! THIS IS REALLY ANNOYING!!! (MESSED UP KBD ROUTINE)

Post by Mastermind »

Therx: I am going to try your code (and restart my computer), so I'll be gone for some time. Thanks for help.
User avatar
Pype.Clicker
Member
Member
Posts: 5964
Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:

Re:YO! THIS IS REALLY ANNOYING!!! (MESSED UP KBD ROUTINE)

Post by Pype.Clicker »

Therx wrote: Surely

Code: Select all

output(STDTXT,1,0,&keypress);
Just adding &keypress will not sufficient! you cannot guarantee the single-character 'keypress' will be followed by some 0 character to terminate the string, so you're likely to see random garbage on screen.
distantvoices
Member
Member
Posts: 1600
Joined: Wed Oct 18, 2006 11:59 am
Location: Vienna/Austria
Contact:

Re:YO! THIS IS REALLY ANNOYING!!! (MESSED UP KBD ROUTINE)

Post by distantvoices »

I agree with Pype.

It is better to stuff the scancodes in a kind of circular buffer, whch keeps them for some routine that interprets and hands them over as characters (modified with shift, alt, etc - kbd-led-switching too ...) to the console/task that requested the input.

an other routine shall be responsible for stuffing the chars to screen/input buffer (some empty string f. ex - via stream-like functions)
int output(int color, int row, int col, char *string) ;
this char *string thing is fuzzy. Why don't you just pass the character in question by value (it is just located on the stack)? It would ease your life to use pointers only where they are really necessary.

stay safe gosh
... the osdever formerly known as beyond infinity ...
BlueillusionOS iso image
User avatar
Pype.Clicker
Member
Member
Posts: 5964
Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:

Re:YO! THIS IS REALLY ANNOYING!!! (MESSED UP KBD ROUTINE)

Post by Pype.Clicker »

Mastermind wrote: When I compile the code, the asciiShift[] and the asciiNonSh[] in the keydefs.h always gives me problems (initialization makes integer from pointer without a cast).
You #define'd NULL 0, but in most implementations, NULL is defined as (void*)0. If for some obscure reason a generic header file is declaring NULL before you (and i suspect this is the case, otherwise why would you have #ifndef NULL ?), then there is a conflict when you have unshifted[]={NULL, ... }

I suggest you give a look to the output of gcc -E your-main-file.c, (after the pre-processing stage) so that you'll be aware of what is actually read by the compiler when it processes your file.
Therx

Re:YO! THIS IS REALLY ANNOYING!!! (MESSED UP KBD ROUTINE)

Post by Therx »

No. I was refering to your code(Pype.Clicker).
char keypress[2]; is not a pointer(is it?) so you will need the &keypress
Tim

Re:YO! THIS IS REALLY ANNOYING!!! (MESSED UP KBD ROUTINE)

Post by Tim »

char keypress[2]; is an array. Arrays decay to pointers when passed to functions; this effectively means that arrays and pointers are the same thing.
Post Reply