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-06-24 11:41
中国DOS联盟论坛 » DOS汉化世界 & 中文系统 (中文化室) » Check register values to detect the startup status and display status of the direct screen writing Chinese character system View 2,537 Replies 1
Original Poster Posted 2005-12-22 12:31 ·  中国 江苏 苏州 电信
银牌会员
★★★
Credits 2,227
Posts 790
Joined 2005-01-27 00:00
21-year member
UID 35703
Gender Male
Status Offline
Check Register Values to Detect Direct Screen Writing Chinese Character System Startup Status and Chinese Character Display Status [Originally Created by!]

  Assuming that most people are currently using Chinese character systems that support direct screen writing (so CGA/MDA/HGA are no longer considered), it is relatively simple to think about detecting the existence of the Chinese character system (note: it refers to whether the Chinese character DOS is started, not whether Chinese characters can be displayed (such as pressing the Ctrl+F7 key to switch to the Western character state)) and whether the activation of the Chinese character display status.

  1. To support direct screen writing (now usually setting the graphics screen and then modifying the E/VGA register values to open the video buffer that was originally only available for the text screen, allowing writing to B800:0000h (or B000:0000h), that is, it looks like a text screen, but essentially it is still a graphics screen - also known as pseudo-character direct screen writing), it is necessary to modify the value of the mixed register with index 6 of the graphics controller port 3CEh to set the memory address to map to the corresponding address range of the host memory.

jzEnDos6: ;check Chinese Character System Status
mov dx,3CEh;Port 3C4/5h, EGA graphics controller index/function al=6, mixed register
mov al,06 ;Index number=6
out dx,al
inc dx ;dx=3CFh
in al,dx
mov ah,al
and al,00000001B ;Graphics enable bit
and ah,00001000B ;High bit of memory address selection bit: set to 1 to map to the text screen address of Bx00:0000h
not ah   ;Invert its value, set 1 to 0
or ah,al ;Concatenate
or ah,ah ;Not allowed to be graphics + set to 0?
;jz EnDos;jnz CcDos
ret

  2. To support the Chinese character prompt line to be positioned at the bottom of the screen, it is necessary to modify the value of the 18h line comparison register (accompanied by the 09h maximum scan line number register), the high and low bytes of the 0Ch/0Dh start address registers, etc., of the CRT controller 3D4/5h (or 3B4/5h).

jzEnDos18: ;check Chinese Character System Status
mov dx,3D4h;Port 3D4/5h, EGA CRT controller index/function al=18h, line comparison register
mov al,18h ;Index number=18h
out dx,al
inc dx ;dx=3D5h
in al,dx
cmp al,0FFh;=default value 0FFh?
;jz EnDos;jnz CcDos
ret

jzEnDosCD: ;check Chinese Character System Status
mov dx,3D4h;Port 3D4/5h, EGA CRT controller index/function al=0C/0Dh, high and low bytes of start address registers
mov cx,0C0Dh
mov al,ch ;Index number=0Ch
out dx,al
inc dx ;dx=3D5h
in al,dx ;Default value=0
mov ah,al
dec dx
mov al,cl ;Index number=0Dh
out dx,al
inc dx ;dx=3D5h
in al,dx ;Default value=0
or al,ah ;Concatenate
or al,al ;Both=default value 0?
;jz EnDos;jnz CcDos
ret

  3. To support direct screen writing, it is also necessary to modify the color plane write enable register 02h of the timing generator 3C4/5h. Because it is pseudo-character direct screen writing, when actually writing the character pattern to the screen, it is necessarily writing to the graphics video buffer, so the value of the color plane write enable register cannot be the value 3 when it is the text screen, but must be something else, which becomes a reliable judgment standard for whether it is in the Chinese character display status. - The same is true for non-direct screen writing Chinese character systems - it is originally graphics display.

jzEnDisp2: ;check Chinese Character Display Status
mov dx,3C4h;Port 3C4/5h, EGA timing generator index/function al=2, color plane write enable register
mov al,02 ;Index number=2
out dx,al
inc dx ;dx=3C5h
in al,dx
cmp al,03 ;Default value of text screen
;jz EnDisp;jnz CcDisp
ret

  Thinking about detecting the existence of the Chinese character system and the Chinese character display status in this way should be hitting the nail on the head.
  Please experts correct!
  Please everyone test and feedback information!
my major is english----my love is dos----my teacher is the buddha----my friends--how about U
Floor 2 Posted 2006-01-10 23:31 ·  中国 湖北 武汉 联通
高级用户
★★★
Credits 587
Posts 302
Joined 2005-07-25 17:31
20-year member
UID 41046
Gender Male
Status Offline
Solved many of my problems all at once...

In practice...
欢迎造访DOS的小屋!
http://risky.ik8.com
Forum Jump: