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-31 21:55
中国DOS联盟论坛 » DOS开发编程 & 发展交流 (开发室) » [Original] DouDiZhu Script Technical Preparation - Color Output SYBC.com View 5,306 Replies 19
Original Poster Posted 2010-02-28 18:39 ·  中国 北京 联通
中级用户
★★
Credits 499
Posts 225
Joined 2008-12-30 22:09
17-year member
UID 135392
Gender Male
Status Offline
I'm working hard to develop a CMD version of Dou Di Zhu (Chinese poker), and there are many technical preparations to do.
Because I plan to use a full-color game interface, so I need a small COM to output colored characters.
Initially, I used tit.com, and then developed sybc.com based on it.
And used sybc.com to write a series of sample codes.
Currently, the complete interface of Dou Di Zhu can be realized with sybc.com.
The game code and version 1.1.11 of sybc are on floor 6
The latest version 1.1.21 is on floor 9
The latest version 1.1.31 is on floor 12

Recruiting experts and novices to join the development together QQ group: 3401238
http://www.cn-dos.net/forum/viewthread.php?tid=50331&fpage=1

[ Last edited by sl543001 on 2010-4-3 at 03:23 ]
Attachments
sybc.rar (1.06 KiB, Downloads: 64)
sybc参数详解.gif
ddz59.GIF
SYBNQQ:354324773
Floor 2 Posted 2010-02-28 19:53 ·  中国 云南 昆明 电信
新手上路
Credits 7
Posts 3
Joined 2010-02-26 00:47
16-year member
UID 161200
Gender Male
Status Offline
Hope to see V1.0 soon.
Floor 3 Posted 2010-03-01 11:20 ·  中国 北京 联通
中级用户
★★
Credits 499
Posts 225
Joined 2008-12-30 22:09
17-year member
UID 135392
Gender Male
Status Offline
Modified and updated the code, slightly modified the grammar, and changed the screenshot to a playing card!
SYBNQQ:354324773
Floor 4 Posted 2010-03-01 11:28 ·  中国 北京 联通
中级用户
★★
Credits 499
Posts 225
Joined 2008-12-30 22:09
17-year member
UID 135392
Gender Male
Status Offline
The code used to display a column of playing cards in the screenshot of floor 1:
set a=a0=$fcA;a1=$fcA;a2=$fc2;a3=$fc3;a4=$fc4;a5=$fc5;a6=$fc6;a7=$fc7;a8=$fc8;a9=$fc9;a10=$fc10;a11=$fcJ;a12=$fcQ;a13=$fcK;a14=$fcS;a15=$fcY;a16=$fcB;a17=$fcN
set p%a:;=&set p%
cls
for /l %%a in (0,1,17) do set /a wz=11800+%%a*4&&(if %%a gtr 2 if %%a lss 8 set /a wz=!wz!-100)&&call :pa !wz! !pa%%a! ◆
pause
exit
:pb
call s7.com %1f1┏━━━━┓;$f1┃╳╳╳╳┃;$f1┃╳SYBN╳┃;$f1┃╳╳╳╳┃;$f1┃╳2010╳┃;$f1┃╳╳╳╳┃;$f1┗━━━━┛
goto :eof
:pa
call s7.com %1f1┏━━━━┓;:┃%2   $f1┃;:┃%3 斗  ┃;:┃  地  ┃;:┃  主 %2$f1┃;:┃   %3┃;:┗━━━━┛
goto :eof
SYBNQQ:354324773
Floor 5 Posted 2010-03-02 17:44 ·  中国 北京 联通
中级用户
★★
Credits 499
Posts 225
Joined 2008-12-30 22:09
17-year member
UID 135392
Gender Male
Status Offline
Is planning to modify the parameter entry and calling method, breaking through the 124 parameter limit
SYBNQQ:354324773
Floor 6 Posted 2010-03-04 12:01 ·  中国 北京 联通
中级用户
★★
Credits 499
Posts 225
Joined 2008-12-30 22:09
17-year member
UID 135392
Gender Male
Status Offline
The plan to modify the parameter entry is postponed to be solved in the sybn Dll. Currently, a new method is found to solve the problem. In the new version of sybc, the meanings of ";:" and ";" in the parameters are swapped. Because the usage rate of the original ";:" is higher than that of ";", so a little code is saved. Just finished changing the color of the number at the lower right corner.

The斗地主 script used in the screenshot
Can only be looked at, still cannot be played.

[ Last edited by sl543001 on 2010-3-4 at 12:18 ]
Attachments
ddz.rar (1.68 KiB, Downloads: 22)
SYBNQQ:354324773
Floor 7 Posted 2010-03-04 14:33 ·  中国 北京 中电华通通信有限公司
高级用户
★★★
据说是李先生
Credits 609
Posts 400
Joined 2008-04-23 15:55
18-year member
UID 116706
Gender Male
Status Offline
.......

Oh, different lines are like different mountains. I don't understand it, and there's no chance to learn assembly anymore. I can only support it spiritually
┏━━━━━━┓
┃据说是李先生┃
┠──────┨
┃*ntRSS┃
┗━━━━━━┛
Floor 8 Posted 2010-03-06 09:56 ·  中国 北京 联通
中级用户
★★
Credits 499
Posts 225
Joined 2008-12-30 22:09
17-year member
UID 135392
Gender Male
Status Offline
No need to understand the principle, just be able to use it.
I will release the DEBUG version when sybc is developed to a certain extent.
At that time, the full-color output without third parties can be realized!
SYBNQQ:354324773
Floor 9 Posted 2010-03-06 16:38 ·  中国 北京 联通
中级用户
★★
Credits 499
Posts 225
Joined 2008-12-30 22:09
17-year member
UID 135392
Gender Male
Status Offline
The new version sybc 1.1.21 already supports the choice function. The method is to run it without adding any parameters.

Now release the debug version of sybc to generate code:
SET SYBCOM=A100;80BE AC00 23C 5472 3CAC 7501 BE13 282;0EEB 3CAC 743A 3C09 740D 8347 1EE 46EB;E8AC 90 A2E8 3C00 7F18 8837 E8C6 84;96E8 3C00 7F4F 882B B0C2 F602 50E2 A0B0;E6F6 15F 57C7 3CAC 7424 E80A 67 45E8;8800 EBD1 E817 3B D188 10EB B0 16CD;E088 4CB4 21CD 815F A0C7 5700 B850 B800;0750 295A 88F5 ACCA 243C D974 3B3C 9274;0D3C DE74 233C 575 D783 EB01 AA01 D088;EBAA E8E4 1E C387 393C 27E 904 FB80;7E39 8003 9C3 F24 E380 B20F F610 E2;88D8 C3C2 3CAC 7420 3CFB 740D 88A5 ACC3;203C F074 D3C 9A74 87C3 2CC3 8030 30EB;0AB4 E4F6 D800 C3
SET V=;RCX;D7;N SYBC.COM;W;Q
(ECHO.%SYBCOM:;=&ECHO.DW %&ECHO.%V:;=&ECHO.%)|DEBUG>NUL


[ Last edited by sl543001 on 2010-3-6 at 16:40 ]
Attachments
ddz59.GIF
SYBNQQ:354324773
Floor 10 Posted 2010-03-20 15:19 ·  中国 河北 廊坊 联通
中级用户
★★
Credits 499
Posts 225
Joined 2008-12-30 22:09
17-year member
UID 135392
Gender Male
Status Offline
Because SYBC is designed to be embedded in scripts, you can release it from the script to memory directly instead of generating the SYBC.COM file on the disk. It can also be run in memory. Of course, if you want, it can also be used like a general third-party tool.

Well, everyone first needs screenshots and download addresses. The screenshots are below, which are real pictures of the cmd script! As for the download address, since it is embedded, why download it? Just save the following code as a cmd and run it to generate SYBC.com (this code version 1.1.21, update date 2010-3-10)
SET SYBCOM=A100;80BE AC00 23C 5472 3CAC 7501 BE13 282;0EEB 3CAC 743A 3C09 740D 8347 1EE 46EB;E8AC 90 A2E8 3C00 7F18 8837 E8C6 84;96E8 3C00 7F4F 882B B0C2 F602 50E2 A0B0;E6F6 15F 57C7 3CAC 7424 E80A 67 45E8;8800 EBD1 E817 3B D188 10EB B0 16CD;E088 4CB4 21CD 815F A0C7 5700 B850 B800;0750 295A 88F5 ACCA 243C D974 3B3C 9274;0D3C DE74 233C 575 D783 EB01 AA01 D088;EBAA E8E4 1E C387 393C 27E 904 FB80;7E39 8003 9C3 F24 E380 B20F F610 E2;88D8 C3C2 3CAC 7420 3CFB 740D 88A5 ACC3;203C F074 D3C 9A74 87C3 2CC3 8030 30EB;0AB4 E4F6 D800 C3
SET V=;RCX;D7;N SYBC.COM;W;Q
if not exist sybc.com (ECHO.%SYBCOM:;=&ECHO.DW %&ECHO.%V:;=&ECHO.%)|DEBUG>NUL

-------------------------------------------------------------------------------
Well, now everyone should have the SYBC.com file. If not, generate one.
The next question is how to use SYBC. SYBC has two types of grammars: basic and advanced (the two only differ in speed, and the final effects are the same). It can be run in the form of the SYBC.com file or directly in memory (the latter is slightly faster).
-------------------------------------------------------------------------------
Before using SYBC, initialization is required (especially for Win2000/XP).
The initialization method is very simple. First, if you want to use Chinese, you need to add ""(CHCP 437 &GRAFTABL 936)>NUL" at the beginning of your code. Then you need to run SYBC without parameters once, and the initialization is completed after the user presses any key.:
(There is no prompt, so it is recommended that everyone better use echo to inform the user to press any key)
-------------------------------------------------------------------------------
Basic grammar:
SYBC positioncolorcontent
SYBC 10303$F1SYBN#s
Position: 5-digit number, the 2nd and 3rd digits are the row number, and the 4th and 5th digits are the column number
Color: 2 hexadecimal numbers preceded by $, the same as the color command
Content: Any string (note that do not use $#; three symbols to avoid conflicts)
#number: No content, keep the original content of this position and only change the color
$number: Allow multiple $numbers, respectively control the color of the following characters
-------------------------------------------------------------------------------
Using the basic grammar can achieve all the effects of SYBC.
If you feel that the speed is not satisfactory, you can use the advanced grammar, combine multiple lines of basic grammar into one line of advanced grammar to reduce the number of calls to speed up. No matter which grammar is used, the time for each call to SYBC is about 0.01 seconds, and the bottleneck is the response speed of the hard disk. In addition, using the embedded call, skipping the disk and directly running SYBC can further improve the speed, but the code readability will be sacrificed.
-------------------------------------------------------------------------------
Advanced grammar:
[Grammar diagram example 3]
SYBC 10303$F1SYBN;2010
The effect is the same as
SYBC 10303$F1SYBN
SYBC 10403$F12010
Semicolon is a line break character, and you can start a new line from the starting column of the previous line.
If you do not use a line break character and write a very long string, it will naturally wrap like echo.

[Grammar diagram example 4]
SYBC 10303$F1SYBN;:10401$F12010
The effect is the same as
SYBC 10303$F1SYBN
SYBC 10401$F12010
Semicolon colon: The effect is similar to the & symbol in the script, which can connect two SYBC commands together.
In this way, you can almost combine all consecutive SYBC commands into one line, and the speed will be much faster.
--------------------------------------------------------------------------------
However, everyone should pay attention that the parameters of the com program have a length limit.
The theoretical length is 127, and the actual available length is 124. If it exceeds 124, it cannot be executed! Of course, if you use the subsequent embedded call, there is no such limit!
--------------------------------------------------------------------------------
Embedded call:
It is convenient to call the com program using DEBUG. The SYBC.com generated earlier used DEBUG. We just need to modify it slightly to be used for embedded calls.
First, save the code of SYBC.com in the variable SYBCOM in hexadecimal form
SET SYBCOM=A100;80BE AC00 23C 5472 3CAC 7501 BE13 282;0EEB 3CAC 743A 3C09 740D 8347 1EE 46EB;E8AC 90 A2E8 3C00 7F18 8837 E8C6 84;96E8 3C00 7F4F 882B B0C2 F602 50E2 A0B0;E6F6 15F 57C7 3CAC 7424 E80A 67 45E8;8800 EBD1 E817 3B D188 10EB B0 16CD;E088 4CB4 21CD 815F A0C7 5700 B850 B800;0750 295A 88F5 ACCA 243C D974 3B3C 9274;0D3C DE74 233C 575 D783 EB01 AA01 D088;EBAA E8E4 1E C387 393C 27E 904 FB80;7E39 8003 9C3 F24 E380 B20F F610 E2;88D8 C3C2 3CAC 7420 3CFB 740D 88A5 ACC3;203C F074 D3C 9A74 87C3 2CC3 8030 30EB;0AB4 E4F6 D800 C3
Then save the DEBUG instructions in the variable V
SET V=;A80;DB 10 00 "10303$F1SYBN2010" 0D;;RCX;F0;G;Q
Note that 10 refers to the hexadecimal value of the parameter length. In version 1.1.21, it is no longer used, so just write it as it is or write other hexadecimal values.
"10303$F1SYBN2010" is the parameter. Remember to add colons on both sides. The parameter length limit here is about 65 bytes.
Finally, call them
(ECHO.%SYBCOM:;=&ECHO.DW %&ECHO.%V:;=&ECHO.%)|DEBUG>NUL
---------------------------------------------------------------------------------------------------------
Of course, you still haven't broken through the 124 parameter limit, but instead the limit is reduced to about 65 bytes.
How to break through the limit? Modify the value of variable V.
SET V=;A80;DB 10 01;; A280;DB 10 00 "10303$F1SYBN";DB "2010-";DB "3-16" 0D;;RCX;F0;G;Q
You don't need to care why it is written like this. Just know that you can segment the parameters, each segment is less than 65 bytes, and write it in quotes.
You can write infinitely many DB "XXXXXXXX". Note that the last one should be added with 0D, and don't forget the space before 0D.

For problems, contact QQ: 354324773
SYBNQQ:354324773
Floor 11 Posted 2010-03-31 18:50 ·  中国 河北 廊坊 联通
中级用户
★★
Credits 499
Posts 225
Joined 2008-12-30 22:09
17-year member
UID 135392
Gender Male
Status Offline
The latest SYBC 1.1.31 supports directly reading variables in memory as program parameters. It greatly improves the usage efficiency, and the display time for the same content is reduced by more than one third. Take斗地主 (Dou Di Zhu, a card game) as an example: the refresh time is reduced from 48 to 27. SYBC 1.1.31 is being tested...
Attachments
ddz61.GIF
SYBNQQ:354324773
Floor 12 Posted 2010-03-31 18:57 ·  中国 河北 廊坊 联通
中级用户
★★
Credits 499
Posts 225
Joined 2008-12-30 22:09
17-year member
UID 135392
Gender Male
Status Offline
### Version 1.1.31 Memory Call Module Demo Code
Insert the content after SYBC into the script. After initialization, you can use "call :SYBC parameter"
The parameter can be almost infinitely long, as long as it does not exceed 64K (it's difficult to make the parameter exceed 64K anyway)

@ECHO Off&SETLOCAL ENABLEDELAYEDEXPANSION&SET SYBNV=0.0.2
:SYDLL
call :SYBA
call :SYBC 103003e completely non-third-party color output example module demo code, the above is the effect display; all the content you see is output with completely non-third-party color single-line code; everyone needs to initialize before using SYBC, execute SYBC without parameters once, or execute the code in label SYBA; labels SYBC and SYBCC need to be placed continuously, and the position relationship cannot be changed; everyone just needs to insert the content after label SYBC into their own script; after initialization, use the form to call SYBC without third parties; the parameter limit length of the example code is 700 bytes; if there are special needs, you can modify the variable V to expand the parameter limit; :10000$f0 :::│$fC product$f9 Left of computer $f00 $f2+0$fC=$f00 $f0│$fC  Landlord V0.0  $f0│$f0 $f0│ Bottom cards │::: ;:10100$f0 ::│$fC score$f9 Right of computer $f00 $f2+0$fC=$f00 $f0│$f9 Development: SYBN NETBENTON PLP $f0│$f9 Left of computer $f0│ │:: ;:10200$f0 :│$fC ranking$f9 Player SYBN $f00 $f2+0$fC=$f00 $f0│$f22010-3-20  Press F1 to view help$f0│$fD Bid 3 points $f0│ │: ;
pause>nul
exit
:SYBA
(CHCP 437 &GRAFTABL 936)>NUL
ECHO {SYBN DLL %SYBNV% } Contains SYBC 1.1.31 initialization, press any key to continue...
(echo a100&echo db B8 00 00 cd 16 cd 20&echo.&echo.rcx&echo.7&echo.g&echo.q)|DEBUG>NUL
GOTO :EOF
:SYBC
SET SYBCOM=A100`80BE AC00 3C 375 83E9 3C00 ACFF 4275`2CBE AC00 E08A 86AC 50C4 BE1F 0 3CAC`7553 ACFB 593C F675 3CAC 7542 ACF1 433C`EC75 3CAC 7553 ACE7 3D3C E275 14EB 3CAC`743A 3C0F 740D 3C4D 7400 8349 1EE 48EB`54B4 E8AC 93 ADE8 3C00 7F18 8A37 E8F0`87 A1E8 3C00 7F4F 8A2B B0D0 F602 50E2`A0B0 E6F6 35F 57F8 3CAC 7424 E80A 6A`49E8 8A00 EBCA E817 3F CA8A 10EB B0`16CD C48A 4CB4 21CD 815F A0C7 5700 B850`B800 750 2B5A 8AEE ACD1 243C D974 3B3C`8C74 D3C DE74 3C DA74 233C 575 D783`EB01 AA01 C28A EBAA E8E0 1D 3C93 7E39`402 8009 39FB 37E C380 2409 800F FE3`10B2 E2F6 C302 D08A ACC3 203C FB74 D3C`A274 3C 9E74 D88A 3CAC 7420 3CEC 740D`3C93 7400 C38F 2C93 8030 30EB AB4 E4F6`C302 C3`
set SYBCS=%*
SET V=`A80`DB FF``RCX`120`g`Q
(ECHO.%SYBCOM:`=&ECHO.DW %&ECHO.%V:`=&ECHO.%)|DEBUG>nul
goto :EOF


[ Last edited by sl543001 on 2010-3-31 at 19:00 ]
SYBNQQ:354324773
Floor 13 Posted 2010-04-03 03:25 ·  中国 河北 廊坊 联通
中级用户
★★
Credits 499
Posts 225
Joined 2008-12-30 22:09
17-year member
UID 135392
Gender Male
Status Offline
1.1.31 preliminary test found no BUG, and is planning to add new functions: mouse support, delay
SYBNQQ:354324773
Floor 14 Posted 2010-04-18 23:09 ·  中国 河北 廊坊 联通
中级用户
★★
Credits 499
Posts 225
Joined 2008-12-30 22:09
17-year member
UID 135392
Gender Male
Status Offline
Floor 15 Posted 2010-04-19 21:28 ·  中国 河北 廊坊 联通
中级用户
★★
Credits 499
Posts 225
Joined 2008-12-30 22:09
17-year member
UID 135392
Gender Male
Status Offline
Line-by-line comment on part of the assembly source code:
;sybc 16-bit color character output based on x86 v 1.1.32
;Parameter list:
;1. No parameters
; Example: sybc
; Call: When called from the command line without additional parameters or when the 0080 data is "00" when called by debug, the choice function is enabled.
; Function: Pause the command line and wait for the user to press a keyboard key. It is ineffective for shift and other keys, but effective for keys like esc, f1, space, enter, etc.
; Technology: In the , interrupt 15 is called, and al = ah, and it exits and returns al to erroelrvrer.
;2. Standard mode
; Example: sybc 10000$f1sybn$f22010 sybc 10000$f1sybn;$f22010;:10308f4sybn
; set v=`a80`db 10 0d "%sybcc%" 0d``rcx`ff`g`q
; (echo.%sybcom:`=&echo.dw %&echo.%v:`=&echo.%)|debug>nul
; Call: When called from the command line with parameters or when the 0080 of the debug call is not "00" and 0081 is not "01", it is enabled.
; Function: Output on one line (without semicolon) or multiple lines (with semicolon) or at non-consecutive positions (with semicolon colon).
; Technology: First, read a coordinate information (read 5 bytes),
; Then read a color information a dollar sign plus 2 bytes of color information. Here, the dollar sign can be omitted.
; Then read the data and output it to the b800 display buffer with the previous color information, so as to display it on the character interface.
; Until a control character is encountered. The control characters are:
; {24 "$"} color marker. When the program encounters the , it jumps to , reads 2 bytes of color information. Only the that is immediately followed by the coordinate information can be omitted.
; {3b ";"} line feed marker. When the program encounters the , it jumps to , then line feed, unless used in conjunction with {3a ":"}.
; {23 "#"} skip marker. When the program encounters the , it adds 1 to di, so as to reserve a character, only change the color, and do not modify the original content at the position of #.
; {0d " "} end marker. When the program encounters the , it ends the program.
; {3a ":"} start marker. Only effective when used in conjunction with , jumps to , reads a new coordinate color information to execute, can be used to connect 2 sybc commands.
; Note: In theory, ";:" can connect sybc infinitely, but the parameter length is limited to 124.
;3. Debug exclusive mode
; Example: set v=`a80`db ff``a282`db "%sybcc:~0,75%"`db "%sybcc:~75,75%"`db "%sybcc:~150,75%"`db "%sybcc:~225,75%"`db 0d``rcx`ff`g`q
; (echo.%sybcom:`=&echo.dw %&echo.%v:`=&echo.%)|debug>nul
; Call: Only for debug call, write ff in the 0080 position, and write parameters in the 0282 position, so as to skip the 124 parameter limit. The parameter limit of the example code is extended to 300.
; Technology: When reading, if 0080 = ff, then the parameter entry is modified to 0282. It is impossible to have 0080 = ff in normal call.
; Note: If needed, the example code can be modified to further extend the parameter limit.

mov si,0080 ; Set SI = 0080 Modify pointer address to 0080 Parameter entry
mov DX,0000 ; Set DX = 0000
lodsb ; Read data from DS:SI pointer address to AL At this time, SI = 0080
mov ah,al ; Set AH = AL AL = data read from 0080
lodsb ; Read data from DS:SI pointer address to AL At this time, SI = 0081
lodsb ; Read data from DS:SI pointer address to AL At this time, SI = 0082
mov BL,al ; Set BL = AL AL = data read from 0082
cmp ah,00 ; Compare Ah value and 0 At this time Ah = value of 0080
jz #TOchoice ; Jump to label TOchoice if equal To get keyboard input
cmp ah,ff ; Compare Ah value and FF At this time Ah = value of 0080
mov si,0082 ; Modify pointer address to 0082 Skip 0081
jnz #hqzb ; Jump to label hqzb if not equal Get output coordinates
mov si,002c ; Set SI = 0080 Modify pointer to 002c Memory variable segment address
lodsb ; Read data from DS:SI pointer address to AL At this time, SI = 002c
mov ah,al ; Set AH = AL AL = read data
lodsb ; Read data from DS:SI pointer address to AL At this time, SI = 002d
xchg al,ah ; Exchange AL and AH
push ax ; Push data onto the stack AX is pushed onto the stack
pop ds ; Pop data from the stack DS = AX from the previous line
mov si,0000 ; Set SI = 0080 Modify pointer to 0000 Because we need to search for variables from the beginning of the memory variable segment
#SSBL
lodsb ; Read data from DS:SI pointer address to AL
cmp al,53 ; Compare Al and 53 53 = "S"
jnz #SSBL ; Jump to label SSBL if not equal
lodsb ; Read data from DS:SI pointer address to AL
cmp al,59 ; Compare Al and 59 53 = "Y"
jnz #SSBL ; Jump to label SSBL if not equal
lodsb ; Read data from DS:SI pointer address to AL
cmp al,42 ; Compare Al and 42 53 = "B"
jnz #SSBL ; Jump to label SSBL if not equal
lodsb ; Read data from DS:SI pointer address to AL
cmp al,43 ; Compare Al and 43 53 = "C"
jnz #SSBL ; Jump to label SSBL if not equal
lodsb ; Read data from DS:SI pointer address to AL
cmp al,53 ; Compare Al and 53 53 = "S"
jnz #SSBL ; Jump to label SSBL if not equal
lodsb ; Read data from DS:SI pointer address to AL
cmp al,3d ; Compare Al and 3d 53 = "="
jnz #SSBL ; Jump to label SSBL if not equal
jmp #hqzb ; Jump unconditionally to label hqzb If the above conditions are met, get output coordinates
#TOchoice
JMP #choice ; Jump unconditionally to label choice Conditional addressing is short addressing, can't reach choice, can only use JMP to transfer
;Processing after encountering semicolon
#wz
lodsb ; Read data from DS:SI pointer address to AL
cmp al,3a ; Compare Al and 3a 3a = ":"
jz #hqzb ; Jump to label hqzb if equal For :, read new coordinates
cmp al,0d ; Compare Al and 0d OD = end character
jz #quit ; Jump to label quit if equal For end character, end
cmp al,00 ; Compare Al and 0 3a = empty
jz #quit ; Jump to label quit if equal For end character, end
sub si,01 ; Set SI minus 1
jmp #xhn ; Jump unconditionally to label XHN Others, line feed and continue
;Read coordinate information, store in di
#hqzb
lodsb ; Read data from DS:SI pointer address to AL Skip one character
; Some content will be added here in the future
call #DQ2SJ ; Call subroutine DQ2SJ Read 2 data
call #ZH10JZ ; Call subroutine ZH10JZ Convert to decimal
cmp al,18 ; Compare Al and 18 AL is the just obtained row number
jg #quit ; Jump to label QUIT if greater than If the row number exceeds 24, end
mov dh,al ; Set DH = AL Save row number to DH
call #DQ2SJ ; Call subroutine DQ2SJ Read 2 data
call #ZH10JZ ; Call subroutine ZH10JZ Convert to decimal
cmp al,4f ; Compare Al and 4f AL is the just obtained column number
jg #quit ; Jump to label QUIT if greater than If the row number exceeds 80, end
mov dl,al ; Set DL = AL Save column number to DL
;Convert row and column coordinates from DH and DL to memory address and save to DI
#ZBZH
mov al,02 ;
mul dl ;
push ax ;
mov al,a0 ;
mul dh ;
pop di ;
add di,ax ;
push di ;
;Read color information
#dcx
lodsb ; Read data from DS:SI pointer address to AL
cmp al,24
jz #color ; For $, skip and read again
call #DQ2SJ0 ; If not $, read normally
call #dc0
mov cl,dl
jmp #dwz
#color
call #dc
mov cl,dl
jmp #dwz
;Choice function
#choice
mov al,0
int 16
mov al,ah
;Quit
#quit
mov ah,4c
int 21
;Line feed and continue from original starting point
#xhn
pop di
add di,a0
push di
;Locate character output position
#dwz
push ax
mov ax,b800
push ax
pop es
pop dx
sub bp,si
mov dl,cl
;Write data
#xr
lodsb ; Read data from DS:SI pointer address to AL
cmp al,24
jz #color ; For $, read new color information
cmp al,3b
jz #wz ; For ;, end, execute from the beginning again
cmp al,0d
jz #quit ; For end character, end
cmp al,0
jz #quit ; For end character, end
cmp al,23
jnz #xr2 ; For #, then
adc di,1
jmp #xr3
#xr2
stosb ; Write one data
#xr3
mov al,dl
stosb ; Write color information
jmp #xr
;Read 2 bytes of character content, convert to color information
#dc
call #DQ2SJ
#dc0
xchg ax,bx
cmp al,39
jle #dc1
add al,9
#dc1
cmp bl,39
jle #dc2
add bl,9
#dc2
and al,0f
and bl,0f
mov dl,10
mul dl
add al,bl
mov dl,al
ret
;Read 2 bytes of content
#DQ2SJ
lodsb ; Read data from DS:SI pointer address to AL
#DQ2SJ0
cmp al,20
jz #DQ2SJ
cmp al,0d
jz #quit ; For end character, end
cmp al,0
jz #quit ; For end character, end
mov bl,al
#DQ2SJ1
lodsb ; Read data from DS:SI pointer address to AL
cmp al,20
jz #DQ2SJ
cmp al,0d
jz #quit ; For end character, end
cmp al,0
jz #quit ; For end character, end
ret
;10进制 character to hexadecimal digit
#ZH10JZ
xchg ax,bx
sub al,30
sub bl,30
mov ah,0a
mul ah
add al,bl
ret
SYBNQQ:354324773
Forum Jump: