Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Greeting, I am trying to run this assembly program. I get the error Source.asm(56): error A2070: invalid instruction operands. Can you, please, help me fix

Greeting,

I am trying to run this assembly program. I get the error "Source.asm(56): error A2070: invalid instruction operands". Can you, please, help me fix this problem and anything that I may have missed?

I got the code from the solution from chapter 6.11.2, problem 8 Message Encryption, and it has the same error.

Thanks.

; This program clears the screen, creates the key and inputs ; plain text from the user, encrypts plain text and display it, ; decrypt the cipher text and display it

INCLUDE Irvine32.inc

BUFFMAX = 128

.data strPlainText BYTE "Enter the plain text:",0 strEncrptPlainText BYTE "The encrypt plain text is:",0 strDecrptPlainText BYTE "The Decrypt cipher text is:",0 buffer BYTE BUFFMAX+1 DUP(0) buffSize DWORD ? key BYTE "ABXmv#7" keySize DWORD 7

.code

main PROC ;call the procedures

CALL Clrscr ;clear the screen CALL InputPlainText ;input plain text from the user CALL ConvertText MOV EDX, OFFSET strEncrptPlainText CALL DisplayText ;display encrypted text

CALL ConvertText MOV EDX, OFFSET strDecrptPlainText ;display decrypted text CALL DisplayText exit main ENDP

InputPlainText PROC USES ECX EDX ;input the plain text, receive and return nothing MOV EDX, OFFSET strPlainText CALL WriteString ;write the string strPlainText CALL Crlf MOV ECX, BUFFMAX ;store the length of maximum buffer MOV EDX, OFFSET buffer CALL ReadString ;read the buffer

MOV buffSize, EAX ;store the input buffer CALL Crlf RET InputPlainText ENDP

ConvertText PROC USES ESI ECX EDX ;encrypt the text and decrypt the cipher text, receive and return nothing

MOV ECX, buffSize ;convert each character of buffer text MOV EDX, 0 ;initialize index of key string MOV ESI, 0 ;initialize index of buffer string

L1: XOR buffer[ESI],key[EDX] ;convert the buffer text INC ESI ;increment ESI register INC EDX ;increment EDX register

CMP EDX, keySize ;compare if EDX equals keySize JE L2 ;jump to L2 JMP L1

L2: MOV EDX, 0 ;reinitialize index to 0 LOOP L1

RET

ConvertText ENDP

DisplayText PROC USES EDX ;display the encrypt and decrypt text CALL WriteString MOV EDX, OFFSET buffer CALL WriteString ;write the content of buffer CALL Crlf CALL Crlf

RET DisplayText ENDP

END main

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

Step: 3

blur-text-image

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

Oracle Database Foundations Technology Fundamentals For IT Success

Authors: Bob Bryla

1st Edition

0782143725, 9780782143720

More Books

Students also viewed these Databases questions

Question

=+ How is this group chosen?

Answered: 1 week ago

Question

How do Dimensional Database Models differ from Relational Models?

Answered: 1 week ago

Question

What type of processing do Relational Databases support?

Answered: 1 week ago

Question

Describe several aggregation operators.

Answered: 1 week ago