I recently started studying this topic, I'm still confused, what arguments to submit when calling mReadAX?
According to the assignment, this macro should enter an integer into the AX register in the 10-digit number system.
Here is the macro itself.
mReadAX macro buffer, size
local input, startOfConvert, endOfConvert
push bx
push cx
push dx
input:
mov [buffer], size
mov dx, offset [buffer]
mov ah, 0Ah
int 21h
mov ah, 02h
mov dl, 0Dh
int 21h
mov ah, 02h
mov dl, 0Ah
int 21h
xor ah, ah
cmp ah, [buffer][1]
jz input
xor cx, cx
mov cl, [buffer][1]
xor ax, ax
xor bx, bx
xor dx, dx
mov bx, offset [buffer][2]
cmp [buffer][2], '-'
jne startOfConvert
inc bx
dec cl
startOfConvert:
mov dx, 10
mul dx
cmp ax, 8000h
jae input
mov dl, [dx]
sub dl, '0'
add ax, dx
cmp ax, 8000h
jae input
inc bx
loop startOfConvert
cmp [buffer][2], '-'
jne endOfConvert
neg ax
endOfConvert:
pop dx
pop cx
pop bx
endm mReadAX