https://pastein.ru/t/mr
скопируйте уникальную ссылку для отправки
include 'emu8086.inc'
org 100h
call input
add si,1
n1:
mov bx,16
div bx
mov [0530h+si],dx
xor dx,dx
inc si
cmp ax,0
jnz n1
jz n2
n2:
cmp si,0
jz end
mov al,[0530h+si]
dec si
n3:
cmp al,10
jz a
cmp al,11
jz b
cmp al,12
jz c
cmp al,13
jz d
cmp al,14
jz e
cmp al,15
jz f
cmp al,16
jz 10
jmp k1;-----------------------------
k1:
call vyvod
xor al,al
jmp n2
a:
print 'A'
xor ax,ax
jmp n2
b:
print 'B'
xor ax,ax
jmp n2
c:
print 'C'
xor ax,ax
jmp n2
d:
print 'D'
xor ax,ax
jmp n2
e:
print 'E'
xor ax,ax
jmp n2
f:
print 'F'
xor ax,ax
jmp n2
10:
print 10
xor ax,ax
jmp n2
end:
ret
proc input
push bx
push cx
push dx
xor bx, bx
xor cx, cx
xor dx, dx
mov ah,01h
int 21h
cmp al,'-'
jne m1 ;Ïðûãíóòü íà ââîä
inc dx
m0:
mov ah,01h
int 21h
cmp al, 39h
ja m2 ;_Çàêîí÷èòü ââîä
cmp al, 0h
m1:
sub al,30h
jb m2 ;_Çàêîí÷èòü ââîä
mov cl,al
shl bx,1
mov ax,bx
shl ax,2
add bx,ax
add bx,cx
jmp m0 ;_Ïîâòîðèòü ââîä
m2:
test dx,dx
jz m3
neg bx
m3:
mov ah, 02h
mov dl, 0dh
int 21h
mov dl, 0ah
int 21h
xor cx,cx
mov ax,bx
pop bx
pop cx
pop dx
ret
endp input
endp proc1
proc vyvod
cmp ax, 0
jne print_ax_r
push ax
mov al, '0'
mov ah, 0eh
int 10h
pop ax
ret
print_ax_r:
pusha
mov dx, 0
cmp ax, 0
je pn_done
mov bx, 10
div bx
call print_ax_r
mov ax, dx
add al, 30h
mov ah, 0eh
int 10h
jmp pn_done
pn_done:
popa
ret
endp
ret