1. get_key() update

The get_key() replacement code I posted yesterday had a serious
flaw. Control keys with values over 255 were not being returned
correctly. I have just fixed this, so here's the new code:

include machine.e

global function get_key()
    sequence reg_list,read_list
    integer key

    if compare(peek({1050,2}),peek({1052,2})) then
        reg_list=repeat(0,10)
        reg_list[REG_AX]=#1000
        read_list=dos_interrupt(#16,reg_list)
        key=remainder(read_list[REG_AX],256)
        if key=224 or key=0 then
            return floor(read_list[REG_AX]/256)+256
        else
            return key
        end if
    else
        return -1
    end if
end function

Regards,
               Michael Bolin

new topic     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu