Re: kbd buffer
You should be able to use interrupt 16h
function 5h to write to kbd buffer
calling registers AH 05h
CH Scan code
CL Character
return registers AL = 1 if buffer full
function 10h to read the buffer
calling registers AH 10h
return registers AH Scan code
AL Character
haven't used function 10h with euphoria
writing to the buffer seemed to work for me
the buffer is 32 bytes only 16 character & scan codes
please excuse the code only been using euphoria for few weeks
include machine.e
include get.e
sequence call_reg,ret_reg,string,scan_code
object st
call_reg = repeat(0,10)
ret_reg = repeat(0,10)
-- interrupt 16h, function 5h
function put_kbd_buf(integer chr,integer sc)
object ax,cx
ax = bytes_to_int({0,5,0,0}) -- AH = 05h
cx = bytes_to_int({chr,sc,0,0}) -- CH = scan code, CL = character
call_reg[7] = ax
call_reg[6] = cx
ret_reg = dos_interrupt(#16,call_reg)
ax = ret_reg[7] -- returns al = 1 if buffer full
return ax
end function
procedure str_to_buf(sequence a,sequence b)
object ln,chr,sc,er
ln = length(a)
for q = 1 to ln do
chr = a[q]
sc = b[q]
er = put_kbd_buf(chr,sc)
if er = 1 then exit end if
end for
end procedure
string = "Hello World"
scan_code = {23,12,26,26,18,39,11,18,13,26,20}
clear_screen()
str_to_buf(string,scan_code)
puts(1,"Hello World is in kbd buffer press ENTER\n\n")
st = gets(0)
puts(1,"\nst = ")
puts(1,st & "\nPress any key")
st = wait_key()
|
Not Categorized, Please Help
|
|