1. Create a DEBUG script file using any available editor or word processing software, for example, DOS Edit. Enter the lines below and save the file as "COVER.SCR" in the C:\SCRATCH subdirectory. If such a subdirectory does not exist, create it by issuing the command: "MD SCRATCH", then set the default path to it using the command: "CD C:\SCRATCH". You do not have to enter the comments. When executed, this program waits for a keystroke and then fills the screen with that character.
A 100
MOV BH,0
;SET PAGE NO. FOR INT 10
MOV DX,0
;ROW AND COL FOR VIDEO DISPLAY OF INT 10
MOV AH,2
;DESIGNATE SERVICE 2 OF INT 10
INT 10
;SET CURSOR TO 0,0 (TOP LEFT CORNER)
MOV AH,8
;DESIGNATE SERVICE 8 OF INT 21
INT 21
;KEYBD INPUT W/O ECHO, PLACE IN AL
MOV CX,7D0
;LOAD NUM CHAR=2000D TO CX FOR WRITING ,INT 10
MOV AH,A
;SERVICE A OF INT 10
INT 10
;WRITE CHARACTER IN REG. AL CX TIMES
JMP 105
;RETURN AND REPEAT- INFINITE LOOP
<blank line> <----
insert a blank line in the file
R CX
16
N C:\SCRATCH\COVER.COM
W
Q
<enter> <----
press the "Enter" key
To create the executable DEBUG program, COVER.COM, enter "DEBUG <C:\SCRATCH\COVER.SCR" at the DOS prompt. At this point, the assembled code has been stored as COVER.COM in the C:\SCRATCH subdirectory. To see the assembly code, invoke DEBUG and use the N, L, and U commands in sequence (N COVER.COM, L, U). Try entering "U 100" and then "U 101" or "U 102". See anything different?
To execute the program in DEBUG issue the command: G=100, or at the DOS prompt in the C:\SCRATCH subdirectory, enter: "COVER". To terminate the program in DEBUG or DOS, enter: Ctrl-C. Follow the comments and study the role of the registers in accomplishing the desired result. What happens if you change "MOV CX,7D0" to "MOV CX,3E8"? You can do this by changing just this one line of code in DEBUG:
-a cs:xxxx <enter>
-cs:xxxx MOV CX,3E8
where xxxx is the offset of that line of code
2. Experiment with the DEBUG commands E, S, and M as follows. Using the E command enter an ASCII string in quotes, for example: "I would rather be (fill in the activity of your choice)" beginning in location 2000:0000. Verify that it is in memory using the S command. Remember this search is case sensitive. Move the string to 2000:0500. Remember the M command requires the segment to be specified unless you use DS. Verify the move using the S command. Is the string still in its original location?
3. Experiment with some numerical calculations in DEBUG. Try the following (remember all numbers are hex): 251+151, 131-133. To perform the calculations, first load the appropriate registers (ax, bx, dx) using the MOV statement and then use ADD or SUB. For example:
MOV AX,23
MOV BX,10
ADD AX,BX
Use the T command to execute step by step. Always begin with T=100 to be safe. Notice the two's complement form for negative numbers.