dualbrain
Junior Member
The only bug free code is code that is no longer used.
Posts: 51
|
Post by dualbrain on Oct 17, 2022 16:24:45 GMT
Is it possible to access they internal keyboard buffer to determine if there is/are any key(s)?
insert code hereqbs *qbs_inkey(){
if (new_error) return qbs_new(0,1);
qbs *tqbs;
// Sleep(0);
tqbs=qbs_new(2,1);
if (cmem[0x41a]!=cmem[0x41c]){
tqbs->chr[0]=cmem[0x400+cmem[0x41a]];
tqbs->chr[1]=cmem[0x400+cmem[0x41a]+1];
if (tqbs->chr[0]){
tqbs->len=1;
}else{
if (tqbs->chr[1]==0) tqbs->len=1;
}
cmem[0x41a]+=2;
if (cmem[0x41a]==62) cmem[0x41a]=30;
}else{
tqbs->len=0;
}
return tqbs;
} Reading this code suggests that there's a spot in cmem that is holding this information and there seems to be some sort of link between cmem and defseg variable which is utilized by func_peek(), but I'm not sure of this and/or how this relationship actually works. I also haven't figured out exactly how these values in cmem are getting set, but it does appear to be some sort of flag indicating that there is a key to be read...
Ultimately, I'd like to know if there is anything in the buffer without actually popping thing out of the buffer... I get that there are ways to handle this by placing the value pulled into a variable and use it later, but I'm trying to reproduce some functionality and would like to keep it as original as possible - thus the question.
Thanks.
|
|