Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

My assembly code: INCLUDE Irvine32.inc .data CrLfMsg db 0DH, 0AH, 0 fileName db C:Data eviews.txt, 0 fileHandle DWORD ? reviewsArray SDWORD 50 DUP(0) reviewersArray DWORD

My assembly code:

INCLUDE Irvine32.inc

.data CrLfMsg db 0DH, 0AH, 0 fileName db "C:\\Data\ eviews.txt", 0 fileHandle DWORD ? reviewsArray SDWORD 50 DUP(0) reviewersArray DWORD 4 DUP(0) highest DWORD 0 highestMovie db 'A',0 buffer1 BYTE 128 DUP(0) ; Define the buffer symbol buffer2 BYTE 128 DUP(0)

.code main PROC ; Initialize the array to zeroes mov esi, 0 mov ebx, OFFSET reviewsArray mov ecx, 15 L1: mov [ebx], esi add ebx, 4 loop L1

; Prompt user for file name and open file mov edx, OFFSET fileName call ReadString mov edx, OFFSET fileName call OpenInputFile mov fileHandle, eax

; Read and process the file call ReadLine jmp DoneReading

ReadLine: ; Read the movie letter mov eax, [fileHandle] mov edx, OFFSET highestMovie call ReadChar mov [edx], al

; Read the comma call ReadChar

; Read the score mov edx, 0 mov ebx, 0 call ReadInt mov edx, eax

; Read the comma call ReadChar

; Read the reviewer number mov ebx, 0 call ReadInt sub ebx, 1

; Add the score to the appropriate reviewer mov eax, OFFSET reviewsArray add eax, ebx mov ebx, [eax] add ebx, edx mov [eax], ebx

; Check for end of file call ReadChar cmp al, 0Dh je DoneReading jmp ReadLine

WriteLine PROC pushad mov edx, OFFSET buffer1 call WriteString mov edx, OFFSET buffer2 call WriteString mov edx, OFFSET CrLfMsg call WriteString popad ret WriteLine ENDP

DoneReading: ; Close the file mov eax, fileHandle call CloseFile

; Calculate the total score for each movie mov esi, 0 mov ebx, OFFSET reviewsArray mov ecx, 4 L2: mov eax, [ebx] add [ebx+16], eax add ebx, 4 loop L2

; Determine the movie with the highest total score mov esi, 0 mov ebx, OFFSET reviewsArray mov ecx, 5 L3: mov eax, [ebx+16] cmp eax, [ebx-4] jle L4 mov esi, ebx L4: add ebx, 4 loop L3

; Display the report mov ebx, OFFSET highestMovie mov ax, [esi] mov dx, 0 mov [ebx], al mov [ebx+1], dl mov edx, OFFSET highestMovie call WriteString mov edx, OFFSET " has the highest total score" call WriteString call CrLf exit main ENDP END main

Everytime I tried to compile it I got this error:

1>Project.asm(121): error A2084: constant value too large

Please fix it as I don't know how to

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Beginning ASP.NET 2.0 And Databases

Authors: John Kauffman, Bradley Millington

1st Edition

0471781347, 978-0471781349

More Books

Students also viewed these Databases questions