prnstr macro msg
mov ah, 09h
lea dx, msg
int 21h
endm
data segment
ans db 6 dup(' '), '$'
buf1 db "Memory available : $"
buf2 db " Kilobytes$"
data ends
code segment
assume cs:code, ds:data
start :
mov ax, data
mov ds, ax
mov es, ax
mov ax, 0000h
int 12h
mov cx, 000ah
mov si, offset ans + 5
again :
mov dx, 0000h
div cx
add dl, 30h
mov byte ptr [si], dl
dec si
cmp ax, 0000h
jnz again
prnstr buf1
prnstr ans
prnstr buf2
mov ax, 4c00h
int 21h
code ends
end start