From: Esra Sdrawkcab on 3 Feb 2010 11:45 On Wed, 03 Feb 2010 14:13:58 -0000, Ted Davis <tdavis(a)mst.edu> wrote: > On Tue, 02 Feb 2010 22:01:32 -0500, bobmct wrote: > >> Been using google for hours and hours. Does anyone know of or have a >> way >> to do this in a script file for Windows XP+? > > That rather depends on what you plan to do with the key and what keys you > need to trap. > > For the main part of the keyboard (the standard ASCII characters), one of > the shortest useful executables ever will wait for a keypress, then > return > the character number as ERRORLEVEL: getch.com at > http://gearbox.mst.edu/batch/debug.scripts.1.html > > It's an eight byte .COM program you create with DEBUG. Is that a challenge? get ala on it. I reckon it's currently longer at 12 bytes MOV AH,01 INT 16 JNZ 0108 XOR AL,AL MOV AH,4C INT 21 > > In more limited cases (limited choice of keys the user is forced to > choose from), CHOICE.EXE from MS is useful. > -- Nuns! Reverse!
From: Terence on 2 Mar 2010 21:52 On Feb 4, 3:45 am, "Esra Sdrawkcab" <ad...(a)127.0.0.1> wrote: > On Wed, 03 Feb 2010 14:13:58 -0000, Ted Davis <tda...(a)mst.edu> wrote: > > On Tue, 02 Feb 2010 22:01:32 -0500, bobmct wrote: > > >> Been using google for hours and hours. Does anyone know of or have a > >> way > >> to do this in a script file for Windows XP+? > > > That rather depends on what you plan to do with the key and what keys you > > need to trap. > > > For the main part of the keyboard (the standard ASCII characters), one of > > the shortest useful executables ever will wait for a keypress, then > > return > > the character number as ERRORLEVEL: getch.com at > >http://gearbox.mst.edu/batch/debug.scripts.1.html > > > It's an eight byte .COM program you create with DEBUG. > > Is that a challenge? get ala on it. > I reckon it's currently longer at 12 bytes > > MOV AH,01 > INT 16 > JNZ 0108 > XOR AL,AL > MOV AH,4C > INT 21 > > > > > In more limited cases (limited choice of keys the user is forced to > > choose from), CHOICE.EXE from MS is useful. > > -- > Nuns! Reverse! Well,it's not strictly accurate, because the jump should be relative. Also, this won't pick up F11 or F12 etc, nor some other key codes. And it is better to test for any key, any either return #FF or else get the key code if and only a key had been pressed. All these changes are available by using hex 16,17 or 18 as the contents of AH.
From: Terence on 4 Mar 2010 03:49 > On Feb 4, 3:45 am, "Esra Sdrawkcab" <ad...(a)127.0.0.1> wrote: Actually the codes for AH are #00,#01,#02, and #10,#11 which get/check F11,F12 etc and NOT #16 or #17 which should have been written without the hex prefix. Here's what I use (written to call from ASM or high-level code); but you just use #01 to check for a key and get #ff back if none, or #00 to wait for a key, but add #10 to get or test for the special keys on the keyboard like F11 and F12 and pad keys. Right now I'm doing a new version to work on the Mac in Vm Fusion mode (where there is no page up or page down, Home or End, nor insert, nor backspace and you usuallly have to disable the F6 to F11 shortcuts):- name INPC public INPC sinpc segment assume CS:sinpc INPC proc far ;I=INPC(0/1/2/16/17) PUSH BP ;0=WAIT, 1=CHECK, #10=WAIT EXTENDED CODE,#11=CHECK EXT MOV BP,SP;2=GET SHIFT STATUS TO AL LES BX,dword ptr [bp+6] MOV AH,ES:[BX] AND AX,1300H ; this is the core part start TEST AH,01H JZ INPC2;IF NOT WAIT INT 16H ;COPY BYTE AL, CODE AH JNZ INPC1;CODE IF ZERO FLAG OFF XOR AX,AX;NOTHING JMP SHORT INPC1 INPC2:INT 16H ;gets keyboard 2-byte code ; to here; the parts outside is MS standard stack control and clean-up INPC1:MOV SP,BP POP BP RET 4 INPC endp sinpc ends END
|
Pages: 1 Prev: clax FAQ list posting Next: D2007 does not do "multiplication illimination" optimization... |