It converts only one number into binary. When 2 numbers are entered, I want them to translate and write them as binary.This is very important for me, I have been dealing for 2 days I made the code here, but I couldn't do it after that.Can someone who knows help me? That's all I can do

`org 100h
; You may customize this and other start-up templates;
; The location of this template is c:\emu8086\inc\0_com_template.txt
.model small

.data

message db 'Please enter a positive integer number = $ '
m db 'Excess-3 Code of entered number: $'
wrong db 'Please enter a between 1-9 numbers ! $'

.code
print_array_macro MACRO array

PUSH DX
PUSH AX

MOV DX, offset array
MOV AH, 09H
INT 21H    

POP AX
POP DX    

print_char_macro 0DH
print_char_macro 0AH      

ENDM
get_char_macro MACRO get

MOV AH, 01H
INT 21H  

print_char_macro 0DH
print_char_macro 0AH 

ENDM

print_char_macro MACRO char

PUSH DX
PUSH AX

MOV AH, 02H
MOV DL, char
INT 21H

POP AX
POP DX

ENDM

convert_decimal_to_binary_and_print MACRO decimal

MOV AL, decimal

MOV CX, 04H 

loop1:  
    MOV AH, 0H
    MOV BL, 02H
    DIV BL

    MOV BX, CX
    MOV [BX + 20H], AH
    loop loop1   

MOV CX, 04H
loop2:
    MOV BX, 05H
    SUB BX, CX

    MOV AL, [BX + 20H] 
    ADD AX, 30H
    print_char_macro AL
    loop loop2 

ENDM

; add your code here

print_array_macro message

get_char_macro

SUB AL, 30H
ADD AL, 3H

print_array_macro m

convert_decimal_to_binary_and_print AL

ret
`

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.