I am trying to get my code to perform a calculation correctly in emu8086, however, I am not sure how to convert a string into an integer in assemly.
message1 db 0dh, 0ah, "input width: $"
message2 db 0dh, 0ah, "Input perimeter: $"
width dw ' ', 20 dup('?')
height dw ' ', 20 dup('?')
w dw 0
h dw 0
calc:
mov dx, offset message1
mov ah, 9
int 21h
lea dx, width
mov ah, 0ah
int 21h
mov cx, width
xor bx, bx
.next_digit1:
mov ax, byte[cx]
inc cx
sub al, '0'
mul bx, 10
add bx, ax
loop .next_digit1
mov ax, w
mov dx, offset message2
mov ah, 9
int 21h
lea dx, height
mov ah, 0ah
int 21h
mov cx, height
xor bx, bx
.next_digit2:
mov ax, byte[cx]
inc cx
sub al, '0'
imul bx, 10
add bx, ax
loop .next_digit2
mov bx, 2
div bx
mov bx, w
sub bx, ax
mov ax, h
mov cx, w
add cx, 100
mov dx, h
add dx, 20
I need to convert the input, so that w and h values are integers, so I can perform additions with them and normal integer values, is there a way to make the actual input be concidered integer, or do I have to convert it, and in either case, how would I go about doing it? I am not very experienced with assembly language.