konopka@cbnewsk.att.com (raymond.konopka..jr) (03/04/91)
I have written an enhanced Change Directory command for DOS and I would like to call it cd, however, since 'CD' is already an internal command, command.com always executes the internal command. Is there any way to disable a DOS internal command, specifically 'CD'? Question #2: Is there any way to set the state of the NumLock key. I already know how to detect the state of the key, but what I really need to do is set it to be either on or off. Any help would be appreciated. Thanks in advance Ray Konopka konopka@ihlpm.att.com
levericw@cheetah.ece.clarkson.edu (Walden Leverich) (03/05/91)
> Path: clarkson!rpi!zaphod.mps.ohio-state.edu!pacific.mps.ohio-state.edu!linac!att!cbnewsl!cbnewsk!konopka > From: konopka@cbnewsk.att.com (raymond.konopka..jr) > Newsgroups: comp.os.msdos.programmer > Date: 4 Mar 91 15:13:01 GMT > Distribution: usa > Organization: AT&T Bell Laboratories > Lines: 15 > I have written an enhanced Change Directory command for DOS and I > would like to call it cd, however, since 'CD' is already an internal > command, command.com always executes the internal command. Is > there any way to disable a DOS internal command, specifically 'CD'? One alternative would be to run JP Software's 4DOS. It is a replacement for command.com and if you can swap to hard drive, EMS or XMS memory, takes as little as 4K of precious DOS memory. Remember this is a replacement for command.com, so this is not 4K additional, but rather about 25K less than command.com takes. As for why it is an alternative: You can tell 4DOS to disable any of its internal commands. The example they give is the disabling of their internal LIST command, so you can run your own LIST command. But he same thing should work with the CD command. Then just put CD.EXE (or .COM) in you path, and you should run you program when you type CD. Also, perhaps you could patch your copy of command.com and rename the CD internal command to something else. Then when command.com reads its internal list of commands, it will not find CD and therefore it will try to execute it as a program. I am not sure if this will work, I have not tried it. If you try it, make sure you have a *BACKUP* copy of command.com. > Question #2: > Is there any way to set the state of the NumLock key. I already know > how to detect the state of the key, but what I really need to do is > set it to be either on or off. Any help would be appreciated. You can read the status from BIOS, you may also be able to SET the status by playing with the settings in BIOS. (Obviously a RAM copy of BIOS.) Anyone on the net care to comment on the feasibility of this? I have not tried it myself, but would be interested in the answer. > Thanks in advance > Ray Konopka > konopka@ihlpm.att.com You are welcome in retrospect. -Walden -- --------------------------------------------------------------------------- Walden H. Leverich III | Inet: levericw@clutx.clarkson.edu ECE Dept. | CServ: 73237,2212 <- checked weekly Clarkson University | SnailMail: Software Solutions | PO Box 763 | Potsdam, NY 13676-0763 #include <std_disclamer_concerning_what_I_say> --------------------------------------------------------------------------
yawei@bronze.ucs.indiana.edu (mr. yawei) (03/05/91)
In article <1991Mar4.151301.12925@cbnewsk.att.com> konopka@cbnewsk.att.com (raymond.konopka..jr) writes: >I have written an enhanced Change Directory command for DOS and I >would like to call it cd, however, since 'CD' is already an internal >command, command.com always executes the internal command. Is >there any way to disable a DOS internal command, specifically 'CD'? Use any binary editor to search for the string 'CD' in COMMAND.COM, then replace it with something different. (I'd just replace it with lower case 'cd'.) A short string like 'CD' may generate multiple matches. In that case look at the vacinity of each match to determine which match is inside the internal command table. The right one should have all the other internal commands next to it. CD is a redundant command. After disabling it you can still use CHDIR. Keep a copy of COMMAND. Even if you do not make errors while patching, you still need a good copy to format floppy disks. Another way to execute a program on disk that bears the name of an internal command is to specify the path or part of the path. For example, "C:CD" will executes a program "CD" from drive C:. >Question #2: >Is there any way to set the state of the NumLock key. I already know >how to detect the state of the key, but what I really need to do is >set it to be either on or off. Any help would be appreciated. Just set or clear bit 20H at 0040:0017. Generally a bad idea, as it distroys the synchronization between the keyboard status lights and actual system status on many systems. >Thanks in advance You are welcome. Ya-Gui Wei
schanin@oracle.com (Steve Chanin) (03/06/91)
To get rid of the dos cd command, run a binary editor on command.com. Search for the string CD (in uppercase). You should find what looks like a table of all the dos builtin commands. Move to where CD is and change it to cd (lowercase). Save command.com. Reboot. Since DOS upcases commands before trying to match them against this table, changing CD to cd will prevent DOS matching the command and it will then look for cd.exe in your path. For the last few weeks, I've been running a version of 4.01 to which I applied this patch and haven't had any problems. Steve -- =============================================================================== DOMAIN: sbchanin@oracle.com Oracle Corporation USMAIL: Steven Chanin, 400 Oracle Parkway, Redwood Shores, CA 94065 PHONE : (415) 506-2864
data@buhub.bradley.edu (CS Major: LCMDR Data) (03/07/91)
In <LEVERICW.91Mar4113004@cheetah.ece.clarkson.edu> levericw@cheetah.ece.clarkson.edu (Walden Leverich) writes: >> Question #2: >> Is there any way to set the state of the NumLock key. I already know >> how to detect the state of the key, but what I really need to do is >> set it to be either on or off. Any help would be appreciated. >You can read the status from BIOS, you may also be able to SET the >status by playing with the settings in BIOS. (Obviously a RAM copy of >BIOS.) >Anyone on the net care to comment on the feasibility of this? I have >not tried it myself, but would be interested in the answer. I'm not 100% percent sure about this, I don't have my ASM manuals with me: If you flip the appropriate bit (in the keyboard status byte), when the keyboard interrupt executes, it checks that byte. That should effectively set the caps lock/numlock/scroll lock keys. This probably won't flip the light on the keyboard, but should work. Mark Hall CS Major at Bradley University (Gee, why is EVERYTHING a hack? =-) -- | I'nt: data@{bucs1,buhub,heartland}.bradley.edu, al632@cleveland.freenet.edu | |-----------------------------------------------------------------------------| | F'net : 1:232/28 1:2250/9 (fname.lname@f<node>.n<net>.z<zone>.fidonet.org) | |-----------------------------------------------------------------------------| | "He sees you when you're sleeping, he knows when you're awake, but Captain, | | it makes no sense!" "But Spock, with Santa, ALL things are possible!" | | Kirk and Spock...Hallmark Greeting Cards |
sidney@borland.com (Sidney Markowitz) (03/07/91)
In article <1991Mar6.233821.15345@bradley.bradley.edu> data@buhub.bradley.edu (CS Major: LCMDR Data) writes: >In <LEVERICW.91Mar4113004@cheetah.ece.clarkson.edu> levericw@cheetah.ece.clarkson.edu (Walden Leverich) writes: > >>> Question #2: >>> Is there any way to set the state of the NumLock key. I already know Here's what I use to turn off num-lock on a machine that doesn't give me the choice of initial num-lock state in the CMOS setup. You can enter this using DEBUG and save it as a num-off.com file to be run in your autoexec.bat. By the way, it takes care of the indicator light, too: 1E push ds 31C0 xor ax,ax 8ED8 mov ds,ax BE1704 mov si,0417 8A04 mov al,[si] 24DF mov al,0df ; change this mask for caps & scroll lock as well 8804 mov [si],al 1F pop ds CD20 int 20 If you turn this into a source file to be assembled, note that the numbers 0417, 0DF and 20 are in hex, and this starts with org 100h. -- sidney markowitz <sidney@borland.com>
hollen@megatek.UUCP (Dion Hollenbeck) (03/08/91)
In article <LEVERICW.91Mar4113004@cheetah.ece.clarkson.edu> levericw@cheetah.ece.clarkson.edu (Walden Leverich) writes: > > Question #2: > > Is there any way to set the state of the NumLock key. I already know > > how to detect the state of the key, but what I really need to do is > > set it to be either on or off. Any help would be appreciated. > > You can read the status from BIOS, you may also be able to SET the > status by playing with the settings in BIOS. (Obviously a RAM copy of > BIOS.) > This is indeed true, but the trouble here is that although you can change the status of the bit representing the NUNLOCK key, you cannot affect the state of the LED by doing this. Maybe someone could post how to set the LED's. I believe this is by writing a command to the keyboard controller, but I am not sure. I am fairly sure that this is not a BIOS service, but a write to an IO port with command and new value. -- ----- Dion Hollenbeck (619) 455-5590 x2814 Megatek Corporation, 9645 Scranton Road, San Diego, CA 92121 uunet!megatek!hollen or hollen@megatek.uucp
valley@uchicago (Doug Dougherty) (03/12/91)
sguerke@brahms.udel.edu (Stephen Guerke) writes: >You can create a small file called NUMOFF.COM by using an ASCII editor >(even EDLIN :)) and typing the following DEBUG script: >(Line numbers included for reference) >1: a 100 >2: mov ax,40 >3: mov ds,ax >4: mov ah,0 >5: mov bx,0017 >6: mov [bx],ah >7: int 20 >8: >9: r cx >10:e >11:n numoff.com >12:w >13:q >carefully proofread the above file (being sure that line 8 is blank >and that line 13 is q) and save it as NUMOFF.SCR . >To create NUMOFF.COM , at the prompt (be sure that the directory >containing DEBUG.COM in in your PATH) type the following command: > C> debug < numoff.scr >This should (it did for me when I used it :)) create a little program >named NUMOFF.COM. Put it in your autoexec.bat file and it will turn >off the Number Lock key and its light. It will only do the light if you have an AT (or better) type keyboard.
dougs@videovax.tv.tek.com (Doug Stevens) (03/13/91)
> In <LEVERICW.91Mar4113004@cheetah.ece.clarkson.edu> levericw@cheetah.ece.clarkson.edu (Walden Leverich) writes: > > >> Is there any way to set the state of the NumLock key. I already know > >> how to detect the state of the key, but what I really need to do is > >> set it to be either on or off. Any help would be appreciated. > Here's what I use (it turns off the light on my machines, too): #define KEYBD_STATUS_BYTE ((char far *)0x00400017L) #define NUM_LOCK_MASK 0x20 void main(void) { *KEYBD_STATUS_BYTE &= ~NUM_LOCK_MASK; } (obviously, it can be made smaller in asm language, but I wanted something quick and dirty).