. , .
.
: Hex_ ascii ( ).
:
AL;
, , DS:SI.
:
DS:SI;
AL .
.model small; .
.stack 300h; 300 (768 ).
.data; .
tblhex db 0123456789ABCDEF; .
result db *h, $; , $
.
Hex dw 586Eh; .
.code; .
start: Mov ax,@data; .
Mov ds,ax; DS ( DS).
Lea SI,result; SI.
Mov ax,Hex; .
And ax,0F000h; .
Mov Cl,12; Cl .
Shr Ax,Cl; 12 .
Call Hex_ascii; .
Mov ax,Hex; .
and ax,0F00h; .
Mov cl,8; Cl .
shr ax,cl; 8 .
inc si; si .
Call Hex_ascii; .
Mov ax,Hex; .
and ax,00F0h; .
mov cl,4; Cl .
shr ax,cl; 4 .
inc si; si .
Call Hex_ascii; .
Mov ax,Hex; .
and ax,000Fh; .
inc si; si .
Hex_ascii; .
Mov Ah,09h; Ah OS .
Lea Dx,result; Dx .
Int 21h; DOS 21.
Jmp M2; 2;
Hex_ascii proc;
.
Push BX; .
Lea BX,tblhex;
|
|
( ).
Xlat;
.
Mov [Si],al; .
Pop BX; .
Ret; .
Hex_ascii endp; .
M2: Mov Ax,400h; (4)
.
int 21h; DOS 21.
end start; .
AL.
XLAT, tblhex (). BX.
Hex ascii . , BX, . AL , , tblhex, xlat. , SI.
ASCII
ASCII-.
ASCII ( ) 3.
10 (h), 10.
, 0 9, ASCII . 4D2h :
4D2 / = 7 4
7 / = 3
/ = 1 2
1, , 0h (10), . , 1234.
, , : 31323334.
, 3, , , ASCII .
ASCII . , ASCVAL , BINVAL- .
ASCII
BIASC PROC; .
Mov ,0010; .
Lea SI,ASCVAL+3;
SI.
Mov AX,BINVAL; .
20: ,0010; , 10,
Jb 0; .
Xor DX,DX; .
Div L; 10.
|
|
Or DL,30h; ASCII .
Mov [SI],DL; ASCII- .
Dec SI; .
Jmp C20; 20.
30: Or AL,30H;
Mov [SI],AL; ASCII-
Ret; .
BIAS ENDP; .
End BEGIN; .