0

Hi:

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

COUNT=3

.data
filename Byte "test.txt",0
BUFFER_SIZE=5000
buffer BYTE BUFFER_SIZE DUP (?)
bytedRead dword ?
array dword ?
msg1 byte 'The sum is:'
fileHandle dword ?

.code 
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



    exit
main ENDP

END main

Thanks

2
Contributors
1
Reply
13
Views
3 Years
Discussion Span
Last Post by turboscrew
0

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

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.