Вы находитесь на странице: 1из 367

IBM PC

Peter Abel
IBM PC ASSEMBLER LANGUAGE AND PROGRAMMING
British Columbia Institute of Technology

__________________________________________________________________________

1. IBM PC


ASCII




2.



:
:

:



3.










5.


DB 
DW 
DD 
  DQ 
DT 

  EQU


6. COM 

EXE  COM 
COM 
COM 

.

JMP
LOOP


CALL 

:
: AND  OR  XOR  TEST  NOT
:




8. I:

: INT

: DOS
: DOS
: ASCII
: DOS
:
: DOS
: DOS
: DOS
CR  LF  TAB

. II:


BIOS
:  
ASCII
 DOS
BIOS INT 16H



1 . III:

  


:


11.


REP:
MOVS:
LODS:
STOS:
CMPS:
SCAS:


 
:


12. I:

DX:AX


Intel 8 8  8 28 


13. II: ASCII BCD

ASCII
 BCD 
ASCII
ASCII

:


1 .




  XLAT 
: ASCII
:
TYPE  LENGTH SIZE


15. I:

FAT 


16. II: DOS

: FCB
FCB
: FCB

: FCB

:

:


:


1 . III: DOS

ASCIIZ


:
ASCII
DOS


18. IV:  BIOS

BIOS

: BIOS


1 .


DOS
:
ASCII
DOS

BIOS INT 1 H


2 .


LOCAL



: REPT  IRP IRPC

EXITM
 IF IFNDEF
 IFIDN


21.


EXTRN PUBLIC
: EXTRN PUBLIC
: PUBLIC
:

 


C 


22.

COMAND.COM

COM 
EXE 
EXE 

23. BIOS DOS


BIOS
DOS
DOS INT 21H


2 .




25.

1.
2.
3.
.

ASCII



__________________________________________________________________________


IBM
PC 
.


.
.
 
.   
.
..
  1 88  .  .
 
1 8 

IBM
PC 
..   1 8 
..  
 1 8 .

 
.

 


.
 
IBM PC.
.

Framework.

.
.

__________________________________________________________________________
6  c
 .

 .

.  
Intel 8 8
.
1  o
Intel 8 8 .
.
1 8 Intel 
Intel 8 86  8 8
.

Intel 8 86 
8 88  1 81 i
.
8 88 c 8 188 
8 86  8 186  8 286 8 386 
c .
8 286  IBM AT 1 8 .
Intel
iAPX 86  iAPX 88  iAPX 86  iAPX286 iAPX386  APX 
Intel Advanced Processor Architecture.

p
.  
 
.  

.


 

.


.

 
.  


. c
:

 IBM PC
c  6 . 

.
 IBM PC.
 


  .
 PC DOS MS DOS 
.
C :

 .
 .
 .
PC 
.


 y
: 
 
.
PC
MS DOS Microsoft  PC DOS IBM PC.
: 2.  
3. AT 
.

.
UNIX PC XENIX .


:  a
.

 p
. 
.

 .

.  11  12  1 
15  1  2 21. 8 1  12 13  15
18  22 25 c .
 :

 p

 

 
 ASCII
 


 


 .

.
.



.

1
IBM PC
__________________________________________________________________________
:
.

________________________________________________________________

. .


.

  
. 
.

.2 .

________________________________________________________________

.  
   512 .
p  .
.
  
.
.

 .

A . 256
:     
 11111111 . 
A 1 1  c 
1 1 1  .
 .

.
A   .
 .

.
  .
  
1 1 A. A 
.
1 1.
 
A.
 
A:
:
:

 6 5 3 2 1
1 1

2 1 2 
.  512 512
1 2  .. 52 288 .
PC 16 
 16  
. 16    .
15 
PC:
: 15 1 13 12 11 1  8 |
: 1 1 |

 6 5 3 2 1
1 1 1

ASCII
________________________________________________________________
a
ASCII American
National Standard Code for Information Interchange .  
. . 1 1
A.
.
8 

ASCII   PC 256 
. .1
ASCII  .8
256 .

________________________________________________________________

 2

. c BInary
digiT   .
  .

.
:
:
:

128 6 32 16 8 2 1
1 1 1 1 1 1 1 1

1   2 
 ..
1  2 
 ...  128  255 2  1 .
1 1 1
6  .. 65. 1 1 A  
 . 1 1
65  A:


 1 1

65
 
   
 1 1  .

.
.
8 88 16   o
16  . 2 16 1 65535 
32 2
32 1 2  6 2 5  .



.
:


1
1
1  1








1
1







1
1
11


.  1 1 1 1 1 . A 
 65 2:

1 1
1 1 1

11 1 11

65
2

1 


:

11 1 11 1 .

1111
11 1 1

111 1

6
53

113




  .

. .. 

1.
:
65:
:
1:

1 1
1 11111
1 111111

 65 

1 111111  65 .

1.
 :
1:
: 1 111111
1
:
1:
1 1

 65 

65 65 :

1 1
1 111111

1 

65 
65 

.
.  p 
.
:
.   2 65.

2 1 1 1  e :  11 1 11 :
65
  2 

23

1 1
11 1 11

1  1 111

23 .
.

:
1  
1. 11111111:

1
11111111

1 

1   11111111
1 :


 1 

1


 1

11111111

c
:

3
2
1

1
2
3

11
1
1

11111111
1111111
111111 1


:
 .

.12 13.

________________________________________________________________
 p
 . o
 

. 32 
  .

. :

1 1 1 1 11 1 1 1 11 1 1 11 111
:

 12 1
:
5
3
5 11

 1 A  11B  12C  13D  1 E  15F.

:
5

35

B

CE

  F 
16  e. .1.1.

15.
__________________________________________________________________________
. .


1
1


1
2


1
2

. .
1
1 1
1 1

8

1

.
8

A

11
3
3
1 11
11
B
11
12
C
1
1 1
5
5
11 1
13
D
11
6
6
111
1
E
111


1111
15
F
__________________________________________________________________________
.1.1.  .
.

 .
DOS DEBUG
.

. c
.  F
1  16.
6


A

5
8

D

F
1

1

F
F

1E

1 FF
1
1
 
2 1

 .2 32  .1 
256 .1  6.
 
. B  . 1 1 11   5
  .
 .
.
H   25H  3 . .
c   B8H
B8H.
.2 p
. c
PC  x .2.

________________________________________________________________


 ..  16 .
6
  c
. :
1. .
 .

.
CS  .
2. .

 

. DS  .
3. .

.

SS  .
 ES 
. p.1.2
SS  DS CS.
.

.
__________________________________________________________________________


D O S

        
SS 
            
DS 
            
CS 
L          

L 

__________________________________________________________________________
.1.2. .
c.
.
16   . .FFFF
65535. 
. 
  1 65535.
 
. 5F
32. p 
5F  5F  ..
. a :
DS:
:
:

5F
32

622

8 86 8 88
 16 .
 p . .FFF
6552   . 
 .
c . nnnn  
 .  .. .
nnnn .  .FFFF 1 856 .
e  .F 1111 
.
8 286 2  FFFFF
16  8 386
.


________________________________________________________________
8 86 8 88 1  y


. 16
 .
:
15 1 13 12 11 1  8  6 5
3 2 1
8 286 8 386

16 . .
CS  DS  SS ES

6 
.  c
p
.
1. CS.
.
IP  
.
CS.
2. DS.
.



.
3. SS.
.
. ES.
.
ES DI.
ES 
.
: AX  BX  CX DX


 . 
o
. high  a 
low .  CX

: CH CL 
. CX  CH
CL  :
MOV CX 
MOV CH 
MOV CL 
1. AX. AX
 
. 
 AX.


AX.
AX: | AH | AL |
2. BX. BX .

  .

 .
BX: | BH | BL |
3. CX. CX .

. CX .
CX: | CH | CL |
. DX. DX .



DX AX.
DX: | DH | DL |
c
8   16  .
: SP BP

SP BP
. .
1. SP.
 .
SS .
2. BP.
: .
: SI DI


.
1. SI.
.
SI DS.
2. DI.
.
DI ES.
: IP

IP 
. 
DOS DEBUG



16
.
.
:

O  
D  
I  
T  

S  
Z  
A  
P  
C  


.


.
.

.  DOS DEBUG


.

   1  .

   1 
.
3  8 

.
8  1 
 .


.


O  S  Z  C  D
.
p.
PC
________________________________________________________________

:
c    
 
.
 .
:






Intel 
ROM 
RAM 512 
.


 


.
 o

 
  2 .
  

. 8 88 16 
 o.
8 88 8 86  : 8 88 8 
 16   
 .
.
8 286 8 386 8 86.
.1.3 : o
   .
 .
c   
y   .
 o
  .
__________________________________________________________________________
:

T 
AH AL

BH BL

CH CL

DH DL


SP



BP



SI



DI

L 

| :
|
|
|
|
|
|
|
|

| 
|
CS

| 
|
DS

| 
|
SS

| 
|
ES

| L T 

|

|


     8 88




|

L 
 |

:  |  1


| 2
          |

: | 3  


|
          |

| L 
L  |
 |
L 


|
L  |
__________________________________________________________________________

.1.3. .
: 
:  

.  
1 .
.

.

   
.

. c

.
. 
.
 c .


.
  ROM read only memory . ROM
 p  
. ROM
  .
ROM
: ROM p
RAM 
  DOS .
ROM BIOS Basic Input Output System 
  . Basic 
 . ROM
.
  RAM
Random Access Memory   .. 
 . RAM
.
RAM 
.

e
 ROM DOS RAM.
 DOS  DOS .
o DOS
DOS .
RAM. DOS
  
. RAM

 .
RAM.
 
RAM.
.
6 
RAM :
6  256.
.  c 

.
RAM  ROM 
. 
.1.  256 RAM
. RAM 
6 
DOS. ROM 68 o
 c
. ROM  c 6
 
.
__________________________________________________________________________


.
.




RAM 256





RAM 38 
256
I O



6
A RAM 128 





C ROM 1 2

68





6
F ROM 6


L 
__________________________________________________________________________
.1. . .
RAM  .
.
 .
. 1 25.
.  1 .
c   1.
:
  . 
. 1 5612 5613 
:
| 1| |
| |
5612  5613


.
 a 
.

________________________________________________________________

 
. .
 
.
 ASCII .
  :
1  .

 .
 1111 2 3  2 2  2 1  2  15.
 :
1.

. .  A F
1111.
 :

.
.
  
.
 ROM   RAM
.

 

  
.

________________________________________________________________
1.1. ASCII
.  1 :
 P   p     5.
1.2. :  5   13 
 21   2 .
1.3. C :
 1 1 1
11 1


 11111
1 1 1


 11111
1


1. . : 
1 11   1111   111 1.
1.5.
:  11 1   1 1111 1   1 .

1.6. .  ASCII Q   ASCII


  1 111 1   111 111.
1. . . :
 23A6
22


 51FD
3


 
88 


 EABE
26C


1.8. . .
.2.
 .
:  1   33   8   255   5   633 8.
1. . 
 .

1.1 . : 
     
   

1.11.


2

__________________________________________________________________________
: 
.

________________________________________________________________
DOS
DEBUG  
.

.

.
.

.
.
c
.  IBM PC
c DOS.

________________________________________________________________
DOS A.
 e 
Ctrl Alt Del.
DOS 

 
A C  .
  Return.

.

________________________________________________________________

DOS DEBUG. DEBUG
Return  DEBUG
.
 DEBUG
.  o

 D  .
1. .
.

.
. 13 1 DEBUG 
:

 

 
13  . 
:
D

:13

 Return 

 

.
.  . .
. .
8
1
8 1
2
8 2

. .

8
1
18
2
28

.  
128
256
38
512
6

2. .  
ROM . FE .  :
D FE :  Return 

.
3. ROM BIOS. ROM BIOS mm dd yy
. FFFF5.
D FFFF: 5  Return 
 
.

  D Display 
.
 D   DEBUG
 .
DOS Q

DEBUG

Quit .
.
:
________________________________________________________________

 .
:

B823 1
525
8BD8
3D8
8BCB
2BC8

CB

. 123 AX.
. 25 AX.
AX BX.
AX BX.
BX CX.
AX AX  AX .
.
DOS.

 : 
.
.

.  
. 
MOV  .B8   .8B.

. c
.
 o DEBUG Return.
DEBUG
. Ctrl
PrtSc .

 :
E CS:1 B8 23 1 5 25  Return 
E Enter  . CS:1 
  .1 256 
.  DEBUG .
E p
 CS:1 CS:1 5.
Enter:
E CS:1 6 8B D8 3 D8 8B CB Return 
 CS:1 6 1  1 8 
1  1 A 1 B. Enter:
E CS:1 C 2B C8 2B C  CB Return 
 CS:1 C 1 D  1 E  1 F  11 111.

. 
 .
 . p.2.1
 E.
o.
R .
. 

AX  BX  ...
DOS
.2.1. IP 
 IP 1 
1 . 
E CS:1 . 
.2.1 :
NV UP DI PL NZ NA PO NC
:  
   
.
.
__________________________________________________________________________
D DEBUG
E CS:1 B8 23 1 5 25
E CS:1 6 8B D8 3 D8 8B CB
E CS:1 C 2B C8 2B C  CB
R
AX BX CX DX SPFFEE BP SI DI
DS13C6 ES13C6 SS13C6 CS13C6 IP 1 NV UP EI PL NZ NA PO NC
13C6: 1 B823
MOV
AX  123
T
AX 123 BX CX DX SPFFEE BP SI DI
DS13C6 ES13C6 SS13C6 CS13C6 IP 1 3 NV UP EI PL NZ NA PO NC
13C6: 1 3 525
ADD
AX  25
T
AX 1 8 BX CX DX SPFFEE BP SI DI
DS13C6 ES13C6 SS13C6 CS13C6 IP 1 6 NV UP EI PL NZ NA PE NC
13C6: 1 6 8BD8
MOV
BX AX
T
AX 1 8 BX 1 8 CX DX SPFFEE BP SI DI
DS13C6 ES13C6 SS13C6 CS13C6 IP 1 8 NV UP EI PL NZ NA PO NC
13C6: 1 8 3D8
ADD
BX AX
T
AX 1 8 BX 2  CX DX SPFFEE BP SI DI
DS13C6 ES13C6 SS13C6 CS13C6 IP 1 A NV UP EI PL NZ AC PO NC
13C6: 1 A 8BCB
MOV
CX BX
T
AX 1 8 BX 2  CX 2  DX SPFFEE BP SI DI
DS13C6 ES13C6 SS13C6 CS13C6 IP 1 C NV UP EI PL NZ AC PO NC
13C6: 1 C 2BC8
SUB
CX AX

T
AX 1 8 BX 2  CX 1 8 DX SPFFEE BP SI DI
DS13C6 ES13C6 SS13C6 CS13C6 IP 1 NV UP EI PL NZ AC PO NC
13C6: 1 E 2BC
SUB
AX AX
T
AX BX 2  CX 1 8 DX SPFFEE BP SI DI
DS13C6 ES13C6 SS13C6 CS13C6 IP 11 NV UP EI PL ZR NA PO NC
13C6: 11 
NOP
T
AX BX 2  CX 1 8 DX SPFFEE BP SI DI
DS13C6 ES13C6 SS13C6 CS13C6 IP 111 NV UP EI PL ZR NA PO NC
13C6: 111 CB
RETF

__________________________________________________________________________
.2.1. .
R 1
. CS .2.1 CS13C6 

:
13C6: 1 B823 1

MOV AX  123

CS13C6 
13C6 13C6 . 13C6: 1 1
.  13C6 CS.
B823 1   CS:1 .
MOV AX  123  

.



.
.

AX.
MOV .
T   Return.
MOV 
 .  AX
123. AX B8
23 1.
B8 23 AX  ..
AL  1  AX  ..
AH:
AX: | 1 | 23 |
IP: 1 3
:
13C6: 1 3

525

ADD AX  25

T. 25
AL  AX AH  AX  ..
25 AX. AX 1 8  IP

1 6  c .
T.
AX BX BX
1 8. AX e
1 8  MOV p
.
T
. c AX
BX  2  .
p BX CX  AX CX  AX
. 
c NZ   ZR  
 AX .
T NOP RET 
.
D :
D CS:1
16
. 32 . 
ASCII  . .
ASCII .
.

CS:1 CS:1 F. c CS:11
CS:11F. 
CS:111  Dump a
CS:1 CS:1  .

IP . R IP 
1  T.
Return.
.2.2 D CS:1 .
CS:1 111
.
__________________________________________________________________________

D CS:1
13C6: 1 B8 23 1 5 25 8B D8  3 D8 8B CB 2B C8 2B C . .. ....... . .
13C6: 11  CB 8D 6 1 5 51 52 FF 6 28 E8  8B E5 ...F.PQR.v .t...
13C6: 12 B8 1 5 FF 6 32 FF 6 3 FF 6 2E FF 6 28 ...P.v2.v .v..v 
13C6: 13 E8 88 15 8B E5 BF 36 18 12 FF 36 16 12 8B 6 28 ......6...6...v 
13C6: 1 FF  3A 8  6 6 E8 22 CE 8B E5 3 E 3D A .t:.F.. ... ...
13C6: 15 5 32 A1 16 12 2D 1 8B 1E 18 12 83 DB 53 u2... .........S
13C6: 16 5 8B 6 28 FF  3A A3 16 12 8  1E 18 12 E8 FA P.v .t:.........
13C6: 1  CD 8B E5 3 E 3D D  A 83 6 16 12 1 83 ... ...t.......
Q
__________________________________________________________________________
.2.2. .
DEBUG Q Quit  .
DOS A 
C . 
c Ctrl PrtSc.

:
________________________________________________________________


MOV ADD .
 123 25
.
DS .

c :
DS

. .


2

6

23 1
25

2A2A2A

6 

1
3
5
8

 .  o 
 23    1 
1 .. .

:

A1

3 6 2
A3
CB

  DS
 AX.
  DS
2  AX.
AX  DS
.
DOS.

 MOV p
: A1 A3. 
  
 

.
DEBUG
. 
.
E Enter  :
E DS: 23 1 25  Return 
E DS: 6 2A 2A 2A  Return 
 
 DS: . 

 123 23 1  a 25 25 .
MOV c 
23 1 123  25  25.
  
D Dump  
.
 CS:1 :
E CS:1 A1 3 6 2
E CS:1  A3 CB

CS:1 CS:1 A.
. .2.3
 E.
 CS DS .
D Dump 
:
:
:

D DS: Return 
D CS:1 Return 


.2.3. DS: DS: 8 CS:1
CS:1 A .2.3.
__________________________________________________________________________
D DEBUG
E DS:23 1 25
E DS:2A 2A 2A
E CS:1 A1 3 6 2
E CS:1  A3 CB
D DS:
13C6: 23 1 25 A 2A 2A 2A F F5 2 2C 1 2E 3 . ... ... ...
13C6: 1 2C 1 BD 2 2C 1 B1 D  1 3 1 2 FF FF FF ... ...........
13C6: 2 FF FF FF FF FF FF FF FF FF FF FF FF EF F 6 ..............d.
13C6: 3 61 13 1 18 C  13 FF FF FF FF a...............
13C6:  ................
13C6: 5 CD 21 CB  2 2 2 . ...........
13C6: 6 2 2 2 2 2 2 2 2 2 2 2
.....
13C6:  2 2 2 2 2 2 2 2 
........
R
AX BX CX DX SPFFEE BP SI DI
DS13C6 ES13C6 SS13C6 CS13C6 IP 1 NV UP EI PL NZ NA PO NC
13C6: 1 A1
MOV
AX  
DS:  123
T
AX 123 BX CX DX SPFFEE BP SI DI
DS13C6 ES13C6 SS13C6 CS13C6 IP 1 3 NV UP EI PL NZ NA PO NC
13C6: 1 3 3 6 2
ADD
AX  2 
DS: 2 25
T
AX 1 8 BX CX DX SPFFEE BP SI DI
DS13C6 ES13C6 SS13C6 CS13C6 IP 1  NV UP EI PL NZ NA PE NC
AX
13C6: 1  A3
MOV
DS:  A
T
AX 1 8 BX CX DX SPFFEE BP SI DI
DS13C6 ES13C6 SS13C6 CS13C6 IP 1 8 NV UP EI PL NZ NA PO NC
13C6: 1 A CB
RETF
D DS:
13C6: 23 1 25 A 2A 2A 2A F F5 2 2C 1 2E 3 . ... ... ...
13C6: 1 2C 1 BD 2 2C 1 B1 D  1 3 1 2 FF FF FF ... ...........
13C6: 2 FF FF FF FF FF FF FF FF FF FF FF FF EF F 6 ..............d.
13C6: 3 61 13 1 18 C  13 FF FF FF FF a...............
13C6:  ................
13C6: 5 CD 21 CB  2 2 2 . ...........
13C6: 6 2 2 2 2 2 2 2 2 2 2 2
.....
13C6:  2 2 2 2 2 2 2 2 
........
Q
__________________________________________________________________________

.2.3. .
R
. 
. :
13C6: 1

A1

MOV AX  

 CS 13C6  CS:1
A1 . MOV
 .
 .

MOV AX 
o AX .
T. MOV AX   c
  AX.
23 1 123 AX.
ADD  T.
DS 2 AX.
AX 123 25  .. 1 8.
MOV AX T.
AX .
D DS: .
:
: 23 1 25 8 1 2A 2A 2A
1 2 3 5 6  8
:
1 8  AX
5  8 1.
.
ASCII.  .23 e  .25  .
. 2A  .

.
  .
D DS:1 
.2.3. Q
.

________________________________________________________________

CS
IP.

 CS . AF 
AF  IP . 23:
CS:
IP:
:

AF
23

B13

  B13 :

A112
|
B13

MOV AX  12 

B13 .
A1  o
 3 .
12  a 
DS   c
B1 
. DS . B1 

c :
DS:
:
:

B1
12

B22


:
:
:

B22

2
|
B22

B23

1
|
B23

2 B22
AL  1 B23  AH. AX
12 .
IP 
IP
26. p
 CS  AF 
IP  26  .. B16.


8 86  8 286 8 386  e
 .
o
B22 .
 . 
 
c B23 AX:
: ||2 | 1||
|
: B23
B22 B23
B23 AL.
B2 B25 B23
AH. AX 12 .


.    

  

 .



 
.  

.
EVEN 
.
:
________________________________________________________________

RAM  . BIOS   
ROM  p .
BIOS INT  c 12H.
BIOS AX .
DEBUG INT 12H RET
:
E CS:1 CD 12 CB
R  Return 
. IP 1  INT 12H.
T  Return 
BIOS  
:
STI
PUSH
MOV
MOV
MOV
POP
IRET

DS
AX 
DS AX
AX  13 
DS

AX p
. T BIOS
. RET CB 
.

________________________________________________________________
DOS 2.
DEBUG  .
.
A

A Assemble  DEBUG
.
:
A 1 Return 

: 1 .  Return.
 Return
. :
MOV AL 25
MOV BL 32
ADD AL BL
RET

Return 
Return 
Return 
Return 

:
: 1
: 1 2
: 1
: 1 6

MOV AL 25
MOV BL 32
ADD AL BL
RET

.
Return .
 .
 .
U

U Unassemble 
.
  c 1 1 6 .
:
U 1 1 6 Return 

: 1
: 1 2
: 1
: 1 6

B 25
B332
D8
C3

MOV AL 25
MOV BL 32
ADD AL BL
RET

 R
.
T .

. 
 
. DEBUG

.


DEBUG
:
1.
. :

 : DEBUG n:
Return 
 D

E 
 : W Return 
2. DEBUG
. :

 DEBUG 
 A assemble  E enter 

 : N .COM Return .
COM . .6
COM  
 

.
: 1 6

C3

RET


1 6   1   .. 6.
 CX : R CX Return 
 CX  
  6 
 : W Return 
DEBUG Writing nnnn bytes.  
nnnn . nnnn 
 c.

________________________________________________________________
DOS DEBUG 
.
 E  .

.
   DOS DEBUG
. 
  
.
 
  E  . 
p .
E .

IP  1 . R register 
:
R IP Return 
IP
. 1
R  IP . 
.  T 
.
 
. y
CS  DS  SP SS 

.
DOS DEBUG.
: o:
D  E  H  N  Q  R 
T  W . o
.


________________________________________________________________
2.1.
 . 62  AX
 . 36A AX.
2.2.  :
E CS:1 B8 5 1 5 25
. 5 5 . E
 ..
5 5 .
2.3.  :
E CS:1 B8 3 5 3 CB
  
.
 AX
6  6 .


. 
2. . :
B 25 D E B3 15 F6 E3 CB
:

 . 25 AL
 AL
AL A 
 . 15 BL
 AL BL.

E  CS:1 .
 .
D CS:1 .
R T
RET. AX

2.5.
:

E 

:
25 15
: A D E F6 26 1 A3 2 CB

 DS: 25 
AL
 AL 
A 
 AL DS: 1 15 
 AX 
DS: 2.
D
. R
T RET . AX
612. D DS: 
DS: 2 12 6.
2.6. 2.5 
TRIAL.COM.
2. . A  :
MOV
ADD
SHL
SUB
NOP
RET

BX 25
BX 3
BX  1
BX 22


NOP.

3

__________________________________________________________________________
:
 .

________________________________________________________________
.2
.
.  
  
 
. 

.

 .
DOS EDLIN
.

 
.  DOS LIN
 .

 .

________________________________________________________________
 o
 . p
 
 
. 
.

 :
1.
2.


ADD AX BX




.




.

________________________________________________________________
:

 

    p
.
 132  
8 
.

COUNT

DB
MOV

1
 
AX  


:
:
:
:

A Z a z


.   
  



.
.
 31 . : COUNT  PAGE25  E1 .
.  

AX  DI AL
. 
ADD AX BX
  AX BX . 
MOV REGSAVE AX
REGSAVE 
. .3 c



.  
 o .
  MOV  ADD .



  
. COUNTER
:

COUNTER

DB

DB 


. :



RET
INC
ADD

CX
AX 12


CX
12 AX

 . 
y .  
DOS EDLIN .

________________________________________________________________
 p
.

.
. .2


. .2 .

: PAGE TITLE

 
. PAGE TITLE
.
PAGE.
 
. c PAGE.
6 132

PAGE 6 132
1 255 
 6 132.
PAGE 66 8 .
 6 .
 6 
e.
 
. PAGE

.
p PAGE.
TITLE. 
   p
TITLE :
TITLE


. 
ASMSORT 

6 :
TITLE ASMSORT 
SUBTTL 

.
SEGMENT


.
. c
SEGMENT :

SEGMENT
.
.
.
ENDS


.
ENDS

. SEGMENT ENDS
. SEGMENT 
 .
1. .
. PARA 
.
16  .. . nnn .
PARA.
2. .

 . 
. : STAC  COMMON 
PUBLIC  AT MEMORY.
:

SEGMENT PARA STAC

 : PUBLIC  COMMON MEMORY.
 
.
3. .  

:

SEGMENT PARA STAC
Stack 
.3.1.
SEGMENT .
PROC

.

PROC. 
:
 SEGMENT PARA
 PROC
FAR

RET

 ENDP
 ENDS

. FAR
DOS 
.
ENDP 
PROC. RET
DOS.
. . .
ASSUME

SS  DS
CS c .

.
ASSUME  :

ASSUME
SS:_ DS:__ CS:__
 SS:_ 
SS.
. ES

. ES 
ES:NOTHING.
END

 ENDS  ENDP
. END
:

END

_ 


  
  .
o 
PROC  o FAR.

________________________________________________________________


.  WORDA
:
MOV AX BX
MOV AX WORDA
MOV AX  BX 
MOV AX 25
MOV AX  25 

BX AX
WORDA AX

BX AX
25 AX
25


.

________________________________________________________________
: EXE COM.
EXE   COM 
.6. DOS
EXE : 1   c
 2  
DS   3 
 DS .
DOS
RET. .3.1

1. ASSUME  







CODESG
CS
DATASG
DS



STAC SG  SS. DATASG STAC SG 
:


STAC SG SEGMENT PARA STAC
Stack Stack 
DATASG SEGMENT PARA Data 

. 
:
 
2 ..
2.
256  .1  
PSP. DS

PSP.
 .  RET
DOS.
3. 
  . SUB
AX  AX 
PUSH .
. DOS
SS CS.
DS 
DS MOV 
.3.1.  .
II  DS.
5. RET
DOS  
PUSH DS.
INT 2 H.
__________________________________________________________________________
SEGMENT PARA CODE 
PROC FAR

1.
ASSUME
CS:CODESG DS:DATASG SS:STAC G
2.
PUSH
DS
DS
AX
3.
SUB
AX AX

PUSH
AX
.
MOV
AX DATASG

MOV
DS AX
DATASG DS
.
.
.
5.
RET
DOS
BEGIN
ENDP
CODESG
ENDS
END
BEGIN
__________________________________________________________________________
CODESG
BEGIN

.3.1. EXE .

 .


.


________________________________________________________________
.3.2


.  STAC SG 
CODESG.
__________________________________________________________________________
page
6 132
TITLE EXASM1 EXE 



STAC SG SEGMENT PARA SAC Stack


DB
12
DUP
STAC
SEG



STAC SG ENDS

CODESG SEGMENT PARA Code 
BEGIN PROC
FAR

ASSUME SS:STAC SG CS:CODESG DS:NOTHING
DS
PUSH
DS
SUB
AX AX

PUSH
AX

BEGIN

MOV
ADD
MOV
ADD
MOV
SUB
SUB
NOP
RET
ENDP

AX  123H
AX  25H
BX AX
BX AX
CX BX
CX AX
AX AX

. 123 AX
.25 AX
AX BX
BX AX
BX CX
AX CX
AX
DOS


CODESG ENDS

END
BEGIN
__________________________________________________________________________
.3.2. .


STAC SG
DB  


12 STAC SEG .
p 


.
CODESG 
ASSUME
 . ASSUME SS
STAC SG CS CODESG.


 STAC SG
SS CODESG  CS.

SS CS.


 ASSUME p DS.
 ASSUME  PUSH  SUB PUSH

DS
.   DOS 
DOS . 
 .
 p.2.1
 .

________________________________________________________________

   .
 ENDS 
ENDP   END.

 ASSUME
.
 EXE   COM   . .6 
32 
PUSH  SUB PUSH DS .

________________________________________________________________
3.1.

3.2. :  PC_AT   5   _Z 
 3 B   AX 
3.3. 

3. . END  
    
3.5. .
3.6. RET END.

 3. .  CDSEG  DATSEG
ST SEG . ASSUME.
3.8. DS
.


__________________________________________________________________________
: 
.

________________________________________________________________

 
. 


________________________________________________________________
.3.2


.
DOS EDLIN
. EDLIN 
DOS.
EDLIN DOS A
B.
 
 CH DS B:.
C: B:.
EXASM1 
EDLIN :EXASM1.ASM Return 
DOS EDLIN New
file   . I 
 p .3.2.

   
y. EDLIN
.
. E
 Return  EDLIN.

DIR B:
DIR B:EXASM1.ASM

 
 


.

.
PRINT  DOS 2. . DOS
:
PRINT B:EXASM1.ASM Return 
EXASM.ASM 
. p

.

________________________________________________________________
EXASM1.ASM

. p 
.


.

OBJ .
.2 x .
OBJ  
. OBJ  
EXE    .
LIN 
DOS  :
1. OBJ  
.
R.
2.  

 

 
.
3. EXE  .
OBJ    EXE  
EXE  . 
EXE   
OBJ  OBJ 
EXE .  
  

EXE  . :
EXE  o COM .
  c .
6.

________________________________________________________________
 
.
a. ASM.EXE 
MASM.EXE 
.  MASM
 . .
 A 
B.
p C A B.
MASM  ASM 
. :
source filename .ASM :
object filename filename.OBJ :
source listing NUL.LST :
cross reference NUL.CRF :

. 
 : B:EXASM1.
ASM  .
 
.  B:.

. B B:
Return.

 c
. B  B:
Return.

Return. 
c OBJ  LST CRF .
  
.
source filename .ASM :B:EXASM1 Return 
object filename filename.OBJ :B: Return 
source listing NUL.LST :B: Return 
cross reference NUL.CRF :B: Return 
 
OBJ   .
LST   

. CRF 
 
.  LST  
CRF .
.  
  1. 2. .

.


  MOVE MOV  p
. ASM 
 ASM
 . 1 .


EXASM1.ASM  .
. .1  c
EXASM1.LST.
__________________________________________________________________________
1
2
3
5
6

8

1
11
12
13
1
15
16
1
18
1
2
21
22


C
53 5 1 3
B 53 5 
6


1E
1 2B C
3 5


A
C

B8
5
8B
3

123
25
D8
D8

page 6 132
TITLE EXASM1 EXE 



STAC SG SEGMENT PARA SAC Stack


DB
12 DUP STAC SEG 



STAC SG ENDS

CODESG SEGMENT PARA Code 
BEGIN PROC
FAR

ASSUME SS:STAC SG CS:CODESG DS:NOTHING
PUSH
DS
DS
SUB
AX AX


PUSH
AX
MOV
ADD
MOV
ADD

AX  123H
AX  25H
BX AX
BX AX

. 123 AX
.25 AX
AX BX
BX AX

23 E 8B CB
MOV
CX BX
BX CX
2 1 2B C8
SUB
CX AX
AX CX
AX
25 12 2B C
SUB
AX AX

26 1
NOP
2  15 CB
RET
DOS
28 16
BEGIN ENDP

2

3 16
CODESG ENDS
31
END
BEGIN


Segments and Groups:
N a m e
Size Align
Combine Class
CODESG
.
.
.
.
.
.
.
.
.
.
.
.

16
PARA
NONE
CODE


STAC SG. . . . . . . . . . . . 6 PARA
STAC
STAC 
Symbols:
N a m e
Type Value
Attr
BEGIN. . . . . . . . . . . . . F PROC
CODESG Length 16
__________________________________________________________________________
. .1. .

PAGE TITLE.  SEGMENT  PROC  ASSUME
END .


.
. .

.
p
SS p.
SEGMENT 16  
. .
 DB 
 12 STAC SEG 
. C  12  .
ASCII . 
. . 6 
6 128 .
.
p CS
. ASSUME
 
PUSH DS  1E 
. SUB AX AX
2B C  1.
.  
.
END BEGIN  e
PROC . 
.
EXASM1.LST  PAGE
p 132 .
.
MODE LPT1:132 6



.
 .

  
 . 
 N MASM  .. MASM N.



 .
 

.
p
  ..
a .

.

.

. 
 : OBJ  LST CRF.

________________________________________________________________
 c
 . EXASM1.OBJ
.


. 

  . LIN

 .

DOS A 
B.


LIN

C.

LIN Return. 
 MASM 
:

Object Modules .OBJ :


Run file EXASM1.EXE :
List file NUL.MAP :
Libraries .LIB :

B:EXASM1
B:
CON
Return 

EXASM1.OBJ
EXASM1.EXE
EXASM1.MAP

  OBJ
.

  
A:EXASM1.EXE . B: 
.  
.

 LIN y 

NUL.MAP .. MAP . MAP 




 LIN .
. CON 
 .

. MAP 
:
Start

Stop

Length

Name

H
2 H

15H
FH

16H
6 H

CODESG

STAC SG

  Return 
LIN y.
DOS.
y
 .


LIN . . p LIN .

________________________________________________________________
  
. . .2
 EXASM1. EXE 
B  :
B:EXASM1.EXE

B:EXASM1

DOS  EXE  COM 


.
 DEBUG.
DEBUG B:EXASM1.EXE
DOS DEBUG   
EXE . 
.
D SS:

 12 
STAC SEG.
D CS:
:
1E2BC 5 B823 1 525 8BD8 3 ...

123 25 23 1 25 .

.  
.
__________________________________________________________________________
__________________________________________________________________________

. .2.  .
R p
T  .
PUSH 
DS .

. RET  Q
Quit   .
dir  :
DIR B:EXASM1.


: EXASM1.BA
 EXASM1.ASM
EDLIN 
EXASM1.ASM  EXASM1.OBJ 
EXASM1.LST 
EXASM1.EXE

EXASM1.CRF.

.

.

 

DOS CH DS . OBJ  CRF  BA 
LST  ERASE  DEL :
ERASE B:EXASM1.OBJ  ...
  ASM 
EXE  .

. c.


________________________________________________________________
 . .1  
.

.
2 .2.3  
. . .3

.
.
__________________________________________________________________________
1
2
3


5 2

6


8

1
11

page 6 132
TITLE EXASM2 EXE 



STAC SG SEGMENT PARA SAC Stack 
DB
32 DUP 


STAC SG ENDS

DATASG SEGMENT PARA Data 

12 FA
FLDA
DW
25
13 2 D
FLDB
DW
125

1 
FLDC
DW
15 6
DATASG ENDS
16

1 
CODESG SEGMENT PARA Code 
18
BEGIN PROC
FAR

1
ASSUME CS:CODESG DS:DATASG SS:STAC SG ES:NO
THING
2 1E
PUSH
DS
DS

21 1 2B C
SUB
AX AX

22 3 5
PUSH
AX
23 B8  R
MOV
AX DATASG
DATASG
2  8E D8
MOV
DS AX
DS
25
25 AX
26  A1 R
MOV
AX FLDA
2  C 3 6 2 R
ADD
AX FLDB
125 AX
28 1 A3 R
MOV
FLDC AX
FLDC
DOS
2  13 CB
RET
3 1
BEGIN ENDP
31 1
CODESG ENDS
32
END
BEGIN

Segments and Groups:
N a m e
Size Align
Combine Class
CODESG . . . . . . . . . . . . 1
PARA
NONE
CODE 

DATA
DATASG
.
.
.
.
.
.
.
.
.
.
.
.
6
PARA
NONE


STAC 
STAC SG. . . . . . . . . . . . PARA
STAC
Symbols:
N a m e
Type Value
Attr
BEGIN. . . . . . . . . . . . . F PROC
CODESG Length 1
FLDA . . . . . . . . . . . . . L WORD

DATASG
FLDB . . . . . . . . . . . . . L WORD
DATASG
2

FLDC . . . . . . . . . . . . . L WORD
DATASG
__________________________________________________________________________
. .3. .
DW Define Word  c 
32 
. 32


   
 .
STAC SEG  p.3.2
DEBUG.
: 32 .


.
. .3 DATASG 
.
DW. FLDA  
25  . FA . .
FLDB 125  p
. D.
 FA D  c
DEBUG.

FLDC 
.
CODESG
 .   ASSUME
DATASG DS.
ES 
.   PUSH  SUB PUSH 
 
:

B8  R
 8E D8

MOV AX DATASG
MOV DS AX

MOV DATASG AX. 



DATASG. :
B8  R
 a
DATASG
. p
 c
R
.
MOV AX DS.
 ASSUME 
DS   DS
DATASG.
.  
DS 

MOV DS DATASG 
 c
DS.  DS
.
  DS  SS
CS   SS CS

DS  ES  .
 c
.
.
.

 
 .
 
. .3  .
DEBUG  
.

________________________________________________________________

CRF 

 .
  o B:  
B:
cross reference NUL.CRF :B: Return 
CRF  p
.
.
CREF. :
Cref filename .CRF :
List filename cross ref.REF :
CRF   .. B:EXASM1.
.
CRF
EXASM1.REF B.
DOS
PRINT. CREF.
__________________________________________________________________________
EXASM2

EXE 

Symbol Cross Reference

 is definition 

Cref 1

BEGIN. . . . . . . . . . . .

18 

32

CODE . . . . . . . . . . . .
CODESG . . . . . . . . . . .

1
1 

1

31

DATA . . . . . . . . . . . .
DATASG . . . . . . . . . . .

11
11 

15

1

FLDA . .
FLDB . .
FLDC . .

STAC. .
STAC SG.

. . . . . . . . . .
. . . . . . . . . .
. . . . . . . . . .

12 
13 
1 

26
2
28

. . . . . . . . . .
. . . . . . . . . .

23

1

1 Symbols
__________________________________________________________________________
. . . .
. . 
. .3. c
p
 .
p. n 
LST  
.  
c .  CODESG
1  1  32.

________________________________________________________________

 OBJ  
 OBJ  EXE .
  M ASM 
LIN CREF Return.
.
 CREF .

  .
CH DS .

.

________________________________________________________________
.1. MASM
TEMPY.ASM LST  OBJ CRF  
B.
.2. TEMPY 
.1  
DEBUG  
DOS.

.3. :  file.BA 
 file.ASM   file.LST   file.CRF   file.OBJ   file.EXE  
file.MAP.
. . DS  
 DATSEG.
.5. :






.3   AL
AL  SHL 
.18   BL
AL BL  MUL BL .

RET.
.
 
. .
DEBUG  
  .
.6. .5 :

  DB 
FLDA  .28  FLDB  .1
  DW 
FLDC 
 FLDA AL

 AL FLDB MUL
FLDB 
 AX FLDC.


DEBUG.

5

__________________________________________________________________________
:
.

________________________________________________________________

.
:

DB  DW o .


.

 ..  :
MOV AL 2 H
2
. o
  
 c.


________________________________________________________________
:  
   c.
:

Dn


 
.
  3.
: DB
  DW   DD   DQ   DT
 .
 :
FLD1

DB

25


FLDB

DB

:
FLD3

DB

11  12  13  1  15  16  ...

c .
FLD3  11  FLD3 1 
 12. FLD3 FLD3  .
MOV AL FLD3 3
AL 1 . E .
:

Dn  DUP   ...

:
DW
DB
DB

1 DUP 

 .1
5 DUP 1 
3 DUP  DUP 8 

8
8888   p
.
.


 
 . o
  PC   PC .

ASCII.
DB  p

.  DB
. .5.1
.
__________________________________________________________________________


1 5 65
61 6C
 5
12 2
13 2
1 5 
15 1 A
5 2
21 33 32
26
A

page
6 132
EXE 
TITLE EXDEF
DATASG SEGMENT PARA Data 



FLD1DB DB
2 3 6F 6E FLD2DB DB
2 3 6F 6D
 65 2
FLD3DB DB
FLD DB DB
FLD5DB DB
1 E 2 6 FLD6DB DB
3 D 1 52
36 35 3
FLD DB DB

FLD8DB DB

 DB:



Personal Computer  .
32

2 H
.
1 11 1B
1  JAN  2  FEB  3  MAR  

3265 
1 DUP  



FLD1DW
FLD2DW
FLD3DW
FLD DW

3
32
3
36

FFF
5 
21 R
3 
8 

5 

A 
E 3 5
52 3C F
56 11
5A E

62
6A
2

A
8

DW
DW
DW
DW

FLD5DW DW



FLD1DD
FLD2DD
FLD3DD
FLD DD
31 FLD5DD

DD
DD
DD
DD
DD



 FLD1DQ DQ
 D FLD2DQ DQ

3C F FLD3DQ DQ



 FLD1DT DT

3 5 FLD2DT DT

 DW:

FFF H
.
1 11 1B
FLD DB

3  8 
5 DUP  
 DD:



PC 

325 2

FLD3DB  FLD2DB

1  
.  DQ:



D H
.
325 2

 DT:



PC 

8E

DATASG ENDS
END

Segments and Groups:
N a m e
Size Align
Combine Class
DATASG . . . . . . . . . 8E PARA
NONE
DATA 
Symbols:
FLD1DB
FLD1DD
FLD1DQ
FLD1DT
FLD1DW
FLD2DB
FLD2DD
FLD2DQ
FLD2DT
FLD2DW
FLD3DB
FLD3DD
FLD3DQ
FLD3DW
FLD DB
FLD DD
FLD DW
FLD5DB
FLD5DD
FLD5DW

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

N
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

a
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

m
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

e
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

Type
L BYTE
L DWORD
L QWORD
L TBYTE
L WORD
L BYTE
L DWORD
L QWORD
L TBYTE
L WORD
L BYTE
L DWORD
L QWORD
L WORD
L BYTE
L DWORD
L WORD
L BYTE
L DWORD
L WORD

Value

A
62
A
3
1
E
6A
8
32
12
52
2
3
13
56
36
1
5A

Attr
DATASG
DATASG
DATASG
DATASG
DATASG
DATASG
DATASG
DATASG
DATASG
DATASG
DATASG
DATASG
DATASG
DATASG
DATASG
DATASG
DATASG
DATASG
DATASG
DATASG Length  5

FLD6DB . . . . . . . . . L BYTE
15
DATASG
FLD DB . . . . . . . . . L BYTE
DATASG
21
26
FLD8DB . . . . . . . . . L BYTE
DATASG Length  A
__________________________________________________________________________
.5.1. .



a . .

 .
.
.

 D 
  125 125D. 

. .  125 .
D.
.

. F H.
 
. .  2EH
FFFH  2E FF F 

.
.
1 B.

AND  OR  XOR TEST. 12  . C 11 B
: . C 11
 .
.
 Q O 
 253Q. .

ASM.

 
  DB 12 
ASCII .3132   o
DB 12  . C.
.5.1
. 
 .
DB 
________________________________________________________________
 

DB  . p
DB 

. FLD2DB FLD DB .5.1 .  FLD2DB


Personal Computer .
ASCII . .2 .
DB
. .
p.
. F   
8 FF .
12  128.
.5.1 FLD3DB  FLD DB 
FLD5DB FLD8DB. FLD6DB
 .
DW 
________________________________________________________________
DW 
 . DW 
PC 
  
CP . DW
.
DW
. . .
. FFF  
8 FFFF .
32 6  32 68.
.5.1 FLD1DW FLD2DW
. FLD3DW 
FLD DB. 21 R
.  
FLD DB 21.
FLD DW . 
o 
.
DW  DD DQ
.  .
123 5 .3 3 
3 3 .
DD 
________________________________________________________________
DD  c
 .
  .
. . FFFFFFF
  8 FFFFFFFF
.

21  836  21  836 8.


.5.1 FLD3DD .
FLD DD 
FLD2DB. FLD5DD
.
DD .
 .
123 5 . 3 3 
o 3 3 .
DD
.

 FLD2DD .
DQ 
________________________________________________________________
DQ  
. 
16 . .
.  15 F.
  . 1 15
:
1152 215 6 68 6 6
. 5.1 FLD2DQ FLD3DQ
. DQ
. 

 DD DW.
DQ a
DD DW.
DT 
________________________________________________________________
DT  .
 
. .13 . DT 

a.
.5.1 DT
.
.5.1 .
X c



LIN
MAP


: Warning: No STAC Segment  :
 LIN There were 1 errors detected 
 1 .
DEBUG  .5.2.
__________________________________________________________________________
D:  D DEBUG D:EXDEF.EXE
D
1 21: 5 65 2 3
1 21: 1 65 2 2 2 5 
1 21: 2 52 33 32 36 35
1 21: 3 F FF 5  21
1 21:
1 21: 5 3C F
1 21: 6
1 21:  3C F
D
1 21: 8 3
1 21:  3E 36 33 33 3
1 21: A 1C 6 63 63 3E
1 21: B 18 18 18 18 3C
1 21: C 63 63 63 63 3E
1 21: D C3 C3 66 3C 18
1 21: E DB DB FF 66 66

6F
1
3




6E
A

3

11

61 6C
1 E







2
2





3
6



E


6F
5




D

6D
2

8




3





5
D


3
31


1


5


.Personal Comput
.er Y.JAN.FEB.MA
R3265 ..........
..Y. ...........
..............CP
.. ...........1.
..........GM....
.. .............


 A
 A
 A
 A
 A
 A


E
E
E
E
E
E


3E
FF
63
C3
C3
C3


63
DB
63
C3
C3
C3

33
63

63
C3
C3
66

33
3
18
63
C3
C3
3C

....CP........33
633s....... cc
..cc ...........
.... .......cccc
cccc ...........
..f ............
...ff.........f 

1 21: F 18 3C 66 C3 C3  A E C3 C3 C3 66 . f............f
Q
__________________________________________________________________________
.5.2. .
 
 Personal Computer .

________________________________________________________________
. 2.1 2
.
MOV

AX  123H

. 123 AX.
B823 1  B8 
AX  a
. :
  .


o c
MOV  
:
:

AMT1 DW
123H
MOV AX AMT1



.
 
AL :
MOV AL  123H

 

  

ADD AX 25H

 

 25
25 .


 p 
123H   2 1 
. 123    1 1 11 
. 123 .

:
:

MOV  CMP.

ADC  ADD  SBB  SUB.


RCL  RCR  ROL  ROR  SHL  SAR  SHR.
AND  OR  TEST  XOR.

:
:
:

.5.3
.
 .

.
__________________________________________________________________________



1 
3

11
13
15
1 
1B
1D
1F

23
25
28
2B
3
3

page
6 132
EXIMM
EXE  .
 

SEGMENT PARA Data 
DB


DW
ENDS

CODESG SEGMENT PARA Code 


BEGIN PROC
FAR
ASSUME CS:CODESG DS:DATASG

BB 113
3 3C 1 

5

A
C

TITLE


DATASG
FLD1
FLD2
DATASG

1
8
1C
8

D
D
D1
D
D1
D1
D

2
8
F6
8

5
C  C
5
2E R 5

D3
DC
6 1 R
C8
E1
FB
2E R

2C
CF 2A
C3 A
36 R 23

MOV
CMP

:


BX 2 5
AL H

ADC
ADD
SBB
SUB

:

AL 5

BH 12


AL 5

FLD1 5

RCL
RCR
ROL
ROR
SAL
SAR
SHR

 1 :


BL 1
AH 1

FID2 1


AL 1

CX 1
BX 1
.
FLD1 1

:

AL  1 11 B AND  
OR  
BH 2AH
TEST  
BL AH
FLD1 23H XOR  

AND
OR
TEST
OR
BEGIN ENDP
CODESG ENDS
END
__________________________________________________________________________
.5.3. .

 
. .  . .11 .
EQU
________________________________________________________________
EQU  
.
 EQU:
TIMES

EQU 1

 TIMES 
.  

TIMES 1 . 

FIELDA

DB

TIMES DUP 

FIELDA

DB

1 DUP 

 EQU 
 :
COUNTR

EQU 5
...
MOV CX COUNTR

COUNTR MOV 5  c

MOV CX  5

EQU 
 COUNTR.

EQU.  EQU
 . EQU
:
1.
2.

TP EQU TOTALPAY
MPY EQU MUL

 p
TOTALPAY.  TP 
TOTALPAY.
MPY MUL.

________________________________________________________________


. 
EMPWAGE.
 DB 

  .

 . .
  AX 25
. 25:
ADD AX 25
ADD AX 25H

25
3 

  DW  DD DQ
.
 DB AL  AH  BL
..  DW AX  BX  CX .. .
 DD DQ .


:  AL 
BH 
 AX  BX .

________________________________________________________________
5.1. 
:  DW   DD   DT   DB   DQ 
5.2. TITLE1 
RGB Electronics.

5.3.
FLDA FLDE:
a  
.

115
b   .
25
c  
d  

25
e  DW  16  1 
2  2  3 .
5. . .  DB 26  
DB 26.
5.5. .  DB 26H   DW
26 5H   DD 25 33AH   DQ 25 33AH.
5.6. :







32 AX
FLDB
. BX
. CX
FLDB
CH .

5. .
5.2  5.3 5.6. .

.
DEBUG. LST   
. MODE
LPT1:132 6 .

6
COM 
__________________________________________________________________________
: COM 
COM .

________________________________________________________________
 
EXE . LIN
EXE    
p 512 .  .22
.
COM .
COM  COMMAND.COM. EXE2BIN.COM
DOS EXE  COM .
BIN   

 EXE in EXE to BIN . in 

COM .
EXE COM 
________________________________________________________________
 EXE2BIN EXE  COM  
c 

EXE   COM .
. EXE 
 COM 
6 . COM   EXE 
 COM  512 
EXE .



COM  

. EXE  
COM  .

.

. EXE
 DS .
COM  .
.
. EXE 
DS. COM  
 . COM 

PSP   256  . 1  
DOS COM EXE
. . 1 PSP 

SEGMENT ORG 1 H.
. EXE COM
OBJ  
EXE . EXE  
. COM  
:

Warning: No STAC Segment
: 

. EXE  COM 
EXE2BIN.  EXE2BIN
A  CALC.EXE  B.

EXE2BIN B:CALC B:CALC.COM


EXE 
EXE.  CALC.COM .
COM  EXE2BIN BIN 
COM.
OBJ  EXE .
EXE   
 COM .
COM 
________________________________________________________________
EXCOM1  .6.1 
. .3  COM .
COM :

 .
 ASSUME
. CS 
PSP .
ORG 1 . 

PSP.
 ORG 1 H
.
.
 JMP 
.
:
MASM
 
LIN 
EXE2BIN B:EXCOM1 B:EXCOM1.COM
DEL B:EXCOM1.OBJ B:EXCOM1.EXE  OBJ EXE  
EXE  COM   88 2 .
COM  
COM .
  RET DEBUG B:EXCOM1.COM.

JMP .


.
__________________________________________________________________________
page 6 132
TITLE XCOM1 COM 
CODESG SEGMENT PARA Code 
ASSUME CS:CODESG DS:CODESG SS:CODESG ES:CODESG
ORG
1 H
PSP

BEGIN: JMP
MAIN

FLDA
DW
25

FLDB
DW
125

FLDC
DW

MAIN
PROC
NEAR
MOV
AX FLDA
25 AX
125 AX
ADD
AX FLDB
FLDC
MOV
FLDC AX
RET
DOS
MAIN
ENDP
CODESG ENDS
END
BEGIN
__________________________________________________________________________
.6.1. COM .
COM 
________________________________________________________________
COM  DOS
o p.
6  DOS
SP c  .FFFE.
. 6 
DOS . DOS
.

. DIR p
.

COM .

________________________________________________________________
COM 
. EXE2BIN o 

. SEGMENT 
ASSUME END. ORG 1 H 

.
COM 
DEBUG
D CS:1 .
RET
Q . INT 2 H

RET.
EXE   COM  
.

________________________________________________________________

 COM  6 .
 COM   EXE .
  COM 
DS.
  COM 
ORG 1 H SEGMENT
.
 EXE2BIN EXE  COM  
COM .
 DOS COM 
  .

________________________________________________________________
6.1. COM  
6.2. 
COM  
6.3. COM 

6. . SAMPLE.EXE.
DOS COM .
6.5. .6 COM  
DEBUG.



__________________________________________________________________________
:
 .

________________________________________________________________

. 
.

 
 .

 .


.
.


.
 :
: JMP
:
LOOP
:
Jnnn    
:
CALL
 : SHORT  NEAR FAR.
SHORT  p
. NEAR FAR CALL 
  SHORT.
IP FAR
CS.
JMP
________________________________________________________________

JMP.  ..
.
COM  . .1 JMP. p AX 
BX  CX 1 
:
1 AX 
AX BX 
CX.

AX:
1 2 3  ...  BX: 1 3 6 1 ...  CX: 1 2  8...
  A2 :  o 
 BEGIN  .

JMP A2
 c
A2 . 
.
 .
__________________________________________________________________________


1
1
1 B8 1

page 6 132
TITLE EXJUMP COM  JMP
CODESG SEGMENT PARA Code 
ASSUME CS:CODESG DS:CODESG SS:CODESG
ORG
1 H
MAIN

PROC
MOV

NEAR
AX  1

AX 

1 3
1 6
1 
1 
1 C
1 E
11
112
112

BB 1
B  1

5
3
D1
EB

1
D8
E1
F

A2 :

BX  1
CX  1

MOV
MOV

BX 
CX

1 AX
ADD
AX  1
ADD
BX AX
1 BX
SHL
CX 1
CX
A2
JMP
A2
MAIN
ENDP
CODESG ENDS
END
MAIN
__________________________________________________________________________
. .1. JMP.
:
A2 :

ADD

AX  1

:
A2 :

ADD

AX  1

A2 ADD.
A2  NEAR. :
.
A2
 JMP 
 EBF . EB
JMP  F   .
JMP F  IP  p
JMP  112 :
:
JMP:
:

.
2


265

.
112
F   

1 

 .1 .

.1 . JMP
.
JMP 128 12 
SHORT.
FF. JMP   FAR 

.

.  JMP .
JMP p
 :
A5 :

...
JMP A5

.
 
JMP A 

A  :

...

NEAR FAR  3 
. 
 SHORT:

A  :

JMP SHORT A 
...

 
 COM .

. DEBUG COM 
. AX
8  BX CX .2
.36  .8
.128 
. Q.
LOOP
________________________________________________________________
JMP . .1 .
.
LOOP  
CX. LOOP

CX 1. CX 
  CX 
LOOP .
__________________________________________________________________________
page 6 132
TITLE EXLOOP COM  LOOP
CODESG SEGMENT PARA Code 
ASSUME CS:CODESG DS:CODESG SS:CODESG
ORG
1 H


1
1
1
1 3
1 6
1 
1 C
1 C
1 D
1 F
111

B8
BB
BA
B

1
1
1
A


3 D8
D1 E2
E2 F 

113 C3
11
11

BEGIN

A2 :

PROC
MOV
MOV
MOV
MOV

NEAR
AX  1
BX  1
DX  1
CX 1

INC
ADD
SHL
LOOP

AX
BX AX
DX 1
A2

AX 
BX 


DX

1 AX
AX BX
DX
CX


RET
ENDP
ENDS
END
BEGIN
__________________________________________________________________________
BEGIN
CODESG

. .2. LOOP.
. .2  LOOP 

 . .1 
. MOV
CX 1 . LOOP CX 
1 CX
DX. JMP A2 LOOP
ADD AX  1 INC AX  AX
1 .
JMP  LOOP
LOOP A2 
. LOOP
128 12  . 
Relative jump out of range  
.
LOOP
 . .1  
COM .
DEBUG. CX
 p AX  BX DX . B 
2 . Q.
LOOP  LOOPE
 LOOPZ  LOOPNE  LOOPNZ .
CX 1. LOOPE 
CX ZF1 .
LOOPNE  CX
ZF .

________________________________________________________________

. p 16 
.

.
 :
:
:

15 1 13 12 11 1  8  6 5
3 2 1
O D I T S Z A P C

.
CF Carry Flag   .   
1 
. .12 .
PF Parity Flag   .
p .
  1.
.
AF Auxiliary Carry Flag  

.
1 
 3  .

ASCII .
ZF Zero Flag   .
a . 
 

. 
    ..
 e   .. .
JE JZ .
SF SIgn Flag   .
 

p:
  1.
JG JL .
TF Trap Flag   .

DEBUG. c 
 ..
.
IF Interrupt Flag   .
  .
DF DIrection Flag   .
.
SI DI 
 
 . .11 .
OF Overflow Flag   .
 ..  
.
: CMP

AF  CF  OF  PF  SF  ZF. 
.
BX :

B5 :

BX
CMP BX 
B5
JZ B5
.
 
.
BX
...

BX  CMP
ZF    .
JZ    ZF.
ZF  
  .. B5 .

________________________________________________________________
 LOOP
CX : 
 . 

.


. 
.
LOOP . .2 :
CX 

:
LOOP

LOOP A2

DEC CX
JNZ A2

DEC JNZ LOOP:


CX 1 A2  CX
. DEC
1. JNZ .
LOOP

  : DEC JNZ.
JMP LOOP JNZ c
JNZ A2 
.
128 12  .
Relative jump out of range  
.



. 


: .
:
 .
 
  .
.
 AX 11 11 
BX  1 11 .
CMP AX BX
AX BX. 
AX   .




JE JZ
JNE JNZ
JA JNBE
JAE JNB
JB JNAE
JBE JNA















ZF
ZF
ZF CF
CF
CF
CF AF

.
 JB JNAE 
JB  JNAE.




JE JZ
JNE JNZ
JG JNLE
JGE JNL
JL JNGE
JLE JNG















ZF
ZF
ZF SF OF
SF OF
SF OF
ZF SF OF

JE JZ 
JNE JNZ 
.  .




JS
JNS
JC
JNC
JO
JNO
JP JPE
JNP JP










 
 
 JB 




SF
SF
CF
CF
OF
OF
PF
PF


CX .
p
.
JCXZ 
CX .
. 
 
  .
 .

.  JAE JGE
 .
CALL
________________________________________________________________
o
 :
BEGIN

PROC FAR
.
.

BEGIN

ENDP

FAR 
 ENDP .
  
PROC ENDP.

. .3.
__________________________________________________________________________



CODESG SEGMENT PARA



BEGIN PROC
FAR

CALL
B1

CALL
C1

RET

BEGIN ENDP


B1
PROC
NEAR

RET

B1
ENDP


C1
PROC
NEAR

RET

C1
ENDP


CODESG ENDS

END
BEGIN
L 
__________________________________________________________________________
. .3. .
:

 PROC B1 C1 NEAR

. 
NEAR.

ENDP .
 BEGIN :
CALL B1 CALL C1 . CALL
B1 .
RET 
CALL B1 . CALL 
C1 
RET.
 RET .
BEGIN B1 C1 
BEGIN. BEGIN
DOS RET
DOS. B1

RET  B1
C1 . C1
RET  
C1 .

.  CALL

 128 12  .
NEAR
.
CALL
RET .

________________________________________________________________

   PUSH 
DOS  EXE  .
o . 
CALL 
CALL 
. RET

.
 PUSH
. POP
. SP ..
 .
RET CALL . 
CALL 
 .
 .
32 .
PUSH  PUSHF  CALL  INT  INTO
. POP  POPF  RET IRET
a .
EXE 
:
DS ES:  256
.1  
.
CS:  .
IP: .
SS: .
SP:  . 
32 6 
DW

32 DUP 

SP 6  . .
EXE   . . .
.
__________________________________________________________________________

2  

TITLE
CALLPROC EXE 



STAC SG SEGMENT PARA STAC Stack 
DW
32 DUP 


STAC G ENDS

CODESG SEGMENT PARA Code 


BEGIN PROC
FAR

ASSUME CS:CODESG SS:STAC SG
PUSH
DS
1E
1 2B C
SUB
AX AX
3 5
PUSH
AX
E8 8 R
CALL
B1
B1
...

 CB

RET
8
BEGIN ENDP

B1
PROC
8
8 E8 C R
C1
CALL
C1

...
B C3
RET

B1
ENDP
C


C
C1
PROC

...
RET
C C3

D

C1
ENDP

D
CODESG ENDS
END
BEGIN
__________________________________________________________________________
. . . .

. PUSH SP 2
DS  f  
.. B 3E. PUSH SP
2 AX   B 3C.
CALL B1 SP
  B 3A. CALL C1
SP  B 
B 38.
C1 RET B
 B 38  IP SP
2.
B  .. B1 .
RET B1 
 B 3A  IP SP 2.

. RET  
FAR.
.
DEBUG.
3 3F SP:

:
PUSH DS  F 
PUSH AX  
CALL B1  
CALL C1  B 




SP

F
F
F
F


3E
3C
3A
38

 B 
 
|
|
3 36
:

RET
RET

 F
F
|
|
|
|
38 3A 3C 3E

3A
3C

.  
   .
  DEBUG
 IP 
.
:
________________________________________________________________

c  
o
. p

.
 . .11

.
EXE   . .5  c
 NAME1  NAME2  NAME3. 
NAME1 NAME2 NAME2
NAME3. 
MOV .
.
__________________________________________________________________________
page
65 132
EXE 
TITLE EXMOVE



STAC SG SEGMENT PARA STAC Stack 
DW
32 DUP 

STAC SG ENDS

DATASG SEGMENT PARA Data 
NAME1 DB
ABCDEFGHI


J LMNOPQR 
NAME2 DB
STUVWXYZ 
NAME3 DB
DATASG ENDS

CODESG SEGMENT PARA Code 
BEGIN PROC
FAR

ASSUME CS:CODESG DS:DATASG SS:STAC SG ES:DATASG
PUSH
DS
SUB
AX AX
PUSH
AX
MOV
AX DATASG
MOV
DS AX
MOV
ES AX
JUMP
CALL
B1 MOVE
CALL
C1 MOVE
CALL
RET

BEGIN ENDP




B1 MOVE

B2 :

JUMP  
:

PROC
LEA
SI NAME1

LEA
DI NAME2
NAME1 NAME2

MOV
CX  

MOV
MOV
INC
INC
DEC
JNZ
RET
B1 MOVE ENDP




C1 MOVE

C2

AL  SI 
DI AL
SI
DI
CX
B2

NAME1
NAME2
NAME1
NAME2

  
 

LOOP  
LOOP:

PROC
LEA
SI NAME2

NAME2 NAME3
LEA
DI NAME3

MOV
CX  
MOV
MOV
INC
INC
LOOP

AL  SI 
DI AL
DI
SI
C2

NAME2
NAME3
NAME2
NAME3


 

RET
C1 MOVE ENDP
CODESG ENDS
END
BEGIN
__________________________________________________________________________
. .5. .
BEGIN
B1 MOVE C1 MOVE. B1 MOVE
NAME1 NAME2. 
NAME1
 ..:
NAME1:
NAME2:

A B C D E F G H I
| | | | | | | | |
J
L M N O P Q R

NAME1 NAME2 CX 
SI DI . LEA
a NAME1 NAME2 SI DI:
LEA SI NAME1
LEA DI NAME2


NAME1 NAME2

NAME1
NAME2 SI DI. k
MOV 

 c. 
MOV AL  SI 
: SI ..NAME1 
AL.
MOV

DI AL

: AL 
DI .. NAME2 .
SI DI
SH. CX 
 B2 .
SI DI 1  MOV
NAME1 1 NAME2 1. 
NAME1 8 NAME2 8.
C1 MOVE B1 MOVE :
NAME2 NAME3 LOOP
DEC JNZ.
:  . .5 
 DEBUG.
 .
NAME2 NAME3 D DS: .
: AND  OR  XOR  TEST  NOT
________________________________________________________________

. AND  OR 
XOR TEST  .

ASCII ..13 .
 CF  OF  PF  SF  ZF.
AND: 1  1
 .
OR: 1 
1   .
XOR:  1 
1    1 
 .
TEST: AND   .


. AND  OR XOR
:

AND
1 1
11

1

OR
1 1
11

111

XOR
1 1
11

11

  AL 11

1 1  BH 1 1 11 :
1.
2.
3.
.
5.
6.

AND
OR
XOR
AND
AND
OR

AL BH
BH AL
AL AL
AL 
AL  FH
CL CL

AL 1 1
BH 11 1 11 1
AL
AL
AL 1 1
SF ZF

3 . 5
AL. CMP
 OR :
1.
2.

OR
JZ
OR
JS

CX CX
...
CX CX
...






CX

CX

TEST AND 
 . :
1.
2.
3.

TEST
JNZ
TEST
JNZ
TEST
JZ

BL 1111 B
...
AL  1B
...
DX OFFH
...

BL

AL

DX


NOT p
 : 
 .   p AL 11 1 1 
NOT AL 11 1 1 . .
NOT NEG 

.  
.1. .
:
________________________________________________________________

.  
 .

  YES yes 
. A Z .
1
5A  a z . 61 A.
p  1
:
:
A:
Z:

65 321
1 1
1 11 1

:
a:
z:

65 321
11 1
1111 1

COM   . .6 
TITLEX  TITLEX 1.
BX TITLEX 1
AH  TITLEX 1.
.61 A  AND 5 :

AND AH 11 11111B


  a z  .
TITLEX 
BX
.
__________________________________________________________________________


1
1 EB 1C 
3

3
2

65
65

68

65
2
2

61
6F
2
6C
3

6E
2
63
65

6
5
61


COM  .
TITLE CASE
CODESG SEGMENT PARA CODE 
ASSUME CS:CODESG DS:CODESG SS:CODESG
ORG
1 H
BEGIN: JMP
MAIN

65 TITLEX DB
Change to uppercase letters 

3



MAIN
PROC
NEAR
8D 1E 1 R
LEA
BX TITLEX 1 .
B  1F
MOV
CX 31

B2 :
TITLEX
8A 2 
MOV
AH  BX 

8 FC 61
CMP
AH 61H
2 A
JB
B3

8 FC A
CMP
AH AH

 5

JA
B3
8 E DF
AND
AH 11 11111B 
88 2 
MOV
BX AH
TITLEX
B3 :

3
INC
BX
31
E2 EC
LOOP
B2
C3
RET
MAIN
ENDP
CODESG ENDS
END
BEGIN
__________________________________________________________________________
11E
11E
122
125
125
12 
12A
12C
12F
131
13
136
136
13 
13 
13A
13A

. .6. .
BX
.
SI DI.

________________________________________________________________

 :









8   16  

    .
1 c
 1 CL.


CF
. c:
SHR
SHL
SAR
SAL

 
 

SHR:
MOV
MOV
SHR
SHR

CL  3
AX 1 11 111B
AX 1
AX CL


AX:
1 11 111
1 11 11
1 11

1
3

SHR AX 1 .
CF 
AX . c
AX . CF 1 
1   AX .
SAR:
MOV
MOV
SAR
SAR

CL  3
AX 1 11 111B
AX 1
AX CL


AX:
1 11 111
11 11 11
11111 11

1
3

SAR SHR:
. 
.
.
. p 
SHL SAL .
 
2. 
.   5
 2 3 


CF 1. 
2  
CL 2.
 CF JC
  .



.
:
ROR
ROL

RCR
RCL

ROR:
MOV
MOV
ROR
ROR

CL  3
BX 1 11 111B
BX 1
BX CL


BX:
1 11 111
11 11 11
1111 11

1
3

ROR
BX .
ROR .
RCR RCL CF.
CF  CF
.

.  32 

DX:AX  16 DX  
AX. 2 c :
SHL AX 1
RCL DX 1


DX:AX 2

SHL AX 
CF. RCL
DX CF.

________________________________________________________________
:
1. 
.
2.
. 
p  . .5  c
.
 LOOP.

:

:


:


1
1:



3. 
. 25  
.
. .

 .
5. 

.  
XLAT  .
6. 
.

LEA  SI DI  .

.

________________________________________________________________

   B2 : 
NEAR. .
 LOOP
128 12  .
. . 1 F 1 12 
. FF 8 1 128.
1

.
 5 .
CX
 LOOP 
. LOOP 
.

 
 . 
  MOV 
.  
c
 .

.
 CALL 
 RET.  
 
RET .

 COM .
 . :
MOV AX SI
MOV AX  SI 
MOV AX SI.

MOV
SI.



.

________________________________________________________________

.1. p
JMP  LOOP 

.2. JMP . 62 . 
. JMP:  2   6B   C6.
.3. 12 : 1  1  2  3  5 
8  13 ... 
. LOOP.

DEBUG
.
. .  AX BX  a CX
DX  . CMP  
:







DX  CX 
BX  AX 
CX 

BX  AX 
DX  CX 

.5.

a





.6. 
. .  BEGIN RET 
. . PROC p
FAR NEAR 
.8. 
. . EXE  A1 B1  B1 C1 
C1 D1 .  DOS 

.1 .  BL 111 11
BOONO 1111 1. BL
:  XOR BL BOONO  AND BL BOONO  OR BL BOONO  XOR
BL 11111111B  AND BL  B.

.11. . .6 : 
TITLEX  .
.12.  DX 1 111 1 1 111 1 
p CL  3. DX
:  SHR DX 1  SHR DX CL  SHL DX CL  SHL DL 1
 ROR DX CL  ROR DL CL  SAL DH 1.
.13.  
AX 1 .
.1 .  
 DX:AX 2.
:   
8 DX:AX:BX 2.

8
I:
__________________________________________________________________________
: 
.

________________________________________________________________


o


.
. c


.

 ASCII
.
INT  .

 .

.

INT 1 H 
BIOS.

INT 21H 
DOS. 

Return. p DOS INT 21H

BIOS.
   BW 
. .  1
.
: INT
________________________________________________________________
INT  DOS

BIOS
.
.
INT
:

 2

 TF IF
 2
CS
 2



 INT.
.

.
: BIOS INT 1 H
DOS INT 21H .
INT 1 H
INT 21H.

________________________________________________________________

.
  25  2  8
 .
:
________________________________________________________
.
.
______________
______________



________________________________________________________






F





12
3 
2 28



2
18

2

18
F
________________________________________________________
INT 1 H
. 5 
12  :
MOV
MOV
MOV
MOV
INT

AH  2
BH 
DH  5
DL 12
1 H



5
12
BIOS

2 AH INT 1 H
. DX 
  BH  .

.
MOV c . :
MOV DX  5 CH

5  12


________________________________________________________________

 
. c 
.
.
DX   
BH 6 H AX.
:
MOV AX  6 H
MOV
MOV
MOV
INT

BH  
CX 
DX 18 FH
1 H

AH 6  
AL  
  


BIOS

6 AH INT 1 H
.
  .
 . 18 F 

.


.
: DOS
________________________________________________________________


. 
DOS  p 
DOS 2. . DOS
 DOS
. DOS
 
.
: DOS
________________________________________________________________
DOS
 AH  
DOS  DOS INT 21H.
o 
:
NAMPRMP

DB
.

    

.
MOV AH  
LEA DX NAMPRMP
INT 21H


.
DOS

 c
  :   
DB  . 
. 


  .
LEA NAMPRMP DX
DOS . NAMPRMP  DX
LEA  o 
DOS DS DX DS:DX .
: ASCII
________________________________________________________________
256 ASCII 
. . FF
 ASCII
. 2 .
.8.1 COM  
ASCII. B1 CLR 
C1 SET D1 DISP. B1 CLR  C1 SET
 . D1 DISP

CTR 
y 1 
. FF.
__________________________________________________________________________
page
TITLE ALLASC
CODESC SEGMENT
ASSUME
ORG
BEGIN: JMP
CTR
DB

6 132
COM  ASCII  FF
PARA Code 
CS:CODESG DS:CODESG SS:CODESG ES:NOTHING
1 H
SHORT MAIN
 S 



MAIN

:

NEAR
B1 CDR


C1 SET

D1 DISP

PROC
CALL
CALL
CALL
RET
ENDP

MAIN


B1 CLR PROC
MOV
MOV
MOV
MOV
INT
RET
B1 CLR ENDP

:

AX  6 H
BH  
CX 
DX 18 FH
1 H



C1 SET PROC
MOV
MOV
MOV
INT
RET
C1 SET ENDP


D1 DISP PROC
MOV
LEA
D2
MOV
INT
INC
LOOP

 :

AN  2
BN 
DX 
1 H
ASCII :

CX 256
DX CTR

256

AH  
21H
CTR
D2



CX 


RET
D1 DISP ENDP

CODESG ENDS
END
BEGIN
__________________________________________________________________________
.8.1. ASCII

. 8 . D c 
. :
.8.1  
COM .  
:ASCII.COM.
. 
  . 1 2  . 3 
5 .  . 6
  . 8 D
. D  
 . . E  .
. F .
.

. 8 D.  o  
. 8   D  :

D3 :

D :

CMP
JB
CMP
JBE

CTR  8H
D3
CTR  DH
D

MOV AH  H
...
INT 21H
INC CTR

8 

 D 

 8

 D

: DOS
________________________________________________________________
 .
 DOS  c
 
INT.  
. 

.  

.

. LABEL BYTE.
.
  .FF 255.
DOS
. 
.
NAMEPAR
MAXLEN
ACTLEN
NAMEFLD

LABEL
DB
DB
DB

BYTE
2

2 DUP  

LABEL 
NAMEPAR MAXLEN a .
MASM

STRUC.  
  
c .2  .
AH 
1 . AH  NAMEPAR
 DX INT 21H:
MOV AH  AH
LEA DX NAMEPAR
INT 21H



DOS

INT 
 c

 2
. Return.
. D  NAMEFLD
.   BROWN Return  c
:
.: |2 | 5| | R| O| W| N| | | | | | ...
.: |1 | 5| 2|52| F|5 | E| D|2 |2 |2 |2 | ...
ACTLEN 
 5. Return
NAMEFLD 5.  
. D . 2
. D 
1  .
:
________________________________________________________________

EXE   . 8.2  
.

Return . 
TED SMITH:
1.  2 
2.  36
SHR E1 CENT  o 
2. 1 1
1 . NEG   . ADD
 DL  36.
12 36
:
12:
:

TED SMITH
| |

36

E1 CODE  c
  :
MOV NAMEFLD BX  
BX 
MOV  BX NAMEFLD 
.  5 
NAMEFLD  5  Return .
E1 CODE  .
 F1 CENT  p
.
__________________________________________________________________________
page
6 132
TITLE CTRNAME EXE 



STSC SG SEGMENT PARA STAC Stack 
DW
32 DUP 

STAC SG ENDS

DATASG SEGMENT PARA Data 
NAMEPAR LABEL BYTE
:
MAXNLEN DB
2
.


NAMELEN DB
NAMEFLD DB
2 DUP    
PRIMPT DB
Name    
DATASG ENDS

CODESG SEGMENT PARA Code 
BEGIN PROC
FAR

ASSUME CS:CODESG DS:DATASG SS:STAC SG ES:DATASC
PUSH
DS
SUB
AX AX
PUCH
AX
MOV
AX DATASC
MOV
DS AX
MOV
ES AX

CALL

Q1 CLR

MOV
CALL
CALL
CALL
CALL
CMP
JE
CALL

DX 
Q2 CURS
B1 PRMP
D1 INPT
Q1 CLR
NAMELEN 
A3
E1 CODE

CALL
JMP
A3 :

F1 CENT
A2 LOOP

A2 LOOP:

BEGIN ENDP


B1 PRMP PROC
MUV
LEA
INT
RET
B1 PRMP ENDP


D1 INPT PROC
MOV
LEA
INT
RET
D1 INPT ENDP


E1 CODE PROC
MOV
MOV
MOV
MOV
RET
E1 CODE ENDP


F1 CENT PROC
MOV
SHR
NEG
ADD
MOV
CALL
MOV
LEA
INT
RET
F1 CENT ENDP


Q1 CLR PROC
MOV
MOV

RET







 

DOS

:

NEAR

AN  
DX PROMPT
21H
:

NEAR

AN  AN
DX NAMEPAR
21H
 :

NEAR
Return  D 
BN 
BL NAMELEN
.  
NAMEFLD BX  
NAMEFLD BX 1   
:

NEAR
DL NAMELEN
:
DL 1
2 

DL

DL 
DH 12

Q2 CURS

AN  

DX NAMEFLD
21H
:

NEAR
AX  6 H
BH 3


   

MOV
MOV
INT
RET

Q1 CLR


Q2 CURS PROC
MOV
MOV
INT
RET
Q2 CURS ENDP

CX 
DX 18 FH
1 H


2 
BIOS

  :

DX
NEAR
AH  2

BH 

BIOS
1 H

CODESG ENDS
END
BEGIN
__________________________________________________________________________
.8.2. .
Return

 
 o
Return. 
Return  y
:
. :

|1 | | D|...


Return . p
.
Return



:   .
  Return . D 
NAMEFLD .2 . NAMELEN
c D.  
NAMELEN 5  D NAMEFLD 5.
BX NAMEFLD:
MOV BH 
MOV BL NAMELEN
MOV NAMEFLD BX 2 H

BX
5
D

MOV .2  
o : NAMEFLD
BX  .. NAMEFLD 5.



 .
:

NAMEPAR . 

1. BROWN
|1 | 5| 2|52| F|5 | E| D|2 |2 |2 | ... |2 |
2. HAMILTON |1 | 8| 8| 1| D| | C|5 | F| E| D| ... |2 |
3. ADAMS
|1 | 5| 1| | 1| D|53| D| F| E| D| ... |2 |
HAMILTON BROWN.
HAMILTON  HAMIL.
T.  ON o
NAMEFLD

B3 :

 ADAMS
Return
ADAMS.
:

MOV CX 2
MOV SI 

MOV NAMEFLD si 2 H


INC SI
LOOP B3

SI DI BX.
 
.  NAMEFLD
DB  
 WORD  a
PTR   :

B3 :

MOV CX 1
LEA SI NAMEFLD
MOV
INC
INC
LOOP

WORD PTR SI 2 2 H


SI
SI
B3

1




1

MOV B3
 SI. p
LEA SI
MOV 3   
:
MOV WORD PTR NAMEFLD 2 2 H


.
c

.
: DOS
________________________________________________________________
 DOS 2.
 UNIX .
DOS 
. file handle 
y BX 
. :

  CON
  CON

2
3

  CON
 AUX
LPT1 PRN

DOS   INT 21H 


AH: .3F   .  .
CX   DX 
.

CF  AX
 . o
CF   6  AX.
AX  
 CF 
 .
o 
o  .

 p.
: DOS
________________________________________________________________

DOS:
DISAREA

DB
...
MOV
MOV
MOV
LEA
INT

2 DUP  

AH  H
BX  1
CX 2
DX DISAREA
21H





DOS

LEA DX DISAREA DOS


 .
  AX
.
 y .
CF  6  AX.
AX  
 CF.
:

DEBUG
. DEBUG A
1   p 1 .
 DEBUG 
:
1
1 2
1 5
1 8
1 B
1 D
1 E

MOV
MOV
MOV
MOV
INT
RET
DB

AH 
BX  1
CX 
DX 1 E
21

 

 

AH
. 1 F DX  DB 
.
 Return.
U U 1 1 D  .
R T .
INT 21H BIOS 
1 B GO G 1 D  RET.
. Q DOS.
: DOS
________________________________________________________________

DOS:
INAREA

DB
MOV
MOV
MOV
LEA
INT

2 DUP  
AH 3FH
BX 
CX 2
DX INAREA
21H






DOS

LEA INAREA DX.


INT  c 

CX 2 . Return  .
D  .  PC Users
Group  INAREA :
PC Users Group  . D  . A

. D   . A 
.
p
. c 
.
CF 
 AX 
. 1
2
 .. 16.
.
YES NO 
p    .

. CF AX
6 . AX
 
 CF.



y CX  .
 CX 8  PC
Exchange . PC Excha 
. AX
8. INT
 
. 

ng   AX
5.
CF .
INT:
INT:

PC Excha
ng  D  A

AX  8
AX  5

 
AX  CX 
AX CX   D
A.
DOS AH
.
.
:

c
DEBUG.
12  .
DEBUG A 1
 c 1 .  DEBUG
 .
1
1 2
1 5
1 8
1 B
1 D
1 F

MOV
MOV
MOV
MOV
INT
JMP
DB

AH 3F
BX 
CX  C
DX 1 F
21
1
 

AH BX c
 CX
DX 1 F  DB .
.
 Return.
U 1 1 8 .
R T MOV.
1 B  G 1 D INT
 BIOS . 
Return. AX 
CF D 1 F  .
Q.


________________________________________________________________


:

CR
LF
TAB

ASCII

13
1


DH
AH
H


 DOS. :
MESSAGE

DB
MOV
MOV
MOV
LEA
INT

 PC Users Group Annual Report 13 1


AH  H


BX  1

CX 31
DX MESSAGE

21H
DOS

EQU
:
CR
LF
TAB
MESSAGE DB

EQU
EQU
EQU
TAB 

13
1

PC Users Group Annual 

EQU DH
EQU AH
EQU H
DB Report  CR  LF


________________________________________________________________

 INT 1 BIOS
. INT 21H DOS
.
 
INT 21 INT 21H  .
 A  BX  CX
DX .
 INT 21H DOS
  .
 .
.
 DOS
. INT 21H 

.
 DOS
A  BX 
1.
 DOS
3FH  BX 
.
. 
.

________________________________________________________________
8.1.
25 

8.2. :
12  8.
8.3.   12 
 22  .
8. .
    .
. :  DOS  
DOS .
8.5.
8. . : 
DOS   DOS .
8.6. 
.
8. . .8.2

  : 
12 15 
15.
8.8. .8.2
DOS.  .


II:
__________________________________________________________________________
: 
  

 .

________________________________________________________________
.8
.

   .
 BIOS 1  
 .
c 
.




. B  .
:

 2 25 8 

 2  
 .



16
  .B8 .
 ASCII  

  BW  .
p  3
8 c 
.
 .
.

________________________________________________________________
 
 
.  8 :

:
:

BL R G B
 6 5

I R G B
3 2 1

RGB  red 
green  blue  .  BL 
 3 I   .

 BW .
o:

 
 
 
 

RGB



111

RGB

1
111


.

  :


111
1 111
1111
111
1111

 
  
8   
F  
  
F . 

 
. 
. INT
1 H. BL  
AH : 6    
 8     .
p  

.
.  .
BIOS INT 1 H
________________________________________________________________
INT 1 H .
AH  . c
BX  CX  DX  SI BP.
.
AH : .
. p

c INT 1 H.
. AL
:


1
2
3

5
6

8  A
D
E
F
1

25 
25 i6 
8 25 
8 25 16 
32 2 
32 2 
6 2 
8 25 
PCjr
32 2 16  EGA 
6 2 16  EGA 
6 35  EGA 
6 35 6  EGA 

EGA Enhanced Graphics Adapter  


.
16  :
MOV AH 
MOV AL  3
INT 1 H


8 25
BIOS

 
BIOS INT 11H. AX 
5
:

1
1
11

25
8 25
8 25



 

  p
AX INT 11H .
AH 1: .
ASCII .
. INT
. p .

INT 1 H  :
CH   CL 
. p : 13
EGA p  .

:
MOV
MOV
MOV
INT

AH  1
CH 
CL 13
1 H




BIOS


.
   8  3 1 ..
 . 12 13 
 6    .
AH 2: . c
c .
 3 8
.
AH 2  BH DX
:
MOV
MOV
MOV
MOV
INT

AH  2
BH 
DH 
DL 
1 H





BIOS

AH 3: .
  p 
:
MOV AH  3
MOV BH 
INT 1 H



BIOS

DH  DL
 . CH c 
CL  .
AH : . e
p.
AH 5: .
25
3.
8   8 25 
 3 .
MOV AH  5
MOV AL 
INT 1 H



BIOS

AH 6: .

. p
 
. .
6 .
AL
 .
AL .
 .

:
MOV
MOV
MOV
MOV
INT

AX  6 1H
BH  
CX 
DX 18 FH
1 H


:  

2   
BIOS

AL. BH
 
.. CX DX
. :
1. ROW  
.
2. .
3.  CMP
ROW 22 .
.  ROW INC ROW  .
5.   ROW
.
AH : .
.
AH  p
6 .
AH 8:  .
 
:
MOV AH  8
MOV BH 
INT 1 H

. .
 . 
BIOS

AL  AH 
. .
ASCII . c 
.
AH :  .

.. :
MOV
MOV
MOV
MOV
MOV
INT

AH  
AL 
BH 
BL 
CX 
1 H



.. 


BIOS

AL .
CX .
.
.
  :
MOV AH  
MOV AL  3H


 

MOV
MOV
MOV
INT

BH 
BL  F H
CX  5
1 H

. 


BIOS

 
.

CX 1 AL
. CX
 LOOP. 

 2 .
BL
.   
 1  XOR.
AH A: .
A   A
:
MOV
MOV
MOV
MOV
INT

AH  AH
AL 
BH 
CX 
1 H



 

BIOS

DOS INT 21H


.
AH E: .

 .
AH . E  p AL
  
BL  BH.
 H   8H   AH 
 DH   .

c 
.
AH F: .
AL . AH  p AH 
2  8  BH  .
AH13:  AT .
AT
:
MOV
MOV
MOV
LEA
MOV
MOV
INT

AH 13H
AL 
BH 
BP 
CX 
DX 
1 H


 1  2 3

ES:BP


BIOS

:

1 

2  
3   .
: 
________________________________________________________________
 . .1 
. 

:
Name  Francis Bacon
|

Francis Bacon 
|


ROW   COL 
. INT 1 H .
 2  .

.
__________________________________________________________________________
page
6 132
TITLE NMSCROLL EXE   



STAC SG SEGMENT PARA STAC Stack 
DW
32 DUP 

STAC SG SEGMENT PARA STAC Stack 
DW
32 DUP 

STAC G ENDS

DATASG SEGMENT PARA Data 
:
NAMEPAR LABEL BYTE
MAXNLEN DB
2
.
ACTNLEN DB



NAMEFLD DB
2 DUP  
COL
DB

COUNT DB

Name  
PROMPT DB

ROW
DB
DATASG ENDS

CODESG SEGMENT PARA Code 
BEGIN PROC
FAR

ASSUME CS:CODESG DS:DATASG SS:STAC SG ES:DATASG
PUSH
DS
SUB
AX AX
PUSH
DS
MOV
AX DATASG
MOV
ES AX
MOV
AX  6 H

CALL
Q1 CLR
A2 LOOP:
MOV
COL 

CALL
Q2 CURS

CALL
B1 PRMP

A3 :

CALL
CMP
JNE
MOV
CALL
RET

D1 INPT
ACTNLEN 
A3
AX  6 H
Q1 CLR


 .. 

CALL
JMP
ENDP

E1 NAME
A2 LOOP

BEGIN


B1 PRMP PROC
LEA
MOV
B2 :
MOV
CALL
INC
INC
CALL
DEC
JNZ
RET
B1 PRMP ENDP


D1 INPT PROC
MOV
LEA
INT
RET
D1 INPT ENDP


E1 NAME PROC
LEA
MOV
E2 :
CALL
MOV
CALL
INS
INS
DES
JNZ
CMP
JAE
INC
RET
E3 :
MOV
CALL
RET
E1 NAME ENDP


F1 DISP PROC
MOV
MOV
MOV

 

:

NEAR
SI PROMPT

COUNT  5
BL  H
F1 DISP
SI
COL
Q2 CURS
COUNT
B2

:

NEAR
AN  AH
DX NAMEPAR
21H
:

NEAR
SI NAMEFLD

COL 

Q2 CURS
BL  FOH
F1 DISP
SI
COL
ACTNLEN
E2
ROW 2
E3
ROW







n


AX  6 1H
Q1 CLR



:

NEAR
BL  
AN  


AL  SI 

BH 

MOV
CX  1

INT
1 H
BIOS
RET
F1 DISP ENDP

:


AX
Q1 CLR PROC
NEAR

MOV
BH  
MOV
CX
MOV
DX 18 FH
BIOS
INT
1 H
RET
Q1 CLR ENDP
  :



Q2 CURS PROC
NEAR
MOV
AN  2
MOV
BH 
MOV
DH ROW
MOV
DL COL
INT
1 H
RET
Q2 CURS ENDP
CODESG ENDS
END
BEGIN
__________________________________________________________________________
. .1.  .
D1 INPT DOS INT 21H.
BIOS INT 1 H :
1.
.
2. INT 1 H  8  8 AH BH.
AL.
3. AL RETURN

.
. AL .
5. AL RETURN  .
6. .
. .
8. 2.
RETURN 
 .
ASCII
________________________________________________________________
ASCII  128 255 . 8 FF 
 
.  c
:
.

DA
BF
C
D
C
B3

INT 1 H
25 :
MOV
MOV
MOV
MOV
MOV
MOV

AH  
AL  C H
BH 
BL  FH
CX 25
1 H





25
BIOS

 .

. B3.
:
.
B
B1
B2

 
 
 



.
 DOS
________________________________________________________________
DOS 

. AH  
INT 21H.
AH 1: .

AL. AL 
ASCII  c  
. AL 
  
F1 PgUp.  
.  

. Ctrl Break.
AH 2: .
p DL.
 .
AH : .
1 :
 ..  o
Ctrl Break.
AH 8: .
1 :

 .. .
AH B: . .
FF AL   
. 1   8 
.
BIOS INT 16H
________________________________________________________________
BIOS INT 16H 
AH
.
AH : . AL o
ASCII   
AH.   .
  F1  AL
.
.
AH 1: .

ZF 
 AL
AH
.
AH 2: .
AL . 1 :


6
5
3
2
1

Ins 
Caps Lock 
Num Lock 
Scroll Lock 
Alt Shift
Ctrl Shift
Shift
Shift


________________________________________________________________
:
1.    : a z 
    ..
2. :  End  
 Return  Del  Ins  PgUp  PgDn 
.
3. : Alt  Ctrl Shift 
.
 
.
 .
 

End .


.
 1 Esc  83 Del 
. 1 .53. 
. 
AH BIOS
INT 16H:

MOV AH 
INT 16H
BIOS

.   A 
:
1. ASCII  A . 1  AL
2.  A .1E  AH.
  Ins 
:
1. AL
2.  Ins .52  AH.
 INT 16H
AL. AL 
  .
:
MOV
INT
CMP
JZ

AH 
16H
AL 
exit


BIOS





. .2  .
  .
   .2A AL
 AH 
: .  8 .2 
PrtSc.
 :
CMP
JNE
CMP
JE

AL 2AH
EXIT1
AH  H
EXIT2



 

__________________________________________________________________________

Alt A  Alt Z
F1  F1
Home

PgUp


1E  2C
3B 

8

B
D

End
F

5
PgDn
51
Ins
52
Del
53
__________________________________________________________________________
. .2. 
c
  :
MOV
INT
CMP
JNE
CMP
JNE
MOV
MOV
MOV
INT
.
F1 :

AH 
16H
AL 
EXIT1
AH  H
EXIT2
AH  2
BH 
DX 
1 H





 Home 




BIOS

F1  F1  .3B
.
CMP AH  H
JE EXIT1

F1 


EXIT1 .
 BASIC.
IBM PC  
Alt  Ctrl Shift.

________________________________________________________________

  2
2 .
 16
 BW  . 
ASCII  
.
 
. 
. RGB
 .
 BIOS INT 1 H :
  
.
 
 .
 

 INT 1 H 
 .
 BIOS INT 16H
.


.

 
1 Esc  83 Del  . 1 .53.

AL  AH.

AL  AH.

________________________________________________________________

.1.   
  .
.2.  BW
   8   
5 12  
1  
. B1 .
.3.  : 
  F3   Home   PgUp.
. . DEBUG 
AX .
A 1 Return . :
MOV AH 
INT 16H
JMP 1
U 1 1  G 1
MOV INT. INT
.
AH . G 1  
 .
Q.

.5. :
PgDn   2
.

1
III:
__________________________________________________________________________

: 
.

________________________________________________________________

. p 
 p
:
1. 
 .
2. 
 .
.
3. RGB  
 
.  RGB 
.


CGA
Color Graphics Adapter  16 
.B8  8  8 .
8 25  3 
. 25
  2 .
 .

.
EGA  Enhanced Graphics
Adapter  
CGA 
. 32 2  6 2
6 35 .
:

   
.
.
 p BIOS INT 1 H 
AH .
BIOS INT 1 H 
:
MOV AH 
MOV AH 
MOV AL  3  MOV AL 

INT 1 H
INT 1 H
  
________________________________________________________________

.  BW 

.
ASCII 256   BW 
.
16 .
16 .



 .
  
. 
16 :

R




1
1
1
1

G


1
1


1
1

B

1

1

1







I
1
1
1
1
1
1
1
1

R




1
1
1
1

G


1
1


1
1

B

1

1

1

1

o
16 . .
 .
 .




p . .  BL
BLinking  RGB    I
 :

:
:

BL R G B
 6 5

I R G B
3 2 1

.
:


BL









 1

6
R




1

5
3
G B I


1
1
1 1 1
1 1

2
R


1

1

1
G



1


B .


1
1
1
1 23
D
1
A8

 
BW  .
INT 11H. BW  .
.
 .
INT 1 H AH 6 
AH  AH .  
:
MOV AH  
MOV AL   

MOV
MOV
MOV
INT

BH 
BL  DAH
CX  5
1 H




BIOS


________________________________________________________________

 pixel .
CGA  :
1.  ROM 
1 16 .. .
16 
 .
Motorola 68 5 CRT.
: .3D 3D5.
2.

2 32 .
.. .
3. 2 6 .
16 
 BW  .
8 .. .
  .
 ROM
128 ASCII . INT 1FH 1
 128 . 8
. 
 p.

________________________________________________________________

3:

:
|C1 C |C1 C |C1 C |C1 C |

:
1
2
3
 3.

:  1  1 11. p
16 1  1  11
. p :
C1



1
1


1

1

INT 1 H. p 
  
:   . 

1 1 1 1  .
 1  :  
.  11 11  
 .
BIOS INT 1 H

AH INT 1 H .
AH11 INT 1 H
. AH :
AH : . AH
p AL :
MOV AH 
MOV AL 
INT 1 H


32 2


. .
AH BH: . BH
BL:
BH
p BL. 1 16 . o
F
BH 1 BL 
1 :
MOV
MOV
MOV
INT

AH  BH
BH  1
BL 
1 H


.



   . 
BIOS
 
.
AH BH


 .

AH CH: . C AH
 .
 32 2 DX
 1  CX  
31 . AL  3 :
MOV
MOV
MOV
MOV
INT

AH  CH
AL 
CX 
DX 
1 H





BIOS

AH DH: .
. DX
 1  CX  
31 . AH D.
AL.

:
________________________________________________________________
 .1 .1  INT 1 H

 32 .
1 .

.
__________________________________________________________________________
TITLE GRAPHIX COM 
CODESG SEGMENT PARA Code 
ASSUME CS:CODESG DS:CODESG SS:CODESG
ORG
1 H
MAIN

A5 :

PROC
MOV
MOV
MOV
MOV
MOV
INT
MOV
MOV
MOV

NEAR
AN 
AL  DH
AH  BH
BH 
BL  2
1 H
BX 
CX 
DX 


EGA CGA 





MOV
AH  CH

MOV
AL BL

BX  CX  DX
INT
1 H

INC
CX
CMP
CX 32
32 
JNE
A5
 

MOV
CX 

INS
BL
INS
DX

CMP
DX 

 
JNE
A5

RET
MAIN
ENDP
CODESG ENDS
END
MAIN
__________________________________________________________________________
.1 .1 .
.
DOS MODE MODE
CO8  COM 
INT 1 H.

________________________________________________________________

 16
 .
8 .

 
ROM    
 .

 

  .


CGA   16
 .

_________________________________________________________________
1 .1.
CGA  
1 .2. 
     .
1 .3.  
.
1 . .
   .
1 .5.
 32 2 CGA  6 2 EGA.
1 .6. .
1 . . 12 13
.
1 .8. .1 .1 : 
  1 3  2
3 .

11

__________________________________________________________________________
:
.

________________________________________________________________
  
.  
 .
 

.

.

:
MOVS 
LODS 
STOS 
CMPS 
SCAS 




AX




AL
AL AX

AL AX .

REP .

________________________________________________________________

p . 
 
  .
 
.  DI SI
:

MOVS
LODS
STOS
CMPS
SCAS

DI SI
AL SI AX SI
DI AL DI AX
SI DI
DI AL DI AX

MOVSB
LODSB
STOSB
CMPSB
SCASB

MOVSW
LODSW
STOSW
CMPSW
SCASW

 MOVS 
MOVSB MOVSW.  p DI SI
 
LEA . SI
 DS:SI. DI
 ES:DI.  MOVS  STOS  CMPS
SCAS ES  DS .
REP:
________________________________________________________________

 REP
.

 REP MOVSB. REP
CX.
REP 1 CX .
 .
:

CLD
DF
STD
DF 1.

2 STRING1

STRING2.  DS ES
:
STRING1
STRING2

DB
DB
...
CLD
MOV
LEA
LEA
REP

2 DUP  
2 DUP  
CX 2
DI STRING2
SI STRING1
MOVSB

DF
2
 
 

CMPS SCAS


. REP
:
REP 
REPZ REPE 
REPNE REPNZ 

 CX
 ZF 
. ZF 
CX
 ZF 
. ZF 
  CX .

8 86  8 286 8 386  o
  
.
MOVS:
________________________________________________________________
. .5
.
. MOVS REP CX
.
  
p ES  DI 
. DS  SI
. 
MOVS ES DS 
DI SI.
DF MOV S
1   2  
DI SI.
 REP MOVSB:
LABEL1:

LABEL2:

JCXZ
MOV
MOV
INC DEC
UNC DEC
LOOP
...

LABEL2
AL  SI 
DI AL
DI
SI
LABEL1

.11.1 C1 MVSB MOVSB


NAME1 NAME2.
CLD
. DF

CLD .
__________________________________________________________________________
page
6 132
TITLE STRING EXE 



STAC SG SEGMENT PARA STAC Stack 
DW
32 DUP 

STAC G ENDS

DATASG SEGMENT PARA Data 
NAME1 DB
Assemblers 

NAME2 DB
1 DUP  
NAME3 DB
1 DUP  
DATASG ENDS

CODESG SEGMENT PARA Code 

BEGIN PROC
FAR

ASSUME CS:CODESG DS:DATASG SS:STAC SG ES:DATASG
PUSH
DS
SUB
AX AX
PUSH
AX
MOV
AX DATASG
MOV
DS AX
MOV
ES AX
MVSB
CALL
C1 MVSB
LODS
CALL
D1 MVSW
CALL
E1 LODS
LODS
CALL
F1 STOS
CMPS
SCAS
CALL
H1 SCAS
RET
BEGIN ENDP
MOVSB:



C1 MVSB PROC
NEAR
CLD
LEA
SI NAME1
LEA
D1 NAME2
1
MOV
CX 1
REP MOVSB
NAME1 NAME2
RET
C1 MVSB ENDP

MOVSW:


D1 MVSW PROC
NEAR
CLD
LEA
SI NAME2
LEA
DI NAME3
MOV
CX  5
5
NAME2 NAME3
REP MOVSW
RET
D1 MVSW ENDP
LODSW:



E1 LODS PROC
NEAR
CLD
LEA
SI NAME1

NAME1 AX
LODSW
RET

E1 LODS ENDP
STOSW:



F1 STOS PROC
NEAR
CLD
LEA
D1 NAME3
MOV
CX  5

MOV
AX 2 2 H
REP STOSW
NAME3
RET
F1 STOS ENDP

CMPSB:


G1 CMPS PROC
NEAR
CLD
MOV
CX 1
LEA
SI NAME1
LEA
DI NAME2
NAME1 NAME2
REPE CMPSB

JNE
G2
MOV
BH  1
G2 :

MOV
CX 1
LEA
SI NAME2
LEA
DI NAME3
REPE CMPSB
JE
G3
MOV
BL  2
G3 :
RET
G1 CMPS ENDP

NAME2 NAME3



SCASB:


H1 SCAS PROC
NEAR
CLD
MOV
CX 1
LEA
DI NAME1
MOV
AL  m 
m 
NAME1
REPNE SCASB

JNE
H2
MOV
AH  3
H2 :
RET
H1 SCAS ENDP
CODES

ENDS
END
BEGIN
__________________________________________________________________________
.11.1. .
LEA SI DI
NAME1 NAME2 . DS ES
DATASG  NAME1 NAME2
COM
ES:DI DS:SI.

ES DS . MOV CX
1  NAME1 NAME2. REP MOVSB
:

 NAME1

p ES:DI  NAME2 
DS:SI .
 1 DI SI
.
 CX 1.
  1 
CX .
DF  MOVSB
DI SI 
 .. NAME1 1 NAME2 1 .. DF
1  MOVSB DI SI 
. SI DI
 .. NAME1 
NAME2  .
D1 MVSW .11.1 

MOVSW 
. MOVSW
DS SI 2 
. SI
NAME1 8  DI  NAME2 8.
LODS:
________________________________________________________________
LODS AL
AX . DS:SI.
DF SI.
LODS 
REP . MOV
LODS  MOV 
LODS   SI.

LODS 
 
.
 LODSB:
MOV AL  SI 
INC SI
.11.1 E1 LODS
LODSW. :
NAME1  As  AL  
AH. AX sA.
STOS:
________________________________________________________________
STOS   AL AX
.
ES:DI. DF STOS
DI 1 2 .
STOS REP 
 
.  c  AX.
 REP STOSB:
LABEL1:

JCXZ
MOV

LABEL2
DI AL

INC DEC
LOOP
...

LABEL2:

DI
LABEL1

.11.1 F1 STOS
STOSW. . 2 2  
NAME3  AL 
AH  . DI
NAME3 1 .
CMPS:
________________________________________________________________
CMPS 
DS:SI   ES:DI .
DF CMPS
SI DI 1 2 . CMPS
AF  CF  OF  PF  SF ZF.
REP CX . CMPS
.
 JEAN
JOAN. :
J
E
A
N

:
:
:
:

J
O
A
N

E O 


N:N

p .   
 . REP
REPE  
 CX p .
:
REPE CMPSB
.11.1 G1 CMPS
CMPSB.
NAME1 NAME2. MOVSB NAME1
NAME2  CMPSB

p : SF

  ZF  1  .
NAME2 NAME3.
STOSW NAME3  CMPB
  : SF
  ZF   .
   1
BH.  
2 BL. DEBUG
 G1 CMPS BX
1 2.
 CMPSB
. CMPSW
 p CX
5.  CMPSW
.  SAMUEL ARNOLD
CMPSW SA AR  .. AS RA.
   
..

. CMPSW
  DW  DD
DQ.
SCAS:
________________________________________________________________
SCAS CMPS 

  .
SCAS  p ES:DI 
AL AX. DF
SCAS DI 1
2 . SCAS AF  CF  OF  PF  SF
ZF. REP CX
SCAS .
SCAS   
 :
 .
.11.1 H1 SCAS NAME1
m . SCASB 
   CX 
REPNE:
REPNE SCASB
NAME1 Assemblers  SCASB
m  . DEBUG
H1 SCAS
AH 3  m  . REP
SCASB CX 1 6.
SCASW
AX. LODSW MOV
AX   AL 
 AH. SCAS
 o .

________________________________________________________________

 

.

c
STRING 
 .
SCASB
 STRING 8 
DI a
STRING .

DI .
STRLEN
STRING

STRING
EQU 15
DB
The time
is now 
...
CLD

MOV AL  

MOV CX STRLEN
STRING
LEA DI STRING
STRING

REPNESCASB

JNZ 2

2 :

DEC DI

MOV BYTE PTR DI 2 H
RET


________________________________________________________________
MOVSB

. MOVS
.  FLDA

REP MOVS FLDA FLDB

MOVSW


FLDB DB 

FLDB FLDA.
:
REP MOVS ES:BYTE PTR DI DS: SI 
DI SI FLDA FLDB o
.

________________________________________________________________
STOS
o . 
 MOVS
. 
:

     . . .


 
.
:
PATTERN
DISAREA

DB
DB
.
.
CLD
MOV
LEA
LEA
REP

  
2 DUP 

CX 21
DI DISAREA
SI PATTERN
MOVSW

MOVSW  
PATTERN DISAREA  
  :

 
|
|
PATTERN DISAREA
DI DISAREA 6  p SI 
PATTERN 6  DISAREA. MOVSW
 DISAREA

DISAREA 6  DISAREA 2  DISAREA 8  DISAREA  DISAREA 1 ..


DISAREA:

     . . . 


|
|
|
|
PATTERN
DISAREA 6 DISAREA 12 DISAREA  2

.
.
:
________________________________________________________________
COM   .11.2 
 .

:
B1 INPT  3  .
D1 SCAS  SCASB
  .
E1 RGHT  MOVSB
.
ACTNLEN
 :

JEROME ERN
OSCAR HAMMERSTEIN
RICHARD ROGERS
F1 CLNM  STOSW .
__________________________________________________________________________
page
6 132
TITLE EXRING COM  
CODESG SEGMENT PARA Code 
ASSUME CS:CODESG DS:CODESG SS:CODESG ES:CODESG
ORG
1 H
BEGIN: JMP
SHORT MAIN


NAMEPAR LABEL BYTE
.
MAXNLEN DB
31
ACTNLEN DB


NAMEFLD DB
31 DUP  

Name    
PROMPT DB
NAMEDSP DB
31 DUP   13  1   
ROW
DB



MAIN
PROC
NEAR
MOV
AX  6 H
CALL
Q1 SCR


SUB
DX DX
CALL
Q2 CURS
A1 LOOP:
CALL
B1 INPT

 .. 
TEST
ACTNLEN  FFH

JZ
A 

CALL
CMP
JE
CALL
CALL
RET
ENDP

D1 SCAS
AL   
A1 LOOP
E1 RGHT
A1 LOOP





A  :
MAIN

:


B1 INPT PROC
MOV
AH  

LEA
DX PROMPT
INT
21H
RET
B1 INPT ENDP

:


D1 SCAS PROC
CLD
MOV
AL   
MOV
CX 3
 3
LEA
DI NAMEFLD

REPNE SCASB
 
JE
D2
MOV
AL 2 H
AL
D2 :
RET
D1 SCAS ENDP

:


E1 RGHT PROC
STD
SUB
CH CH
MOV
CL ACTNLEN
CX REP
LEA
SI NAMEFLD


ADD
SI CX

DEC
SI
LEA
DI NAMEDSP 3
.
REP MOVSB

MOV
DH ROW
MOV
DL  8
CALL
Q2 CURS

MOV
AH  

LEA
DX NAMEDSP
INT
21H
CMP
ROW 2

JAE
E2


INC
ROW
JMP
E 
E2 :
MOV
AX  6 1H


CALL
Q1 SCR

MOV
DH ROW
MOV
DL 
CALL
Q2 CURS
E  :
RET
E1 RGHT ENDP

:


F1 CLNM PROC
CLD

MOV
AX 2 2 H
MOV
CX 15
15
LEA
DI NAMEDSP
REP STOSW
RET
F1 CLNM ENDP

:


Q1 SCR PROC
AX
MOV
BH 3
   
MOV
CX 
MOV
DX 18 FH
INT
1 H
RET
Q1 SCR ENDP

  :


Q2 CURS PROC
DX
MOV
AH  2
SUB
BH BH
INT
1 H
RET
Q2 CURS ENDP
CODESG ENDS
END
BEGIN
__________________________________________________________________________
.11.2. .

________________________________________________________________

 MOVS  STOS  CMPS SCAS


ES.
 CLD 
.

STD 

 DI SI
.  MOVS DI SI 
CMPS  SI DI.
 CX
 .
 REP MOVS
STOS REPE REPNE  CMPS SCAS.
 c
CMPSW SCASW.

.   NAME1
1 
 LEA  NAME1 .
 NAME1 8.

________________________________________________________________
11.1.  MOVSB  
LODSB  STOSB REP.
 MOVSW   LODSW  STOSW REP.
11.2.  
.11.1. ES.
MOVSB MOVSW .
H1 SCAS NAME1 mb .
DEBUG 
.
11.3. :
DATASG

SEGMENT
CONAME
PRLINE

PARA
DB
SPACE EXPLORERS INC. 
DB 2 DUP  

 :






CONAME PRLINE
CONAME PRLINE
CONAME AX
AX PRLINE 5
CONAME PRLINE 

 CONAME PRLINE 
.  BH.

11. . H1 SCAS .11.1  


NAME1 er . 
er  NAME1 : As se mb le rs .
:
 SCASW 
NAME1   NAME1 1
 SCASB  
r .
11.5.  . 3   5 B .
2 .

12
I:
__________________________________________________________________________
:  
.

________________________________________________________________
  1 
 2 . 
 16  
.



.

.
ASCII .

________________________________________________________________
ADD SUB 
.
:
1 
.  
.
.12.1 ADD SUB 
. B1 ADD ADD
 C1 SUB SUB .
:









.
..

__________________________________________________________________________
page
6 132
TITLE EXADD
 
CODESG SEGMENT PARA Code 
ASSUME CS:CODESG DS:CODESG SS:CODESG
ORG
1 H
BEGIN: JMP
SHORT MAIN


BYTEA DB
6 H
BYTEB DB
H
BYTEC DB
16H
H
WORDA DW
WORDB DW
2 H
WORDC DW
1 H

:
MAIN
PROC
NEAR
ADD
CALL
B1 ADD
CALL
C1 SUB
SUB
RET
MAIN
ENDP

:


B1 ADD PROC
MOV
AL BYTEA
MOV
BL BYTEB
ADD
AL BL

ADD
AL BYTEC


ADD
BYTEA BL
.
ADD
BL 1 H
ADD
BYTEA 25H
.
RET
B1 ADD ENDP

:



C1 SUB PROC
MOV
AX WORDA
MOV
BX WORDB
SUB
AX BX

SUB
AX WORDC


SUB
WORDA BX
. pe.
SUB
BX 1 H
SUB
WORDA 256H
. .
RET
C1 SUB ENDP
CODESG ENDS
END
BEGIN
__________________________________________________________________________
.12.1. ADD SUB.
 

o .
WORDB WORDA  DW:
MOV AX WORDA
ADD AX WORDB
MOV WORDB AX


.

 .. 128 12 .

.  AL 
 AH.
 AL .6 
ADD AL 2 H
AL  .8 .
 .

 .8 1
. ..  128  128.
AL
AX. CBW Convert Byte to Word 
 .6 AL . 6
AX    AH.
ADD AX :
. 8  128:
CBW
ADD AX 2 H

AL AX
AX

: 15
 32 68 32 6 .
 .



32 6 

.
. 
    .
__________________________________________________________________________
page
6 132
TITLE EXDBADD COM 
CODESG SEGMENT PARA Code 
ASSUME CS:CODESG DS:CODESG SS:CODESG
ORG
1 H
BEGIN: JMP
SHORT MAIN

WORD1A DW
123H

BC62H
WORD1B DW
12H
WORD2A DW
WORD2B DW
553AH
WORD3A DW


WORD3B DW

MAIN
PROC
NEAR
:
CALL
D1 DWD
1
2
CALL
E1 DWD
RET
MAIN
ENDP
:



D1 DWD PROC
MOV
AX WORD1B

ADD
AX WORD2B
MOV
WORD3B AX

MOV
AX WORD1A
ADC
AX WORD2A

MOV
WORD3A AX
RET
D1 DWD ENDP

:


E1 DWD PROC

CLC
MOV
CX 2

LEA
SI WORD1B
DWORD1
DWORD2
LEA
DI WORD2B

LEA
BX WORD3B
2 :
MOV
AX  SI 
AX

ADC
AX  DI 
BX AX

MOV
DEC
SI
DEC
SI
DEC
DI
DEC
DI
DEC
BX
DEC
BX

LOOP
2
RET
E1 DWD ENDP
CODESG ENDS
END
BEGIN
__________________________________________________________________________

.12.2. .
.12.2 D1 DWD
WORD1A WORD1B 
WORD2A WORD2B  WORD3A
WORD3B . :
WORD1B
WORD2B
:

BC62
553A

111 C

 .111 C AX.
1.
  ADD
ADC ADd with Carry . 
CF  1:
WORD1A
WORD2A

:

123
12
1

136

DEBUG
136 AX  p
36 1 WORD3A C11 WORD3B.
.12.2 E1 DWD
.

. c  
 . SI  DI BX
2. DEC
.
SUB reg  2
 .. 
.
 ADC.
CLC CLear Carry 

.
: 1   2 
3  CX .
SBB SuBtract with
Borrow   ADC.
E1 DWD .12.2  ADC SBB 
.

________________________________________________________________
   a
.

   .

.  
 .


32 6  65535.
. ADD SUB

. 
.

2  
:
11111 1
1
11111 11

2 
2

251


2

5


.  251

5 . 
.
   p
.   

.

:
111111
1 1

CF

252
5
5


1
1
1
 

OF


:

1111 1
1 11
1 1

121
11

132

CF
121
11

12

 

OF


 :
1111 11
1 1 1

1111111

CF OF
1
2 6
13 
11 


12 
12 
1
1
   

________________________________________________________________
MUL 
 IMUL Integer MULtiplication  .

.
:

 . AL 
.
AX. p
 AH.
| AH | AL |
: |
||

|
AX
|
: ||

 . AX 
 .
 :
  DX   
AX. 
DX.
| AX |
:||

| DX || AX |
: |.||.|
| |

MUL IMUL .
:
MUL MULTR
MULTR DB 
AL MULTR. MULTR
DW 
AX MULTR. 
 :
MUL CL
MUL BX

: AL  . AX
: AX  . DX:AX

: MUL

MUL MULtiplication   .
.12.3 C1 MUL : 
. MUL .8
128  .  6 . .2 81 2 
AX.
__________________________________________________________________________
page 6 132
TITLE EXMULT COM 
CODESG SEGMENT PARA Code 
ASSUME CS:CODESG DS:CODESG SS:CODESG
OR6
1 H
BEGIN: JMP
SHORT MAIN

BYTE1 DB
8 H
H
BYTE2 DB
WORD1 DW
8 H
WORD2 DW
H

:
MAIN
PROC
NEAR

CALL
CALL
RET
ENDP

MAIN


C1 MUL PROC
MOV
MUL
MOV
MUL
MOV
SUB
MUL
RET
C1 MUL ENDP


D1 IMUL PROC
MOV
IMUL
MOV
IMUL
MOV
CBW
IMUL
RET
D1 IMUL ENDP

C1 MUL
D1 IMUL

. MUL
. IMUL

MUL:

AL BYTE1
BYTE2
AX WORD1
WORD2
AL BYTE1
A A
WORD1


A

DX:AX

. . A
DX:AX

IMUL:

AL BYTE1
BYTE2
AX WORD1
WORD2
AL BYTE1
WORD1


A

. DX:AX

. . A
. DX:AX

CODESG ENDS
END
BEGIN
__________________________________________________________________________
.12.3. .
MUL .1 p DX:AX.
MUL
BYTE1 .

 AH . 
CBW p AL
1 .  . DX:AX.
: IMUL

IMUL Integer MULtiplication  
. .12.3 D1 IMUL
 C1 MUL  MUL
IMUL.
IMUL .8  
.  .  .E
AX.  MUL
.2  MUL IMUL.
MUL .8 128  IMUL  128.
128 6 81 2
.E .
 . .
IMUL .8


 .2  .

.F DX:AX

o .
IMUL
BYTE1 AX.

 CBW
AH: .8 p AL
.FF8 AX. WORD1

. : . DX:AX 
 MUL 
.

 MUL IMUL . 
 MUL
 IMUL  .
 DEBUG
.
:
2 2  8 .. 
. 1
CL. 
AL AX:
2:
8:

SHL AL 1
MOV CL 3
SHL AX CL



:    .

32 6 .
.
.
:
1365
12

2 3
1365

1638

. 13 65 12  c :
13
12

26
13

156

65
12

13
65

8

 13
 156 :
156

8

1638

  
.



.
E1 XMUL .12. . 
MULTCND   .32 6
.2521. DW 
DD  MOV 
AX. MULTPLR .6 .
 PRODUCT  .
MUL MULTPLR c MULTCND
 . E8 E PRODUCT 2 PRODUCT  . MUL
MULTPLR MULTCND  .
138A 58 . :
1:
2:
:

E8 E
138A 58

138A 668 E

ADD 
c ADC ADd with Carry .
p 8 86 8 88 
PRODUCT 8A13 8 66
E .  PRODUCT
.
__________________________________________________________________________
TITLE EXDWMUL 
CODESG SEGMENT PARA Code 
ASSUME CS:CODESG DS:CODESG SS:CODESG
ORG
1 H
BEGIN: JMP
SHORT MAIN

MULTCND DW
32 6H

DW
2521H
MULTPLR DW
6 H
A26H
DW
PRODUCT DW

DW


DW

DW

MAIN
PROC
NEAR

1 
CALL
E1 XMUL

CALL
Z1 ZERO
CALL
F1 XMUL
2 
RET
MAIN
ENDP

:

E1 XMUL PROC

MOV
AX MULTCND 2

MUL
MULTPLR

MOV
MOV

PRODUCT  AX
PRODUCT 2 DX


MOV
AX MULTCND
MUL
MULTPLR

ADD
PRODUCT 2 AX

ADC
PRODUCT DX
RET
E1 XMUL ENDP
:


F1 XMUL PROC
MOV
AX MULTCND 2
2
MUL
MULTPLR 2
2

MOV
PRODUCT 6 AX
MOV
PRODUCT  DX
MOV
MUL
ADD
ADC
ADC

AX MULTCND 2
MULTPLR
PRODUCT  AX
PRODUCT 6 DX
PRODUCT 

2
1

1
MOV
AX MULTCND
MUL
MULTPLR 2
2
ADD
PRODUCT  AX

ADC
PRODUCT 6 DX

ADC
PRODUCT 
MOV
AX MULTCND
1
MUL
MULTPLR
1

ADD
PRODUCT 2 AX
ADC
PRODUCT DX
RET
F1 XMUL ENDP

:

Z1 XMUL PROC
MOV
PRODUCT 
MOV
PRODUCT 2 
MOV
PRODUCT  
MOV
PRODUCT 6 
RET
Z1 XMUL ENDP
CODESG ENDS
END
BEGIN
__________________________________________________________________________
.12. . .



.
:

2
2
1

2
1
2

DX AX
.
F1 XMUL .12. . MULTCND .32 6 2521 
MULTPLR  .6 A26. PRODUCT 
.

 
ADD ADC ADC 
PRODUCT.  ADC
 .
ADC   1 
. ADD ADC ADC 
PRODUCT
.
138A 68 C 8E5C CCE6 PRODUCT
.
DEBUG.
DX:AX
________________________________________________________________

p DX:AX .

    CX. 
.
MOV
C2 : SHL
SHL
ADC
LOOP
MOV
D2 : SHR
SHR
JNC
OR
D3 : LOOP



CX 
DX 1
DX 1
AX 1
AX 1

DX 

C2

CX 

AX 1
AX 1
DX 1
DX 1
D3

AH 1 B 1 AH

D2


. CL.


:
MOV
SHL
MOV
SHL
SHL
OR

CL 
DX CL
BL AH
AX CL
BL CL
DL BL


DX
AH BL
AX
BL
BL DL

________________________________________________________________

DIV  a
 IDIV.
. :

AX  


12  . F 
.

 .
.
AH   AL.
 255 .FF 


| AX |
: ||

| AH | AL |
: |||

 .
DX:AX  
. DX 
AX. 32 6 
.FFFF  16383 . FFF  .
| DX || AX |
| AH || AL |
: |.||.| : ||||
|

|
DIV IDIV .
:
DIV DIVISOR
DIVISOR DB 
. DIVISOR DW 
.
  13 3 
1 3.
  1.  
333....
BASIC 
  333 . 1 3 333...
 1 .
: DIV

DIV . .12.5 D1 DIV
:  
. DIV .2 8 2 
.8 128 . AH 
. 6   AL.
DIV BYTE1
. 
AH . 
.12 AH  . 5  AL.
DIV .1 DX
. 8 AX.
DIV
WORD1 DX. .
DX  . 2  AX.
__________________________________________________________________________
TITLE

page
EXDIV

6 132
COM  DIV IDIV

CODESG SEGMENT PARA Code 


ORG
1 H
BEGIN: JMP
SHORT MAIN

BYTE1 DB
8 H
Data items
BYTE2 DB
16H
WORD1 DW
2 H
1 H
WORD2 DW
WORD3 DW
1 H


MAIN
PROC
NEAR

CALL
D1 DIV
CALL
E1 IDIV

MAIN
ENDP

DIV:

D1 DIV PROC
MOV
AX WORD1

:
DIV
BYTE1

MOV
AL BYTE1
SUB
AH AH

DIV
BYTE3
:

DIV
IDIV

AH:AL
AH
AH:AL


MOV
DX WORD2
MOV
AX WORD3
DX:AX
DIV
WORD1
: DX:AX

MOV
AX WORD1
DX
SUB
DX DX
DIV
WORD3
: DX:AX
RET
D1 DIV ENDP

IDIV:

E1 IDIV PROC

MOV
AX WORD1
: AH:AL
IDIV
BYTE1
MOV
AL BYTE1

CBW
AH
: AH:AL
IDIV
BYTE3
MOV
DX WORD2

MOV
AX WORD3
DX:AX
: DX:AX
IDIV
WORD1

MOV
AX WORD1
CWD
DX
IDIV
WORD3
: DX:AX
RET
E1 DIV ENDP
CODESG ENDS
END
BEGIN
__________________________________________________________________________
.12.5. .
: IDIV

IDIV Integer DIVide  .
.12.5 E1 IDIV 
D1 DIV  DIV IDIV.

IDIV .2  
.8  .  .
AH   . C 6   AL. DIV 
 6 .

:
IDIV
2
3

EE 18 
1  6 

FB 5 
8 128 
2



DIV.  
DIV IDIV p. 

DIV

 IDIV  .
 DEBUG .
. 2 2  
..  .
 AX:
2:

SHR AX 1

8:

MOV CL 3
SHR AX CL



DIV IDIV 

p.  
 .
  .
. 1
  .
:  
 AH  :
   DX 
.  1:
:
:
:

123
26

1
1

1 23
1  26

.
 DIV IDIV
. p 
DIVBYTE   AX.
 DIVWORD  
DX:AX.

CMP AH DIVBYTE
JNB
DIV DIVBYTE

CMP DX DIVWORD
JNB
DIV DIVWORD

IDIV 
 
 NEG
.



. 
1.
 . c 
AX   BX 
CX:
SUB
C2 : CMP
JB
SUB
INC
JMP
3 : RET

CX CX
AX BX
C3
AX BX
CX
C2


 




CX  AX

CX  AX 
o.
. DX:AX 
:
1. C2 AX BX DX.
2. SUB SBB DX  .
:
.

________________________________________________________________
NEG
. NEG
1. :
NEG AX
NEG BL
NEG BINAMT

 

35   
.  DX:AX 32 
. NEG
 .
NOT:
NOT
NOT
ADD
ADC

DX
AX
AX 1
DX 



1 AX
DX

: 
 
. 

 . 

 ASCII . ASCII 

. .
INTEL 8 8  8 28 
________________________________________________________________

Intel 8 8   8 28 . 8 8 
8 88  8 28 
8 286.


.
8  
1
.
1 
.



. MASM 
E R   MASM R.

________________________________________________________________


p. 128 12 .
 ADC
. 
CLC  .
 MUL DIV
IMUL IDIV .
 .
 . 
AH   DX
 .
 c.
SHR SAR
. SHL
SAL.
 . 
FACTOR DB  MUL FACTOR
AL  DIV FACTOR
AX. FACTOR DW  MUL FACTOR
AX  DIV FACTOR
DX:AX.

________________________________________________________________
:

DATAX
DATAY

DW
DW
DW
DW

1 8H
2316H
23 H
52H

12.1.  DATAX
DATAY   DATAX 
DATAY.
12.2. :
STC
MOV BX DATAX
ADC BX DATAY
12.3. MUL :  DATAX
DATAY   DATAX 
DATAY.
12. .   
12.5. DIV :  DATAX 23 
 DATAX  DATAY.
12.6.  DX:AX 

. .

13

II:
ASCII BCD
__________________________________________________________________________
: ASCII BCD
.

________________________________________________________________

a .
.12  
.
ASCII c .
ASCII.  23
1 111 .1  ASCII
c 25 ASCII  p
.3235.

ASCII 
ASCII 
.  
p .1  12.
 BASIC
Pascal 
  . 
  .

 

 

ASCII 
________________________________________________________________
  ASCII   
SAM 53 1 D  123 
.3132333 .  
 .


.3132333  .

ASCII :
AAA
AAD
AAM
AAS

ASCII
ASCII
ASCII
ASCII

Adjust
Adjust
Adjust
Adjust

for
for
for
for

Addition  ASCII  
Division  ASCII  
Multiplication  ASCII  
Subtraction  ASCII  


AX.  ASCII 
 
.
ASCII 

8
ASCII :
.

38
3

6C

ASCII  
.  6 6 .C: .C 
6  .12  .
 
AAA .
  AX . 38 
 . 3 . 38 3
BX
ASCII   .
:
ADD AL BL
AAA

3 38
ASCII 

AAA .   AL.
A F AF 1  AL
6  AH 1  AF
CF
1. AAA
. AL.  AX:
ADD:
AAA:


6C
1 2

ASCII  

. :
OR

AX 3 3 H

3132


.
ASCII  
. 
.13.1 ASCII 
. :
__________________________________________________________________________
TITLE ASCADD COM  ASCII 
CODESG SEGMENT PARA Code 
ASSUME CS:CODESG DS:CODESG SS:CODESG
ORG
1 H
BEGIN: JMP
SHORT MAIN

5 8 

ASC1
DB
6  
ASC2
DB
ASC3
DB
 

MAIN
PROC
NEAR
CLC
LEA
SI AASC1 2
ASCII 
LEA
DI AASC2 2
LEA
BX AASC1 3
3
MOV
CX  3
A2 :
MOV
AH 
AH
ASCII 
MOV
AL  SI 
 
ADC
AL  DI 
AAA
ASCII
MOV
BX AL

DEC
SI
DEC
DI
DEC
BX
LOOP
A2
3
BX AH

MOV
RET
MAIN
ENDP
CODESG ENDS
END
BEGIN
__________________________________________________________________________
.13.1. ASCII .

 ADC 

  . CLC CF .
 MOV AH 
AAA . ADC p.
 XOR SUB o
AH CF.


p AH  1  .
 1 2  2.
OR AAA 
CF  p

ADC.
PUSHF  OR  
 POPF:
ADC AL  DI 
AAA
PUSHF
OR AL 3 H
POPF
MOV BX AL


ASCII



PUSHF POPF LAHF Load AH


with Flags  AH  SAHF Store AH in Flag
register  AH . LAHF
AH SF  ZF  AF  PF CF SAHF
AH .
  AH

. ASCII  
OR .
ASCII 

AAS ASCII Adjust for Subtraction 
ASCII   a AAA. AAS
.   AL.
A F AF 1  AL 6 
AH 1  AF CF 1.
AAS . p AL.
 ASC1
.38  ASC2  .3 :
1:
MOV AL ASC1
SUB AL ASC2
AAS
2:
MOV AL ASC2
SUB AL ASC1
AAS

AX

AF

38
3

AX

AF

3
FC
FF 6

1
1

1 AAS .
AL .C  AAS
AL 1 AH 1 AF
   .
..  .

2 
6
CF.
FF 6 

ASCII 

AAM ASCII Adjust for Multiplication 
ASCII  
ASCII  AX.  .

ASCII .  IBM
p .  ASCII 

3132333
1 2 3 .
 
 o 
.
AAM AL 1 . A 
AH  AL.  AL
.35  CL  .3 .
AL CL
ASCII :
AND CL  FH
AND AL  FH
MUL CL
AAM
OR AX 3 3 H

AX:
CL 
AL 5
5
AL CL
2D
.. 5
ASCII  
3 35

MUL 5 . 2D  AX 
AAM 1  AH
5 AL. OR p
ASCII .
.13.2
. AAM
 
.
 1 8  1 5.

 .

ASCII  .
 ASCII  .
__________________________________________________________________________
TITLE ASCMUL COM  ASCII 
CODESG SEGMENT PARA Code 
ASSUME CS:CODESG DS:CODESG SS:CODESG
ORG
1 H
BEGIN: JMP
MAIN

3 83 

MULTCND DB
MULTPLR DB
5 
PRODUCT DB
5 DUP  

MAIN
PROC
NEAR
MOV
CX 

LEA
SI MULTCND 3
LEA
DI PRODUCT 
ASCII 
AND
MULTPLR  FH
A2 :
MOV
AL  SI 
ASCII 
 LODSB 
ASCII 
AND
AL OFH
MUL
MULTPLR

AAM
ASCII

ADD
AL  DI 

AAA
MOV
DI AL

DEC
DI
DI AH

MOV
DEC
SI

LOOP
A2

RET
MAIN
ENDP
CODESG ENDS
END
BEGIN
__________________________________________________________________________
.13.2. ASCII .
ASCII 

AAD ASCII Adjust for Division 
ASCII  

ASCII 

. 
ASCII  . AAD
AX. 
AX 3238 ASCII  CL
3  ASCII .
:
AX:
AND CL  FH
CL ..
2 8
AND AX  F FH AX ..

1C
AAD
DIV CL


AAD AH 1 . A  p
2 .1  AL AH. 1C .
28.

1 .
.13.3
.
. AH AAD
AL. p:  2
AH 2.


 ASCII  . 
__________________________________________________________________________
TITLE ASCDIV COM  ASCII 
CODESG SEGMENT PARA Code 
ASSUME CS:CODESG DS:CODESG SS:CODESG
ORG
1 H
BEGIN: JMP
SHORT MAIN

36 8 

DIVDND DB
DIVSOR DB
 
QUOTNT DB
DUP  

MAIN
PROC
NEAR
MOV
CX 

SUB
AH AH

ASCII 3
AND
DIVSOR  FH
LEA
SI DIVDND
LEA
DI QUOTNT
A2 :
ASCII
MOV
AL  SI 
 LODSB 

AND
AL  FH
ASCII
AAD


DIV
DIVSOR
DI AL

MOV
INC
SI
INC
DI

LOOP
A2
RET
MAIN
ENDP
CODEGS ENDS
END
BEGIN
__________________________________________________________________________
.13.3. ASCII .
 BCD 
________________________________________________________________
ASCII 
 2 . 
 2 .  BCD 
Binary Coded Decimal   .
. 
ASCII .
  2 1 
16 .. . 
. 3 C.

BCD  . p
:
DAA
DAS

Decimal Adjustment for Addition  


Decimal Adjustment for Subtraction  . . 


.  .13. 
ASCII  BCD  .
B1 CONV ASCII BCD.
 . 
 
BCD  ASCII .
ASCII .
C1 ADD

BCD .
 12 263.
__________________________________________________________________________
TITLE BCDADD   .ASCII BCD 
CODESG SEGMENT PARA Code 
ASSUME CS:CODESG DS:CODESG SS:CODESG
ORG
1 H
BEGIN: JMP
SHORT MAIN

 5 836 
ASC1
DB
 6  2  
ASC2
DB
BCD1
DB
 
BCD2
DB
 
BCD3
DB
DUP  


MAIN

PROC
LEA
LEA
CALL
LEA
LEA
CALL
CALL
RET
ENDP

MAIN


B1 CONV PROC
MOV
MOV
MOV

XCHG
SHL
SHL
MOV
DEC
DEC
DEC
DEC
JNZ
RET
B1 CONV ENDP


C1 ADD PROC
XOR
LEA
LEA
LEA
MOV
CLC
2 :
MOV
ADC
DAA
MOV
DEC
DEC
DEC
LOOP
RET
C1 ADD ENDP

NEAR
SI ASC1 
DI BCD1 2
B1 CONV
SI ASC2 
DI BCD2 2
B1 CONV
C1 ADD

ASC1

ASC2

ASCII BCD:

CL 
OX  3
AX  SI 
AH AL
AL CL
AX CL
DI AH
SI
SI
DI
DX
2


2 :
ASCII apy
 LODSW 

ASCII 
BCD 

BCD :

A A
SI BCD1 2
DI BCD2 2
BX BCD3 3
CX  3

A

BCD

AL  SI 
AL  DI 

BCD1  LODSB 
BCD2

3 BCD3

BX AL
SI
DI
BX
2

CODESG ENDS
END
BEGIN
__________________________________________________________________________
.13. . BCD  .
ASCII 
________________________________________________________________
ASCII BCD

.
.
ASCII 
 ASCII  BCD   
:
 ASCII 
1 
2. :
1. ASCII 
.
2. . ASCII .
3. ASCII  1  1  1 .1  A  6  ..
.
123 ASCII 
:

1 
3 1 
2 1 
1 1 
:

3
2
1

1E
C8
3E8
D2

 . D2
123 . .13.5 B1 ASBI
ASCII  123 . 
ASCII  ASCLEN.
ASCII  ASCVAL 1 SI   BX.
B2 ASCII  AL:
MOV AL  SI BX 
ASCVAL 1 BX  
.. ASCVAL 3  ASCVAL .
BX 1 
.
BX  CX    LOOP.
MULT1 1 
1 1 1 .. 

SI DI.
__________________________________________________________________________
TITLE EXCONV   . ASCII . 
CODESG SEGMENT PARA Code 
ASSUME CS:CODESG DS:CODESG SS:CODESG
ORG
1 H
BEGIN: JMP
SHORT MAIN

ASCVAL DB
123 


BINVAL DB
ASCLEN DB
MULT1 DB
1

:
MAIN
PROC
NEAR
ASCII
CALL
B1 ASBI

CALL
RET
ENDP

MAIN



B1 ASBI PROC
MV
LEA
MOV
2 :
MOV
AND
MUL
ADD
MOV
MUL
MOV
DEC
JNZ
RET
B1 ASBI ENDP



C1 BIAS PROC
MOV
LEA
MOV
2 :
CMP
JB
XOR
DIV
OR
MOV
OEC
JMP
C3 :
OR
MOV
RET
C1 BIAS ENDP

C1 BIAS


ASCII :

CX 1
SI ASCVAL 1
BX ASCLEN


ASCVAL
ASCVAL

AL  SI BX 
AX  FH
MULT1
BINVAL AX
AX MULT1
CX
MULT1 AX
BX
2

ASCII 

1



. ASCII  



. . ASCII:

CX  1
SI ASCVAL 3
AX BINVAL


ASCVAL
.

A  1
3
DX DX
CX
DL 3 H
SI DL
SI
2

1 


1

AL 3 H
SI AL

3 c.
ASCII 

ASCII 

CODESG ENDS
END
BEGIN
__________________________________________________________________________
.13.5. ASCII .
ASCII 
________________________________________________________________

p  ASCII .
.

1 . A 
1 .  
ASCII .

. D2 :

B
C
1

3
2

D2 : A
B : A
C : A

1  .A  .
ASCII  
123 .
 .. 3132333 .
.13.5 C1 BIAS . D2

B1 ASBI  ASCII  123 .
.13.5  p
.

________________________________________________________________

. 12 3 5 
5

:
12 3 5
5

: 12 35  12 35

:
5:

12 3 55  5
. 12 3 555 5
:
12 3 55
5

12 35 5  12 35

12 3 555
5

12 35 55  12 35

  5
..

 123 5
.3 3 . 5 3 3  3 3E  1235
. .
.181F  16 5  ..
. 
.
1 .A :
.3 3E : .A 

D3 .1235

. D3 ASCII  1235. o
12 35 
.
.
5 1 
: 5 p 1 .
: 5  5  5 .. 
1  1  1 .. .
 p.

:
_______________________________________________________________________
 .13.6 

p .
. :
B1 INPT
D1 HOUR
E1 RATE
F1 MULT

G1 WAGE

1 DISP
M1 ASBI

.
.
ASCII
.
ASCII
.
 .

. 

    .

ASCII
ASCII .

ASCII 

.

__________________________________________________________________________

EXE  




STAC SG SEGMENT PARA STAC Stack 
DW
32 DUP 

STAC SG ENDS

DATASG SEGMENT PARA Data 

HRSPAR LABLE BYTE
:
MAXHLEN DB
6


ACTHLEN DB
HRSFLD DB
6 DUP 

TITLE

SCREMP


:


RATEPAR LABLE

BYTE

MAXRLEN DB
ACTRLEN DB
RATEFLN DB

6

6 DUP 

MESSG1
MESSG2
MESSG3
ASCWAGE
ADJUST
ASCHRS
ASCRATE
BINVAL
BINHRS

Hours worked    
Rate of pay    
Wage  
1 DUP 3 H  13  1   




DB
DB
DB
DB
DW
DB
DB
DW
DW

BINRATE DW

COL
DB


DECIND DB
1
MULT1 DW
NODEC DW

ROW
DB


SHIFT DW
TENWD DW
1
DATASG ENDS

CODESG SEGMENT PARA Code 
BEGIN PROC
FAR

ASSUME CS:CODESG DS:DATASG SS:STAC SG ES:DATASG
PUSH
DS
SUB
AX AX
PUSH
AX
MOV
AX DATASG
MOV
DS AX
MOV
ES AX
MOV
AX  6 H
CALL
Q1 SCR

CALL
Q2 CURS

A2 LOOP:

CALL
B1 INPT
CMP
ACTHLEN 

JE
A3

CALL
D1 HOUR

CALL
E1 RATE
CALL
F1 MULT

CALL
G1
WAGE

ASCII


CALL
1 DISP
JMP
A2 LOOP
A3 :
MOV
AX  6 H

CALL
Q1 SCR

RET
BEGIN ENDP



B1 INPT PROC
LEA
DX MESSG1

MOV
AH  
INT
21H

LEA
DX HRSPAR
MOV
AH  AH
INT
21H

CMP
ACTHLEN 
JNE
B2
RET
 A2 LOOP
B2 :

MOV
COL 25
CALL
Q2 CURS
LEA
DX MESSG2

MOV
AH  
INT
21H

LEA
DX RATEPAR
MOV
AH  AH
INT
21H
RET
B1 INPT ENDP


:


D1 HOUR PROC
MOV
NODEC 
MOV
CL ACTHLEN
SUB
CH CH

LEA
SI HRSFLD 1

ADD
SI CX
CALL
M1 ASBI

MOV
AX BINVAL
MOV
BINHRS AX
RET
D1 HOUR ENDP
:



E1 RATE PROC
MOV
CL ACTRLEN
SUB
CH CH

LEA
SI RATEFLD 1

ADD
SI.CX
CALL
M1 ASBI

MOV
AX BINVAL
MOV
BINRATE AX
RET
E1 RATE ENDP
 :



F1 MULT PROC
MOV
CX  5
LEA
DI ASCWAGE

ASCII 3 
MOV
AX 3 3 H
CLD
REP STOSW
MOV
SHIFT 1
MOV
ADJUST 
MOV
CX NODEC
CMP
CL  6
6
JA
F

DEC
CX
DEC
CX
JLE
F3
 3
MOV
NODEC  2
MOV
AX  1
F2 :
MUL
TENWD

LOOP
F2
MOV
SHIFT AX

SHR
AX 1
MOV
ADJUST AX
F3 :
MOV
AX BINHRS

MUL
BINRATE
ADD
AX ADJUST

ADC
DX 

CMP
DX SHIFT
DIV 
JB
F5
F :
SUB
AX AX
JMP
F 
F5 :

CMP
JZ
DIV
F  :
SUB
F8 :
RET
F1 MULT ENDP


G1 WAGE PROC
LEA
MOV
ADD
G3 :
CMP
JNE
DEC
G35:
CMP
JNZ
CMP
JB
G :
DIV
OR
MOV
DEC
SUB
JMP
G5 :
OR
MOV
RET
G1 WAGE ENDP


1 DISP PROC
MOV
CALL
MOV
LEA

2 :
CMP
JNE
MOV
INC
LOOP

3 :
LEA
MOV
INT
CMP
JAE
INC
JMP

8 :
MOV
CALL
MOV
CALL

 :
RET

ADJUST 
F8
SHIFT
DX DX

ASCII :

SI ASCWAGE 
.
BYTE PTR SI  . 

SI NODEC
BYTE PTR SI  . 
 ..
G35
SI
DX 
G
AX  1
G5

dx:ax  1 

TENWD
DL 3 H
SI DL
SI
DX DX
G3

 ASCII 

AL 3 H
SI AL

ASCII

ASCII

:

COL 5
Q2 CURS
CX  
SI ASCWAGE

DX MESSG3
AH  
21H
ROW 2
8
ROW



AX  6 1H
Q1 SCR
COL 
Q2 CURS




BYTE
PTR
SI
3
H





3
BYTE PTR SI 2 H
SI
2




1 DISP ENDP



M1 ASBI PROC
MOV
MOV
MOV
SUB
M2 :
MOV
CMP
JNE
MOV
JMP
M :
AND
MUL
ADD
MOV
MUL
MOV
CMP
JNZ
INC
M  :
DEC
LOOP
CMP
JZ
ADD
M1 : RET
M1 ASBI ENDP


Q1 SCR PROC
MOV
SUB
MOV
INT
RET
Q1 SCR ENDP


Q2 CURS PROC
MOV
SUB
MOV
MOV
INT
RET
Q2 CURS ENDP

ASCII 
:

MULT1  1
BINVAL 
DECIND 
BX BX
AL  SI 
AL  . 
M
DECIND  1
M 
AX  FH
MULT1
BINVAL AX
AX MULT1
TENVD
MULT1 AX
DECIND 
M 
BX
SI
M2
DECIND 
M1
NODEC BX

ASCII 
 .


.

x 1




. 


:

NEAR
AX
BH 3
   
CX CX
DX 18 FH
1 H
:

NEAR
AH  2
BH BH
DH ROW
DL COL
1 H

CODESG ENDS
END
BEGIN
__________________________________________________________________________
.13.6. .

. 
.13.6  c 
.  
 1  a

ASCII  1 .

65535  .

.
.


 

.
 .
.

XLAT . .1 .
:
  .



.   12 3 
12 3 .
.

.
ASCII .
 
  ASCII  
 .12
 . IMUL
IDIV .
 5.

________________________________________________________________

 ASCII  .

.
.
 ASCII 
AAA ASCII   AAS.
 ASCII  
  
.
AAM.
 ASCII   : 1 
  
2 
AAD.


ASCII  .
ASCII : .3
.3     
.

________________________________________________________________
13.1.  AX  ASCII 
BX  ASCII .
:


ADD AX 33H
 ADD AX BX
AAA
AAA
 SUB AX BX
 SUB AX  DH
AAS
AAS

13.2. UNPA . 1  5
.  ASCII  
.. 313 3 35.
13.3. ASCA 313 33 ASCII  
ASCB 35.
ASCII  ASCPRO.
13. . 13.3  ASCA ASCB
ASCQUO.
13.5. :  ASCII
6328 . 
. ASCII .
13.6. 
INT 12H  . .2 
ASCII  :
nnn .

1

__________________________________________________________________________
: 
.

________________________________________________________________

    .
 XLAT. 
 
.
.
.

.

________________________________________________________________

 .. 


.
 
 6  :

STAC
DW 6 DUP 

:
MONTAB
COSTAB

DB
DB

JAN  FEB  MAR  ...  DEC 


2 5 2 8 2 212 215 22 ...

MONTAB  COSTAB 
.
 .

  

  . 
Paper   . 

.

STO TBL DB 12  Computers 1  Paper.... 1  Diskettes 
:

STO TBL DB 12  Computers 
DB 1  Paper.... 
DB 1  Diskettes 

.


________________________________________________________________
  3
March.

 .
 September  :
MONTBL

DB
DB
DB

January.. 
February. 
March.... 

 . January  
MONTBL   February   MONTBL  March   MONTBL 18.
3  :

3.

1. ASCII 33

2. : 3  1  2
3. : 2   18
. 18  MONTBL
: MONTBL 18.
__________________________________________________________________________
page
6 132
TITLE DIRECT COM 
CODESG SEGMENT PARA Code 
ASSUME CS:CODESG DS:CODESG ES:CODESG
ORG
1 H
BEGIN: JMP
SHORT MAIN

THREE DB
3
MONIN DB
11 
   
ALFMON DB
JAN  FEB  MAR  APR
MONTAB DB
  MAY  JUN 
DB
JUL  AUG  SEP  O T  NOV  DEC 


MAIN
PROC
NEAR

CALL
C1 CONV
CALL
D1 LOC

CALL
F1 DISP

RET
MAIN
ENDP

ASCII :


C1 CONV PROC

MOV
AH MONIN
MOV
AL MONIN 1
XOR
AX 3 3 H
ASCII
1  
CMP
AH 

JZ
C2
SUB
AH AH
 AH 
ADD
AL 1

C2
RET
C1 CONV ENDP

:


D1 LOC PROC
LEA
SI MONTAB
DEC
AL

MUL
THREE
AL 3
ADD
SI AX

MOV
CX  3
CLD
LEA
DI ALFMON
3
REP MOVSB
RET
D1 LOC ENDP
.:



F1 DISP PROC
LEA
DX ALFMON
MOV
AH  
INT
21H
RET

F1 DISP ENDP
CODESG ENDS
END
BEGIN
__________________________________________________________________________
.1 .1. .
.1 .1
.
 . MONIN.

ASCII  MONIN.

. p

.

.
 : 1 
2  3 ... 1 6  1  1 8 ... 5  1  15. 
.
 .

________________________________________________________________



. 
  13  138  1 1  23  2 5.

.
.



.   

 .
 .
 

 .
 :

STONOS DB 1 1  1   1  ...
STO DCR DB Excavators  Processors  Assemblers ...
 :

1 1  Excavators 
STO TAB DB
DB
1   Processors 
DB
1   Assemblers 
...
.1 .2
. .



STO NIN . 

.
 A3 
DESCRN.

 
.

 

STO NIN AX. STO NIN
3233  MOV AX
3332.
 MOV XCHG 
AX 

 .. 3233. CMP 

   .
 p 
.
XCHG 
MOV   BX
AX BX :

MOV AX STONIN
LEA SI STO TAB
C2 :
MOV BX  SI 
CMP AX BX
JA JB ...

. 

 .
.1 .2
. o
. 
REPE CMPSB 
p CX.
__________________________________________________________________________
page
6 132
TITLE TABSRCH COM 
CODESG SEGMENT PARA Code 
ASSUME CS:CODESG DS:CODESG ES:CODESG
ORG
1 H
BEGIN: JMP
SHORT MAIN


23 
STONIN DW
 5  Excavators 
STO TAB DB
DB
 8  Lifters

DB
   Presses

12  Valves

DB
23  Processors 
DB
DB
2   Pumps

DESCRN 1
DUP 

MAIN
PROC
NEAR 
MOV
AX STO NIN

XCHG
AL AH

MOV
CX  6 

LEA
SI STO TAB

A2 :

A3 :

CMP
JE
ADD
LOOP
CALL
RET

AX  SI 
A3
SI 12
A2
R1 ERR


 


MOV
CX  5
LEA
DI DESCRN
INC
SI
INC
SI
REP MOVSW
RET
ENDP

MAIN

R1 ERR PROC

RET
R1 ERR ENDP

 

CODESG ENDS
END
BEGIN
__________________________________________________________________________
.1 .2.



.  o
 :

1 .
1  1 25 
25  1  25 
25  1 6 
6  1

1
15
18
2
23


5 
125 
26 
3  


.
:
TAXTBL

DD

1 25  25 6 

 x
:

 

  .
:
: 1  




REPE CMPS. 

.1 .2 
.


STO NIN  STO TAB  
c :
: |123| 35Excavators| 38Lifters
| | |
| |
: 3 6
16 1 

| Presses
| |
2  32

| ...


.1 .3 STO TAB 
  . 
STO NIN:


STO NIN
35
38

1 2
123

123
123
123
123
123

: . 
: . 
: . 
: . 
:

 CMPSB .1 .3 
p SI DI.
CX 3 
SI DI 3 .
 35:123 
 SI  DI: 1  CX: 2.
SI 16  DI:
.
DI STO NIN.
 SI 
   
. CX 
  2. SI
CX 
:


2
1

. 16

SI CMPSB
CX

CX 
  :
1  2 3 .
 CX  p SI
.
__________________________________________________________________________
page
6 132
TITLE TABSRCH COM   CMPSB
CODESG SEGMENT PARA Code 
ASSUME CS:CODESG DS:CODESG ES:CODESG
ORG
1 H
BEGIN: JMP
SHORT MAIN



STONIN DW
123 
STO TAB DB
 35  Excavators 

 38  Lifters

DB
   Presses

DB
DB
1 2  Valves

DB
123  Processors 
12   Pumps

DB
  1 DUP  

DB
DESCRN 1
DUP 

MAIN
PROC
NEAR
CLD

LEA
SI STO TAB

A2 :
3
MOV
CX  3 

LEA
DI STO NIN
REPE CMPSB

JE
A3
 

JA
A
CX
ADD
SI CX
JMP
A2

A3 :
5
MOV
CX  5

LEA
DI DESCRN
REP MOVSV

RET
A :

CALL
R1 ERR
RET
MAIN
ENDP
R1 ERR PROC

RET
R1 ERR ENDP

 

CODESG ENDS
END
BEGIN
__________________________________________________________________________
.1 .3. CMPSB


 .

  .

p .FF. 
. 
.
SCAS.
XLAT
________________________________________________________________
XLAT

. XLAT

IBM  XLAT
ASCII EBCDIC.

ASCII EBCDIC. ASCII
.3 3  EBCDIC  .F F 
OR.  ASCII
.  EBCDIC. XLAT
 256 
EBCDIC ASCII :
XLTBL DB
DB
DB

 DUP  H 
EBCDIC
F H  F1H  F2H  F3H ...  F H  EBCDIC 
1  DUP  H  EBCDIC

XLAT BX 
  ASCNO  AL.
:
LEA BX XLTBL
MOV AL ASCNO
XLAT
XLAT AL
a  .. BX AL. 
 ASCNO  XLTBL 
XLAT . . ASCNO c
.32  XLTBL 5 .
.F2 2 EBCDIC  XLAT
AL.
.1 .
2E  2D  ASCII EBCDIC  B
6
.
. ASCNO 31.5
 .2D33312E352 .
EBCNO .6 F3F1 BF5 .
__________________________________________________________________________
page
6 132
COM  ASCII EBCDIC
TITLE XLATE
CODESG SEGMENT PARA Code 
ASSUME CS:CODESG DS:CODESG ES:CODESG
ORG
1 H
BEGIN: JMP
MAIN

ASCNO DB
31.5 
EBCNO DB
6 DUP  
XLTAB DB
5 DUP  H 
DB
6 H  2DH
DB
5CH
F H  F1H  F2H  F3H  F H
DB
F5H  F6H  F H  F8H  F H
DB
DB
1  DUP  H 


MAIN
PROC
NEAR
ASCNO
LEA
SI ASCNO
LEA
DI EBCNO
EBCNO
MOV
CX  6


LEA
BX XLTAB
A2 :

MOV
AL  SI 
ASCII
XLAT

DI AL
EBCNO
MOV
INC
DI
INC
SI
LOOP
A2
6
RET
MAIN
ENDP
CODESG ENDS
END
BEGIN
__________________________________________________________________________
.1 . . ASCII EBCDIC.
: . ASCII 
________________________________________________________________
__________________________________________________________________________
page
6 132
TITLE ASCHEX COM  ASCII .
CODESG SEGMENT PARA Code 
ASSUME CS:CODESG DS:CODESG ES:CODESG
ORG
1 H
BEGIN: JMP
MAIN

 13
DISPROW DB
16 DUP 
HEXSTR DB

XLATAB DB
3 H 31H 32H 33H 3 H 35H 36H 3 H 38H 3 H
DB
1H  2H  3H  H  5H  6H

MAIN
PROC
NEAR

CALL
Q1 CLR

LEA
SI DISPROW
A2 LOOP:
CALL
C1 HEX

CALL
D1 DISP

FF 
CMP
HEXCTR  FFH

JE
A5
INC
HEXCTR

JMP
A2 LOOP
A5 :
RET
MAIN
ENDP
C1 HEX PROC
MOV
MOV
SHR
LEA
MOV
XLAT
MOV

NEAR
AH 
AL HEXCTR
AX CL
BX XLATAB
CL 

SI AL

.
.


.

MOV
SHL
XLAT
MOV
RET
C1 HEX ENDP

AL HEXCTR
AX CL

SI 1 AL

D1 DISP PROC
MOV
MOV
CMP
JE
CMP
JB
CMP
JAE
D2 :
MOV
D3 :
ADD
LEA
CMP
JNE
MOV
MOV
MOV
LEA
INT
LEA
D :
RET
D1 DISP ENDP
Q1 CLR PROC
MOV
MOV
MOV
MOV
INT
RET
Q1 CLR ENDP

NEAR
AL HEXCTR
SI 3 AL
AL 1AH
D2
AL  H
D3
AL 1 H
D3

EOF 

 8 
 O
 F 
 O

BYTE PTR SI 3 2 H


SI  5
DI DISPROW 8
DI SI
D
AH  H
BX  1
CX 81
DX DISPROW
21H
SI DISPROW

NEAR
AX  6 H
BH  3
CX 
DX 18 FH
1 H

   

CODESG ENDS
END
BEGIN
__________________________________________________________________________
.1 .5. . ASCII 
 .1 .5 
ASCII   . .  ASCII 
.53  S  53 S.
1616:


.
.
.
F

1
.
.
.
F1

2
.
.
.
F2

3
.
.
.
F3


.
.
.
F

5
.
.
.
F5

6
.
.
.
F6


.
.
.
F

8
.
.
.
F8


.
.
.
F

A
.
.
.
FA

B
.
.
.
FB

C
.
.
.
FC

D
.
.
.
FD

E
.
.
.
FE

F
.
.
.
FF

.8.1  ASCII   o
. .
ASCII  . 
ASCII .  1 .. . .3 3 
. 1 .3 31 ..
HEXCTR .
1. C1 HEX

HEXCTR . .  HEXCTR . F.
.
XLATAB. AL
.3 . . F
. 6. o .3 6 
F.
DOS . 
.1A  .
 DOS . 
  .
.
ASCII . .
:
________________________________________________________________

. 


. 

. 
 
.

 .



. 


. 
 .
. 
.

1 2  2 3 ..
 . 
.. 1 2 
2 3 .. 
.

SWAP

: YES  NO :
G1 :
G2 :
G3 :


SWAPNO

 
:
SWAPYES


: G3
: SWAPYES 
: G2  . 
:

 .1 .6 
3 
.
__________________________________________________________________________

page
6 132
TITLE NMSORT EXE 



STAC
SGMENT PARA STAC Stack 
DW
32 DUP 

STAC
ENDS

DATASG SEGMENT PARA Data 
NAMEPAR LABEL BYTE
:
.
MAXNLEN DB
21


NAMELEN DB
NAMEFLD DB
21 DUP  

CRLF
DB
13  1   

ENDADDR DW
MESSG1 DB
Name    
NAMECTR DB

NAMETAB DB
3 DUP 2 DUP  
NAMESAV DB
2 DUP  13  1   
SWAPPED DB

DATA
ENDS

CODESG SEGMENT PARA Code 
BEGIN PROC
FAR

ASSUME CS:CODESG DS:DATDSG SS:STAC ES:DATASG
PUSH
DS
SUB
AX AX
PUSH
AX
MOV
AX DATASG
MOV
DS AX
MOV
ES AX
CLD
LEA
DI NAMETAB

CALL
Q1 CLR

CALL
Q2 CURS
A2 LOOP:
CALL
B1 READ


CMP
NAMELEN 

JZ
A3
CMP
NAMECTR 3
3 
JE
A3


CALL
D1 STOR
JMP
A2 LOOP
A3 :

CALL
Q1 CLR


CALL
Q2 CURS
2 
CMP
NAMECTR  1
JBE
A

CALL
G1
SORT




CALL
1 DISP

A :
RET
BEGIN ENDP




B1 READ PROC
MOV
AH  
LEA
DX MESSG1

INT
21H
MOV
AH  AH

B2 :

LEA
INT
MOV
LEA
INT

DX NAMEPAR
21H
AH  
DX CRLF
21H

MOV
MOV
MOV
SUB

BH 
BL NAMELEN
CX 21
CX BX

CRLF

MOV
NAMEFLD BX 2 H
INC
BX
LOOP
B2
RET
B1 READ ENDP

:


D1 STOR PROC

INC
NAMECTR
CLD
LES
SI NAMEFLD
MOV
CX 1

REP MOVSV
RET
D1 STOR ENDP

:


G1 SORT PROC
SUB
DI 

MOV
ENDADDR DI
G2 :
MOV
SWAPPED 

LEA
SI NAMETAB

G3 :

MOV
CX 2
MOV
DI SI
ADD
DI 2

MOV
AX DI
MOV
BX SI
REPE CMPSB

JBE
G


CALL
H1 XCHG
G :
MOV
SI AX
CMP
SI ENDADDR


JBE
G3

CMP
SWAPPED 
JNZ
G2
 
RET

G1 SORT ENDP

:


H1 XCHG PROC
MOV
CX 1
LEA
DI NAMESAV
MOV
SI BX
REP MOVSW

MOV

CX 1

MOV
DI BX
REP MOVSW
MOV
CX 1
LEA
SI NAMESAV
REP MOVSW

MOV
SWAPPED  1
RET
H1 XCHG ENDP

:



1 DISP PROC
LEA
SI NAMETAB

2 :

LEA
DI NAMESAV
MOV
CX 1
REP MOVSV
MOV
AH  
LEA
DX NAMESAV
INT
21H

DEC
NAMECTR


 
JNZ
2

RET

1 DISP ENDP
:



Q1 CLR PROC
MOV
AX  6 H
MOV
BH 61H
   
SUB
CX CX
MOV
DX 18 FH
INT
1 H
RET
Q1 CLR ENDP

:


Q2 CURS PROC
MOV
AH  2
SUB
BH BH
SUB
DX DX

INT
1 H
RET
Q2 CURS ENDP

CODESG ENDS
END
BEGIN
__________________________________________________________________________
.1 .6.

________________________________________________________________


. 
 
 .
TYPE   LENGTH   SIZE  

.
:
TABLEX

DW

1 DUP  1

TYPE DW
 LENGTH DUP  1 
SIZE 1 2  2 .
:
MOV AX TYPE TABLEX
MOV BX LENGTH TABLEX
MOV CX SIZE TABLEX

AX 2
BX A
CX 1

1 
2 

LENGTH SIZE
.  SI

:
CMP SI SIZE TABLEX
23  
TYPE  LENGTH SIZE.

________________________________________________________________



.

 . 
 .
:  
p 
.
3   2.
  2
SHL 
.  1 .
  DB  256 
DW . CMP CMPSW

.
 
 .
.

.
 .

.

________________________________________________________________

1 .1.  
.
1 .2  1 
 1 .1.
.
1 .3 
:
 : 6  1  1  21  2
 :   

 : 3. 5  82.25   .6  85.8  13.85.
1 . 
ITEMIN  QTYIN  .
1 .3  ITEMIN.
.
  .
1 .5 1 .3  :
   
.

15
I:
__________________________________________________________________________
:
  

________________________________________________________________

.
   

.
. c 5
1  
3 .
512 .
 
. 
  

.
.
. o
.   
 .

:

T T  T T  T T 


T T 
1 2 3... n

L L L 

L 

.
 5 1   .

________________________________________________________________
:
DOS

DOS 2.
DOS 2.

3 1 2 



8
8

8

15


512
512
512
512

32 
368
1 228
3 

68
6
8
28

1
2

3 6
61

1
1

512
512

1 653 6 6
21.3 . 2

 

. 
 1.
 
________________________________________________________________



DOS .

.
:




1
1

1
2 3

1 3
...


FAT 

1 
 .
 1  p  1  1   
2  ..
.
 .
FORMAT S 
DOS IBMBIO.COM IBMDOS.COM .

 512  512 
. DOS p
.  
. :



  .
: . 
 .E5   .2E
 .

 :
. 
. 1 
. 2   
.  DOS
. 8 
.1 
.2   .
DOS.
 
:

8 1
11

12 21
22 23

||
2 25


:
|||

26 2 

28 31

1 8
11   1 12   1 31.
.
.  COM  DOS 
2. 
.
. DOS
.

 
.

________________________________________________________________
FAT  File Allocation Table 
 .
 DOS
.
1  2 FAT. FAT
 FAT
.
  .
FAT p

 .
FAT :
FE

FC
FF
FD
F
F8


8


1 2 

FFFF.

.  
:

FAT
..
 8
1
2 3
1

 
1
2 5
6 
1
1
 8
1
2 3
2
 
1
2 5
6 12
2
1 2  1
2 15 16 2 
1
XT
1
2 1  18  
8
115
AT
1
2 838
 FAT .
12 .  DOS 3 FAT
16 . FAT 
1  
 .
2. FAT
. 12 
:


nnn
FF 
FFF



 
.

 
PAYROLL.ASM  2  3 .
PAYROLL   ASM  .
  2 
. FAT
 
:
FAT:
|FDF|FFF| 3| |FFF| | |...| |
.:
1 2 3
5 6 ...
FAT

1.
 :
1. DOS PAYROLL
ASM.
2. DOS

 2 
.
3. DOS
FAT 

2.


  3.

 3. DOS
.

. DOS FAT 
3.
 . DOS
.
5. FAT .FFF 
 .

 FAT  . 
 . 
  
FAT .FFF 
.
 
15.
FAT :

 15 1 5  22 5.
 22 23 FAT.
 F FF.
 : FFF .
 15    FFF
.



15. FAT  22 
p p:
6 1 1  8 1 FF F
 FAT  15 1 5 
22 5  22 23 
. 6 1 
16 . 15  
16.   16.
  16 1 5
2 . 2 25 FAT.
1 8 8 1 . 16
 1 .
1 .
  1 
1 5  25.5. 25 26
FAT. 8 1 18 . 1 
 18.
18.

FAT 2  28  FF F 
FFF. 18 
FFF  .
 p.

 .

FAT   
DOS 1BH 1CH.

________________________________________________________________

 .
   
    p .

p .

FAT 


________________________________________________________________
15.1. 
15.2. 
15.3. 
15. .
DOS FORMAT S 
15.5. FAT 

15.6. 28    : 
c  
   .

16
II: DOS
__________________________________________________________________________
:
DOS .

________________________________________________________________
DOS 
FCB 

. DOS
.
DOS
FCB  file control block 
. FCB DOS
.

.
.
   DOS
.
     DOS
.   
 .


 .


     
DOS 21H. 
 DOS 
25H 26H. BIOS
13H 
. DOS

BIOS. .1 
DOS 2 
.18 BIOS. :

.
FCB 
________________________________________________________________

DOS
FCB. FCB

. FCB

15 32 36  16 31 DOS:


1 8
11

12 13

1 15

16 1 

2 21
22 31
32

33 36

: 1 A  2 B ..
 
8 .
  LPT1 .
  DTA
ASM. 
. DOS
.
. 128 .

 32 . 
 1 ..
.
.
128 .8 .

.
. DOS
 
.
.
 .
. DOS
.
.
DOS.
.
 12  . 12 13 .

.  

12 .
.

. 

25 .1 
.1  . 

.
1. 3.  1.82 

.
6  36 .

.
FCB


.
.FF   
. .
FCB
________________________________________________________________

. 
FCB DX.
FCB DS:DX.
.16

DOS INT 21H :


MOV AH 16H

LEA DX FCBname
DOS
INT 21H
DOS 

FCB  .

   DOS

 DOS .
  .

AL:


FF

FCB 
   128 .8  . 

.

DTA  disk trausfer


area . FCB  DTA
. .1A
DOS DTA.
DTA. DTA:
MOV AH 1AH
LEA DX DTAname
INT 21H


DTA
DOS

DTA .
DTA
.
.15:
MOV AH 15
LEA DX FCBname
INT 21H



DOS

FCB
DTA. 
.
. 
128   128512 
.
DOS FCB
1.
128  FCB
1. AL
:


1
2

.
.
DTA .

  
.1A .
.1 :
MOV AH 1 H
LEA DX FCBname
INT 21H



DOS


DOS 
. AL :


FF

.

 .

: FCB
________________________________________________________________
__________________________________________________________________________
page
6 132
TITLE FCBCREAT EXE  FCB



STAC SG SEGMENT PARA STAC Stack 
DW
8 DUP 

STAC SG ENDS

DATASG SEGMENT PARA Data 
RECLEN EQU
32
NAMEPAR LABEL BYTE
:
MAXLEN DB
RECLEN
.


NAMELEN DB
NAMEDTA DB
RECLEN DUP   DTA 

FCBREC
FCBDRIV
FCBNAME
FCBEXT

FCBBL
FCBRCSZ
FCBFLSZ

LABEL
DB
DB
DB
DW
DW
DD
DW
DT
FCBSQRC DB
DD

BYTE

NAMEFILE 
DAT 








FCB
D




DOS 
DOS 
DOS 

CRLF
DB
13 1   

ERRCDE DB
Name    
PROMPT DB
ROW
DB
1
OPNMSG DB
 Open error   
 Write error   
WRTMSG DB
DATASG ENDS

CODESG SEGMENT PARA Code 
BEGIN PROC
FAR

ASSUME CS:CODESG DS:DATASG SS:STAC SG ES:DATASG
PUSH
DS
SUB
AX AX
PUSH
AX
MOV
AX DATASG
MOV
DS AX
MOV
ES AX
MOV
AX  6 H

CALL
Q1 SCR
CALL
Q2 CURS

CALL
C1 OPEN
 DTA

CMP
ERRCDE 
 
JZ
A2 LOOP
RET
 DOS
A2 LOOP:
CALL
D1 PROC

CMP
NAMELEN 
JNE
A2 LOOP
 
CALL
G1 CLSE

DOS
RET
BEGIN ENDP

:


C1 OPEN PROC
NEAR

MOV
AH 16H
LEA
DX FCBREC
INT
21H

CMP
AL 

JNZ
C2

C2 :

MOV
LEA
MOV
INT
RET

FCBRCSZ RECLEN
DX NAMEDTA
AH 1AH
21AH

EQU 
DTA

LEA

DX OPNMSG

CALL
RET
C1 OPEN ENDP


D1 PROC PROC
MOV
LEA
INT

D2 :

X1 ERR
:

NEAR

AH  

DX PROMPT
21H

MOV
LEA
INT
CALL

AH  AH
DX NAMEPAR
21H
E1 DISP

CMP
JNE
RET

NAMELEN 
D2


 


MOV
MOV
MOV
CALL

Return
BH 
BL NAMELEN
NAMEDTA BX   

F1 WRIT

CLD
LEA
DI NAMEDTA


MOV
CX RECLEN  2

MOV
AX 2 2 H
REP STOSW
RET

D1 PROC ENDP

:


E1 DISP PROC
NEAR

MOV
AH  
CR LF
LEA
DX CRLF
INT
21H
DOS
CMP
ROW 18

 
JAE
E2

INC
ROW
RET
E2 :
1
MOV
AX  6 1H
CALL
Q1 SCR
CALL
Q2 CURS

RET
E1 DISP ENDP

:


F1 WRIT PROC
NEAR

MOV
AH 15H
LEA
DX FCBREC
INT
21H
CMP
AL 


JZ
F2

LEA
DX WRTMSG
CALL
X1 ERR

MOV
NAMELEN 
F2 :
RET
F1 WRIT ENDP



G1 CLSE PROC
MOV
CALL
MOV
LEA
INT
RET
G1 CLSE ENDP


Q1 SCR PROC
MOV
MOV
MOV
INT
RET
Q1 SCR ENDP


Q2 CURS PROC
MOV
MOV
MOV
MOV
INT
RET
Q2 CURS ENDP


X1 ERR PROC
MOV
INT
MOV
RET
X1 ERR ENDP

:

NEAR
EOF
NAMEDTA 1AH
F1 WRIT
AH 1 H

DX FCBREC
21H
:

NEAR
AX
BH 1EH

CX 
DX 18 FH
1 H

:

NEAR
AH  2
BH 
DL 
DH ROW

1 H
:

NEAR
AH  
DX
21H


ERRCDE  1

CODESG ENDS
END
BEGIN
__________________________________________________________________________
.16.1. .
 .16.1  
. FCB FCBREC 
:
FCBDRIV
FCBNAME
FCBEXT

FCBBL
FCBRCSZ
FCBSQRC


 D .
 NAMEFILE.
 DAT.
 .

128.
 .

:
BEGIN

C1 OPEN

C1 OPEN
D1 PROC
E1 DISP
F1 WRIT
G1 CLSE
X1 ERR

DTA DOS  D1 PROC


. 
G1 PROC .

 32 .2  DTA
DOS.

F1 WRIT
.
.
.

.

1 FCBSGRC 
 .2   FCBFLSZ  .
32  16
.
DTA :
DTA: | |
: | | 1| 2|...| 15|
25  1
25 .1 . :
25 32  8 . 32

.
: 2 3 .

:
: | 16| 1 |...| 2 |.1A|...|...|


.  

DTA. 
EOF  .
1A.
 

. 
 FCB.

________________________________________________________________
DOS  
  .
. OF:
MOV AH OFH
LEA DX FCBname
INT 21H



DOS


 FCB.

 AL .FF. 
AL FCB
 
.8 .
.
DTA
 .
DTA .1A  EOF
.1A  :
MOV AH 1AH
LEA DX DTAname
INT 21H


DTA
DOS


.1 :
MOV AH 1 H
LEA DX FCBname
INT 21H



DOS

DTA
FCB. AL
:


1
2
3

.
 .
DTA .
  .

DOS.
FCB
DTA.
  .

.

FCB

1.
EOF 
.

. 
.
 DOS .
: FCB
________________________________________________________________
__________________________________________________________________________

TITLE FCBREAD EXE  CREATDS



STAC SG SEGMENT PARA STAC Stack 
DW
8 DUP 

STAC SG ENDS

DATASG SEGMENT PARA Data 
FCB
FCBREC LABEL BYTE

D
FCBDRIV DB

FCBNAME
FCBEXT

FCBBL
FCBRCSZ

DB
DB
DW
DW
DD
DW
DT
FCBSQRC DB
DD

NAMEFILE 
DAT 








RECLEN EQU
NAMEFLD DB


32
RECLEN DUP   13  1   





DOS 
DOS 
DOS 

ENDCDE DB

 Open error   
OPENMSG DB
 Read error   
READMSG DB
ROW
DB

DATASG ENDS

CODESG SEGMENT PARA Code 
BEGIN PROC
FAR

ASSUME CS:CODESG DS:DATASG SS:STAC SG ES:DATASG
PUSH
DS
SUB
AX AX
PUSH
AX
MOV
AX DATASG
MOV
DS AX
MOV
ES AX
MOV
AX  6 H
CALL
Q1 SCR


CALL
Q2 CURS

CALL
E1 OPEN
DTA
CMP
ENDCDE 


JNZ
A 
A2 LOOP:
CALL
F1 READ

CMP
ENDCDE 


JNZ
A 

CALL
G1 DISP
JMP
A2 LOOP

A  :
RET

BEGIN ENDP

:


E1 OPEN PROC
NEAR
LEA
X FCBREC

MOV
AH  FH
INT
21H
CMP
AL 


JNZ
E2

E2 :

MOV
MOV
LEA
INT
RET

FCBRCSZ RECLEN
AH 1AH
DX NAMEFLD
21H

EQU 

MOV
LEA

ENDCDE  1
DX OPENMSG

DTA

CALL
RET
E1 OPEN ENDP


F1 READ PROC
MOV
LEA
INT
CMP
JNE
MOV
JMP
F2 :
CMP
JZ
MOV
CMP
JZ
LEA
CALL
F  :
RET
F1 READ ENDP


G1 DISP PROC
MOV
LEA
INT
CMP
JAE
INC
JMP
G3 :
MOV
CALL
CALL
G  :
RET
G1 DISP ENDP


Q1 SCR PROC
MOV
MOV
MOV
INT
RET
Q1OSCR ENDP


Q2 CURS PROC
MOV
MOV
MOV
MOV
INT
RET
Q2 CURS ENDP

X1 ERROR
:

NEAR

AH 1 H
DX FCBREC
21H
NAMEFLD 1AH
EOF 

F2

ENDCDE  1
F 
AL 
F 
ENDCDE  1
AL  1
F 
DX READMSG
X1 ERR



:

 


:

NEAR

AH  
DX NAMEFLD
21H

ROW 2
...
G3
ROW

G 
AX  6 1H
Q1 SCR
Q2 CURS

  :

AX
NEAR

BH 1EH
CX 
DX 18 FH

1 H
:

NEAR
AH  2
BH 
DH ROW
DL 
1 H
:


X1 ERR PROC
MOV
INT
RET
X1 ERR ENDP


NEAR
DX
AH  

21H

CODESG ENDS
END
BEGIN
__________________________________________________________________________
.16.2.
.16.2  
 .
FCB   FCB
. .
:
BEGIN

E1 OPEN
F1 READ
G1 DISP
X1 ERR

 E1 OPEN
DTA F1 READ
. 
  G1 DISP.
 
32 .2  DTA.
.
FCB.
.

.

.
 FCB
 .
16
 . DTA 
FCB 1:
: | | 1| 2|... | 15|
DTA : | |
.

1 DTA .
16
.
16 
DTA.
DTA.

AL . 1.

________________________________________________________________

 
.




DTA  FCB .
A
B. 
.

 

.   3  
2 
 3  . :
.
 
 .
 DOS 
FCB
.

33 36  FCB.
.

 12 13   32 .
p

DTA 
. 
. 5 FCB
.
DTA.

FCB .21:
MOV AH 21H
LEA DX FCBname
INT 21H



DOS


.
 DTA
AL :


1
2
3



 DTA
 .


.
 .

DTA FCB. 
AL .
 


DTA.   128 
.. . 23

 :
| 2 | 21 | 22 | 23 |
  23 
.
 DTA.
35  

DTA. 
 .
p

DTA 
.
  
    
.
FCB .22
:
MOV AH 22H
LEA DX FCBname
INT 21H



DOS

AL :


1
2 DTA.

.
.
FCB
 
.


.
:
________________________________________________________________
page
6 132
TITLE RANREAD COM  
FCBCREAT

CODESG SEGMENT PARA Code 
ASSUME CS:CODESG DS:CODESG SS:CODESG ES:CODESG
ORG
1 H
BEGIN: JMP
MAIN

FCB
FCBREC LABEL BYTE
FCBDRIV DB

D
FCBNAME DB
MAMEFILE 




FCBEXT
DB
DAT



FCBBL
DW

FCBRCSZ DW
DD
DW
DT
DB
FCBRNRC DD






RECLEN
RECDPAR
MAXLEN
ACTLEN
RECDNO

32
BYTE
3

3 DUP  

EQU
LABEL
DB
DB
DB

NAMEFLD DB


DOS 
DOS 
DOS 

RECLEN DUP  13 1    DTA

 Open error 13 1   


OPENMSG DB
READMSG DB
 Read error 13 1   
COL
DB

Record number   
PROMPT DB

ROW
DB
ENDCDE DB


MAIN
PROC
NEAR

CALL
Q1 CLR
CALL
Q2 CURS

CALL
C1 OPEN

DTA

CMP
ENDCDE 
JZ
A2 LOOP
 
RET

A2 LOOP:

CALL
D1 RECN
CMP
ACTLEN 

JE
A

 
CALL
F1 READ

CMP
ENDCDE 
JNZ
A3

CALL
G1 DISP

A3 :
JMP
A2 LOOP
A :
RET

MAIN
ENDP

:


C1 OPEN PROC
NEAR
MOV
AH  FH

LEA
DX FCBREC
INT
21H
CMP
AL 

JNZ
C2

MOV
FCBRCSZ RECLEN EQU 
MOV
AH 1AH
LEA
DX NAMEFLD
DTA
INT
21H
RET
C2 :
LEA
DX OPENMSG
CALL
X1 ERR
RET
C1 OPEN ENDP



D1 RECN PROC
MOV
LEA
INT
MOV
LEA
INT
CMP
JB
JA
SUB
MOV
JMP
D2 :
MOV
MOV
D3 :
AND
AAD
MOV
D :
MOV
CALL
RET
D1 RECN ENDP


F1 READ PROC
MOV
MOV
LEA
INT
CMP
JZ
LEA
CALL
F2 :
RET
F1 READ ENDP


G1 DISP PROC
MOV
LEA
INC
INC
MOV
RET
G1 DISP ENDP


Q1 CLR PROC
MOV
MOV
MOV
MOV
INT
RET
Q1 CLR ENDP

:

NEAR

AH  H
DX PROMPT
21H

AH  AH
DX RECDPAR
21H
ACTLEN  1
 1 2 

D
D2
AH AH
1
AL RECDNO
D3
AH RECDNO
AL RECDNO 1

AX  F FH

ASCII

WORD PTR FCBRNRC AX
COL 2
Q2 CURS

:

NEAR

ENDCDE 

AH 21H
DX FCBREC
21H

AL 

F2
DX READMSG

X1 ERR

:

NEAR

AH  
DX NAMEFLD
21H
ROW
COL 
:

NEAR
AX  6 H

   
BH  1H
CX 
DX 18 FH
1 H


:


Q2 CURS PROC
NEAR

MOV
AH  2
MOV
BH 

MOV
DH ROW
MOV
DL COL
INT
1 H
RET
Q2 CURS ENDP

:


X1 ERR PROC
NEAR
MOV
AH  
DX

INT
21H
INC
ROW
MOV
ENDCDE  1
RET
X1 ERR ENDP
CODESG ENDS
END
BEGIN
__________________________________________________________________________
.16.3. .
.16.3  
. .16.1 .
 
. 25 
2 . ASCII
 .
:
C1 OPEN
D1 RECN

F1 READ
G1 DISP

 32
DTA.

FCB.

2 .
DTA
FCB.
.

D1 RECN
. :


1
2


 AL 
 AX 

ASCII
. AX 
AAD .
AX
FCB.   12 ASCII
 AX 3132. AND
1 2  AAD  C.
FCB .


________________________________________________________________

DTA 
DTA.
 .
.

. DTA.

CX  FCB
.28:
MOV
MOV
LEA
INT

AH 28H
CX records
DX FCBname
21H




DOS

.
AL
:

FCB

.  2 
25 .1 .

CX .2 :
MOV
MOV
LEA
INT

AH 2 H
CX records
DX FCBname
21H




DOS

AL :


1
2
3



DTA
.

CX 
FCB
 .


.  .32 8 
.2 32  .1  25 .
:
________________________________________________________________
__________________________________________________________________________


TITLE RANBLO COM 
CODESG SEGMENT PARA Code 
ASSUME CS:CODESG DS:CODESG SS:CODESG ES:CODESG
ORG
1 H
BEGIN: JMP
MAIN

FCB
FCBREC LABEL BYTE
FCBDRIV DB

D
FCBNAME DB
NAMEFILE 




FCBEXT
DB
DAT



FCBBL
DW
FCBRCSZ DW


FCBFLZ DD

DOS

DOS
DW

DOS
DT
DB


FCBRNRC DD



DS RECS DB
1 2 DUP    DTA
ENDCODE DB


NORECS DW
25
 Open error 13 1   
OPENMSG DB
READMSG DB
 Open error 13 1   
ROWCTR DB


MAIN
PROC
NEAR
CALL
Q1 CLR

CALL
Q2 CURS


CALL
E1 OPEN
DTA
CMP
ENDCODE 

JNZ
A3


CALL
F1 READ

CALL
G1 DISP
A3 :
RET

MAIN
ENDP

:


E1 OPEN PROC
NEAR
MOV
AH  FH

LEA
DX FCBREC
INT
21H
CMP
AL 

JNZ
A3


E2 :

MOV
MOV
LEA
INT
RET

LEA
CALL
RET
E1 OPEN ENDP


F1 READ PROC

FCBRCSZ  2 H
AH 1AH

DX DS RECS
21H

DX OPENMSG
X1 ERR

:

NEAR

DTA

MOV
MOV
LEA
INT
MOV
RET
F1 READ ENDP


G1 DISP PROC
MOV
LEA
INT
RET
G1 DISP ENDP


Q1 CLR PROC
MOV
MOV
MOV
MOV
INT
RET
Q1 CLR ENDP


Q2 CURS PROC
MOV
MOV
MOV
MOV
INT
INC
RET
Q2 CURS ENDP


X1 ERR PROC
MOV
INT
MOV
RET
X1 ERR ENDP

AH 2 H
CX NORECS
DX FCBREC
21H
ENDCODE AL

:

NEAR

AH  
DX DS RECS
21H
:

NEAR

AX  6 H
   
BH  1H
CX 
DX 18 FH
1 H
:

NEAR
AH  2

BH 
DH ROWCTR
DL 
1 H
ROWCTR
:

NEAR
DX
AH  
21H

ENDCODE  1

CODESG ENDS
END
BEGIN
__________________________________________________________________________
.16. . .
.16.  
.16.1.
 CX  25
DTA   
.

25 .
:

E1 OPEN
F1 READ
G1 DISP

 FCB 32
DTA.
25
.

FCB
.
FCB .1 
 .1  .

________________________________________________________________

DOS INT 25H
26H.
 DOS INT
21H.


.  
 .


 1  :



1
1
2

1
2
1




1

1
26

:
      1 
 2

2     1   18  8  26
:
MOV
MOV
MOV
MOV
INT

AL drive 
BX addr
CX sectors
DX record 
25H 26H

A  1 B ..




  CF
  1  .
AL :
AL
1
1

1
1





1
1
11
1



DMA


INT .
INT 
CF.

________________________________________________________________
DOS
.
: .D


.
 
. DOS .D
. 
.
MOV AH ODH
INT 21H


DOS

: .E

DOS .E 
  . DL 
A  1  B ..
MOV AH OEH
MOV DL  2
INT 21H


C
DOS

AL 
. DOS 2 A
B  DOS 2 . 
INT
11H .
: .11 12


  .

DX FCB
11H. FCB
. DOS .
MOV AH 11H
LEA DX FCBname


FCB

INT 21H

DOS

FCB 5CH
 DTA .
. .22.
AL .FF  
.  . DTA 1A 
2B ..  .
 
.ASM 
12H:
MOV AH 12H
LEA DX FCBname
INT 21H


FCB
DOS

AL 11H.
: .13

DOS 13H.

.
MOV AH 13H
LEA DX FCBname
INT 21H


FCB
DOS


 .FF.

AL

: .1 

DOS
.1 . FCB 
 16.
MOV AH 1 H
LEA DX FCBname
INT 21H


FCB
DOS


.
AL  
  FF.
: .1 

DOS .1  :
MOV AH 1 H
INT 21H


DOS

. AL  A  1B
.. . FCB
.

FAT 1B 1  2 
25  26 
2 .
DOS.
:
________________________________________________________________
__________________________________________________________________________
TITLE SELDEL COM 




: .  .BA  ..

CODESG SEGMENT PARA Code 
ASSUME CS:CODESG DS:CODESG SS:CODESG
ORG
1 H
BEGIN JMP
MAIN


TAB
EQU
LF
EQU
1
CR
EQU
13
CRLF
DB
CR LF   
DELMSG DB
TAB  Erase   
ENDMSG DB
CR LF  No more directory entries CR LF   
ERRMSG DB
Write protecteddisk   
y  Erase  N  eep  Ret  Exit CR LF   
PROMPT DB

MAIN
PROC
NEAR

MOV
AH 11H

CALL
D1 DIS

CMP
AL  FFH
JE
A 

LEA
DX PROMPT

CALL
B1 DISP
A2 :
LEA
DX DELMSG

CALL
B1 DISP

11
MOV
CX 11

MOV
SI 81H
A3 :
MOV
DL  SI 


CALL
C1 CHAR

INC
SI
LOOP
A3
MOV
DL   
CALL
C1 CHAR

MOV
AH  1
INT
21H

CMP
AL ODH
Return 

JE
A 

OR
AL  1 B

CMP
AL  y 

 
JNE
A5

MOV
AH 13H
MOV
DX 8 H
INT
21H

CMP
AL 

JZ
A5

A5 :

A  :

LEA
CALL
JMP

DX ERRMSG
B1 DISP
A 

LEA
CALL
MOV
CALL
CMP
JNE

DX CRLF
B1 DISP
AH 12H
B1 DIS
AL  FFH
A2

RET
MAIN
ENDP


B1 DISP PROC
MOV
INT
RET
B1 DISP ENDP


C1 CHAR PROC
MOV
INT
RET
C1 CHAR ENDP



D1 DIS PROC
MOV
INT
CMP
JNE
PUSH
LEA
CALL
POP
D  :  RET
D1 DIS ENDP




DOS



DX
NEAR
AH  

21H


DL
NEAR
AH  2
21H
:

NEAR
FCB
DX 5CH
21H
AL  FFH

D 
AL
AX
DX ENDMSG
B1 DISP
AX
AL

CODESG ENDS
END
BEGIN
__________________________________________________________________________
.16.5. .
.16.5 COM  SDEL 
DOS 11H  12H 13H .
  :
SDEL . 
SDEL .BA
SDEL TEST.


 
 BA  
 TEST 

DOS


. DOS PSP
  .81 DTA .
. Y

   N    Return
.

COM   EXE 
.5 81 PSP.
.

________________________________________________________________

  INT 21H DOS


  FCB 
.
 128 .
FCB 
.
 FCB
:  

.
  
FCB.
  DTA  
. 


DTA.
 FCB
:   .8 
.
.
  DOS INT 21H 

 
.
 DOS INT 21H
FCB.
 DOS INT 21H

.

FCB.
  
.
 
DTA.
 .

.

 DOS INT 25H 26H

 

.

________________________________________________________________
16.1. DOS : 
  DTA    
  .
16.2. 

.   

   



16.3.  
:  
12   .
.
ASCII .
16. .  
16.3.
16.5.
:  5  3  15  26 .
16.6. 2652  
FCB 
16. .

:       
.
16.8.

 .
FCB FLSZ FCB FCSZ.
16. . 16.

 

. 
.

23
2
2 

11
11 
122
12
12 

315
3
525
2
1125
63
1 52
21335
6

232


5635

16.1 . 16.  
.

16.11. 16. 



 

 .

1 
III: DOS
__________________________________________________________________________
: DOS 
2. .

________________________________________________________________
DOS 
16  DOS.
 DOS 2. 3.
. 

DOS.

DOS. DOS 
UNIX.
ASCIIZ

.
ASCIIZ
________________________________________________________________

DOS ASCIIZ 




 :
PATHNM1
PATHNM2

DB
DB

B: TEST.ASM 
C: UTILITY NU.EXE 

 

. zero   ASCIIZ
.  ASCIIZ 
DX   LEA
DX PATHNM1.

________________________________________________________________
AX

 . 8

:   1   2
  3  
 .

ASCIIZ DOS .3C 3D.
CF AX.
DW
.
CF 1  AX 
..1 .1 .
__________________________________________________________________________

1
2
3


5  
6

8

1
11
12
13
15
16
1  
18
__________________________________________________________________________
.1 .1.

________________________________________________________________

DOS.
: .3C


.3C. DX
ASCIIZ   CX  .
15  .
:
MOV
MOV
LEA
INT
JC
MOV

AH 3CH
CX 
DX PATHNM1
21H
error
HANDLE1 AX



ASCIIZ
DOS

DW


 CF AX.

.
..

 .
CF 1
AX : 3  5 ..1 .1 . 5


 .
CF 
AX 5 
5  .
: .

DOS . .
BX  CX 
 DX  .
256 OUTREC:
HANDLE1 DW
OUTREC DB
MOV
MOV
MOV
LEA
INT
JC
CMP
JNE


256 DUP  
AH  H


BX HANDLE1

CX 256
DX OUTREC

21H
DOS

error2

AX 256
error3

256
 CF AX
. 
. CF
1  AX 5   6
 .

BX

: .3E


 DOS .3E  .

FAT.
MOV AH 3EH
MOV BX HANDLE1
INT 21H



DOS

AX
.

: .
________________________________________________________________
__________________________________________________________________________
TTILE

page
6 132
HANCREAT EXE 




STAC SG SEGMENT PARA STAC Stack 
DW
8 DUP 

STAC SG ENDS

DATASG SEGMENT PARA Data 
:
NAMEPAR LABEL BYTE

MAXLEN DB
3
NAMELEN DB


NAMEREC DB
3 DUP   DH  AH  CR LF

ERRCDE DB

HANDLE DW
PATHNAM DB
D: NAMEFILE.DAT 
PROMPT DB
Name  
1
ROW
DB
 Open error  DH  AH
OPNMSG DB
WRTMSG DB
 Write error  DH  AH
DATASG ENDS

CODESG SEGMENT PARA Code 
BEGIN PROC
FAR

ASSUME CS:CODESG DS:DATASG SS:STAC SG ES:DATASG
PUSH
DS
SUB
AX AX
PUSH
AX
MOV
AX DATASG
MOV
DS AX
MOV
ES AX
MOV
AX  6 H
CALL
Q1 SCR


CALL
Q2 CURS
 DTA
CALL
C1 CREA
CMP
ERRCDE 

JZ
A2 LOOP
 
 DOS
RET
A2 LOOP:
CALL
D1 PROC
CMP
NAMELEN 

 
JNE
A2 LOOP

CALL
G1 CLSE
RET

DOS
BEGIN ENDP

:


C1 CREA PROC
NEAR
MOV
AH 3CH


MOV
CX 
LEA
CX PATHNAM
INT
21H
JC
C2

 
MOV
HANDLE AX
RET
C2 :

LEA
DX OPNMSG


CALL
X1 ERR
RET
C1 CREA ENDP
:



D1 PROC PROC
NEAR

D2 :

D  :

MOV
MOV
MOV
LEA
INT

AH  H
BX  1
CX  6
DX PROMPT
21H


Handle 

MOV
LEA
INT
CMP
JNE
RET

AH  AH
DX NAMEPAR
21H
NAMELEN 
D2

MOV
SUB
MOV
LEA
ADD
NEG
ADD
REP

AL 2 H
CH CH
CL NAMELEN
DI NAMEREC
DI CX
CX
CX 3
STOSB

F1 WRIT
E1 SCRL

CALL
CALL
RET
D1 PROC ENDP


E1 SCRL PROC
CMP
JAE
INC
JMP
E1 :
MOV
CALL
E  :
CALL
RET
E1 SCRL ENDP


F1 WRIT PROC
MOV
MOV
MOV
LEA
INT
JNC
LEA
CALL
MOV
F2 :
RET
F1 WRIT ENDP


G1 CLSE PROC
MOV
CALL
MOV





:

NEAR
ROW 18

 
E1

ROW
E1
AX  6 1H
Q1 SCR
Q2 CURS
:

NEAR
AH  H
BX HANDLE
CX 32
DX NAMEREC
21H
F2
DX WRTMSG
X1 ERR
NAMELEN 


3  2 CR LF



:

NEAR
NAMEREC 1AH
EOF 
F1 WRIT

AH 3EH

MOV
BX HANDLE
INT
21H
RET
G1 CLSE ENDP

  :


AX 
Q1 SCR PROC
NEAR

MOV
BH 1EH
MOV
CX 
MOV
DX 18 FH

INT
1 H
RET
Q1 SCR ENDP
:



Q2 CURS PROC
NEAR
MOV
AH  2
MOV
BH 

MOV
DH ROW
MOV
DL 
INT
1 H
RET
Q2 CURS ENDP

:


X1 ERR PROC
NEAR
DX

MOV
AH  H
MOV
BX  1
MOV
CX 21

INT
21H

MOV
ERRCDE  1
RET
X1 ERR ENDP
CODESG ENDS
END
BEGIN
__________________________________________________________________________
.1 .2. .
 .1 .2  
.
:
C1 CREA
D1 PROC
F1 WRIT
G1 CLSE

.3C
HANDLE.

.
 . .
 .3E 
 .

3 :
. DH  . AH .
 32 . 32 x
 . 
   
. DOS SORT
. SORT
:

SORT

B: NAMEFILE.DAT

NAMEFILE.SRT

NAMEFILE.DAT
NAMEFILE.SRT.
 .1 .3
NAMEFILE.SRT . : 1 

. 2 
 

.1 . .

________________________________________________________________

DOS.
: .3D


 .3D.
. DX
ASCIIZ   AL 
:


1
2
AL DOS
3. . DOS . 
.3C 
. :
MOV
MOV
LEA
INT
JC
MOV

AH 3DH
AL 
DX PATHNM1
21H
error
HANDLE2 AX



ASCIIZ
DOS

DW


1  
CF AX.
.
 CF
AX : 2   5 12 . .1 .1 .
CF.
AX 5  5
 .
: .3F

DOS .3F.
BX  CX 

DX  .
512  :
HANDLE2
INPREC

DW
DB
MOV
MOV
MOV
LEA
INT
JC
CMP
JE


512 DUP  
AH 3FH


BX HANDLE2

CX 512
DX INPREC

21H
DOS

error5

AX 
endfile


CF AX
. AX
. CF
AX 5   6  .
DOS 
 
.
:
________________________________________________________________
__________________________________________________________________________
page
6 132
TITLE HANREAD EXE   HANCREAT



STAC SG SEGMENT PARA STAC Stack 
DW
8 DUP 

STAC SG ENDS

DATASG SEGMENT PARA Data 
ENDCDE DB


HANDLE DW
IOAREA DB
32 DUP  
PATHNAM DB
D: NAMEFILE.SRT 
OPENMSG DB
 Open error  DH  AH
 Read error  DH  AH
READMSG DB

ROW
DB
DATASG ENDS

CODESG SEGMENT PARA Code 
BEGIN PROC
FAR

ASSUME CS:CODESG DS:DATASG SS:STAC SG ES:DATASG
PUSH
DS
SUB
AX AX
PUSH
AX
MOV
AX DATASG
MOV
DS AX
MOV
ES AX
MOV
AX  6 H
CALL
Q1 SCR

CALL
Q2 CURS


CALL
E1 PEN

DTA

CMP
JNZ

ENDCDE 
A 




CALL
CMP
JNZ
CALL
JMP
RET
ENDP

F1 READ
ENDCDE 
A 
G1 DISP
A2 LOOP



 
 

A2 LOOP:

A  :
BEGIN


E1 PEN PROC
MOV
MOV
LEA
INT
JC
MOV
RET
E2 :
MOV
LEA
CALL
RET
E1 PEN ENDP


F1 READ PROC
MOV
MOV
MOV
LEA
INT
JC
CMP
JE
CMP
JE
RET
F2 :
LEA
CALL
F3 :
MOV
F  :
RET
F1 READ ENDP


G1 DISP PROC
MOV
MOV
MOV
LEA
INT
CMP
JEA
INC
RET
G  :

:

NEAR
AH 3DH
CX 
DX PATHNAM
21H
E2
HANDLE AX
ENDCDE  1
DX OPENMSG
X1 ERR








:

NEAR
AX 3FH

BX HANDLE
3  2 CR LF
CX 32
DX IOAREA
21H

F2

AX 
F3
IOAREA 1AH
EOF 

F3
DX READMSG
X1 ERR

ENDCDE  1

:

NEAR

AH  H

BX  1
CX 32

DX IOAREA
21H

ROW 2
G 

ROW

MOV
CALL
CALL
RET
G1 DISP ENDP


Q1 SCR PROC
MOV
MOV
MOV
INT
RET
Q1 SCR ENDP


Q2 CURS PROC
MOV
MOV
MOV
MOV
INT
RET
Q2 CURS ENDP


X1 ERR PROC
MOV
MOV
MOV
INT
RET
X1 ERR ENDP

AX  6 1H
Q1 SCR
Q2 CURS

 

  :

AX 
NEAR
BH 1EH

CX 

DXX 18 FH
1 H
:

NEAR
AH  2


BH 

DH ROW
DL 

1 H
:

NEAR
DX 
AH  H
BX  1

CX 2

21H

CODESG ENDS
END
BEGIN
__________________________________________________________________________
.1 .3. .
.1 .3  
..1 .2  DOS SORT.
.3D.
HANDLE
.3F .

   .
ASCII   ASCII 
________________________________________________________________

. ASCII  
 DOS .

FAT 
 . DOS  
ASM  
.  .OD  .OA .

DOS 
 
 .
 :

tab MOV tab AH  return 


ASCII  :

 D F56  1 82C3 3  D A
TYPE
     
.
 .1 . 
HANREAD.ASM  . 1 .3  .
HANREAD 
.
__________________________________________________________________________
page
6 132
TITLE ASCREAD COM  ASCII
CODESG SEGMENT PARA Code 
ASSUME CS:CODESG DS:CODESG SS:CODESG ES:CODESG
ORG
1 H
BEGIN: JMP
MAIN

SECTOR DB
512 DUP  

DISAREA DB
12 DUP  


ENDCDE DW

HANDLE DW
OPENMSG DB
 Open error 
PATHNAM DB
D: HANREAD.ASM 

ROW
DB

MAIN
PROC
NEAR

MOV
AX  6 H

CALL
Q1 SCR

CALL
Q2 CURS
CALL
E1 OPEN

DTA

CMP
ENDCDE 
 
JNE
A 
A2 LOOP:

CALL
R1 READ

 
CMP
ENDCDE 

JE
A 
CALL
G1 XPER

A  :
RET

MAIN
ENDP

:


E1 OPEN PROC
NEAR

MOV
AH 3DH

MOV
AL 
LEA
DX PATHNAM
INT
21H
CF
JNC
E2

CALL
X1 ERR

E2 :

RET


MOV
HANDLE AX
RET
E1 OPEN ENDP
:



G1 XPER PROC
NEAR
CLD

LEA
SI SECTOR
G2 :
LEA
DI DISAREA
G3 :
LEA
DX SECTOR 512

CMP
SI DX
 
JNE
G
CALL
R1 READ

CMP
ENDCDE 


JE
G8
LEA
SI SECTOR
G :
LEA
DX DISAREA 8
DISAREA 
CMP
DI DX
 
JB
G5
MOV
DI  D AH
 CR LF
CALL
H1 DISP

LEA
DI DISAREA
G5 :
LODSB
SI  AL
SI
AL DI 
STOSB
DI
CMP
AL 1AH

JE
G8


CMP
AL  AH
 
JNE
G3
CALL
H1 DISP

JMP
G2
G8 :

CALL
H1 DISP
G  :
RET
G1 XPER ENDP

:


H1 DISP PROC
NEAR
MOV
AH  H

Handle 
MOV
BX  1

LEA
CX DISAREA
NEG
CX

ADD
CX DI

LEA
DX DISAREA
INT
21H
CMP
ROW 22

JAE
H2

INC
ROW
JMP
H 
H2 :
MOV
AX  6 1H
 
CALL
Q1 SCR
CALL
Q2 CURS

H  :
RET
H1 DISP ENDP


R1 READ PROC
MOV
MOV
MOV
LEA
INT
MOV
RET
R1 READ ENDP


Q1 SCR PROC
MOV
MOV
MOV
INT
RET
Q1 SCR ENDP


Q2 CURS PROC
MOV
MOV
MOV
MOV
INT
RET
Q2 CURS ENDP


X1 ERR PROC
MOV
MOV
MOV
LEA
INT
MOV
RET
X1 ERR ENDP

:

NEAR
AH 3FH


BX HANDLE

CX 512
DX SECTOR

21H
ENDCDE AX
  :

AX
NEAR
BH 1EH

CX 

DX 18 FH
1 H
:

NEAR
AH  2


BH 
DH ROW
DL 
1 H
:

NEAR

AH  H
BX  1

CX 18

DX OPENMSG
21H
ENDCDE O1

CODESG ENDS
END
BEGIN
__________________________________________________________________________
.1 . . ASCII .
 DOS TYPE  ..
  
 CR LE .  

.


.
. ASCII 
 

.

SECTOR. G1 XFER SECTOR
DISAREA  .
  DISAREA 
 . 
. 
8 .

 . ASCII  
ASM  

CR LF. 
EXE OBJ 
DISAREA .
ASCII  
.
G1 XFER :
1.
2.
3.
.
5.
6.
.

SECTOR.
DISAREA.
SECTOR .
 
SECTOR.
DISAREA CR LF 
DISAREA.
SECTOR DISAREA.
  .1A  .
  .OA 
.2  .3.

DEBUG.

 DOS .
.
DOS
________________________________________________________________
: .36

.
DL  
 1  A  2  B .. :
MOV AH 36H
MOV DL 
INT 21H



DOS


AX .FFFF  :

AX
BX
CX
DX




.

DOS 2.
.1B  FAT .

: . 1


  . 1. DX
ASCIIZ  :
MOV AH  1H
LEA DX PATHNAM
INT 21H


ASCIIZ 
DOS

AX 2
5  .

 

: . 2

DOS 
1
.
. 2 
.
BX
CX:DX .
65.535 CX  DX  .
AL 
:

 .
1  
 .
2  . 
 
CX:DX 2 AL.

1 2 :
MOV
MOV
LEA
MOV
MOV
INT
JC

AH  2H
AL 
BX HANDLE1
CX 
DX 1 2
21H
error





1 2
DOS

CF
DX:AX.
CF 1 AX 1   6
 .
: . 3


. 3H. DX
ASCIIZ . AL
. AL 1 
CX  .
:

MOV
MOV
MOV
LEA
INT

AH  3H
AL  1
CX 
DX PATHNM2
21H




ASCIIZ 
DOS


CX.
CX.
AX 2  3 5.
: . 


. .

DX. DL
:   1  A  2  B ..

  :
ASSEMBLE EXAMPLES
. 
.
 . .
. .1 .5
.
__________________________________________________________________________
TITLE GETPATH COM 
CODESG SEGMENT PARA Code 
ASSUME CS:CODESG DS:CODESG ES:CODESG
ORG
1 H
BEGIN: JMP
SHORT MAIN


PATHNAM DB
65 DUP  

MAIN
PROC
NEAR

MOV
AH 1 H
INT
21H
ADD
AL  1H
.
MOV
DL AL
: A  1B ...

CAL
B1 DISP
MOV
DL  : 
CAL
B1 DISP

MOV
DL   

CAL
B1 DISP
MOV
MOV
LEA
INT
A1 LOOP:
CMP
JE
MOV

AH  H
DL 
SI PATHNAM
21H

BYTE PTR SI 

A2

AL  SI 

MOV
CALL
INC
JMP
RET
ENDP

A2 :
MAIN

B1 DISP PROC
MOV
INT
RET
B1 DISP ENDP

DL AL
B1 DISP
SI
A1 LOOP

NEAR
AH  2
21H



DOS

DL 

CODESG ENDS
END
BEGIN
__________________________________________________________________________
.1 .5. .
: . E . F

. 11 12 DOS.
E  F 
. DX
ASCIIZ   .
 . CX
  
.
MOV
MOV
LEA
INT

AH  EH
CX  H
DX PATHNM1
21H



ASCIIZ 
DOS

 
DTA FCB :


21
22
2
26
3








DOS



: 
13  ASCIIZ  . .

AX 2   18
 .  . E 

F.
DTA.
MOV AH  FH
INT 21H


DOS

AX  18  .
CF.
: .56

.56.

DX ASCIIZ  
   DI 
ES:DI   ASCIIZ  
  .
 .

 .
MOV
LEA
LEA
INT

AH 56H
DX oldstring
DI newstring
21H


DS:DX
ES:DI
DOS

AX 3 
 5   1   .
DOS  
.3  .3A 
. 3B  
. 5 
. 

. 6 

 .5 .

________________________________________________________________

 DOS ASCIIZ  
 . .
 
.
 CF
AX.
  
 .
  
 .

________________________________________________________________
1 .1.  
  
1 .2. ASCIIZ  PATH1 CUST.LST
C.
1 .3. .1 .2  
CUSTHAN    
CUSTOUT 128   .
.
1 . . .1 .3   
CUSTIN. .
1 .5. 


1 .6. .1 . 
 .

 .. Return.

18
IV: BIOS
__________________________________________________________________________
: BIOS
.

________________________________________________________________

BIOS  BIOS
 . BIOS INT 13H
  
.

:
AH
AL
CH
CL
DH
DL
ES:BX

:
.
.
.

  :
: A  1B

.

.
1 .
..

BIOS
________________________________________________________________
INT 13H
AH .
AH  :


INT 13H AH . .

.
AH  1:

AL
 . .
1 AH.

AH  2:


. 1  8 .
BX 
 EX 
ES:BX.
INSECT 

 :
MOV
MOV
LEA
MOV
MOV
MOV
MOV
INT

AH  2
AL  1
BX INSERT
CH  5
CL  3
DH 
DL  1
13H



ES:BX
5
3
 
1 B 
BIOS

AL.
DS  BX  CX DX .

.
CH CL. 
 1 
1 1

.
AH  3:


512 512  .

 2 . AL 
. DX  BX  CX DX
.
AH  :

 
.
 3  
.

 3 
ES:BX  .

AL . DX  BX  CX
DX .
AH  5:



PC  512 .
. ES:BX

.
T H S|B 

T
H
S
B




  128  1 256  2 512  3 1 2 .

 3  512
 . 3 1 2

.
AT BIOS.

________________________________________________________________
 2  3  5 
CF AH .
CF 1  AH 
.
AL 1.
AH







1
1
1
1

1
1
11
1
1
1 1







DMA 


6


 


AH  .


.
: BIOS
________________________________________________________________
__________________________________________________________________________
TITLE BIOREAD COM  BIOS
CODESG SEGMENT PARA Code 
ASSUME CS:CODESG DS:CODESG SS:CODESG ES:CODESG
ORG
1 H
BEGIN JMP
MAIN


RECDIN DB
512 DUP  
ENDCDE DB

CURADR DW
3 H
  
5 1H
  
ENDADR DW
 Read error  
READMSG DB
SIDE
DB


MAIN
PROC
NEAR

MOV
AX  6 H

A2 LOOP:

CALL
CALL
CALL
MOV
MOV
CMP
JE
CALL
CMP
JNZ
CALL
JMP
RET
ENDP

A 
MAIN


C1 ADDR PROC
MOV
CMP
JNE
CMP
JE
INC
C2 :
XOR
MOV
MOV
C  :
RET
C1 ADDR ENDP


F1 READ PROC
MOV
MOV
LEA
MOV
MOV
MOV
INT
CMP
JZ
MOV
CALL
F  :
INC
RET
F1 READ ENDP


G1 DISP PROC
MOV
MOV
MOV
LEA
INT
RET
G1 DISP ENDP

Q1 SCR
Q2 CURS
C1 ADDR
CX CURADR
DX ENDADR
CX DX
A 
F1 READ
ENDCDE 
A 
G1 DISP
A2 LOOP











:

NEAR

CX CURADR

CL 1
C 

SIDE 
 
C2

CH
SIDE  1
CL  1
CURADR CX


 1

:

NEAR
AL  1


AH  2

BX RECDIN
CX CURADR

DH SIDE

B
DL  1

13H
AH 

F 


ENDCDE  1

X1 ERR
CURADR

:

NEAR

AH  H
BX  1

CX 512

DX RECDIN
21H
:


Q1 SCR PROC
NEAR
MOV
AX  6 H


MOV
BH 1EH

MOV
CX 
MOV
DX 18 FH
INT
1 H
RET
Q1 SCR ENDP

:


Q2 CURS PROC
NEAR

MOV
AH  2
MOV
BH 

MOV
DX 
INT
1 H
RET
Q2 CURS ENDP
:



X1 ERR PROC
NEAR
MOV
AH  H

MOV
BH  1


MOV
CX 18
LEA
DX READMSG
INT
21H
RET
X1 ERR ENDP
CODESG ENDS
END
BEGIN
__________________________________________________________________________
.18.1. BIOS .
 .18.1 
BIOS INT 13H .
 .16.3  :
1. FCB .
2. .
.
1 C1 ADDR 1.
 1 
: 1 1 .
3. CURADR
  ENDADR 
. 

.

DEBUG.
 
FAT
 FAT .
G  
FAT .
DEBUG
ASCII  .
 DEBUG . .1 .5 .


 
.
 DOS
 .
 BIOS INT 13H

.

________________________________________________________________

 BIOS INT 13H


.
 BIOS INT 13H 
 .

 .


BIOS.


________________________________________________________________
18.1. .
18.2. .
18.3.
 BIOS INT 13H 
INDIS  A   6
3.
18. . BIOS
INT 13H 

OUTDIS  B   8
1.
18.5. 18. 

18.6. 18.
 .

1 

__________________________________________________________________________
:
 .

________________________________________________________________
.
 DOS INT 21H
BIOS INT 1 H.   

    .
.

.

 
  

.

  
.
1  12 15
 
 .

.
.
IBM PC 
. 
 .
 .
 .
   
 .
   
 .



.

________________________________________________________________
:
.

8

1
11
12
13

8

A
B
C
D

.  
 .
.
.

.OA 
.
.
.
.
11 . 
.

.

  55  . C   
1.
 
 

.
 
.
DOS
________________________________________________________________
DOS 2. 
.
DOS .
. 25
HEADG:
HEADG

DB
...
MOV
MOV
MOV
LEA
INT

Industrial Bicycle Mfrs  DH  AH


AH  H
BX 
CX 25
DX HEADG
21H



25

DOS

CF
AX.
:
________________________________________________________________
__________________________________________________________________________
TITLE PRTNAME COM 
CODESG SEGMENT PARA PUBLIC CODE 
ASSUME CS:CODESG DS:CODESG SS:CODESG ES:CODESG
ORG
1 H
BEGIN: JMP
SHORT MAIN

NAMEPAR LABEL BYTE


MAXNLEN DB
2


NAMELEN DB
NAMEFLD DB
2 DUP  

:
List of Employee Names
HEADG DB
Page 
 1  AH  AH
PAGECTR DB
FFEED DB
CH

LFEED DB
AH

1
LINECTR DB
Name  
PROMPT DB

MAIN
PROC
NEAR

CALL
Q1 CLR

CALL
M1 PAGE
A2LOOP:
MOV
DX 

CALL
Q2 CURS

CALL
D1 INPT

A3 :

CALL
CMP
JE
CALL

Q1 CLR
NAMELEN 
A3
E1 PRNT

JMP

A2 LOOP

MOV
LEA
CALL
RET
ENDP

CX  1
DX FFEED
P1 OUT

MAIN


D1 INPT PROC
MOV
MOV
MOV
LEA
INT
MOV
LEA
INT
RET
D1 INPT ENDP


E1 PRNT PROC
CMP
JB
CALL
E2 :
MOV
MOV
LEA
CALL
MOV
LEA
CALL
INC
E1 PRNT ENDP


M1 PAGE PROC
CMP
JE
MOV
LEA
CALL
MOV
M3 :
MOV
LEA
M :
CALL
INC
CMP
JNE
MOV
INC
M5 :
RET


 


:


DOS

:

NEAR

AH  H
BX  1

CX  5
5
DX PROMPT
DOS
21H
AH  AH

DX NAMEPAR
DOS
21H
:

NEAR
LINECTR 6

E2


M1 PAGE
CH 
CL NAMELEN

DX NAMEFLD


P1 OUT

CX  1
DX LFEED

P1 OUT

LINECTR
:

NEAR
WORD PTR PAGECTR 313 H 
M3

CX  1


DX FFEED

P1 OUT
LINECTR  3

CX 36
DX HEADG

P1 OUT
PAGECTR 1
PAGECTR 1 3AH
M5
PAGECTR 1 3 H
PAGECTR


 .xx3A 
 
 ASCII

M1 PAGE ENDP
:



CX DX
P1 OUT PROC
NEAR
MOV
AH  H

MOV
BX 

DOS
INT
21H
RET
P1 OUT ENDP
:



Q1 CLR PROC
NEAR
MOV
AX  6 H

MOV
BH 6 H
   

MOV
CX 
2 
MOV
DX 18 FH
INT
1 H
BIOS
RET
Q1 CLR ENDP

  :


Q2 CURS PROC
NEAR
DX

MOV
AH  2

MOV
BH 
INT
1 H
BIOS
RET
Q2 CURS ENDP
CODESG ENDS
END
BEGIN
__________________________________________________________________________
.1 .1. .
 .1 .1  . .1 

 .
:
List of Employee Names
Clancy Alderson
Ianet Brown
David Christie
...

Page 1


.
:
D1 INPT
E1 PRNT
M1 PAGE
P1 UT

.


M1 PAGE.
 

.

.

. M1 PAGE
 PAGECTR 1  .
PAGECTR
PAGECTR DB

 1 


. M1 PAGE
 PAGECTR 1  .
PAGECTR
PAGECTR

DB

 1 

ASCII   .3 31.
M1 PAGE PAGECTR 1 
3 32  3 33 .. 3 3 
3 3A   : . 
PAGECTR .3A 
.3  . .3 3A
.313  .. 1 .
  

.
ASCII 
________________________________________________________________
   
 
 8. 
8  16  2 ..  
.   DOS PRINT 
ASCII 
  . 


8.
 .1 .2 
  .
.1 .3  
.

8  8 15  16 ..  
G1 XFER G6 .
:
:
:
:
8:
:


1
21
1 1 1 1 1 1
1 1
1 1 11
8
16
2

:
1 PRMP
E1 OPEN
G1 XFER

. Return
.
.
  
  .
.

P1 PRNT
R1 READ

.
.

    

.
.OC 
  62.

 ASCII
  . 
5 DOS.
.
.
__________________________________________________________________________

TITLE PRINAS COM 
CODESG SEGMENT PARA Code 
ASSUME CS:CODESG DS:CODESG SS:CODESG ES:CODESG
ORG
1 H
BEGIN JMP
MAIN


PATHPAR LABEL BYTE

MAXLEN DB
32
NAMELEN DB


FILENAM DB
32 DUP  

SECTOR DB
512 DUP  

DISAREA DB
12 DUP  
COUNT DW

ENDCDE DW

CH
FFEED DB

HANDLE DW
OPENMSG DB
 Open error 
PROMPT DB
Name of file  


MAIN
PROC
NEAR
CALL
Q1 SCR

CALL
Q2 CURS

A1 LOOP:

MOV
ENDCDE 
CALL
C1 PRMP

CMP
NAMELEN 


JE
A 

CALL
E1 OPEN
DTA
CMP
ENDCDE 


JNE
A8

CALL
R1 READ
CMP
ENDCDE 
 
JE
A8


CALL
G1 XPER
A8 :
JMP
A1 LOOP
A  :
RET
MAIN
ENDP

:


C1 PRMP PROC
NEAR

MOV
AH  H
MOV
BX  1

MOV
LEA
INT
MOV
LEA
INT
MOV
MOV
MOV
C 
RET
C1 PRMP ENDP


E1 OPEN PROC
MOV
MOV
LEA
INT
JNC
CALL
RET
E2 :
MOV
MOV
MOV
REP
RET
E1 PEN ENDP


G1 XFER PROC
CLD
LEA
G2 :
LEA
MOV
G3 :
LEA
CMP
JNE
CALL
CMP
JE
LEA
G :
MOV
CMP
JB
MOV
CALL
LEA
G5 :
LODSB
MOV
MOV
INC
CMP
JE
CMP

CX 13
DX PROMPT
21H
AH  AH
DX PATHPAR
21H
BL NAMELEN
BH 
FILENAM BX 

:

NEAR

AH 3DH

AL 
DX FILENAM
21H
CF
E2

X1 ERR
HANDLE AX
AX 2 2 H
CX 256
STOSW

:

NEAR

SI SECTOR

DI DISAREA
COUNT 
DX SECTOR 512
SI DX
G
R1 READ
ENDCDE 
G8
SI SECTOR
BX COUNT
BX 8
G5
DI BX  D AH
P1 PRNT
DI DISAREA

BX COUNT
DI BX AL
BX
AL 1AH
G8
AL  AH








 CR LF

SI  AL 
SI





G6 :

G  :

JNE
CALL
JMP

G6
P1 PRNT
G2

CMP
JNE
DEC
MOV
AND
ADD

AL  H

G 
 BX:
BX
BYTE PTR DI BX 2 H TAB
BX  FFF8H
8
BX  8
8

MOV
JMP
G8 :
MOV
MOV
CALL
G  :
RET
G1 XFER ENDP


P1 PRNT PROC
MOV
MOV
MOV
INC
LEA
INT
MOV
MOV
LEA
REP
RET
P1 PRNT ENDP


R1 READ PROC
MOV
MOV
MOV
MOV
INT
MOV
RET
R1 READ ENDP


Q1 SCR PROC
MOV
MOV
MOV
MOV
INT
RET
Q1 SCR ENDP


Q2 CURS PROC
MOV
MOV
MOV

 


COUNT BX
G3
BX COUNT


BYTE PTR DI BX  CH

P1 PRNT
:

NEAR
AH  H

BX 

CX COUNT
CX
DX DISAREA
21H

AX 2 2 H
CX 6
DI DISAREA
STOSW
:

NEAR
AH 3FH

BX HANDLE


CX 512

DX SECTOR
21H
ENDCDE AX
:

NEAR
AX  6 H
BH 1EH

CX 
 
DX 18 FH
1 H
:

NEAR
AH  2


BH 
DX 

INT
1 H
RET
Q2 CURS ENDP

:


X1 ERR PROC
NEAR

MOV
AH  H

MOV
BX  1
MOV
CX 18

LEA
DX OPENMSG

INT
1H

MOV
NDCDE  1
RET
X1 ERR ENDP
CODESG ENDS
END
BEGIN
__________________________________________________________________________
.1 .2. ASCII .
DOS
________________________________________________________________
DOS AH
5  DL  
INT 21H :
MOV AH  5
MOV DL char
INT 21H



DOS

.
  
 .
. SI
HEADG  CX 
.  P2 
HEADG .
HEADG      

.
HEADG DB
LEA
MOV
P2 :
MOV
MOV
INT
INC
LOOP

CH  Industrial Bicycle Mfrs  DH  AH  AH


SI HEADG

CX 2 

AH  5
DL  SI 
21H
SI
P2



DOS

 DOS Out of paper .


.
Ctrl Break.

________________________________________________________________


. :
.

15
1
18
2

F
E
12
1

 Esc
.1B .
:
1B
1B
1B
1B

3
32
5
6

8
6

:
1. .
 8 
   :
HEADG DB

FH  1BH  3 H  Title...  DH  AH

2. :
MOV AH  5
MOV DL  FH
INT 21H


 .

.
.
BIOS INT 1 H
________________________________________________________________
BIOS INT 1 H
AH:

AH :
1 2   .
MOV
MOV
MOV
INT

AH 
AL char
DX 
1 H




BIOS


1.
AH1: :

AH

MOV AH  1
MOV DX 
INT 1 H



BIOS

 
 .
.
AH2: :
MOV
MOV
INT
TEST
JNZ


AH  2

DX 
1 H
BIOS
AH  1 1 1B 
errormsg 

AH1 AH2
. AH
1:


6
5
3

 . 
1 1      
. 5 
3  . 
.B 1 11   .
 BIOS
 
. 
.

.  BIOS 

 .  DOS
 Out of paper 
. 
.

.
.

________________________________________________________________

 
.

  .

 

 DOS

. BIOS

. BIOS INT 1 H
.

________________________________________________________________
1 .1. DOS 
 


   .
DOS.

1 .2.

1 .3.  :
   
 .
1 . . 1 .1 BIOS INT
1 H. .
1 .5. 1 .1    
5 .
DOS.

1 .6. .1 .1

1 . . .1 .2 
.

__________________________________________________________________________
:
.

________________________________________________________________

.
Pascal C  
. 
.
MASM 

. 
MACRO  
 MEND.

 .
.
:




 .
 
ASCII
 
 .
 
.

.

________________________________________________________________

.
INIT1 
EXE :
INIT1 MACRO

ASSUME CS:CSEG DS:DSEG SS:STAC ES:DSEG
PUSH DS
SUB AX AX
PUSH AX
MOV AX DSEG
MOV DS AX
MOV ES AX
ENDM


________________
|


|

|
p|
|

________________|

MACRO 
ENDM .  INIT1 
.
ENDM .
MACRO ENDM .
   CSEG  DSEG
STAC
 .
INIT1 
.
INIT1  
 .
INIT1


.



.
.2 .1 .

 
. 

ASSUME  .


.
__________________________________________________________________________
TITLE MACRO1 EXE 

INIT1 MACRO

ASSUME CS:CSEG DS:DSEG SS:STAC ES:DSEG
PUSH
DS

2  


5
66
6F
2
6E
1A

65
2
2D
65
D

3
6D
6
3


61
6E


2
63
3
6

SUB
AX AX
PUSH
AX
MOV
AX DSEG
MOV
DS AX
MOV
ES AX
ENDM




STAC
SEGMENT PARA STAC Stack 
DW
32 DUP 

STAC
ENDS

DSEG
SEGMENT PARA Data 
MESSGE DB
Test of macro instruction  13

6F
2

6F

DSEG
ENDS

CSEG
SEGMENT PARA Code 
BEGIN PROC
FAR
INIT1


PUSH
DS

SUB
AX AX

PUSH
AX
MOV
AX DSEG


MOV
DS AX

MOV
ES AX
MOV
AH  H

MOV
BX  1


MOV
CX 26
LEA
DX MESSGE
INT
21H
RET
BEGIN ENDP
CSEG
ENDS
END
BEGIN




1
3



B
D
1
13
1 
1 
1A
1A

1E
2B
5
B8
8E
8E
B
BB
B
8D
CD
CB

 R
D8
C

1
1A
16 R
21

Macros:
N a m e
Length
INIT1. . . . . . . . . . . . . . . .
Segments and Groups:
N
CSEG . . . . . . . .
DSEG. . . . . . . .
STAC . . . . . . . .

a
.
.
.

m
.
.
.

e
Size
. . . . . . 1A
. . . . . . 1A
. . . . . .

Align
PARA
PARA
PARA

Combine
NONE
NONE
STAC

Class
CODE 
DATA
STAC 

Symbols:
N a m e
Type
Value Attr
BEGIN. . . . . . . . . . . . . . . . F PROC
CSEG
Length 1A
MESSAGE. . . . . . . . . . . . . . . L BYTE
DSEG
__________________________________________________________________________
.2 .1. .

________________________________________________________________


: CSEG  DSEG STAC . 
 
:
INIT2 MACRO CSNAME DSNAME SSNAME

ASSUME CS:CSNAME DS:DSNAME SC:SSNAME ES:DSNAME
PUSH DS
SUB AX AX
PUSH AX
MOV AX DSNAME
MOV DS AX
MOV ES AX
ENDM


.
CSNAME  DSNAME SSNAME
ASSUME  DSNAME MOV.

.
INIT2

. 

:
: INIT2 MACRO CSNAME DSNAME SSNAME . 
|
|
|
:
INIT2 CSEG DSEG STAC  


:

 1: CSEG
. CSEG
ASSUME.
 2: DSEG
. DSEG
ASSUME
 MOV.

 3: STAC

. STAC
ASSUME.

CSNAME
CSNAME

DSNAME

DSNAME:
SSNAME
SSNAME

.2 .2.

   CX 
. 
 
.
  12 .
__________________________________________________________________________
TITLE MACRO2 EXE 

INIT2 MACRO CSNAME DSNAME SSNAME
ASSUME CS:CSNAME DS:DSNAME

ASSUME SS:SSNAME ES:DSNAME


PUSH
DS
SUB
AX AX
PUSH
AX
MOV
AX DSNAME
MOV
DS AX
MOV
ES AX

ENDM



STAC
SEGMENT PARA STAC Stack 


2  
DW
32 DUP 


STAC
ENDS

DSEG
SEGMENT PARA Data 

5 65 3  2 6F MESSAGE DB
Test of macro   
66 2 6D 61 63 2
6F 2
DSEG
ENDS
E


CSEG
SEGMENT PARA Code 

BEGIN PROC
FAR

INIT2 CSEG DSEG STAC

1E
PUSH
DS
1 2B C

SUB
AX AX
3 5

PUSH
AX
MOV
AX DSEG
B8  R

 8E D8

MOV
DS AX
 8E C

MOV
ES AX
B B 
MOV
AH  

LEA
DX MESSGE
D 8D 16 R

11 CD 21
INT
21H
13 CB
RET
1
BEGIN ENDP
CSEG
ENDS
1
END
BEGIN
__________________________________________________________________________
.2 .2. .

________________________________________________________________

. COMMENT
 PROMPT:
PROMPT
MACRO
MESSGE

MOV
AH  H
LEA
DX MESSGE
INT
21H
ENDM

 
. 


.LALL list all   
:

.LALL
PROMPT

MESSAG1


  .
.LALL. 
  
.
.XALL  
.  

.
.SALL suppress all   

.
.LALL  .XALL  .SALL

. 
  
.
.2 .3
. INIT2 PROMPT 
. .SALL
INIT2 PROMPT.
PROMPT .LALL
.   
  PROMPT 

.
__________________________________________________________________________

TITLE MACRO3 EXE  .LALL .SALL



INIT2 MACRO CSNAME DSNAME SSNAME
ASSUME CS:CSNAME DS:DSNAME
ASSUME SS:SSNAME ES:DSNAME
PUSH
DS
SUB
AX AX
PUSH
AX
MOV
AX DSNAME
MOV
DS AX
MOV
ES AX
ENDM

PROMPT MACRO MESSAGE

DOS
MOV
AH  

LEA
DX MESSAGE
INT
21H
ENDM



STAC
SEGMENT PARA STAC Stack 
2  
DW
32 DUP 

STAC
ENDS

DATA
SEGMENT PARA Data 
Customer name    
3 5 3  6F 6D MESSG1 DB
65 2 2 6E 61 6D

2
3  6F 6D MESSG2 DB
Customer address    
2 61 6 6
3 3 3F 2
21
DATA
ENDS


CSEG
SEGMENT PARA Code 

BEGIN PROC
FAR
.SALL

INIT2 CSEG DATA STAC
PROMPT MESSG1
.LALL
PROMPT MESSG2

13 B 


MOV
AH  
15 8D 16 F R

LEA
DX MESSG2
1  CD 21

INT
21H
RET
1B CB
1C
BEGIN ENDP
1C
CSEG
ENDS
END
BEGIN
__________________________________________________________________________

65
3
65
2

3F
5
2
65

.2 .3. .

________________________________________________________________
.
DOS21  AH
DOS INT 21H:
DOS21

MACRO
MOV
INT
ENDM

DOSFUNC
AH DOSFUNC
21H


:
LEA
DOS21

DX NAMEPAR
AH

 
AH :
DISP

MACRO
MOV
MOV
INT
ENDM

CHAR
AH  2
DL CHAR
21H

 
DISP  .

DOC21:
DISP

MACRO
MOV
DOS21

CHAR
DL CHAR
2

DISP 

ENDM
 DISP DISP  
:
MOV
MOV
INT

DL   
AH  2
21H

LOCAL
________________________________________________________________

.

. 
.
LOCAL 
MACRO  .
:
LOCAL dummy 1 dummy 2 ...

.2 . LOCAL.

1 
. : COMP  
OUT  . COMP OUT
LOCAL .
COMP   OUT 
 1. DIVIDE
  2
 3 .  LOCAL
.
__________________________________________________________________________

COM  LOCAL
TITLE MACRO

DIVIDE MACRO DIVIDEND DIVISOR QUOTIENT
LOCAL COMP
LOCAL OUT

AX  BX  CX
MOV
AX DIVIDEND

MOV
BX DIVISOR


SUB
CX CX
COMP:
CMP
AX BX
 
JB
OUT


SUB
AX BX
 1
INC
CX
JMP
COMP
OUT:

MOV
QUOTIENT CX
ENDM

CSEG
SEGMENT PARA Code 
ASSUME CS:CSEG DS:CSEG SS:CSEG ES:CSEG
ORG
1 H

1 EB 6

BEGIN: JMP
SHORT MAIN

1 2 6

DIVDND DW
15
1 1B

DIVSOR DW
2
1 6 
QUOTNT DW



1 8
MAIN
PROC
NEAR
.LALL
DIVIDE DIVDND DIVSOR QUOTNT
AX  BX  CX

1 8 A1 1 2 R


MOV
AX DIVDND
1 B 8B 1E 1 R 

MOV
BX DIVSOR
1 F 2B C 

SUB
CX CX

111
  :
111 3B C3

 
CMP
AX BX
113 2 5

 1

JB
115 2B C3

SUB
AX BX

INC
CX
11  1

 1
118 EB F 


JMP
11A
  1:
11A 8  E 1 6 R 
MOV
QUOTNT CX

RET
11E C3
11F
MAIN
ENDP
11F
CSEG
ENDS
END
BEGIN
__________________________________________________________________________
.2 . . LOCAL.

________________________________________________________________
 INIT1 INIT2
.

   MACRO.LIB:
INIT

PROMPT

MACRO
.
.
ENDM
MACRO
.
.
ENDM

CSNAME DSNAME SSNAME

MESSGE


MACRO INCLUDE:
INCLUDE
.
.
INIT

C:MACRO.LIB


CSEG DATA STAC

MACRO.LIB  
C INIT PROMPT.
INIT.
 C 3
LST .

 31 .

INCLUDE 
 :
IF1
INCLUDE

C:MACRO.LIB

ENDIF
IF1 ENDIF . IF1

. ENDIF IF . 

.
.2 .5 IF1 
INCLUDE ENDIF  LST  ENDIF.
INIT PROMPT
MACRO.LIB  ..
MACRO.LIB .
INCLUDE 
.
__________________________________________________________________________
TITLE MACRO5 EXE  INCLUDE
EDIF




STAC
SEGMENT PARA STAC Stack 

2 
DW
32 DUP 

STAC
ENDS



DATA
SEGMENT PARA Data 
5 65 3  2 6F MESSGE DB
Test of macro   
66 2 6D 61 63 2
6F 2
E
DATA
ENDS

CSEG
SEGMENT PARA Code 


BEGIN PROC
FAR

INIT
CSEG DATA STAC
1E

PUSH
DS
SUB
AX AX
1 3B C

3 5

PUSH
AX
B8  R

MOV
AX DATA
 8E D8

MOV
DS AX
MOV
ES AX
 8E C

PROMPT MESSGE
B B 


MOV
AH  
D 8D 16 R

LEA
DX MESSGE
INT
21H
11 CD 21

13 CB
RET
1
BEGIN ENDP
1
CSEG
ENDS
END
BEGIN
__________________________________________________________________________
.2 .5. .


INCLUDE

. 
INIT  PROMPT DIVIDE 
INIT. PURGE   PROMPT
DIVIDE :
IF1
ENDIF
PURGE
...
INIT

INCLUDE MACRO.LIB

PROMRT DIYIDE


CSEG DATA STAC

PURGE
 .


________________________________________________________________

  
. MOVE MOVSB
MOVSW:
MOVE

MACRO
REP
ENDM

TAG
MOVS
TAG

MOVE B MOVE W.
MOVS
REP MOVSB REP MOVSW.
.
: REPT  IRP  IRPC
________________________________________________________________

ENDM.
  ENDM
 ENDM 
.
REPT:

REPT
ENDM  :
REPT
N
DB N :
N 
REPT
N 
DB
ENDM


5
N  1
N

DB DB 1 DB 5.
REPT
.
MOVSB  REP MOVSB CX 5:
REPT 5
MOVSB
ENDM
IRP:

IRP ENDM.
:
IRP dummy arguments 
 
 
.
.
DB 3  DB  DB 1  DB 25 DB 28:
IRP N 3   1  25  28 
DB N
ENDM
IRPC:

IRPC
ENDM. :
IRPC dummy string

DW 3  DW ... DW 8:

string .

IRPC N 3 56 8
DW N
ENDM

________________________________________________________________
.

IF1
.
 .
IF ENDIF
IF  ELSE :
IFxx
 
.
__________
.
|
ELSE  
|
.
|
.
__________|
 IF  
ENDIF


ENDIF

:
Undeterminated conditional 
 .

ELSE ELSE  ENDIF.
 ELSE 
ELSE .
:
IF
IFE
IF1  
IF2  
IFDEF
IFNDEF
IFB  
IFNB  
IFIDN  1  2 

IFDIF  1  2 


.

.

.


.

EXTRN 
.

EXTRN 
.

.
.

.
.


.
.





.
.

IFNB  . DOS
INT 21H AH 
DX.
:
DOS21

MACRO
MOV
IFNB
MOV
ENDIF
INT
ENDM

DOSFUNC DXADDRES
AN DOSFUNC
DXADDRES 
DX OFFSET DXADDRES
21H

DOS21
1 AH:
DOS21

MOV AH  1 INT 21H.


AH AH 
DX  :

DOS21

AH IPFIELD

MOV INT 21H.


EXITM.
________________________________________________________________



. 
.
EXITM:
IFxx
.
.
.
EXITM
.
.
ENDIF


 


EXITM 

ENDM.
EXITM

REPT  IRP IRPC


.
 IF IFNDEF
________________________________________________________________
.2 .6 DIVIDE 
.
: 
 . IFNDEF
.
CNTR.
.
 CNTR:
IF CNTR

EXITM
CNTR 

EXITM

. 
CNTR   IFNDEF
CNTR  1.

. DIVIDE
 .


 .
__________________________________________________________________________


1
1 EB 6
1 2
1
1 6

6
1B


1 8


1 8
1 8
1 F
111
111
113

A1 1 2 R
8B 1E 1 R
2B C 
3B C3
2 5














TITLE MACRO6 COM  . IF IFNDEF



DIVIDE MACRO DIVIDEND DIVISOR QUOTIENT
LOCAL COMP
LOCAL OUT

CNTR

AX   BX   CX 
IFNDEF DIVIDEND


 CNTR 1
CNTR
ENDIF
IFNDEF DIVISOR


 CNTR 1
CNTR
ENDIF
IFNDEF QUOTIENT


 CNTR 1
CNTR
ENDIF
IF
CNTR


EXITM
ENDIF

MOV
AX DIVIDEND
MOV
BX DIVISOR

SUB
CX CX

COMP:
 
CMP
AX BX
JB
OUT

SUB
AX BX

 1
INC
CX
JMP
COMP
OUT:
MOV
QUOTIENT CX
ENDM

CSEG
SEGMENT PARA Code 
ASSUME CS:CSEG DS:CSEG SS:CSEG ES:CSEG
ORG
1 H
BEGIN: JMP
SHORT MAIN

DIVDND DW
15
DIVSOR DW
2

QUOTNT DW

MAIN
PROC
NEAR
.LALL
DIVIDE DIVDND DIVSOR QUOTNT

CNTR
AX   BX   CX 

ENDIF
ENDIF
ENDIF
ENDIF

MOV
AX DIVDND

MOV
BX DIVSOR
SUB
CX CX

 :
 
CMP
AX BX
 1

JB

115 2B C3
11  1
118 EB F 
11A
11A 8  E 1 6 R




  1:


SUB
INC
JMP

AX BX
CX


MOV
QUOTNT CX

DIVIDE DIDND DIVSOR QUOT



CNTR

AX   BX   CX 

IFNDEF DIDND


 1
 CNTR 1

CNTR

ENDIF

ENDIF
IFNDEF QUOT



 2
 CNTR 1

CNTR

ENDIF
IF
CNTR




EXITM
11E C3
RET
MAIN
ENDP
11F
11F
CSEG
ENDS
END
BEGIN
__________________________________________________________________________
.2 .6. IF IFNDEF.
 IFIDN 
________________________________________________________________
.2 .  MOVIF 
MOVSB MOVSW
. B   W
  MOVSB MOVSW MOVS.
:
MOVIF

MACRO
IFIDN

TAG

TAG B 

IFIDN  B
W  B.  REP
MOVSB. 
  
TAG  .
B W 
MOVSB  .
MOVIF:
B  W .

 CX DX .


.  
.
__________________________________________________________________________
TITLE MACRO  COM  IFIDN


MOVIF

MACRO TAG
IFIDN

TAG B 
REP MOVSB
EXITM
ENDIF
IFIDN

TAG W 
REP MOVSW
ELSE

B W 
B

REP MOVSB
ENDIF
ENDM


CSIG
SEGMENT PARA Code 
ASSUME CS:CSEG DS:CSEG
ASSUME SS:CSEG ES:CSEG
ORG
1 H
1
1 EB
BEGIN: JMP
SHORT MAIN

...
1 2
MAIN
PROC
NEAR
.LALL
MOVIF B

B B 
IFIDN
1 2 F3 A

REP MOVSB
EXITM

MOVIF W

ENDIF

IFIDN
W  W 
REP MOVSW
1 F3 A5


ENDIF
MOVIF

ENDIF
ELSE

 . B W  . B
 
1 6 F3 A

REP MOVSB
ENDIF

1 8 C3
RET
1 
MAIN
ENDP
1 
CSEG
ENDS
END
BEGIN
__________________________________________________________________________
.2 . . IFIDN

________________________________________________________________

 MASM .

.
 MACRO 

ENDM .
  

 .SALL  .LALL .XALL


.

.
MACRO.

LOCAL

LOCAL


 .


 .

________________________________________________________________
2 .1. :  
 
.
2 .2. :  MULTBY
 MULTWD
.
.

.
2 .3. 2 .2  .

INCLUDE .
2 . . BIPRINT  BIOS INT 1 H
.
.
2 .5. .2 .6
 .

21

__________________________________________________________________________
: 
.

________________________________________________________________

.  

.


.

 
 

  



 

.


OBJ  . LIN 
EXE  .

.  
.
.21.1
. .21.1.  
1  2 3. .21.1.  
1 2  1 3.

   
.   
1 2  3 
1. 
 
.
__________________________________________________________________________
a

 





L T 
L T 


  
 
 1  2  3
 1  2
L  L  L 
L T  L 

 3
L 
__________________________________________________________________________
.21.1. .

________________________________________________________________
CALL
 .. . CALL
 12  128  
.  
IP   
.
 CALL :
E82 . .E8  2

2 IP.
CS IP
.
RET IP
CALL .

  .
CS 
IP
.

.
 CALL
:

A 2 AF
. A
2 2 IP  AF
AF CS.
:

IP

AF
2
CF

REP
CS IP
CALL .
EXTRN PUBLIC
________________________________________________________________

MAINPROG 

SUBPROG  CALL 
.21.2.
CALL MAINPROG   SUBPROG



SUBPROG . EXTRN
 SUBPROG

FAR 
.. .
  
:
A  E
SUBPROG PUBLIC 
   SUBPROG.
 MAINPROG SUBPROG

:

LIN :
:
Object Modules .OBJ :
Run File filespec.EXE :
List File NUL.MAP :
Libraries .LIB :

B:MAINPROG B:SUBPROG
B:COMBPROG  
CON
return 

EXTRN
PUBLIC
.
.

.
.
__________________________________________________________________________



EXTRN SUBPROG:FAR
MAINPROG: .

CALL
SUBPROG



PUBLIC SUBPROG

SUBPROG: .

RET

L 
__________________________________________________________________________
.21.2. .
EXTRN

EXTRN :
EXTRN

:  ... 

 
EXTRN.

PUBLIC.
ABS  BYTE  DWORD  FAR  NEAR  WORD.
EQU .
PUBLIC

PUBLIC 
.
:
PUBLIC

 ... 

 
PUBLIC.
 PROC   .

EQU  
.
.
: EXTRN PUBLIC
_______________________________________________________________

__________________________________________________________________________
page
6 132
TITLE CALLMULL1 EXE  .
EXTRN SUBMUL:FAR



STAC SG
SEGMENT PARA STAC Stack 


 
DW
6 DUP 

8
STAC SG
ENDS

DATASG SEGMENT PARA Data 

1
1 H
QTY
DW
2 25
PRICE DW
25 H

DATASG ENDS


CODESG SEGMENT PARA Code 

BEGIN PROC
FAR

ASSUME CS:CODESG DS:DATASG SS:STAC SG
PUSH
DS
1E
1 2B C
SUB
AX AX
3 5
PUSH
AX
B8  R
MOV
AX DATASG
MOV
DS AX
 8E D8
 A1 2 R

MOV
AX PRICE
C 8B 1E R

MOV
BX QTY
1 A  E
CALL
SUBMUL

RET
15 CB
16
BEGIN ENDP
16
CODESG ENDS
END
BEGIN
Segments and Groups:
N a m e
Size
CODESG . . . . . . . . . . . . 16
DATASG
 . . . . . . . . . . . .
STAC SG. . . . . . . . . . . . 8

Align
PARA
PARA
PARA

Combine
NONE
NONE
STAC

Class
CODE 
DATA
STAC 

Symbols:
BEGIN.
PRICE.
QTY. .
SUBMUL

.
.
.
.

.
.
.
.



F  E3
2 CB
3
3

.
.
.
.

.
.
.
.

N a m e
. . . . .
. . . . .
. . . . .
. . . . .

.
.
.
.

.
.
.
.

.
.
.
.

Type
Value
F PROC
L WORD 2
L WORD
L FAR

Attr
CODESG Length 16
DATASG
DATASG
External

page
6 132
TITLE SUBMUL

CODESG SEGMENT PARA Code 
SUBMUL PROC
FAR
ASSUME CS:CODESG
PUBLIC SUBMUL
AX   BX 
MUL
BX
RET
DX:AX
SUBMUL ENDP
CODESG ENDS
END
SUBMUL

Segments and groups:


N a m e
Size
CODESG . . . . . . . . . . . . 3

Align
PARA

Combine Class
CODE 
NONE

Symbols:
N a m e
Type
Value Attr
SUBMUL . . . . . . . . . . . . F PROC
CODESG Clobal Length 3
__________________________________________________________________________

LIN
IBM Personal Computer Linker
Version 2.3 C  Copyright IBM Corp 1 81  1 85
Object Modules: B:CALLMUL1 B:SUBMUL1
Run File: B:CALLMUL1.EXE : return 
List File: NUL.MAP : CON
Libraries .LIB : return 
Start

H
2 H
3 H
H

Stop Length Name

15H
22H
33H
BFH

16H
3H
H
8 H

CODESG
CODESG
DATASG

STAC SG

Class
CODE : 2
CODE 
DATA
STAC

Program entry point at :


__________________________________________________________________________
. 21.3. EXTRN PUBLIC.
.21.3 CALLMUL1
SUBMUL1. 
. QTY PRICE.
AX PRICE  BX 
QTY  . EXTRN
SUBMUL .
PUBLIC  ASSUME 

SUBMUL. AX  
BX  .
DX:AX . 2E .
 
. 
.

 . 

.
.

.  SUBMUL
FAR External
   F  FAR  Global  .
 
.. .
 
.  
 .



.  
.   . 2 .


CALL SUBMUL

A D 13
CALL  . A.
IP 
.13D2 CS .D 13.
CS:IP ..
13D . 
CS  .13D2  .. 13D2 .

. 2 . 
:
CS
IP

13D2
2
13D


CALL.
: PUBLIC
________________________________________________________________
__________________________________________________________________________
page
6 132
CALLMUL2 EXE  .
EXTERN SUBMUL:FAR



STAC SG
SEGMENT PARA STAC Stack 
DW
6 DUP 

STAC SG
ENDS

DATASG SEGMENT PARA Data 
QTY
DW
1 H
PRICE DW
25 H
DATASG ENDS

CODESG SEGMENT PARA PUBLIC Code 
BEGIN PROC
FAR

ASSUME CS:CODESG DS:DATASG SS:STAC SG
PUSH
DS
SUB
AX AX
PUSH
AX
MOV
AX DATASG
MOV
DS AX
MOV
AX PRICE

MOV
BX QTY


CALL
SUBMUL
RET
BEGIN ENDP
TITLE



8


2



1
25




1
3



C
1
15
16

1E
2B
5
B8
8E
A1
8B
A
CB

 R
D8
2 R
1E R
 E

16

CODESG ENDS
END
BEGIN
________________________________________________________________________
Segments and Group:
N a m e

Size

Align

Combine Class

CODESG . . . . . . . . . . . . . 16
DATASG
 . . . . . . . . . . . . .
STAC SG. . . . . . . . . . . . . 8

CODE 
DATA
STAC 

PARA
PARA
PARA

PUBLIC
NONE
STAC

Value

2

Attr
CODESG Lenght 16
DATASG
DATASG
External

Symbols:
BEGIN.
PRICE.
QTY. .
SUBMUL

.
.
.
.

.
.
.
.

.
.
.
.

.
.
.
.

N a m e
. . . .
. . . .
. . . .
. . . .

.
.
.
.

.
.
.
.

.
.
.
.

Type
PROC
WORD
WORD
FAR

F
L
L
L

page
6 132
TITLE SUBMUL2

CODESG SEGMENT PARA
PUBLIC CODE 
SUBMUL PROC
FAR
ASSUME CS:CODESG
PUBLIC SUBMUL
AX   BX 
MUL
BX
RET
DX:AX
SUBMUL ENDP
CODESG ENDS
END
SUBMUL




2
3
3

.
.
.
.

F  E3
CB

Segments and Groups:


N a m e
Size
CODESG. . . . . . . . . . . . . 3

Align
PARA

Combine Class
PUBLIC CODE 

Value

Attr
CODESG Global Length 3

Symbols:
N a m e
Type
SUBMUL. . . . . . . . . . . . .F PROC


LIN
IBM Personal Computer Linker
Version 2.3 C  Copyright IBM Corp 1 81  1 85
Object Modules: B:CALLMUL2 B:SUBMUL2
Run File: B:CALLMUL2.EXE : return 
List File: NUL.MAP : CON
Libraries .LIB : return 
Start

Stop Length Name

H 22H 23H CODESG


3 H 33H H DATASG

H BFH 8 H STAC SG

Class
CODE  : 1
DATA
STAC

Program entry point at :


__________________________________________________________________________
.21. .  PUBLIC.
.21.
.21.3. 
. SEGMENT
PUBLIC:
CODESG

SEGMENT

PARA PUBLIC CODE 


CALL.

 
: CODESG  PUBLIC  .21.3
NONE . 
 
CODESG  CODE  PUBLIC 

. 

:

A 2 D213
.2 IP .D213 CS.

CS  .D213.
. 2 :
CS:
IP:
:

13D2
2
13D

  
.13D . 
 
. 16.
SEGMENT 
 .. .1
.

. 2 .
13D2 2 13D .
__________________________________________
| ... | |
|   |
|
|___________________________|______________|
|
|
|
13D2
13D3
13D
 
.
:
________________________________________________________________
__________________________________________________________________________
page
6 132
CALLMUL3 EXE 

EXTRN SUBMUL:FAR
PUBLIC QTY PRICE



STAC SG
SEGMENT PARA STAC Stack 
DW
6 DUP 

STAC SD
ENDS
TITLE



1
25




1
3



E
F

1E
2B
5
B8
8E
A
CB

 R
D8
 E


DATASG SEGMENT PARA PUBLIC Data 
1 H
QTY
DW
PRICE DW
25 H
DATASG ENDS

CODESG SEGMENT PARA PUBLIC Code 
BEGIN PROC
FAR

ASSUME CS:CODESG DS:DATASG SS:STAC SG
PUSH
DS
SUB
AX AX
PUSH
AX
MOV
AX DATASG
MOV
DS AX

CALL
SUBMUL
RET
BEGIN ENDP

CODESG ENDS
END
BEGIN
_____________________________________________________________________
Segments and Groups:
N a m e
Size
CODESG . . . . . . . . . . . . F
DATASG
 . . . . . . . . . . . .
STAC SG. . . . . . . . . . . . 8

Align
PARA
PARA
PARA

Combine
PUBLIC
PUBLIC

STAC

Class
CODE 
DATA
STAC 

Symbols:
BEGIN.
PRICE.
QTY. .
SUBMUL

.
.
.
.

.
.
.
.

.
.
.
.

.
.
.
.

N a m e
. . . . .
. . . . .
. . . . .
. . . . .

.
.
.
.

.
.
.
.

.
.
.
.

Type
Value
F PROC
L WORD 2
L WORD
L FAR

Attr
CODESG Length F
DATASG Global
DATASG Global
External

page
6 132
SUBMUL
EXTRN QTY:WORD PRICE:WORD


CODESG SEGMENT PARA PUBLIC CODE 
SUBMUL PROC
FAR

ASSUME CS:CODESG
PUBLIC SUBMUL

A1 E
MOV
AX PRICE
8B 1E E
MOV
BX QTY
3

DX:AX
F  E3
MUL
BX

CB
RET
A
SUBMUL ENDP
CODESG ENDS
A
END
SUBMUL
_____________________________________________________________________
TITLE

Segments and Groups:


N a m e
Size
CODESG . . . . . . . . . . . . A

Align Combine Class


PARA PUBLIC CODE 

Symbols:
N a m e
Type
Value Attr
PRICE. . . . . . . . . . . . . V WORD

External

QTY. . . . . . . . . . . . . . V WORD
External
SUBMUL . . . . . . . . . . . . F PROC CODESG Global Length A
_____________________________________________________________________

LIN
IBM Personal Computer Linker
Version 2.3 C  Copyright IBM Corp 1 81  1 85
Object Modules: B:CALLMUL3 B:SUBMUL3
Run File: B:CALLMUL3.EXE : return 
List File: NUL.MAP : CON
Libraries .LIB : return 
Start

Stop Length Name

H 1 H 1AH CODESG
3 H 33H H DATASG

H BFH 8 H STAC SG

Class
CODE
DATA
STAC

PROGRAM entry point at :


__________________________________________________________________________
.21.5. .


.  QTY PRICE
 
BX AX .
.21.5. :

 QTY PRICE PUBLIC.


PUBLIC.
Global   QTY PRICE

.
 QTY PRICE EXTRN WORD.
2 .
MOV 
.  QTY
PRICE External  .
MOV :
A1 E
8B 1E E

MOV AX PRICE
MOV BX QTY

.A1
AX  .8B  BX 
AX 
. 
:
A1 2
8B 1E

MOV . 
DS
.


 PUBLIC EXTRN.
 

.
 
6 .
.23 

GROUP
.

________________________________________________________________
__________________________________________________________________________
page
6 132
CALLMULL EXE 

EXTRN SUBMUL:FAR




STAC SG
SEGMENT PARA STAC Stack 

 
DW
6 DUP 

STAC SG
ENDS
8


DATASG SEGMENT PARA Data 
1
QTY
DW
1 H
PRICE DW
25 H
2 25

DATASG ENDS


CODESG SEGMENT PARA PUBLIC Code 
BEGIN PROC
FAR


ASSUME CS:CODESG DS:DATASG SS:STAC SG
1E
PUSH
DS
1 2B C
SUB
AX AX
PUSH
AX
3 5
B8  R
MOV
A DATASG
 8E D8
MOV
DS AX
 FF 36 2 R
PUSH
PRICE
PUSH
QTY
D FF 36 R
11 A  E

CALL
SUBMUL
16 CB
RET
1 
BEGIN ENDP
CODESG ENDS
1 
END
BEGIN
_____________________________________________________________________
TITLE

Segments and Groups:


N a m e
Sise
CODESG . . . . . . . . . . . . 1 
DATASG
 . . . . . . . . . . . .
STAC SG. . . . . . . . . . . . 8

Align
PARA
PARA
PARA

Combine
NONE
NONE
STAC

Class
CODE 
DATA
STAC 

Symbols:
N a m e
BEGIN. . . . . . . . . . . . .
PRICE. . . . . . . . . . . . .
QTY. . . . . . . . . . . . . .

Type
Value
F PROC
L WORD 2
L WORD

Attr
CODESG Length 1 
DATASG
DATASG

SUBMUL . . . . . . . . . . . . L FAR

External
_____________________________________________________________________
page
6 132
TITLE SUBMUL
CODESG SEGMENT PARA PUBLIC Code 


SUBMUL PROC
FAR
ASSUME CS:CODESG
PUBLIC SUMBUL
55
PUSH
BP

1
8P EC
MOV
BP SP
3

8B 6 8
MOV
AX  BP 8 
6
8B 5E 6
MOV
BX  BP 6 

F  E3
MUL
BX

DX:AX
B
5D
POP
BP
F
SUMBUL ENDP
F
CODESG ENDS
END
_____________________________________________________________________
Segments and Groups:
N a m e
Size
CODESG . . . . . . . . . . . . F

Align
PARA

Combine Class
PUBLIC CODE 

Symbols:
N a m e
Type
Value Attr
SUBMUL . . . . . . . . . . . . F PROC
CODESG Global Length F
_____________________________________________________________________

LIN
IBM Personal Computer Linker
Version 2.3 C  Copyright IBM Corp 1 81  1 85
Object Modules: B:CALLMUL B:SUBMUL
Run File: B:CALLMUL .EXE : return 
List File: NUL.MAP : CON
Libraries .LIB : return 
Start

Stop Length Name

H 1 H 1AH CODESG
3 H 33H H DATASG

H BFH 8 H STAC SG

Class
CODE
DATA
STAC

PROGRAM entry point at :


__________________________________________________________________________
.21.6. .

.
. PUSH
.
 .21.6 
SUBMUL PRICE QTY. CALL
:
... | 16 | D213 |
6
5

1 | 25 | | C213 |
3
2
1

1.
2.
3.
.
5.
6.

PUSH DS .
DOS.
PUSH AX .
PUSH PRICE 25 .
PUSH QTY  1 .
CALL CS D213 
CALL 
IP 16 .

BP
 BP 
.   BP 
 .
BP SP 
BP 
SP. BP 2. SP
 .. .8 .
SP 2:

SP:

| | 16 | D213 |
|
|
|
2

6

1 | 25 | | C213 |
|
|
|
|
8
A
C
E

BP 2  PRICE 
BP 8  QTY   BP 6.
AX BX
.

BP
 SP
2  2  .
RET  

. :

 IP 16 
 SP 2   6.
 CS
D213 .
 SP 2 6 8.

. . RET
RET

 . RET
SP  C. 
.
SP 
.
BASIC 
________________________________________________________________
BASIC IBM PC
BASIC  .
:

BIOS 

.


BASIC .
BASIC 
.
 6 
BASIC. .


:
BASIC  PO E
BASIC .


BASIC  PO E


. 
LST 
DEBUG.
BASIC  DATA.  BASIC 
READ PO E
.



EXE  .
BASIC  .
BASIC  BSAVE BASIC
save  BLOAD 
.
BASIC  
 . BASIC
: USR CALL. DS  ES
SS BASIC.
CS 
DEF SEG  . SP 

.

.

SP BASIC
RET.

. HIGH
  B: HIGH.
DEBUG EXE 
R CS IP:
.  N  BASIC
L.
BASIC  EXE  
USR CALL. 
EXE   
USRn CALL. BASIC IBM PC
USRn CALL
.
: BASIC

__________________________________________________________________________

LOAD D:BASTEST.BAS
LIST
1
CLEAR 32 68 
2
 BLOAD
3
 DEFSEG

 CALL
5
 ASM 
6
FOR N  1 TO 5
INPUT Hours  H

8
INPUT Rate  R

W  H R
1
PRINT Wage   W
11
NEXT N
12
END
_____________________________________________________________________

TITLE LIN BAS  BASIC
CODESG SEGMENT PARA CODE 
ASSUME CS:CODESG
CLRSCRN PROC
FAR
PUSH
BP
BP

MOV
BP SP

MOV
AX  6 H
MOV
BH  

MOV
CX 

MOV
DX 18 FH
INT
1 H
POP
BP
RET

CLRSCRN ENDP
CODESG ENDS
END
__________________________________________________________________________
.21. . BASIC
.

BASIC  .

BASIC 
 . FOR NEXT
. BASIC 
 .
. 21.  BASIC 
. BASIC :
1 32 2  3  5
.
BASIC  .
BASIC  . BASIC
 .
F2.

SAVE B:BASTEST.BAS 
:

  BASIC


 BP
SP BP
 

.
 .
 DOS 
A   B:
1.
2.

3.
.
5.

6.

.
8.

.



B:LIN BAS.ASM
.

LIN  
:



LIN B:LIN BAS B:LIN BAS HIGH CON
DEBUG BASIC  : DEBUG
BASIC.COM.
R .
SS  CS IP.

:

N B:LIN BAS.EXE
L
R
CX  CS IP.
SS  CS IP . 
R SS  R CS R IP .
G go  BASIC.
BASIC .
 
 :
DEF SEG 
Hxxxx  CS 6 
BSAVE B:CLRSCRN.MOD  
Hxx  CX 6 


. 
.
B.
1 . BASIC  .
 
SYSTEM BASIC   Q
DEBUG. DOS
11. BASIC  BASIC 
:
BASIC
LOAD B:BASTEST.BAS 
LIST
12. 2  3  5 :
2
3

5

BLOAD B:CLRSCRN.MOD 
DEF SEG 
Hxxxx  CS 6 
CLRSCRN 
 
 
CALL CLRSCRN

13.  BASIC .
BASIC  


. .21.8 

.

. 

BASIC 

CALL  1  2 ... 

BP BP  .21.3.
RET 
.  CALL
RET 6.
__________________________________________________________________________

D LIN
IBM Personal Computer Linker
Version 2.3 C  Copyright IBM Corp. 1 81  1 85

Object Modules
 .OBJ : LIN BAS
Run File LIN BAS.EXE : LIN BAS HIGH
List File NUL.MAP : CON
Libraries .LIB :
Warning: no stack segment
Start Stop Length Name
Class
H 11H 12H CODESG
CODE
D DEBUG BASIC.COM
R
AX BX CX 12 DX SPFFFF BP SI DI
DS1 1 ES1 1 SS1 1 CS1 1 IP 1 NV UP EI PL NZ NA PO NC
1 1 : 1
JMP
3FE3
 E E 3E
N D:LIN BAS.EXE
L
R
AXFFA3 BX CX 12 DX SP BP SI DI
DS1 1 ES1 1 SS FE CS FE IP NV UP EI PL NZ NA PO NC
FE : 55
R SS
SS FE
:1 1
R CS
CS FE
:1 1
R IP
IP
: 1
G
Ok
DEF SEG 
H EF

Ok
BSAVE D:CLRSCREEN.MOD  
H12
Ok
SYSTEM
Program terminated normally
Q
D BASIC
IBM Personal Computer Basic
Ver sion D3.1 Copyright IBM Corp. 1 81  1 85
6131 Bytes free
Ok
LOAD D:BASTEST.BAS
Ok
2
BLOAD D:CLRSCREEN.MOD 
3
DEF SEG 
H FE

CLRSCRN 
5
CALL CLRSCRN
LIST
1
CLEAR 32 68 
2
BLOAD D:CLRSCRN.MOD 
3
DEF SEG 
H FE

CLRSCRN 
5
CALL CLRSCRN
6
FOR N  1 TO 5
INPUT HOURS  H

8
INPUT rATE  R

W  H R
1
PRINT WAGE   W
11
NEXT N
12
END
Ok
__________________________________________________________________________
.21.8. BASIC .
PASCAL
________________________________________________________________
__________________________________________________________________________
program pascall  input  output 
procedure move_cursor  const row: integer
const col: integer  extern
var
temp_row:
integer
temp_col:
integer
begin
write  Enter cursor row:  
readln  temp_row 
write  Enter cursor column:  
readln  temp_col 
move_cursor  temprow  temp_col 
write  New cursor location  
end.

_____________________________________________________________________
MOVCUR 

PUBLIC MOVE_CURSOR


MOVE_CURSOR:




: const row

const col



:


CODESEG SEGMENT PARA PUBLIC CODE 
TITLE

MOVE_CURSOR PROC FAR


ASSUME CS:CODESEG
ROWWPAR EQU
8
COLPAR EQU
6

 
 
BP
BP

PUSH
MOV

BP
BP SP

MOV
MOV

SI  BP ROWPAR  SI
DL
DH  SI 

MOV
SUB
INT

AH  2
BH BH
1 H

POP
BP


RET
MOVE_CURSOR
ENDP
CODESEG ENDS
END
__________________________________________________________________________
.21. . PASCAL .


PASCAL IBM MicroSoft


. .21.  PASCAL 
. PASCAL 
OBJ   
OBJ . LIN OBJ 
EXE .
PASCAL  : temp_row temp_col 

. temp_row temp_col

. PASCAL 

procedure move_cursor
 extern  . PASCAL  

:
move_cursor temp_row  temp_col 
:
 
.


2

6
8

BP 

PASCAL . 

.21.6.
SP .

BP SP
BP. BP
.
 .
 
8  BP  8. 
 6 BP  6.

BX  DI SI.
BP  8  SI  SI   
DH.
DL.
DX
BIOS .
BP. RET 
 22  .
.

PUSH
POP .
.
  PASCAL 
AX
DX:AX.

PASCALL

PASCALL   CODESEG  
.

PASCALL .

.5 2  2 .

.
C
________________________________________________________________
C
 C

C. 
:

 C



.   

 :
MOV
MOV
MOV
MOV
...
POP
RET

ES BP
BP SP
DH  BP  
DL  BP 6 
BP

 C 

 C .
 C 
 DI SI 
.
 
 AX   DX:AX
 .
 C 
DF  CLD
.

________________________________________________________________

 


EXTRN   PUBLIC.
  1
2  1.
 

PUBLIC.

.
 
. PUBLIC 
   EXTRN.

________________________________________________________________
21.1.  MAINPRO
SUBPRO.  MAINPRO 
SUBPRO  
SUBPRO 
MAINPRO 
21.2.  MAINPRO QTY
DB  VALUE DW PRICE DW. SUBPRO
VALUE QTY PRICE. 

MAINPRO 
  SUBPRO
 
21.3.
.

21.2 21.3

21. . 
MAINPRO  . SUBPRO
.
21.5. 
. 21. 
MAINPRO QTY 
VALVE   SUBCONV ASCII 
SUBCALC PRICE 
SUBDISP ASCII 
.

22

__________________________________________________________________________
:
.

________________________________________________________________
DOS 
DOS
. DOS 
:
1.
DOS  
FORMAT S.   DOS
A C 
.
 
.
2. IBMBIO.COM
BIOS ROM 
. 6 . IBMBIO.COM


COMMAND.COM. IBMBIO.COM 

.
3. IBMDOS.COM
 . B .

 INT 21H 
.
.
 COMMAND.COM DOS 
DIR CH DS  COM  EXE BAT .
:


. COMMAND.COM 


.
.22.1 .
.
__________________________________________________________________________



5
6
XXXX

..23 
ROM  
DOS
IBMBIO.COM
IBMDOS.COM



FAT  
XXXX COMMAND.COM
XXXX COM EXE  
XXXX COM  256 
XXXX COMMAND.COM 
.
__________________________________________________________________________
.22.1. DOS .
COMMAND.COM
________________________________________________________________
COMMAND.COM
.
COMMAND.COM:
1.
IBMDOS.COM  
.
 :
INT 22H
INT 23H
INT 2 H
INT 2 H

.
Ctrl Break.


FAT .

.

2.
AUTOEXEC .
.

.
.

.
3. .
   DOS

 . COMMAND.COM
DOS A  C 
.
COM  EXE  .
 
PSP 
COMMAND.COM.

.1


:
IBMBIO.COM
IBMDOS.COM
COMMAND.COM  


...
COMMAND.COM   .
RET INT 2 H
COMMAND.COM.

.

________________________________________________________________
PSP  256 1 H 
COM  EXE  
. PSP :


2

5
A
E
12
16
2C
5
5C
6C
8 FF

INT 2 H CD2 .

. p  512
8 H 8 H.
.
DOS.
.
Ctrl Break.
.
.
ASCIIZ .
DOS INT 21H RETF .
1 
FCB 1 .
2 
FCB 2  
FCB 1 .
DTA .

DTA

PSP 8 H
 .

.
  .
 

. DTA:
1. . 
CALCIT.EXE CALCIT return .
 DOS PSP 
.8 . D. 
CALCIT  
. Return 
. 
. D.  .8 81 D.
2. . 
   COLOR BY 
COLOR
BY  . 
.8  DOS :
8 :

3 2 2 5  D

3   BY  .
3. . DEL
 
.   DEL B:CALCIT.OBJ
return  PSP  .5C .8  :
5C:
8 :

2 3 1 C
C A L
D 2 2 3A
B :

3 
C I
3 1
C A

5 2 2
T
C 3 
L C I

F
O
5
T

2
B
2E
.

A
J
F 2 A D
B J

.5C  FCB 
  CALCIT.OBJ 
.  2B
. CALCIT 
  OBJ. 
:
progname A:FILEA B:FILEB
DOS FCB FILEA .5C FCB FILEB
.6C.
.8
   16  .2  A:FILEA B:FILEB
OD .
PSP 
PSP
. DTA COM 
.8 SI :
MOV SI 8 H
CMP BYTE PTR SI 
JE EXIT

DTA


EXE  
PSP. 
DS ES PSP 
ES DS:
MOV AX DSEG

MOV DS AX
MOV SAVEPSP ES
PSP:
MOV SI SAVEPSP
CMP BYTE PTR SI  8 H 
JE EXIT

DOS 3. INT 62H  BX


PSP  PSP.
COM 
________________________________________________________________
EXE   COM  .
COM   DOS  
  COM.
 COM  EXE 
.
INT 2 H  DOS . COM 
DOS
PSP.
6

.FFFE   .
.
.1  PSP .
CS:IP  .. PSP.
COM 
.
RET IP
 .
CS:IP PSP 
INT 2 H.
COMMAND.COM. 
INT 2 H RET 
COMMAND.COM .
EXE 
________________________________________________________________
EXE   
: 1   
2  .

 
.
:


2

6
8
A
C

. D5A.
EXE .
EXE .
512 EXE   .
.
16     
 .

.
.

E
1
12
1
16
18
1A
1C



. .
 .FFFF  .

.
.
 SP
.
  
.
 IP
.
.
CS.
.
: 
EXE .

 6.

512 
. 6

.  1C

.

COMMAND.COM  . COMMAND.COM
:

 .
 
8 
.


 OE .
 SS SP
.
 DS ES
.
 CS PSP
 16  CS.
PSP  256
.1 . CS:IP
 .. .
CS SS 
DS  ES 
:
1.
2.
3.
.
5.

PUSH
SUB
PUSH
MOV
MOV

DS
AX AX
AX
AX datasegname
DS AX

PSP


DX

RET IP
 .

CS:IP 
PSP  INT 2 H.
 DOS.
EXE 
________________________________________________________________
MAP  :
Start
Stop
Length
Name
H
3AH
3BH
CSEG
H
5AH
1BH
DSEG
STAC
6 H
FH
2 H
Program entry point at :

Class
CODE
DATA
STAC

MAP  
. H

. 

.
MAP CSEG

. . 3B .
DSEG .
. 1B. .
CSEG

 .. .1 .
 STAC  . 6 
DSEG  .
DEBUG 
DOS
. 
 


.

:


2

6
8
C
E
1
1
16
18

. D5A.
: 5B .
512  : 2 . 2
512  1 2 .



: 1  .. 1.
16 : 2 . 2 32
3216512 .
: .FFFF.
: 6 .6 .
SP: 2 .2 .
IP: .
C CS: .
C : 1E .1E.

DEBUG
:
SP  2
SS  13A5

DS  138F
CS  13 F

ES  138F
IP 

EXE  DS ES
 
IP  SS SP  .
SP

.2
.  16
DUP  .. 16 32 .2  .
SP .
CS

DS 
PSP .138F  . PSP .1 
 PSP 
.138F 1 13 F .
CS.  CS
CSEG . D CS: DEBUG
.
LST
 R.
SS

SS
:
PSP .DS 
PSP

138F
1
6

13A5

DS

DS PSP.
 DS
:

B8  R
 8E D8

MOV AX DSEG
MOV DS AX

DSEG 
.
DEBUG :
B8 A313
A313 DS 13A3.

CS
DS
SS

13 F
13A3
13A5


DEBUG

PUSH
SUB
PUSH
MOV
MOV

IP
IP
IP
IP
IP

DS
AX AX
AX
AX DSEG
DS AX

SP
AX  
SP
AX
DS

DS .
D DS:
DSEG D SS: .

________________________________________________________________

. . B
.
ASCIIZ  DX 
BX 
ES:BX . AL 3:
AL . .

Cntrl Break
. 
SP   .
 ES:BX  :


2
6
1

.
PSP 8 H.
FCB PSP 5CH.
FCB PSP 6CH.

AL3. .
 PSP .
.
ES:BX :

.
.

 AX: 1  2  5  8  1
11. .22.2 DOS DIR
D.  EXE . 
PC Magazine .
__________________________________________________________________________
TITLE

EXDOS

EXE  DOS BH DIR

GMENT PARA Code 


ASSUME CS:CSEG DS:CSEG ES:CSEG
BEGIN: JMP
SHORT MAIN

PARAREA DW


DW
OFFSET DIRCOM


DW
CSEG
DW
OFFSET FCB1
FCB2
DW
CSEG
DIRCOM DB
1  C DIR D: 13 
FCB1
DB
16 DUP  
FCB2
DB
16 DUP  
PROGNAM DB
D:COMMAND.COM 

MAIN
PROC
FAR

MOV
AH  AH
6
MOV
BH 1 H

INT
21H

JC
E1 ERR
MOV
DI 2CH

MOV
AX  DI 


LEA
SI PARAREA
SI AX
1
MOV
MOV
AX CS
DS ES
MOV
DS AX
CSEG
MOV
ES AX

MOV
AH  BH
MOV
AL 

LEA
BX PARAREA
COMMAND.COM
LEA
DX PROGNAM
DOS
INT
21H
JC
E2 ERR

MOV
AL 

JMP
X1 XIT
E1 ERR:
MOV
AL  1
1
JMP
X1 XIT
E2 ERR:
2
MOV
AL  2
JMP
X1 XIT
E1 XIT:

MOV
AH  CH
DOS
INT
21H
MAIN
ENDP
CSEG
ENDS
END
__________________________________________________________________________
CSEG

.22.2. DIR .

23
BIOS DOS
__________________________________________________________________________
:  BIOS DOS.

________________________________________________________________

.
:
 
  .
BIOS Basic Input Output System  ROM
.

. BIOS  DOS  
IN OUT.

________________________________________________________________
IBM PC ROM FFFF H.

 CS FFFFH  IP 
. FFFF:
FFFF  BIOS. BIOS
.
BIOS   
 INT 11H
  INT 12H 
.
BIOS
DOS.  BIOS
INT 1 H 
.

 IBMBIO.COM  IBMDOS.COM
COMMAND.COM .
:

BIOS
IBMBIO.COM IBMDOS.COM
COMMAND.COM

COMMAND.COM
RAM  
ROM BASIC
ROM BIOS
INTR
.  IF
1   

 IF  .
  INT 12H 
 .
 .
256 
1 2 . .3FF.


CS IP .
. 23.1.
 CS
IP.  12H 


AX  . 8 .12
. 8 . . 8
IP SS. 
CS:IP 
BIOS  .
IRET Interrupt Return 
CS IP
 .
__________________________________________________________________________

. 

3

8 B
C F
1 13
1 1 
18 1F
2 23
2 2 
28 3 
38 3B
3C 3F
 3
 
8 B
C F
5 53
5 5 
58 5B
5C 5F
6 63
6 6 
68 6B
6C 6F
 3
 
8 B
C F
8 83
8 8 
88 8B
8C 8F
 3
 
8 B
F
AO FF
1 1FF
2 21 
218 3C3
3C 3FF


. 


1
2
3
5
6 
8

A B C D
E
F
1
11
12
13
1
15
16
1
18
1
1A
1B
1C
1D
1E
1F
2
21
22
23
2
25
26
2
28 3F
F
8 85
86 F
F1 FF


 DEBUG 
NMI 
 DEBUG 



AT


.. 8   1 
.. 
..2 
 ..18 

. AT
.. 
..1 
BASIC  ROM







DOS 
DOS
DOS 
Ctrl Break DOS 
DOS 
DOS 
DOS 
DOS 
DOS

BASIC
BASIC 

1F BIOS 
2 FF DOS BASIC.
__________________________________________________________________________
:

.23.1. .
BIOS
________________________________________________________________
BIOS.
INT 5H. .
. INT 5H
 Ctrl PrtSc  .
.
INT 1 H. .
 . .
INT 11H.
. 
AX.
AX
. 1 . AX:

15 1
13
12
11 
6
5

.
.
.
RS232.
 1:
1  12  1 3 11 .
:
 
1  25 
1  8 25 
11  8 25  .
1 .
1

.

INT 12H .
AX   .2
512 .
.
INT 13H.  .
 
16.
INT 1 H.


.

RS232. DX  1 
RS232.  AH 
AX
.
INT 15H. 
AT.
 
AT.

INT 16H. .
 . .
INT 1 H. .
. .1 .
INT 18H. BASIC  ROM.
BASIC   ROM.
INT 1 H. .
1
  C 
. 
INT 18H ROM BASIC.
ROM BASIC 
.
INT 1AH.



.
AH.

. 18 2
. AH :
AH . CX
 DX  .
2  AL .
AH 1 . CX
  DX  .
2 6 AT.
INT 1FH.



.
128 255 1  .

128
ASCII   12 .
DOS
________________________________________________________________
BIOS DOS: IBMBIO.COM
IBMDOS.COM. DOS
 DOS
 BIOS .
IBMBIO.COM BIOS .

.
IBMDOS.COM

 .
INT 21H  IBMDOS
. IBMDOS
IBMBIO 
BIOS. :

  

ROM

DOS
DOS
 
 IBMDOS.COMIBMBIO.COMBIOS
L  L  L  L  L 
 .2 .62
DOS. :
INT 2 H. .
DOS.
.
INT 21H. DOS. DOS 
AH.
DOS .
INT 22H.


. .INT 2 H .
INT 23H.

Ctrl Break. .INT 2 H .

INT 2 H.

.



.
DOS.
INT 25H. . ..1 .
INT 26H. . ..1 .
INT 2 H. 
. COM  .

.
DOS INT 21H
________________________________________________________________
DOS INT 21H.
AH:


1
2
3

5
6

8




D

F
1

 INT 2 H .
.
.
.
.
.1 .
.
Ctrl Break.
Ctrl Break.
.8 .
.8 .
.
.
.16 .
.16 .
FCB .16 .
FCB .16 .

11
12
13
1
15
16
1
18
1
1
1
1
21
22
23
2
25
26
2
28
2
2
2
2
2D
2

.16 .
.16 .
.16 .
.16 .
.16 .
.16 .
.16 .
DOS.
.16 .
DTA .
FAT .
FAT .
.16 .
.16 .
.
.
.
.
.16 .
.16 .
.
CX  D  DL  .
.
CH  CL  D  DL 1 1 .
.
 .

DOS 2. :
2F
3
31
33
35
36
38
3

3
3C
3D
3E
3F

1
2
3
5
6

8


DTA ES:BX.
DOS .

.
Ctrl Break.
 .
.

.

 M DIR .
 RMDIR .
 CHDIR .
FCB .1 .
FCB .1 .
FCB .1 .
.8 1 1 .
.8 1 1 .
.1 .
.1 .
.1 .
 .
.
  .
.1 .
.
.
.
  .
.
.
.1 .
.1 .

5
56
5

.
.1 .
 .

DOS 3. :
5
5
5
5
62

.
.
.
 .
PSP .

DOS
.

________________________________________________________________
Prokey  Superkey 
Homebase  Sidekick .  
.
.


DOS .
 COM 

RET INT 2 H
INT 2 H DOS 31. INT 2 
DX :
MOV
INT

DX prog size
2 H

DOS  

. .

 DOS 
DOS  DIR  COPY CLS.


 .
  :
1  


2  
:



 

 DOS

3   
 .


   
.

:

IIO. IBMDOS.COM
COMMAND.




__________________________________________________________________________
TITLE RESIDENT COM 



Alt Left Shift

:
INTTAB SEGMENT AT H


Int H 
ORG
H

BADDR LABEL DWORD

INTTAB ENDS

BIOS:
ROMAREA SEGMENT AT H
ORG
1

H


BFLAG DB

Alt  Shift
ROMAREA ENDS

CSEG
SEGMENT PARA

ASSUME CS:CS
ORG
1 H

BEGIN:
JMP
INITZ

BSAVE DD

INT  BIOS
:




COLORS PROC
NEAR
PUSH
AX
Alt Left Shift
PUSH
BX

PUSH
CX
PUSH
DX
PUSH
SI
PUSH
DI
PUSH
DS
PUSH
ES
PUSHF 
CALL
BSAV

ASSUME DS:ROMAREA
DS
MOV
AX ROMAREA
MOV
DS AX

MOV
AL  B AG
Alt Left Shift
CMP
AL  1 1 B Alt Left Shift 

JNE
EXIT
MOV
AX  6 H

MOV
BH 61H

MOV
CX 
MOV
DX 18 FH
INT
1 H
EXIT:

POP
ES
POP
DS

POP
DI
POP
SI
POP
DX
POP
CX
POP
BX
POP
AX

IRET
COLORS ENDP

:



INITZE PROC
NEAR
ASSUME DS:INTTAB
PUSH
DS
DOS
MOV
AX INTTAB

MOV
DS AX

CLI
:

MOV
AX WORD PTR
BADDR


BIOS
MOV
WORD PTR BSAVE AX

MOV
AX WORD PTR
BADDR
2

MOV
WORD PTR BSAVE 2 AX
MOV
WORD PTR BADDR OFFSET COLORS
BIOS
MOV
WORD PTR BADDR 2 CS

STI
MOV
DX OFFSET INITZE
INT
2 H


INITZE ENDP
CSEG

ENDS
END
BEGIN
__________________________________________________________________________
.23.2
.23.2 
Alt Left
Shift.  :
INTTAB 
    
 BADDR.
ROMAREA
  
 BFLAG  .
3 Alt  1 
Left Shift.
CSEG
COM .

JMP INITZE
INITZE  .
DS


INTTAB

INT
BADDR




 

BSAVE .
BADDR

COLORS  


CS  .  BADDR
: CS 
COLORS 
 .
DX COLORS  INITZE
 COLORS 
 INT 2 H.
COLORS 

.
  DOS 
 


. BSAVE  ..

Alt Left Shift.
 .

 
IRET.

.



 .

________________________________________________________________

.
.
65 536  .
 IN
OUT:
 IN AL
   . :
IN

 OUT AL
 . :
OUT

 

:
1.
255:
: IN
: OUT

AL. 


2. DX
65535.
. DX
1. 6 :
MOV
IN

DX 6 H
AL DX

6  


:
21
... 2
6
61
2 1

.


 1 

3B ...3BF
3D ...3DF 
3F ...3F 
  
INT 16H.
BIOS  IN 6 .
DOS BIOS.
BIOS 21 
... 2  6 2 1. BIOS IBM PC
IN OUT.

________________________________________________________________

.
: 1 
1 21

Intel
8255A 5
  1  2 
Intel 8353 5 PIT .

1 1 318 . PPI
2 61 .
.23.3
. DURTION
 TONE .
61
. CLI 
. 18 2  
CLI  .
TONE :

  .  BIOSP R

1 TONE .. TONE 2 .
TONE

 DURTION
 ..
.
 TONE .
DURTION TONE
. 
CLI.
 TONE
1  DURTION  .
TONE
. DURTION. DURTION .

 .
__________________________________________________________________________
TITLE SOUND
COM 
SOUNSG SEGMENT PARA Code 
ASSUME CS:SOUNG DS:SOUNG SS:SOUNG
ORG
1 H
BEGIN: JMP
SHORT MAIN


DURTION DW
1
 
TONE
DW
256H


MAIN
PROC
NEAR

IN
AL 61H

PUSH
AX
CLI


CALL
B1 SP R


POP
AX

OUT
61H AL
STI

RET
MAIN
ENDP

B1 SP R PROC
NEAR
B2 :
MOV
DX DURTION

B3 :
1
AND
AL 111111 B
OUT
61H AL

MOV
CX TONE

B :

LOOP
B
OR
AL  1 B
1
OUT
61H AL


MOV
CX TONE
B5 :
LOOP
B5

DEC
DX


JNZ
B3
 
SHL
DURTION 1
SHR
TONE 1

JNZ
B2


RET

B1 SP R ENDP
SOUNSG ENDS
END
BEGIN
__________________________________________________________________________
.23.3

2

__________________________________________________________________________
: .

________________________________________________________________

. 
 


.
   
.

________________________________________________________________

 COUNTER:
ADD CX COUNTER


.

 
.  
.
:

 BX BX 
DS BP BP 
SS. 
MOV DX  BX 

DX 
BX DS
 DI DI  SI
SI  DS. 

MOV AX  SI 

A 
SI DS
 
. 
MOV

BX SI  AX

 

 
DS 
BX  SI
   .
. 

MOV DX 8 DI  

 

DX 
DS  8  DI
.
.
BX  BP 
DI  SI .
.

________________________________________________________________
: 

  .
. 
.
  MAS 
WIDTH RECORD
.
LENGTH

LENGTH 
DUP.  MOV DX 1 :
TABLEA

DW
...
MOV

1 DUP 
DX LENGTH TABLEA

DUP  LENGTH
1. . SIZE TYPE .
OFFSET

OFFSET
. :
OFFSET

MOV DX OFFSET TABLEA
DX   TABLEA
.   LEA 
OFFSET. 
PTR

PTR BYTE  WORD
DWORD DB  DW DD 
NEAR FAR .
:
PTR
   BYTE.
.
PTR:
FLDB DB
DB
FLDW DW
MOV
ADD
MOV
MOV
CALL

22H
35H
26 2H
A BYTE PTR FLDW
BL BYTE PTR FLDW 1
BYTE PTR FLDW  5
AX WORD PTR FLDB
FAR PTR BX 

226
1  2 
2  26 
5 1 
3 2235 

LABEL   
PTR.

SEG

SEG 
.


. :
SEG
SEG MOV:
MOV
MOV

DX SEG FLOW
DX SEG A2

SHORT

SHORT  NEAR JMP 
12  128 :
JMP

SHORT


.

SHORT.
SIZE

SIZE LENGTH TYPE
DUP.
:
SIZE
. TYPE.
TYPE

TYPE 
:

DB
DW
DD
DQ
DT
STRUC
NEAR
FAR

1
2
8
1
 STRUC
FFFF
FFFE

TYPE:
TYPE

 TYPE  LENGTH
SIZE:
FLDB
TABLEA

DB
DW
...
MOV
MOV
MOV
MOV


2 DUP 

AX TYPE FLDB
AX TYPE TABLEA
CX LENGTH TABLEA
DX SIZE TABLEA

AX
AX
CX
DX






1
2
A 1 
1 2 

TABLEA DW  TYPE
2  LENGTH   DUP  SIZE 
 .. 1 2 .

________________________________________________________________
. .5
DB  DW
. .
ASSUME

ASSUME 
CS  DS  ES SS. :
ASSUME

_:

 ... 

 GROUP 
SEG. ASSUME
 :

ASSUME
CS:CODESG DS:DATASG SS:STAC ES:DATASG
ASSUME
NOTHING:
ASSUME

ES:NOTHING

  DS
NOTHING 
DS:
MOV
MOV

AX DS: BX 
AX DS:FLDW


FLDW

 DS
.
EXTRN

EXTRN 
 
. :
EXTRN

:  ... 

EXTRN .21.
GROUP

 
 . GROUP 
 6 
:

GROUP

 ... 

GROUP SEG1 SEG2


:
GROUPX
SEG1
ASSUME
SEG1
SEG2
ASSUME
SEG2

GROUP
SEGMENT
CS:GROUPX
ENDS
SEGMENT
CS:GROUPX
ENDS

SEG1 SEG2
PARA CODE 
PARA CODE 

INCLUDE


.

.


ASCII  
CONVERT.LIB.

INCLUDE C:CONVERT.LIB

ASCII .
.
 
INCLUDE . 
LST  3 
 LST  33  .
.2   INCLUDE

.
LABEL

LABEL .
:
LABEL

BYTE  WORD

DWORD

.
LABEL  NEAR FAR.
  DB 

DW. BYTE WORD:


REDEFB
FIELDW
REDEFW
FIELDB

LABEL
DW
LABEL
DB
DB
MOV
MOV

BYTE
2532H
WORD
25H
32H
AL REDEFB
BX REDEFW

MOV FIELDW.
MOV  FIELDB.
PTR .
NAME

NAME :
NAME
:
1  NAME 

2  NAME 
TITLE
3  NAME TITLE 
.
.
ORG


.
:


2
3
5

FLDA
FLDB
FLDC
FLDD

DW
DB
DW
DD

25 2H
36H
212EH
 5H

2
3
5


 . FLDA

2. FLDB 
3 ...

ORG. :
OR6
 
.
 FLDD:


1
3

FLDX
FLDY
FLDZ





5

ORG
DB
DW
DB
ORG


1
2



ORG .
FLDX  FLDY FLDZ  FLDA 
FLDB FLDC:
: | | 1 | 2 | 3 |
|
| |
FLDA
FLDB FLDC
| |
|
FLDX FLDY
FLDZ

| 5 | 6 |  | 8 |
|
FLDD

  ORG 
.  5
 5  
 FLDD.
FLDC 
3  FLDZ
:
MOV
MOV

AX FLOC
AL FLDZ

ORG .

. 
 
. ORG
STRUCT.
PROC


PROC ENDP.
.
JMP 
CALL RET
.
 
NEAR:
 PROC

NEAR 

 NEAR no .

CALL 
PUBLIC. 
ASSUME CS 
FAR:
PUBLIC  
 PROC
FAR
CALL

RET.
PUBLIC

PUBLIC  
. :
PUBLIC ... 
PUBLIC .21.
RECORD

RECORD .

. :
RECORD :    ... 

. : 
 1 16 :

1...8
...16

8
16

8 
16  
. RECORD:




BITREC RECORD BIT1:3 BIT2: BIT3:6


BIT1 3 BITREC  BIT2  
BIT3  6 .  16  .. .
BITREC   :
BITREC2 RECORD BIT1:31 1B BIT2:  11 11 B BIT3: 11 1 B
 RECORD .

. 
RECORD  
:
DEFBITS BITREC 
AD A.
AAD . 
BITREC.
.2 .1 BITREC
RECORD  .
.

RECORD WIDTH  MAS

RECORD 
RECORD.

WIDTH. WIDTH
RECORD . .2 .1 1
WIDTH. MOV
BH RECORD BITREC 16 
MOV AL BIT2  .
.
__________________________________________________________________________
TITLE RECORD COM  RECORD
CODESG SEGMENT PARA Code 
ASSUME CS:CODESG DS:CODESG SS:CODESG
1
ORG
1 H
1 EB 2
BEGIN:
JMP
SHORT MAIN

BITREC RECORD BIT1:3 BIT2: BIT3:6

1 2 A AD
DEFBITS BITREC 1 1B  11 11 B  11 1 B 

1
MAIN PROC
NEAR
A1 :
1
:
1 B  1
16 
MOV
BH WIDTH BITREC
1 6 B 
 
MOV
AL WIDTH BIT2
1 8
B1 :
:
MOV
CL BIT1
1 8 B1 D
. D
1 A B1 6

6
MOV
CL BIT2
1 C B1


MOV
CL BIT3
1 E
C1 :

:

MOV
AX MAS BIT1
1 E B8 E
.E
111 BB 1FC

MOV
BX MAS BIT2
1FC
11 B  3F

3F
MOV
CX MAS BIT3
11 
D1 :
BIT2:
MOV
AX DEFBITS
11  A1 1 2 R


11A 25 1FC
BIT1 BIT3 
AND
AX MAS BIT2
11D B1 6
6 
MOV
CL BIT2
11F D3 E8
SHR
AX CL

E1 :
121
BIT1:
121 A1 1 2 R

MOV
AX DEFBITS
12 B1 D
13 
MOV
CL BIT1
126 D3 E8
SHR
AX CL

RET
128 C3
12 
MAIN
ENDP
12 
CODESG ENDS
END
BEGIN
_____________________________________________________________________

Structures and records:


N a m e
BITREC
BIT1 .
BIT2 .
BIT3 .

.
.
.
.

.
.
.
.

.
.
.
.

.
.
.
.

.
.
.
.

.
.
.
.

.
.
.
.

Widht
.
.
.
.

.
.
.
.

.
.
.
.

. 1
. D
. .
.

Segments and Groups:


N a m e
CODESG . . . . . . . . . . . .
Symbols:

Size
12 

 fields
Shift Widht
3
3
E
6

6
3F
Align
PARA

Mask

Initial


1FC

Combine Class
NONE
CODE 

N a m e
Type
Value Attr
A1 . . . . . . . . . . . . . . L NEAR
CODESG
1
1 8
B1 . . . . . . . . . . . . . . L NEAR
CODESG
1
BEGIN. . . . . . . . . . . . . L NEAR
CODESG
C1 . . . . . . . . . . . . . . L NEAR
1 E
CODESG
D1 . . . . . . . . . . . . . . L NEAR
CODESG
11 
1 2
DEFBITS. . . . . . . . . . . . L WORD
CODESG
121
E1 . . . . . . . . . . . . . . L NEAR
CODESG
MAIN . . . . . . . . . . . . . N PROC
1
CODESG Length  25
__________________________________________________________________________
.2 .1. p RECORD
. RECORD :
MOV

CL BIT2

BIT2.
 
 .

 BIT2
. .2 .1 1 
CL BIT1  BIT2 BIT.


MAS . MAS  
 

 . 

MAS  BITREC 
:

11
12
1

111
1111111
111111



1FC
3F

.2.1 1
MAS BIT1  BIT2 BIT. D1 1
BI2 BI1
BITREC. D1
  RECORD 
MAS BI2:
RECORD:
AND MAS BI2:
:

1 1 11 11 11 1
1111111
11 11

 BI2.

:

11 11

 36 

1 A 
RECORD  BI1 
13
:

1 1

 5 

SEGMENT


. :
_ SEGMENT 
.
.
.
_ ENDS

 

.
 .

.

PAGE
PARA
WORD
BYTE






xxx
 
e  

 
 .
.
 :
NONE: .


.

PUBLIC: PUBLIC   
.



STAC : STAC PUBLIC.

STAC . 
SP 
COMMON: COMMON
.
.

AT : .

  ROM
. 


VIDEO_RAM

SEGMENT AT B8 H


.

 
. STAC  CODE .


SEG1 SEGMENT PARA PUBLIC CODE 
ASSUME CS:SEG1
...
SEG1 ENDS

SEG2 SEGMENT PARA PUBLIC CODE 
ASSUME CS:SEG1
...
SEG2 ENDS


:
SEG1
SEG2
SEG2
SEG1

SEGMENT
...
SEGMENT
...
ENDS
...
ENDS

SEG1
SEG2
SEG1

GROUP.
STRUC

STRUC
. ASM.
:
 STRUC
...

...
 ENDS
STRUC

ENDS.
 .
DB  DW  DD DT
.
.2 .2 STRUC PARLIST
.
:
PARAMS

PARLIST 

.
  
.

.
PARAMS 
:

AL PARAMS.ACTLEN

MOV


.
.
__________________________________________________________________________
TITLE DSTRUC COM 
CODESG SEGMENT PARA Code 
ASSUME CS:CODESG DS:CODESG SS:CODESG
ORG
1 H
BEGIN: JMP
SHORT MAIN


PARLIST
STRUC

MAXLEN DB
25
ACTLEN DB


NAMEIN DB
25 DUP  

PARLIST
ENDS

PARAMS PARLIST 


1
1 EB 2 
1 
1 
1 2 
2
1B

1 2 1 
1 3 
1
1 2 
11D 5  68 61  2 6  PROMPT DB
What is name   S 
3 2 6E 61 6D 65
3F 2

12B
MAIN
PROC
NEAR
12B B 
MOV
AH  

LEA
DX PROMPT
12D 8D 16 11D R
131 CD 21
INT
21H
133 B A

MOV
AH  AH
135 8D 16 1 2 R
LEA
DX PARAMS
INT
21H
13  CD 21
13B A 1 3 R
MOV
AL PARAMS.ACTLEN

...
13E C3
RET
MAIN
ENDP
13F
13F
CODESG ENDS
END
BEGIN
Structures and records:
N a m e
PARLIST.
MAXLEN
ACTLEN
NAMEIN

.
.
.
.

.
.
.
.

.
.
.
.

.
.
.
.

.
.
.
.

.
.
.
.

.
.
.
.

.
.
.
.

.
.
.
.

.
.
.
.

.
.
.
.

.
.
.
.

Width  fields
Shift Width Masc
1B
3

1
2

Segments and Groups:


N a m e
Size
CODESG . . . . . . . . . . . . . 13F

Initial

Align
PARA

Combine Class
NONE
CODE 

Value
1
12B
1 2
11D

Attr
CODESG
CODESG Length  1
CODESG
CODESG

Symbols:
BEGIN.
MAIN .
PARAMS
PROMPT

.
.
.
.

.
.
.
.

.
.
.
.

.
.
.
.

N a m e
. . . . .
. . . . .
. . . . .
. . . . .

.
.
.
.

.
.
.
.

.
.
.
.

L
N
L
L

Type
NEAR
PROC
1B
BYTE

__________________________________________________________________________
.2 .2. pp p pp

25

__________________________________________________________________________
:
.

________________________________________________________________

.

:
:

5
3
CB
FD

:
AX 1
INC AX
A
PUSH AX
RET short 
RET far 


STD


.   8 
 
.

________________________________________________________________
  
 w  :
. 
. .25.1 .
MOV :
MOV

1 11 1
| |
w rg  A

__________________________________________________________________________
 :
:

1
1
11
1
1 1
11
111

w 
AL
CL
DL
BL
AH
CH
DH
BH

w  1
AX
CX
DX
BX
SP
BP
SI
DI

: :

ES
1
CS
1
SS
11
DS
__________________________________________________________________________
.25.1.

w   A 1 . MOV
:
MOV

AX  1 111
| |
w reg  AX

w1 
A  . 
w .

________________________________________________________________
 
:
1  mod   11
 1 1
2  reg 
3  r m  r 
 m  .
  
1 2.

BX:
ADD

BX AX

11 11 11
dw mod reg r m

d1  mod 11  reg  11 


1  r m   2. w1 
.  AX OOQ  B
 11 .

.
.
MOD

mod .
:

m 


1
1
11

m

m
m .




w  
.

REG

reg  w  
.
R M

m    mod
 .25.2.
__________________________________________________________________________
mod1.1
mod11

w
w1
BX SI
BX SI disp
BX SI disp
AL
AX
1 BX DI
BX DI disp
BX DI disp
CL
CX
1 BP SI
BP SI disp
BP SI disp
DL
DX
BP DI disp
BP DI disp
BL
BX
11 BP DI
1
SI
SI disp
SI disp
AH
SP
1 1
DI
DI disp
DI disp
CH
BP
11 Direct
BP disp
BP disp
DH
SI
111
BX
BX disp
BX disp
BH
DI
__________________________________________________________________________
r m

mod

mod 1

mod1

.25.2. r m

________________________________________________________________
B A:
ADD

BX AX

11 11 11
dw mod reg r m

1  reg w 1 B 
mod  r m w  2 A 
w
1 
mod 11  2
reg 11  1 B
r m  2 AX.

AL BL:
MUL

BL

1111 11 11 1 11
w mod reg r m

MUL  AL .
w   mod
 m  11 BL. reg  1
.


________________________________________________________________
MOV :
MOV

mem AX 1 1 1 dddddddd dddddddd

A AL 
: . w  1
  16  A.
AL w  . 2 3
. 
AL    .

________________________________________________________________
AL .
 AL

A :
MUL

mem_byte

1111 11 1 11
w mod reg r m

reg 1  mod 
 a r m11  .

.
 LEA 
:
LEA

DX mem 1 11 1 1 11
LEA mod rg r m

Reg  1 DX. Mod  r m11


.
.

________________________________________________________________

.  
. 8 186 
8 286 8 386
.
:
addr
addr high
addr low
data
data high
data low
disp
rg


 
  .
8 w 16 w 1 
 
 
 
.

AAA: ASCII 

: ASCII  AL.
AL  AF
1  AAA
AF CF.
AL.
: AF CF  OF  PF  SF
ZF .
: 11 111  .
AAD: ASCII 

: ASCII  . AAD
A
 ASCII  .
AL .
A 1 .
AL A. AAD .
: PF  CF  ZF  AF CF OF
.
: |11 1 1 1| 1 1 |.
AA: ASCII 

: AAM
.
AL 1  A 
AL.
: PF  SF ZF  AF CF
OF .
: |11 1 1 | 1 1 |  .
AAS: ASCII 

: ASCII 
AL.  CF
1  AAS 6 AL 1  AF
CF 1.
AL.
: AF CF  OF PF SF ZF
.
: 111111  .

ADC:


.
CF 1  ADC 1 1.
2 1  ADD.
: AF  CF  OF  PF  SF ZF.
 :
:
| 1 dw|modregr m|
AL  :
| 1 1 w|  data |data  w1|
:
y1 sw|mod 1 r m| data |data  sw 1|
ADD:

: 

.
: AF  CF  OF  PF  SF ZF.
 :
:
| dw|modregr rm|
AX AL  :
| 1 w| data |data  w1|
:
|1 sw|mod r m| data |data  BW 1|
AND:

:  
. 
.

. AND .
1 
  . . OR 
XOR TEST.
: CF  OF  PF  SF ZF  AF
.
 :
:
| 1 dw|modregr m|
AX AL  :
| 1 1 w| data |data  w1|
:
|1 1 w|modl r m| data |data  w1|
CALL:

:

. RET.
CALL SP 2
 IP  IP
. RET
. CALL
. SP 
CS 

.
: .
 :
:
|111 1 |disp low|diep high|
:
|11111111|mod 1 r m|
:
|11111111|mod 11r m|
:
|1 11 1 |offset low|offset high|seg low|seg high|
CBW:

:
AL . CBW 
AL . CWD.
: .
: 1 11  .
CLC:

:  
  ADC . CLC
. . STD.
: CF  .
: 11111 .
CLD:

:  .
 CMPS MOVS
. . STD.
: DF  .
: 111111  .
CLI:

:
INTR IF

. . STI.
: IF  .
: 11111 1  .
CMC:

: CF  ..
CF .
: CF  .
: 1111 1 1  .
CMP:

: .
CMP 
. : .
CMP 

. . CMPS.
: AF  CF  OF  PF  SF ZF.
 :
:
| 111 dw|modregr m|
AX AL :
| 1111 w| data |data  w1|
:
|1 sw|mod111r m| data |data  sw |
CMPS CMPSB CMPSW:

: .
REPn  REPE CMPSB. CMPSB
 CMPSW  .
DS:SI   ES:DI.
DF  
SI DI .
DF 1   SI
DI .
: AF  CF  OF  PF  SF ZF.
: 1 1 11w.
CWD:

:
DX:AX 
15   DX.

32  . . CBW.

: .
: 1 11 1  .
DAA:

: BCD 
 AL.
 AF 1  DAA 6
AL AF. AL
 F  CF 1  DAA 6
AL CF. . DAS.
: AF. CF  PF  SF 2F  OF
.
: 1 111  .
DAS:

:
BCD
  AL.
 AF 1  DAS
6 AL CF. .
DAA.
: AF  CF  PF  SF ZF.
: 1 1111  .
DEC:

: 1
DEC . . INC.
: AF  OF  PF  SF ZF.
 :
:
| 1 1reg|
: |1111111w|mod 1r m|
DIV:

: 16 32
 8 16 .
 .
16  
8   DIV BH.
AL   A.
32  DX:AX
16   DIV .
A   DX.
. IDIV.

: AF  CF  OF  PF SF ZF
.

: |1111 11w|mod11 r m|


ESC:

:

.
8 8  8 28 .
ESC
.
: .
: |11 11xxx|modxxxr m| x  . .
HLT:

: 
. HLT CS:IP
.
CS IP
. IRET
CS IP 
HLT.
: .
: 1111 1  .
IDIV:

: 16 32 
8 16 .
. 16 
 a 8 
 IDIV DL.
AL   . 32 
DX:AX  16 
 IDIV BX.
  DX. . CBW CWD
 DIV.
: AF  CF  OF  PF  SF ZF.
: |1111 11w|mod111r m|
IMUL:

: 8 16
.
. 8  AL 
 IMUL BL.
. 16 


 IMUL BX.
DX:AX. . MUL.
: CF OF  AF PF SF ZF
.
: |1111 11w|mod1 1r m|
IN:

: AL
.
IN   DX IN AX DX .
8 186  8 286 8 386   INS Input
String  . . OUT.
: .
 :
: |111 11 w|
: |111 1 w| port |
INC:

: 1
 INC . . DEC.
: AF  OF  PF  SF ZF.
 :
:
| 1 reg|
: |1111111w|mod r m|
INT:

:
256  . INT
: 1  SP 2
 IF TF 2  SP 2
CS 
CS 3  SP 2 IP 
IP.
: IF TF.
:
|11 11 v| type |  v   type  3 .
INTO:

:
 OF 1  IRET .
  1 . .
INT.

: .
: 11 111  .
IRET:

:
. IRET : 1 
IP SP 2 2 
CS SP 2 3 
SP.
2. . RET.
: .
: 11 1111  .
JA JNBE:    

:
. CF 
 ZF  
IP  
.
: .
: | 111 111| disp |
JAE JNB:    

:
. CF 
 IP

  .
: .
: | 111 11| disp |
JB JNAE:    

:
. CF 
 IP

  .
: .
: | 111 1 | disp |
JBE JNA:    

:
. CF 

 AF  IP
 
.
: .
: | 111 11 | disp |
JC:

: JB JNAE.
JCXZ: CX 

:
 CX . JCXZ
LOOP.
: .
: |111 11| disp |
JE JZ:    
:
. ZF
  IP
  .
: .
: | 111 1 | disp |
JG JNLE:    

:
. ZF  
SF OF  1 
IP  
.
: .
: | 1111111| disp |
JGE JNL:    

:
. SF OF 
1  IP
  .
: .
: | 11111 1| disp |

JL JNGE:    

:
. SF OF 

IP
 .
: .
: | 11111 | disp |
JLE JNG:    

:
. ZF 
 SF OF  IP
 
.
: .
: | 111111 | disp |
JMP:

:
. JMP IP .
JMP
. CS
.
: .
 :
:
|111 1 1|disp low|disp high|
 :
|111 1 11| disp |
:
|11111111|mod1 r m|
:
|11111111|mod1 1r m|
:
|111 1 1 |offset low|offset high|seg low|seg high|
JNC:

: JAE JNB.
JNE JNZ:    

:
. ZF 

 IP
  .

: .
: | 111 1 1| disp |
INO: 

:

.
OF    IP
 
. . JO.
: .
: | 111 1| disp |
JNP JPO: 

:

. 
.
. PF  
IP  
. . JP JPE.
: .
: | 1111 11| disp |
JHS: 

:
 .
SF   JNS IP
 
. . JS.
: .
: | 1111 1| disp |
JO:

:
 .
OF   JO
IP  
. . JNO.
: .
: | 111 | disp |

JP JPE: 

:
 .

. PF
  IP
  . .
JNP JPO.
: .
: | 1111 1 | disp |
JS:

: 
. SF
  JS IP
  . .
JNS.
: .
: | 1111 | disp |
LAHF:

: .
8 8 . .
SAHF. LAHF
:
SZ A P C

 

: .
: 1 11111  
LDS:

:
.
LDS
 .
DS  
.
DI:
LDS

DI _

: .
: |11 1 1|modregr m|

LES:

:

.
. . LDS.
: .
: |11 1 |modregr m|


LOC :


:

. LOC
 .

 .
: .
: 1111
LODS LODSB LODSW:

: AL
A.  LODS
 REP.
DS:SI  LODSB   LODSW 
AL A . DF 
1   2   SI.
DF  1   2 
 SI.
: .
: 1 1 11 w  .
LOOP:

:
. CX 
. LOOP 
. . CX
 
 IP 
LOOP 
.
: .
: 111 1 disp 
LOOPE LOOPZ: 

:

ZF  .
LOOPE LOOPZ LOOP  
CX 
ZF  . .
LOOPNE LOOPNZ.
: .
: |111 1| disp |
LOOPNE LOOPNZ: 

:
ZF  . 
LOOPNE LOOPNZ LOOP 
CX 
ZF  . .
LOOPE LOOPZ.
: .
: |111 | disp |
MOV:

:

. MOV
 MOVS .
MOV.
: .
 :
  :
|1 1 dw|modregr m|
:
|11 11w|mod r m| data |data w1|
:
|1 11wreg| data |data w1|
AX AL :
|1 1 w|addr low|addr high|
AX AL  :
|1 1 1w|addr low|addr high|
 :
|1 111 |mod sgr m| sg  
:
|1 11 |mod sgr m| sg  
MOVS MOVSB MOVSW:

: .
MOVS B W  REP. MOVSB
 MOVSW  .
DS:SI
  ES:DI   .

DF 
SI DI. DF
SI DI.
: .
: 1 1 1 w  .
MUL:

: 8 16 
8 16 .
 .
8  AL 
 MUL CL.
. 16 
  MUL
. DX:AX. .
IMUL.
: CF OF  AF  PF  SF
ZF .
: |1111 11w|mod1 r m|
NEG:

:

. NEG
:
.
. . NOT. : AF 
CF  OF  PF  SF ZF.
: |1111 11w|mod 11r m|
NOP:

:
. NOP XCHG
  .
: .
: 1 1  
NOT:

: .
. .
NEG.
: .
: |1111 11w|mod 1 r m|

OR:

:  
.
 . OR
.
 1 
1 . . AND XOR.
: CF  OF  PF  SF ZF  AF
.
 :
 :
| 1 dw|modregr m|
:
| 11 w| data |data w1|
:
|1 w|mod 1r m| data |data w1|
OUT:

: AL
A.
OUT   DX OUT DX.AX .
8 186  8 286 8 386   OUTS Output String 
. . IN.
: .
 :
: |111 111w|
:|111 11w| port |
POP:

:  
. SP .
POP SP 2.
POP : 
 . . PUSH.
: .
 :
:
| 1 11reg|
: | sg111| sg .. 
:
|1 1111|mod r m|
POPA: 8 188 8 186 8 286 

: Dl  SI
BP  SP  BX  DX  CX  AX

SP 16.
PUSHA.

: .
: 11 1  .
POPF:

:  
. . PUSHF POP. SP
. POPF
SP 2.
PUSHF  POPF
.
: .
: 1 111 1  .
PUSH:

:  
. SP
. PUSH SP 2
.
PUSH : 
. . POP PUSHF.
: .
 :
:
| 1 1 reg|
: | sg111| sg .. 
:
|11111111|mod11 r m|
PUSHA: 8 188 8 186 8 286 

: AX  CX 
DX  BX  SP  BP  SI  DI
SP 16. POPA .
: .
: 11  .
PUSHF:

:
. SP
. PUSHF SP 2
. . POPF PUSH.
: .

: 1 111  .
RCL RCR:


:  
CF.
 .
1 CL 
. RCL CF
 . CF
. RCR CF
 CF
. . ROL ROR.
: CF OF.
: RCL: |11 1 cw|mod 1 r m|
RCR: |11 1 cw|mod 11r m|
   1
 1  CL .
REP REPE REPZ REPNE REPNZ:

: .

CMPS  MOVS  SCAS  STOS.
CX . CX 1
.
REP

 CX .
REPE REPZ  CX
ZF 1  . REPNE REPNZ
 CX
ZF  .
: .
: REP REPNE: 1111 1
REPE:
1111 11
RET:

: 
CALL. CALL
. RET
IP SP 2.
RET   CS
SP 2.
  RET  SP.
: .
 :
:
|11 11|
: |11 1 |data low|data high|
:
|11 1 11|

: |11 1 1 |data low|data high|


ROL ROR:

:  
. 
.
1 CL 
. ROL
. ROR
. . RCL
RCR.
: CF OF.
: ROL: |11 1 cw|mod r m|
ROR: |11 1 cw|mod 1r m|
   1
 1  CL .
SAHF:

:
8 8
. . LAHF. SAHF
:
SZ A P C

 

: .
: 1 1111  
SAL  SAR  SHL SHR:

: .
 .
1
CL  .
SAR 
. SHL SHR
. SAL
SHL. SAL SHL
.
SHR

. SAR

 1 . 
 .
: CF  OF  PF  SF ZF  AF
.
: SAL SHL: |11 1 cw|mod1 r m|
SAR:
|11 1 cw|mod111r m|
SHR:
|11 1 cw|mod1 1r m|
   1

1  CL 
SBB:

:

. CF 1  SBB 1
1. SBB 2 1 
SUB. . ADC.
: AF  CF  OF  PF. SF ZF.
 :
: | 11 dw|modregr m|
AX AL :
| 111 w| data |data  w1|
:
|1 sw|mod 11r m| data |data  sw 1|
SCAS SCASB SCASW:

:
. SCASB AL 
SCASW  AX. ES:DI
 .
REPE REPNE. DF 
DI.
DF 
DI.
: AF  CF  OF  PF  SF ZF.
: 1 1 111w  .
STC:

: CF 1. .
STD.
: CF  1 .
: 11111 1  .
STD:

: 1.
  MOVS CMPS 
. . CLD.
: DF  1 .
: 111111 1  .
STI:


:
IF
1. . CLI.
: IF  1 .
: 11111 11  .
STOS STOSB STOSW:

: .
REP
 .
STOSB AL  STOSW
. ES:DI
 .
DF 
DI. DF 
DI.
: .
: 1 1 1 1w  .
SUB:

: 

. . SBB.
: AF  CF  OF  PF  SF ZF.
 :
:
| 1 1 dw|modregr m|
AL :
| 1 11 w| data |data  w1|
:
|1 sw|mod1 1r m| data |data  sw 1|
TEST:

:
. TEST
AND  .

.
.
.
: CF  OF  PF  SF ZF  AF
.
 :
:

|1 1 w|modregr m|
AL :
|1 1 1 w| data |data  w1|
:
y1111 11w|mod r m| data |data  w1|
WAIT:

:
 .


.  
 TEST
 .
: .
: 1 11 11
XCHG:

:
  XCHG AH BL   
XCHG CX word .
: .
 :
:
|1 1 reg|
 : |1 11w|modregr m|
XLAT:

: 
ASCII 
EBCDIC .
. AL
 XLAT.
AL 
AL.
: .
: 11 1 111  .
XOR:

:
.
 .
XOR . 
XOR 1 
 1 . .
AND OR.

: CF  OF  PF  SF ZF  AF
.
 :
 :
| 11 dw|modregr m|
AX AL :
| 11 1 w| data |data w1|
:
|1 w|mod11 r m| data |data w1|

__________________________________________________________________________
1:
ASCII 
________________________________________________________________
128 ASCII .
BASIC 128 .  .2
.
A 1. ASCII
__________________________________________________________________________


1
2
3

5
6

8

1
11
12
13
1
15
16
1 
18
1 
2
21
22
23
2
25
26
2 
28

32
33
3
35
36
3 
38
3 

1
2
3

5
6

8

5
51
52
53
5
55
56
5 
58
5 
6

h
1h
2h
3h
h
5h
6h
h
8h
h
Ah
Bh
Ch
Dh
Eh
Fh
1 h
11h
12h
13h
1 h
15h
16h
1 h
18h
1 h
1Ah
1Bh
1Ch


.

.


Shift out
Shift in
Data line esc
1
2
3

End of medium

Escape
.

2 h sp
21h

22h


23h

2 h
25h

26h


2 h

28h
2 h

2Ah


2Bh

2Ch
2Dh

2Eh .

2Fh

3 h
31h 1
32h 2
33h 3
3 h
35h 5
36h 6

3 h
38h 8
3 h

3Ah :

3Bh

3Ch

6
65
66
6 
68
6 

1
2
3

5
6

8

8
81
82
83
8
85
86
8 
88
8 

1
2

h
1h
2h
3h
h
5h
6h
h
8h
h
Ah
Bh
Ch
Dh
Eh
Fh
5 h
51h
52h
53h
5 h
55h
56h
5 h
58h
5 h
5Ah
5Bh
5Ch


A
B
C
D
E
F
G
H
I
J
L
M
N
O
P
Q
R
S
T
U
V
W
X
Y
Z



6

8

1
1 1
1 2
1 3
1
1 5
1 6
1 
1 8
1 
11
111
112
113
11
115
116
11 
118
11 
12
121
122
123
12

6 h
61h
62h
63h
6 h
65h
66h
6 h
68h
6 h
6Ah
6Bh
6Ch
6Dh
6Eh
6Fh
 h
1h
2h
3h
 h
5h
6h
h
8h
h
Ah
Bh
Ch


a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p

r
s
t
u
v
w
x
y
z

|

2  1Dh .
3 1Eh .
31 1Fh .

61 3Dh
62 3Eh
63 3Fh





3 5Dh
 5Eh
5 5Fh

125 Dh

126 Eh ~
12  Fh

2:

________________________________________________________________

.
. A B8 2 36   2 36
. A B8.


. A B8

 . A  16
.
 . A F
1 15.
: A 1 
16

1
16

16

 

16 
16
16

26 2
 B 11 
11

2683
16
16

2 28
8
 8


2 36

2 
.

. . A B8
8  1  B 
 3 A 
B 1 . :

1
1
1
1

8 
8 
8 
8 

1
1
1
1

8
1 6
1 2
6

2 36



2 36
2 36 16

 6  .

16
11 B  .
 
.

2 36
2683
16 
1






16
16
16
16

2683
16 
1

8
11

1

.
8
B

A

 
 


B 1. 2 36

.
2 36
:
.

2 36
6

1 6
1 2

18
1 6

8

.
A


B
8

A B8

B 1. 
T T T T T T T 













61 2561 161 1
1 268 35 561 16 2161 1 85 61 655361
2 5368  122 3355 322 2 1522 131 22 81 22 5122 322 2
3 8 53 63683 5 3316 83 31 5 283 1 66 83 122883 683
83 3
1 3  182 6 1 886
1  3 2621 1638 1 2 6

5 13 21 28 5 83886 8 5 52 288 5 32 68 5 2 8 5 128 5 8 5 5


6 161 612 366 1 6632 66 62 1 566 3 32166 2 5 66 15366 66 6
 18  81 2  11  512  3 32  58 52  286 2  1 2  112 

8 21  836 88 13 21 288 83886 88 52 2888 32 688 2 88 1288 8

 2 15 1 1  15     3 18  58 82  3686  23  1 
A 268 35 56 A 16 216 A 1 85 6 A 65536 A 6 A 256 A 16 A 1
B 2 52  16B 18 5 3 6B 1153 336B 2 8 6B 5 56B 2816B 1 6B 11
C 3221225 2C 2 13265 2C 12582 12C 86 32C 152C 3 2C 1 2C 12
D 3 8 66 28D 2181 38 8D 13631 88D 851 68D 532 8D 3328D 2 8D 13
E 3 58 638 E 23 881 2 E 1 68 6 E 1 5 E 5 3 E 358 E 22 E 1
F 265318 F 2516582 F 15 286 F 83 F 61 F 38 F 2 F 15



5
3 2 1

L 
p
3:

________________________________________________________________


  :

AH
AL
AX

AAA
AAD
AAM
AAS
ADC
ADD
AND
CALL
CBW
CLC
CLD
CLI
CMC
CMP
CMPS
CWD
DAA
DAS
DEC

DIV
ESC
HLT
IDIV
IMUL
IN
INC
INT
INTO
IRET
JA
JAE
JB
JBE
JCXZ
JE
JG
JGE
JL



BH CH DH CS SS
BL CL DL DS SI
BX CX DX ES DI


JLE
JS
JMP
JZ
JNA
LAHF
JNAE
LDS
JNB
LEA
JNBE
LES
JNE
LOC
JNG
LODS
JNGE
LOOP
JNL
LOOPE
JNLE
LOOPNE
JNO
LOOPNZ
JNP
LOOPZ
JNS
MOV
JNZ
MOVS
JO
MUL
JP
NEG
JPE
NOP
JPO
NOT

BP
SP

OR
OUT
POP
POPF
PUSH
PUSHF
RCL
RCR
REP
REPE
REPNE
REPNZ
REPZ
RET
ROL
ROR
SAHF
SAL
SAR

SBB
SCAS
SHL
SHR
STC
STD
STI
STOS
SUB
TEST
WAIT
XCHG
XLAT
XOR

ASSUME
COMMENT
DB
DD
DQ
DT
DW
ELSE



END
EXTRN
IFNB
ENDIF
GROUP
IFNDEF
ENDM
IF
IF1
ENDP
IFB
IF2
ENDS
IFDEF
INCLUDE
EQU
IFDIF
IRP
EVEN
IFE
IRPC
EXITM
IFIDN
LABEL

LOCAL
MACRO
NAME
ORG
OUT
PAGE
PROC
PUBLIC

PURGE
RECORD
REPT
SEGMENT
STRUC
SUBTTL
TITLE

BYTE
COMMENT
CON
DUP



FAR
LENGTH
MOD
GE
LINE
NE
GT
LT
NEAR
HIGH
LOW
NOTHING

PRT
SEG
SHORT
SIZE

THIS
TYPE
WIDTH
WORD

EQ

LE


MAS

OFFSET


STAC

:

________________________________________________________________


:
ASM.EXE   
MASM.EXE  
.
  .
RAM   
. MASM
 ASM  .
:
source filename
object filename
source listing
cross reference

.ASM :
filename.OBJ :
NUL.LST :
NUL.CRF :


. 
 . ASM 
.
 .  .
 .


. :.

Return. 
OBJ  LST  CRF 
:
source filename
object filename
source listing
cross reference

.ASM :B:ASMPROG Return 


filename.OBJ :B: Return 
NUL.LST :B: Return 
NUL.CRF :B: Return 

:
MASM B:name.ASM B:name.OBJ B:name.LST B:name.CRF
:
MASM B:filename B: B: :

 B:filename 

 :
filename.OBJ
 :

filename.LST
 :
filename.CRF


.

.
ASM
 
MASM  .
1 .
:
MASM A
MASM D
MASM E
MASM N
MASM R
MASM S


LST 
8 8 


8 8   E 
.



CRF 


. CRF 
 . :  
:
cross reference NUL.CRF :B: Return 
CRF 
CREF 
. CREF :
Cref filename .CRF :
List filename cross ref.REF :
CRF   B:ASMPROG.
.
CRF 
filename.REF .
 :
CREF : filename. CRF  CON CREF B:filename.CRF B:
.
filename.REF .


 DOS 
 .  RAM 
 


LIN 
. :
Object Modules .OBJ :
Run File d:filename. :
List File NUL.MAP :

Libraries .LIB :

. 
 . OBJ 
.
 .  .
 .
DOS.

Return. 
CON:
Object Modules .OBJ :B:ASMPROG return 
Run File d:filename. :: return 
List File NUL.MAP :CON return 
Libraries .LIB : return 
CON


. LIN

:

LIN B:ASMPROG : CON

LIN

no DOS.
2IN

EXE2BIN.COM DOS
   

.
EXE2BIN DOS 
  .
. :
EXE2BIN B:filename B:filename.COM
 
. 
 .
 OBJ
.


__________________________________________________________________________
1.1.  1 11 1  111111.
1.2.  1 1  1 1 1.
1.3.  1 1  1 .
1. .  111 11 1  11 11 .
1.5.  111  1 .

1.6.  51  5D.
1. .  238  8 .
1.8.  13  5   FFF.
1. .    .
1.l . a  AX  BX  CX  DX  Dl  SI  AX DX  .
1.11.a  ROM 
.
 RAM   
.
2.1.  82  6.
2.2. CS:1 1 5 .
2.3. a 

MOV
AX  3
ADD
AX 3
RET
 R IP IP .

2. . 612.
2.6. N   
CX W
.
3.1. TITLE PAGE.
3.2.     
 AX.
3. . a  END  ENDS.
3.6. RET 
END  
.

3. . ASSUME
CS:CDSEG DS:DATSEG SS:ST SEG.
3.8. PUSH
SUB
PUSH

DS
AX  AX
AX

.1.  MASM : :TEMPY :  : :


.2. a  DEBUG B:TEMPY.EXE  B:TEMPY
.3. 




. . MOV
MOV

AX DATSEG
DS AX

.5. MOV

AL 3 H

AL 1
BL 18H
BL

SHL
MOV
MUL

.6. :
FLDA
OB
28H
FLDB
DB
1 H

FLDC
DW
5.1.  2  1  8.
5.2.

CONAME

DB

RGB Electronics 

5.3. a 



FLDA
FLDC
FLDE

DD
DW
DW

3H

16  1  2  2  3

5. . a  ASCII 3236  1AH.


5.5.  26  325 .
5.6. a 



AX 32
BX  H
FLDB 1  SAL 

MOV
ADD
SHL

6.1. 6 .
6.3. COM 
 .
6. .

EXE2BIN SAMPLE SAMPLE.COM.

.1. 12  128.


FH   12  8 FFH  128 1 .
.2.  62  5  6 .
.3. :

2 :

. .  CMP DX CX
JA

MOV
MOV
MOV
MOV

AX 
BX  1
CX 12
DX 

ADD AX BX
MOV BX DX
MOV DX AX
LOOP B2
 JCXZ
CMP CX 
JZ

AX

 CMP BX AX
JLE JNG

.5. a  OF 1   ZF 1   DF 1 
. .   PROC FAR 
. NEAR

.. .

. .  CALL .
.1 .  1 1 1 1  1111 1 11  1 11 .
.12.  1 111 11 111  11 11 1 11 1 .
8.1.  18   2 .
8.3.

AX  6 H
BH  
CX OCOOH
DX 16 FH
1

MOV
MOV
MOV
MOV
INT

8. .  DOS:
MSSGE

DB
MOV
MOV
INT

What Is the date mm dd yy   H   


AH  


DX MSSGE
21H

8.5.  DOS:
DATEPAR
MAXLEN
ACTLEN
DATEFLD

LABEL BYTE
DB 
DB 
DB  DUP  
DB  
MOV AH  AH
LEA DX DATEPAR
INT 21H

.1. a  1 1  111 1 .
.2. a 


MOV
MOV
INT
MOV
MOV
MOV
MOV
INT


AL  2
1
A  6 A
BH  
CX 
DX 18 FH
1


8 25 BW
3 1

.3.  8  .
.5. INT 1 .
1 .1. 16 .
1 .2.  1 11 1 1  1 11 .
1 .3. : 16 .
:
.
: 2  
 .
1 . .

MOV
MOV
MOV
MOV

AH  
AL 
BH 
BL  1 11 1






BW

MOV CX  5
INT 1

1 .6.  
INT 1 AH BH 
.
1 . . .
MOV
MOV
MOV
INT
11.1. 

AH  DH
CX 13
DX 12
1

JCXZ
label1: MOV
MOV
INC
INC
INC
INC
LOOP
label2: ...

lbl2
AX  SI 
DI AX
DI
DI
SI
SI
label1

11.2. DF .
MOVSB NAME1   NAME2  .
MOVSW NAME1  8
NAME2  8. H1 SCAS
MOV AX  mb 
SCASW .
11.3. a 

CLD
LEA
LEA
MOV
REP

SI CONAME
DI PRLINE
CX 2
MOVSB

CLD
LEA
SI CONAME 2
LODSW


3 

CLD
MOV
LEA
LEA
REPE

CX 2
SI CONAME
DI PRLINE
CMPSB

11. . :
H1 SCAS PROC
CLD
MOV
LEA
MOV
2 :
REPNE

NEAR
CX 1
DI NAME1
AL  e 
SCASB

JNE
CMP
JNE
MOV
3 :
RET
H1 SCAS ENDP

H3Q

BYTE PTR DI  r  
r 
2
AH  3

  5 
11.5. PATTERN DB
DISPLAY DB
8 DUP    
CLD


LEA
SI PATTERN

LEA
DI DISPLAY
MOV
CX 2
2
REP MOVSW

INT 21
DISPLAY.
12.1.a 

MOV
ADD
MOV

AX DATAY
AX DATAX
DATAY AX

 . .12.2  .
12.2. STC CF. 1 8 23  1
12.3.a 

MOV AX DATAX
MUL DATAY

 . .12. .
12.5. a 

MOV AX DATAX
MOV BL 25
DIV BL

13.1.  ADD 6  AAA  1 2.


 SUB 2  AAS .


13.2.
LEA SI UNPA

MOV CX 
2 :
OR
SI 
ASCII

INC SI

LOOP B2
13.3. ..13.2   CX  3.
13. . ..13.3   CX  3.
13.5.  ASCII  :

81
2
3
6


1 
1 
1 
1 

8
2
3
6

8
1
12
1 


B F8


W DAYS

1 .1.

1 .2.

DAYNO
DAYNAM
NINE

1 .3. a  ITEMNO
 ITPRICE

Sunday... 
Monday... 
Tuesday.. 

DB
DB
DB

DB

DB
 DUP 
 
DB
LEA
SI W DAYS
SUB

MOV
AL DAYNO
DEC
AL
MUL
NINE
ADD
SI AX
MOV
CX  
LEA
DI DAYNAM
REP MOVSB




1






 6  1  1  21  2 
3 5 8225  6 858 1385

DB
DW

1 . . :

1OREAD
C1 SRCH
D1 MOVE
E1 CONV
F1 CALC
G1
 CONV
1 DISP

.
.
.
ASCII .
 .
. . .  ASCII .
.

1 .5.

SORTAB

DB
LEA
LEA
MOV
CLD
REP MOVSB

5 DUP  DUP 


SI ITDESC

1 SORTAB


CX  5

.
. .1 .6.
15.1. 512.
15.3. 5.
15.5. FAT F8.
15.6.  28...31
 .
16.1. INT 21 :  16  15  1 .
16.2.   1 8  3 
  .. 2 .
16.3. .16.1 .13.6
ASCII  .
16. . .16.2 .13.6

ASCII .
16.5.  

 1  21.

16.6. 2652 5 
5 .
16. . INT 21:  22  28.
16.8. FCBFLSZ 
 FCBRCSZ .
FCBFLSZ  DX:AX  FCBRCSZ
 .
16. . . .16. .
16.1 . .13  ASCII 
.
16.11. .16.3
.13.6 ASCII 
.
1 .1. 1 6.
1 .3. 

MOV
MOV
LEA
INT
JC
MOV

AH 3CH
CX 
DX PATH1
21H
error
CUSTHAN AX



ASCIIZ 
DOS

.

1 . . 

MOV
MOV
LEA
INT
JC
MOV

AH 
AL OO
DX PATH1
21H
error
CUSTHAN.AX



ASCIIZ 
OOS

.

1 .5. .
18.1. INT 13H AH  .
18.2. INT 13H AH  1.
18. .

MOV
MOV
LEA
MOV
MOV
MOV
MOV
INT

 3
AL  3 
BX OUTDS
CH  8
CL  1

DL  1
13H


3

8
1

18.5. 11.
1 .2. 


MOV
MOV
INT
LEA
MOV

AH  5
DL  CH
21H
SI NAMEFLD
CX length

2 :

MOV
MOV
INT
INC
LOOP

AH  5
DL  SI 
21H
SI
2



DOS

length

   .

  .
1 .3.

HEADNG

DB

13  1  15  Title  12

1 .5. CX 
.
BX :
2 :

MOV BX  5
DEC BX
JNZ 2

2 .1. a  .SAIL.
2 .2. a 

MULTBY MACRO MULTPR MULTCD


MOV
AL MULTCD
MUL
MULTPR
ENDM

2 .3.
:

IF1

INCLUDE library name


ENDIF

2 . . :
BIPRINT MACRO PRTLINE PRLEN
PRTLINE PRLEN
 .
BIOS INT 1 H . .1 .
2 .5. IF .
IF 

.   :
CMP
JNZ
CALL

DIVISOR 

 

 

21.1. a  EXTRN SUBPRO:FAR


21.2. a  PUBLIC QTY VALUE.PRICE
21.3. .21.5.
21. . .21.5.


.
PRICE  BP 1 .
PRICE .
RET.
21.5. c : 8  

 13

ASCII 

 12   21  .
.

__________________________________________________________________________
p p .. : 2  

Оценить