Re: Reading ctrl-c's without crashing program

new topic     » goto parent     » topic index » view thread      » older message » newer message

------=_NextPart_000_01BC18D0.D0531020
Content-Transfer-Encoding: 8bit


I needed a function to test if a key was pressed without disturbing the
buffer, here is:

    -- By Jeszs Consuegra (jconsuegra at redestb.es)

include machine.e
include bitwise.e

constant FALSE = 0,
         TRUE = 1,
         ZeroFlag = #40

global function keypressed()

sequence reg_list

reg_list = repeat(0,10)
reg_list[REG_AX] = #0100

reg_list = dos_interrupt(#16, reg_list)

if AND(reg_list[REG_FLAGS], ZeroFlag) = ZeroFlag then
    return FALSE
else
    return TRUE
end if

end function

------------------
I still miss some SHR SHL bitwise shifts, and some serial port
procedures/functions to allow changing the baud rate, etc.
Any ideas?
Thanks
------=_NextPart_000_01BC18D0.D0531020
Content-Description: keypress.e ()

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu