Search code examples
assemblytasm

Looking for some way to save array in file - like a numbers (now program saves all like a text)


xor    ax, ax
mov    tab[100], '$'
mov    ah, 3ch
mov    cx, 00000000b
lea    dx, filename1
int    21h
jc     openerr
mov    handle, ax
mov    ah, 40h
mov    bx, handle
mov    cx, 100
lea    dx, tab
int    21h
jc     openerr
mov    ah, 3eh
mov    bx, handle
int    21h

Solution

  • This is an outline of what you need to do:

    • read one value from the array, number 65
    • convert this value to its text representation, string "65"
    • add a space character, string "65 "
    • write the result to the file, use CX=3
    • repeat the previous for all the values in the array, repeat 100 times

    The conversion is the hard part, but you can find many good examples everywhere including on this forum.