. , , ,

,,,

Intel 8086 IBM PC — ,

( )

Intel 8086

IBM PC

7

..-41

──────────── .. ───────────── ..

1994 .


- 2 -

16- ,

16- .

2- ,

ASCII .

:

1. ASCII-

.

2.

ASCII-.

3. ASCII- 1,10,100 (01, 0, 64 ) ..

.

: (.3)

4- 6.

( ).

. 65535

ASCII 2- .

"".


- 3 -

_DATA segment word public 'DATA'

;----------------------------------------------------------------------------

SYMB db 0ah,0dh,'$' ; p p

MULT10 dw 01 ;p 1 10 100 1000... p

OVERTXT db 'p','$' ;

TXT1 db '1- :','$' ;

TXT2 db '2- :','$' ;

NAMEPAR1 label byte ;

MAXLEN1 db 6 ;

ACTLEN1 db 5 ; -'-

NAMEFLD1 db 6 dup (' '),'$' ;Xp ASCII 堠

;

BINARY1 dw 00 ;

NAMEOUT1 db 6 dup (' '),'$' ; p ASCII

NAMEPAR2 label byte ;

MAXLEN2 db 6 ;

ACTLEN2 db 5 ;

NAMEFLD2 db 6 dup (' '),'$' ; , p

;

BINARY2 dw 00 ;

;

NAMEOUT2 db 6 dup (' '),'$' ;

BINAR dw 00 ; p p

SUMBIN dw 00 ; 2- ()

SUMOUT db 6 dup (' '),'$' ; -'- ( ASCII )

;-----------------------------------------------------------------------------

_DATA ends

;------------------------------------------------------------------------------

_STACK segment para public 'STACK'

stk db 20 dup(' ')

_STACK ends

;-------------------------------------------------------------------------------

_TEXT segment word public 'CODE'

;-------------------------------------------------------------------------------

assume cs:_TEXT,ds:_DATA,ss:_STACK


- 4 -

begin:

; ----- pp-----

MAIN proc far

push ds ;

sub ax,ax ;

push ax ;p EXE-pp

mov ax,_DATA ;

mov ds,ax ;

VVOD:

lea dx,TXT1 ; TXT1

call SCREEN ;

mov ah,0ah ;

lea dx,NAMEPAR1 ;B 1-

int 21h ;

call SYMBL ;p p

lea dx,TXT2 ;

call SCREEN ;

mov ah,0ah ; 2-

lea dx,NAMEPAR2 ;

int 21h ;

call SYMBL ;

call SYMBL ;p p

lea si,NAMEFLD1-1 ;

mov bl,ACTLEN1 ;

mov MULT10,01 ;

call PREOBR ;p ASCII

mov ax,BINAR ; BINAR p

mov BINARY1,ax

mov bx,bx ;

sub bx,0 ; bx 0 p

jnz KON ;

lea si,NAMEOUT1+4 ;p ASCII ( p)

mov ax,BINARY1 ;

call OBR ;

mov BINAR,00


- 5 -

lea si,NAMEFLD2-1 ;

mov bl,ACTLEN2 ;

mov MULT10,01 ;

call PREOBR ; 2-

mov ax,BINAR ;

mov BINARY2,ax ;

mov bx,bx ;

sub bx,0 ;

jnz KON ;

lea si,NAMEOUT2+4 ;

mov ax,BINARY2 ;

call OBR

mov ax,BINARY1 ;

add ax,BINARY2 ;

jc KON ; p

mov SUMBIN,ax ;

lea si,SUMOUT+4 ;p ASCII

mov ax,SUMBIN ;

call OBR ;

mov ah,09 ;

lea dx,NAMEOUT1 ; 1-

int 21h ;

call SYMBL ;

mov ah,09 ;

lea dx,NAMEOUT2 ; 2-

int 21h ;

call SYMBL ;

mov ah,09 ;

lea dx,SUMOUT ;

int 21h ;

jmp DOS ; DOS

KON:

lea dx,OVERTXT ; p

call SCREEN ;

DOS: ret

MAIN endp

; ------p ASCII ------


- 6 -

PREOBR proc

mov cx,10 ;p

mov bh,0

B20:

mov al,[si+bx] ;p ASCII

and ax,000fh ; ax

mul MULT10 ; p 10

jc OVR ;

add BINAR,ax

jc OVR

mov ax,MULT10

mul cx

mov MULT10,ax

dec bx

jnz B20

OVR: ret

PREOBR endp

; ------p ASCII----

OBR proc

mov cx,0010

c20:

cmp ax,10

jb c30

xor dx,dx

div cx

or dl,30h

mov [si],dl

dec si

jmp c20

c30:

or al,30h

mov [si],al

ret

OBR endp

SYMBL proc ; - p p

;

mov ah,09h ;

lea dx,SYMB ;

int 21h ;

ret ;


- 7 -

SYMBL endp

SCREEN proc ; -

;

mov ah,09h ;

int 21h ;

ret ;

SCREEN endp

;-----------------------------------------------------------------------------

_TEXT ends

end begin

( )

 

 

 

! , , , .
. , :