China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --

Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
DOS stands for freedom, openness and progress. Let us work hard, learn from the openness and GNU spirit of FreeDOS and Linux, and together build and grow a free GNU GPL world!

中国DOS联盟论坛
The time now is 2026-07-01 00:32
中国DOS联盟论坛 » DOS疑难解答 & 问题讨论 (解答室) » How to automatically turn on CapsLock in DOS View 1,654 Replies 7
Original Poster Posted 2006-12-11 22:11 ·  中国 广东 深圳 宝安区 电信
初级用户
Credits 34
Posts 13
Joined 2006-12-10 22:21
19-year member
UID 73132
Gender Male
Status Offline
How to automatically turn on Caps Lock in DOS? Num Lock can be configured in config.sys
Floor 2 Posted 2006-12-12 21:30 ·  中国 北京 朝阳区 联通
金牌会员
★★★★
Credits 2,902
Posts 1,147
Joined 2006-09-21 12:00
19-year member
UID 63324
Gender Male
Status Offline
The following post has the tool you need (this tool is only a few KB in size), which is to turn on the caps lock state and turn off the caps lock state.

(The tool can be downloaded on the 9th floor of the following post)
(It also contains the source code)
(Tested under MS-DOS 6.22 version)

Turn on the caps lock key when starting
http://www.cn-dos.net/forum/viewthread.php?tid=23973&fpage=1&highlight=%E5%A4%A7%E5%86%99
    Redtek,一个永远在网上流浪的人……

_.,-*~'`^`'~*-,.__.,-*~'`^`'~*-,._,_.,-*~'`^`'~*-,._,_.,-*~'`^`'~*-,._
Floor 3 Posted 2006-12-29 11:12 ·  中国 辽宁 锦州 联通
新手上路
Credits 16
Posts 8
Joined 2006-02-07 14:35
20-year member
UID 49981
Status Offline
I wrote a program with QuickBASIC to control the on and off of the keyboard indicators.
Floor 4 Posted 2007-01-02 23:36 ·  IANA 局域网IP(Private-Use)
初级用户
Credits 63
Posts 25
Joined 2006-12-24 03:33
19-year member
UID 74402
Gender Male
Status Offline
40:17 byte Keyboard flag byte 0 (see KB FLAGS)
|7|6|5|4|3|2|1|0| keyboard flag byte 0
| | | | | | | `--- right shift key depressed
| | | | | | `---- left shift key depressed
| | | | | `----- CTRL key depressed
| | | | `------ ALT key depressed
| | | `------- scroll-lock is active
| | `-------- num-lock is active
| `--------- caps-lock is active
`---------- insert is active

You can just use pokeb(0x40,0x17,0x40)
Recent Ratings for This Post ( 1 in total) Click for details
RaterScoreTime
redtek +5 2007-01-06 22:53
Floor 5 Posted 2007-01-05 10:38 ·  中国 广东 佛山 电信
新手上路
Credits 6
Posts 4
Joined 2006-10-19 09:42
19-year member
UID 66847
Status Offline
Floor 6 Posted 2007-01-06 13:46 ·  中国 湖北 武汉 电信
版主
★★★★★
Credits 11,386
Posts 4,938
Joined 2006-07-23 17:10
19-year member
UID 59080
Status Offline
Originally posted by hebecoco at 2007-1-2 10:36:
40:17 byte Keyboard flag byte 0 (see KB FLAGS)
|7|6|5|4|3|2|1|0| keyboard flag byte 0
| | | | | | | `--- right shift key depressed
| | | | | | `---- left shift key depres ...


How to use this?
Floor 7 Posted 2007-01-06 22:52 ·  中国 北京 东城区 联通
金牌会员
★★★★
Credits 2,902
Posts 1,147
Joined 2006-09-21 12:00
19-year member
UID 63324
Gender Male
Status Offline
At memory address 0040:0017, there is a byte that represents the current key state. This byte uses binary 1 or 0 to indicate the keyboard state.

0 means no on state, and 1 means on lock state.

If a key as shown in the information from Brother hebecoco on floor 4 is pressed, the shown address 0040:0017 will be rewritten by the interrupt routine to indicate the current key state.

Experiment:

Only the NumLock (numeric input state) light on the right small keyboard is on:
The 20H at memory address 0040:0017, converted to binary: 00100000
The 5th bit is 1 (true) indicating on, and the other bits are all 0.


-d 40:17
0040:0010 20-00 00 32 00 32 00 64 20
0040:0020 20 39 34 05 34 05 08 0E-30 0B 3A 27 31 02 37 08
0040:0030 0D 1C 00 00 00 00 00 00-00 00 00 00 00 00 00 00
0040:0040 AE 00 C3 00 00 00 00 00-00 03 50 00 40 1F 00 00
0040:0050 00 06 00 00 00 00 00 00-00 00 00 00 00 00 00 00
0040:0060 07 06 00 D4 03 29 30 00-00 00 00 00 EC 71 08 00
0040:0070 00 00 00 00 00 00 08 00-14 14 14 14 01 01 01 01
0040:0080 1E 00 3E 00 31 08 00 60-F9 11 0B 00 50 01 00 00
0040:0090 00 00 00 00 00 00 10

Then press the NumLock key on the right small keyboard again to turn off the numeric state (at this time the light is off)
00H in binary is: 00000000, all 0s, indicating not on.


-d 40:17
0040:0010 00-00 00 2E 00 2E 00 08 0E
0040:0020 08 0E 34 05 30 0B 3A 27-31 02 37 08 0D 1C 37 08
0040:0030 0D 1C 61 1E 08 0E 64 20-20 39 33 04 30 0B 00 00
0040:0040 F2 00 C3 00 00 00 00 00-00 03 50 00 40 1F 00 00
0040:0050 00 10 00 00 00 00 00 00-00 00 00 00 00 00 00 00
0040:0060 07 06 00 D4 03 29 30 00-00 00 00 00 A8 78 08 00
0040:0070 00 00 00 00 00 00 08 00-14 14 14 14 01 01 01 01
0040:0080 1E 00 3E 00 31 08 00 60-F9 11 0B 00 50 01 00 00
0040:0090 00 00 00 00 00 00 10

Then press the CapsLock key on the left keyboard to start the uppercase state, then the following is 40H,
In binary: 01000000 The 6th bit is 1, indicating the uppercase on state.

-D 40:17
0040:0010 40-00 00 1E 00 1E 00 08 0E
0040:0020 08 0E 34 05 30 0B 3A 27-31 02 37 08 0D 1C 44 20
0040:0030 20 39 34 05 30 0B 3A 27-31 02 37 08 0D 1C 00 00
0040:0040 53 00 C3 00 00 00 00 00-00 03 50 00 40 1F 00 00
0040:0050 00 1A 00 00 00 00 00 00-00 00 00 00 00 00 00 00
0040:0060 07 06 00 D4 03 29 30 00-00 00 00 00 47 7E 08 00
0040:0070 00 00 00 00 00 00 08 00-14 14 14 14 01 01 01 01
0040:0080 1E 00 3E 00 31 08 00 60-F9 11 0B 00 50 01 00 00
0040:0090 00 00 00 00 00 00 10


So finally use Debug

E 40:17 40


(Invalid under Windows CMD, valid under MS-DOS)

This command can directly rewrite the keyboard representation state of the byte at memory address 0040:0017.
And set the keyboard to the uppercase lock state: the 6th bit of the binary is 1, indicating the on function, then 01000000 in hexadecimal (for easy reading) is 40, so fill 40 into that memory address~:)

Brother hebecoco on floor 4 gave "pokeb(0x40.0x17,0x40)" which is the operation method in high-level languages. According to Brother hebecoco's detailed explanation on floor 4, it can be completed in high-level languages like C that can write and operate memory~:)
Recent Ratings for This Post ( 1 in total) Click for details
RaterScoreTime
lxmxn +10 2007-01-07 01:48
    Redtek,一个永远在网上流浪的人……

_.,-*~'`^`'~*-,.__.,-*~'`^`'~*-,._,_.,-*~'`^`'~*-,._,_.,-*~'`^`'~*-,._
Floor 8 Posted 2007-01-07 01:49 ·  中国 湖北 武汉 电信
版主
★★★★★
Credits 11,386
Posts 4,938
Joined 2006-07-23 17:10
19-year member
UID 59080
Status Offline

  Powerful, learned it.
Forum Jump: