YO! THIS IS REALLY ANNOYING!!! (MESSED UP KBD ROUTINE)
YO! THIS IS REALLY ANNOYING!!! (MESSED UP KBD ROUTINE)
I have a problem with a very basic keyboard routine. I tried to use getch, but it crashed my computer, telling me to remove the disk and restart the computer.
Can anyone help me solve this problem?
Can anyone help me solve this problem?
Re:YO! THIS IS REALLY ANNOYING!!! (MESSED UP KBD ROUTINE)
Oh yeah, I forgot: I've attached some of the code.
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).
Can anyone see anything wrong with the code? Somebody help me PLEASE!!!
[attachment deleted by admin]
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).
Can anyone see anything wrong with the code? Somebody help me PLEASE!!!
[attachment deleted by admin]
Re:YO! THIS IS REALLY ANNOYING!!! (MESSED UP KBD ROUTINE)
The gurus can tell you a millions of reasons for this but I think you wont be happy with it so I think you should try giving some clue about the problem.(like some source, bochs error...)
Re:YO! THIS IS REALLY ANNOYING!!! (MESSED UP KBD ROUTINE)
Hey mastermind I am sorry, you had posted your second post before I have finished typing my post.
Re:YO! THIS IS REALLY ANNOYING!!! (MESSED UP KBD ROUTINE)
Well, the src is attached. If you didn't see it, I'll attach it again. As for Bochs: I didn't use it. I used a physical computer.
I still can't see what went wrong with the code...
[attachment deleted by admin]
I still can't see what went wrong with the code...
[attachment deleted by admin]
Re:YO! THIS IS REALLY ANNOYING!!! (MESSED UP KBD ROUTINE)
Well, I didn't mind that . I posted the new src code, which has the same problem but is easier to read (sort of).Ozguxxx wrote: Hey mastermind I am sorry, you had posted your second post before I have finished typing my post.
Stil looking for help .
Re:YO! THIS IS REALLY ANNOYING!!! (MESSED UP KBD ROUTINE)
Hey, I just checked fastly and I think there is some mistake here:
In keydefs.h:
UINT GetRawKey() {
RAWKEY scancode;
while ( TRUE ) { // Wait 'til a key is pressed
//while (!(inportb(0x64)&1));
while (!(inportb(0x64)&&1));
^-------This should be changed...
scancode = getrawkeynow();
//if ( scancode & KEYPRESS ) { // Is a key is up?
if ( scancode && KEYPRESS ) { // Is a key is up?
^-------This should be changed...
scancode &= 0x7F; // Yep.
if ( scancode == KRLEFT_SHIFT || scancode == KRRIGHT_SHIFT ) { // Shift up?
I think these two lines should be changed becuase & applies to two values and takes their and and returns result so if you use it in an if(a&b) then you will most probably always enter into if block you would better use if(a&&b) so that you will do in right way. I think there are some errors like this, if you cahnge these and if problem still exists, send code again. Hope this helps, good luck...
In keydefs.h:
UINT GetRawKey() {
RAWKEY scancode;
while ( TRUE ) { // Wait 'til a key is pressed
//while (!(inportb(0x64)&1));
while (!(inportb(0x64)&&1));
^-------This should be changed...
scancode = getrawkeynow();
//if ( scancode & KEYPRESS ) { // Is a key is up?
if ( scancode && KEYPRESS ) { // Is a key is up?
^-------This should be changed...
scancode &= 0x7F; // Yep.
if ( scancode == KRLEFT_SHIFT || scancode == KRRIGHT_SHIFT ) { // Shift up?
I think these two lines should be changed becuase & applies to two values and takes their and and returns result so if you use it in an if(a&b) then you will most probably always enter into if block you would better use if(a&&b) so that you will do in right way. I think there are some errors like this, if you cahnge these and if problem still exists, send code again. Hope this helps, good luck...
Re:YO! THIS IS REALLY ANNOYING!!! (MESSED UP KBD ROUTINE)
Because it's really late, I cannot check it out right now. But I'll do it tomorrow and see if it works. Thanks a bunch!!
Re:YO! THIS IS REALLY ANNOYING!!! (MESSED UP KBD ROUTINE)
Nope, wrong. & is right here because it's the AND operator - && is the logical AND operator. scancode & KEY_PRESS will check if a the a key is pressed (statement will be true). If you use && the statement will likely *always* be true which isn't that what you wantI think these two lines should be changed becuase & applies to two values and takes their and and returns result so if you use it in an if(a&b) then you will most probably always enter into if block you would better use if(a&&b) so that you will do in right way.
Re:YO! THIS IS REALLY ANNOYING!!! (MESSED UP KBD ROUTINE)
Yeah well ;D sorry my mistake...
Re:YO! THIS IS REALLY ANNOYING!!! (MESSED UP KBD ROUTINE)
Yeah... I sorta figured that out when I was dissecting my code... It seems as if the computer thinks that the unsigned char "retchar" in getch() is an integer. That's why it says "initialization makes integer from pointer without a cast" when I try to display it as a string. I think the error originated in the initialization of asciiShift[] and asciiNonSh[] in keydefs.h. How can I solve this problem (and make the getch work)?
As for the exact message the computer displays to tell me to reset... It it "Remove disks or other media. Press any key to reset."
Please help.
As for the exact message the computer displays to tell me to reset... It it "Remove disks or other media. Press any key to reset."
Please help.
Re:YO! THIS IS REALLY ANNOYING!!! (MESSED UP KBD ROUTINE)
Please, ANYONE : Help Me!!!
- Pype.Clicker
- 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)
please stop shouting ...
i never seen such a weird message from the computer. It looks like a BIOS message (maybe you're requesting the CPU to halt through the BIOS)
Are you in protected mode ? We do not even know ...
i never seen such a weird message from the computer. It looks like a BIOS message (maybe you're requesting the CPU to halt through the BIOS)
Are you in protected mode ? We do not even know ...
- Pype.Clicker
- 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)
Code: Select all
int c_main(void) {
UCHAR keypress = getch();
output(STDTXT, 1, 0, keypress);
}
int output(int color, int row, int col, char *string) ;
Code: Select all
char keypress[2];
keypress[0]=getch();
keypress[1]=0;
output(STDTXT,1,0,keypress);
Re:YO! THIS IS REALLY ANNOYING!!! (MESSED UP KBD ROUTINE)
Surely
Code: Select all
output(STDTXT,1,0,&keypress);