1. Regs
I saw that someone posted to the list a function that checks the key status
and I wanted to make my own. So I didn't look at the code and I went and
looked at a interrupt list and found what interrupt to use. Here is my code so
far and I get errors
include machine.e
sequence reg_list
sequence al
reg_list = repeat(0,10)
reg_list[REG_AX] = #0200
reg_list = dos_interrupt(#16, reg_list)
al = and_bits(reg_list[REG_AX], ##00FF) --- Error is this line
2. Re: Regs
>I saw that someone posted to the list a function that checks the key status
>and I wanted to make my own. So I didn't look at the code and I went and
>looked at a interrupt list and found what interrupt to use. Here is my code
so
>far and I get errors
>
>include machine.e
>
>sequence reg_list
>sequence al
>reg_list = repeat(0,10)
>reg_list[REG_AX] = #0200
>reg_list = dos_interrupt(#16, reg_list)
>al = and_bits(reg_list[REG_AX], ##00FF) --- Error is this line
Maybe it's a typo. You used 2 ## !!!
Regards,
Daniel Berstein
daber at pair.com
3. Regs
>include machine.e
>sequence reg_list
>sequence al
>reg_list =3D repeat(0,10)
>reg_list[REG_AX] =3D #0200
>reg_list =3D dos_interrupt(#16, reg_list)
>al =3D and_bits(reg_list[REG_AX], ##00FF) --- Error is this line
why 2 times ##? maybe that causes the error; haven't tried it out, tho.
and, maybe even better: al shouldn't be a sequence but an atom or integer=
.
Ad
4. Re: Regs
>I saw that someone posted to the list a function that checks the key status
>and I wanted to make my own. So I didn't look at the code and I went and
>looked at a interrupt list and found what interrupt to use. Here is my code
so
>far and I get errors
Since the errors are already pointed out, I wont name them.
However, I do want to point you to keyread.e by Micheal Bolin.
Which lets you check if *any* current key is currently pressed.
Not the key like getc () or get_key () returns, but its scancode.
The library is available at the archives, im sure.
Ralf
5. Re: Regs
Ok I got the program to work here it is:
--start light.ex--
include machine.e
constant SCROLL_LOCK = 16,
NUM_LOCK = 32,
CAPS_LOCK = 64
function key(integer light)
sequence reg_list
integer al
reg_list = repeat(0,10)
reg_list[REG_AX] = #0200
reg_list = dos_interrupt(#16, reg_list)
al = and_bits(reg_list[REG_AX], #00FF)
return and_bits(al,light)
end function
clear_screen()
if key(NUM_LOCK) != 0 then
puts(1, "\nNUM_LOCK = TRUE")
else
puts(1, "\nNUM_LOCK = FALSE")
end if
if key(SCROLL_LOCK) != 0 then
puts(1, "\nSCROLL_LOCK = TRUE")
else
puts(1, "\nSCROLL_LOCK = FALSE")
end if
if key(CAPS_LOCK) != 0 then
puts(1, "\nCAPS_LOCK = TRUE")
else
puts(1, "\nCAPS_LOCK = FALSE")
end if
--end light.ex--
Albert