How to get RobVG's puter to stand up and ringits BELL !
Refer back to post BEEP.COM.
Let me see, If I start in MS-DOS mode and from C:\> type DEBUG weget the command prompt ( hypen or minus sign ).
We want to use the DEBUG assemble command A to create our program.
You assemble your code, you run it and the computer convertsa hexadecimal source program into a binary object program. Don,t worryabout making a mistake, you are
registering to memory and not writing to disk. Yet !
The mnemonic code to use from the microcomputer's instruction setis MOV.
From the command prompt ( hypen or minus sign ) type the following:
A 100 press ENTER to get:
166E:0100_at the cursor type MOV AH,2to get:
166E:0100MOV AH,2 ; [ DSTany destination register ] <--- [ SRC any source register ] move contentsof SRC to DST . The ASCII 02h code is loaded into AH high register askingto print a character onto the screen.
166E:0102 _atthe cursor type MOV DL,7 to get:
166E:0100 MOV AH,2
166E:0102 MOV DL,7 ; [ DST any destination register ] <---[ SRC any source register ] move contents of SRC to DST . The ASCII 07hcode for BELL is loaded into DL register.
166E:0104 _atthe cursor type INT 21 to get:
166E:0100 MOV AH,2
166E:0102 MOV DL,7
166E:0104 INT 21 ; The interrupt instruction INT 21hasks DOS to use the instruction found in register AH to print a characteronto the screen. DOS uses the number instruction found in the DLregister to determine which character to print. DL is set to 07h whichinstructs DOS to sound the BELL.
166E:0106 _atthe cursor type INT 20 to get:
166E:0100 MOV AH,2
166E:0102 MOV DL,7
166E:0104 INT 21
166E:0106 INT 20 ; The interrupt instruction INT 20hasks to return control to DOS by
terminating the program.
166E:0108 _atthe cursor press ENTER.
It should look like this:
A 100
166E:0100 MOV AH,2
166E:0102 MOV DL,7
166E:0104 INT 21
166E:0106 INT 20
166E:0108
If there is a mistake type A100 and start again.
Type U 100 tosee what has happened in memory.
U 100
166E:0100 B402 MOV AH, 02
166E:0102 B207 MOV DL, 07
166E:0104 CD21 INT 21
166E:0106 CD20 INT 20
166E:0108 0C8B OR AL, 8B
166E:010A DF8B440A8BCF ESC 39, [ BP + DI + 0A44 ]TBYTE PTR [ BP + DI + CF8B ]
166E:0110 C1 DB C1
166E:0111 E302 JCXZ 0115
166E:0113 C43E5056 LES DI, [ 5650 ]
166E:0117 26 ES:
166E:0118 2901 SUB [ BX + DI ] , AX
166E:011A 8B4634 MOV AX , [ BP + 34 ]
166E:011D 005D16 ADD [ DI + 16 ] , BL
166E:0108 and onward is previous program codeleft in memory before we ran DEBUG.
Memory addresses are 166E:0100 to 166E:0108.
Mnemonic code is MOV .
Operands are AH,2 and DL,7 .
Now we write to disk.
Type U 100 108.
U 100
166E:0100 B402 MOV AH, 02
166E:0102 B207 MOV DL, 07
166E:0104 CD21 INT 21
166E:0106 CD20 INT 20
166E:0108 0C8B OR AL, 8B
Here is our four lines of instruction codeand it occupies addresses 100h to 107h or
memory addresses from 166E:0100 to 166E:0107.108h is the first address after our last
instruction code. So we have a BEEP programthat is 8 bytes long.
Type D 100 110.
D100 110
166E:0100 B4 02 B2 07 CD 21 CD 20- 0C 8B DF 8B 44 0A 8B CF . . . . . ! . . . . . D . . .
166E:0110 C1 .
DOS requires that every COM file start at100h within a segment.
Set the instruction pointer ( IP ) to 100hwith the following:
Type RIP press ENTER to get:
R IP
IP 0100
: ; after the colon type 100 so it is like the following:
R IP
IP 0100
:100
Check it out with Rto see if IP register indeed is set to 100h, IP=0100.
Now we name our command file and write todisk.
Type N BEEP.COMand press ENTER to assign a name for our COM program.
NBEEP.COM
The write command of DEBUG will expect tofind information for the size of our file in
the BX and CX registers. The BX register settingallows for files greater than 64K.
Set BX=0000 and CX=0008.
Type the following to set BX register to zero:
R BX and press ENTER and at the colontype: 0000
R BX
BX 0000
:0000
Type the following to set CX register to 8bytes:
R CX and press ENTER and at the colontype: 0008
R CX
CX 0000
:0008
Now write to root directory.
W
The process has created a BEEP.COM file in the root directory C:\.Go and take a peek.
now, left double click on BEEP.COM . DING! DING! It works !!!!
Now, from MS-DOS prompt C:\> type EDIT BEEP.TXT . This willbe the name of the script file that we can run in DEBUG. Type the following:Type A , then pressENTER. Repeat for each line. After INT 20, press Enter and then once more to create a SPACE. After Q, press Enter and then once more to create a SPACE so the prog will exit DEBUG. Alt-F and save BEEP.TXT in C:\ and then, Alt-F exit. BEEP.COM and BEEP.TXT will be in your ROOT C:\ directory.
A
MOV AH,2
MOV DL,7
INT 21
INT 20
G
Q
Cross your fingers and touch plastic. Hopeit works ?
From MS-DOS prompt C:\> type DEBUG < BEEP.TXT. The prog should have run in
DEBUG and rang your puters bell.
Review:
C:\>DEBUG
-A 100
166E:0100 MOV AH,2
166E:0102 MOV DL,7
166E:0104 INT 21
166E:0106 INT 20
-R IP
IP 0100
:100
-N BEEP.COM
-R BX
BX 0000
:0000
-R CX
CX 0000
:0008
-W
regards,
Return RobVG and his puters BELL.
