In this tutorial, I will show you one simple way to write source code for debug command.
Working with assembler is provides the opportunity of knowing more the operation of your PC.
Open a file with notepad, named YN.txt and fill with the source code below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | n YN.SCR a jmp 11b db 0d,0a,"APASA tasta Y sau N!",0d,0a,"$" mov ah,09 mov dx,0102 int 21 mov ah,08 int 21 cmp al,59 jz 140 cmp al,4e jz 159 jmp 162 db 0d,0a,"Ai apasat Y",0d,0a,"$" mov ah,09 mov dx,130 int 21 jmp 100 db 0d,0a,"Ai apasat N",0d,0a,"$" mov ah,09 mov dx,149 int 21 jmp 100 mov ax,4c00 int 21 rcx 0067 w q |
After that, save the file and run the command below.
1 | debug < YN.txt |
The output will be this:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | -n YN.SCR -a 138E:0100 jmp 11b 138E:0102 db 0d,0a,"APASA tasta Y sau N!",0d,0a,"$" 138E:011B mov ah,09 138E:011D mov dx,0102 138E:0120 int 21 138E:0122 mov ah,08 138E:0124 int 21 138E:0126 cmp al,59 138E:0128 jz 140 138E:012A cmp al,4e 138E:012C jz 159 138E:012E jmp 162 138E:0130 db 0d,0a,"Ai apasat Y",0d,0a,"$" 138E:0140 mov ah,09 138E:0142 mov dx,130 138E:0145 int 21 138E:0147 jmp 100 138E:0149 db 0d,0a,"Ai apasat N",0d,0a,"$" 138E:0159 mov ah,09 138E:015B mov dx,149 138E:015E int 21 138E:0160 jmp 100 138E:0162 mov ax,4c00 138E:0165 int 21 138E:0167 -rcx CX 0000 :0067 -w Writing 00067 bytes -q |
This will create an output with all debug commands and show us.
Let’s run the file YN.COM and we will see this.
1 2 3 4 5 6 7 8 9 10 11 12 | YN.COM APASA tasta Y sau N! Ai apasat Y APASA tasta Y sau N! Ai apasat N APASA tasta Y sau N! |
It’s a very simple program but the way is easy to use it.
The source code of this is a simple loop with some messages and DOS functions.