So I have a program that displays text ("Work was done to") and after that counts to 100% and display process, but the thing is that I don't want to print always the text before I display the new percent. So how can I insert text on specified position on the screen to overwrite other text?
How it looks now
Work was done to 1%
2%
3%
...
How I want to be
Work was done to 1% (and this percent just overwrites with the new one)
cpu 386
bits 16
org 0h
start:
...
;=====================================================================================================================
mov ah, 0x07 ;function to call with interrupt
mov al, 0x00 ;scroll whole window
mov bh, 0x07 ;background color
mov cx, 0x0000 ;row 0,col 0
mov dx, 0x184f
int 0x10
mov si, msg1
call print_str
mov eax, [PERCENT]
next:
inc eax
mov di, strbuf ;ES:DI points to string buffer to store to
call uint32_to_str ;Convert 32-bit unsigned value in EAX to ASCII string
mov si, di ;DS:SI points to string buffer to print
call print_str
mov si, msg2
call print_str
cmp eax, 100 ;End loop at 100
jl next ;Continue until we reach limit
done:
hlt
jmp done
;=====================================================================================================================
print_str:
...
;=====================================================================================================================
uint32_to_str:
...
;=====================================================================================================================
MBR_Signature:
msg1 db 13,10,' Work was done to ',0
msg2 db '%',0
PERCENT dd 0
strbuf times 11 db 0
times 510-($-$$) db 0
db 55h,0aah
times 4096-($-$$) db 0