I am new in the forum and I need some help. I have to write an assembly language program that reads a file with numeric information, and I need to create an array with that information and add them. SO far, I can open, read and display the information in the console, but when I am going to add the data I do not get anything. I think I am using a wrong register or I am not making the connection between the buffer and the procedures.

I need some help.

INCLUDE Irvine32.inc


filename Byte "test.txt",0
bytedRead dword ?
array dword ?
msg1 byte 'The sum is:'
fileHandle dword ?

main PROC
    mov edx, OFFSET filename
    call OpenInputFile

    mov edx, OFFSET buffer
    mov ecx, BUFFER_SIZE
    call ReadFromFile
    call WriteDec
    call Crlf

    mov edx,OFFSET buffer   
    call    WriteString
    call    Crlf

    mov eax, fileHandle
    mov edx, OFFSET buffer
    mov ecx, BUFFER_SIZE
    call WriteToFile

    mov esi, OFFSET array
L1: mov [esi], edx
    add esi, TYPE dword
    loop L1

    mov eax,0
    add eax, [esi]
    add esi, TYPE dword
    loop L1

    mov edx, OFFSET msg1
    call WriteString
    call WriteInt

main ENDP

END main


Too bad Irvine is used.
DOS calls would have been more general and the documentation easy to find.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.