Question

In: Computer Science

Assembly Language Visual Studio. Problem 1 College Registration Using the College Registration example from Section 6.7.3...

Assembly Language Visual Studio.

Problem 1
College Registration
Using the College Registration example from Section 6.7.3 (textbook) as a starting point, do the
following:
1. Recode the logic using CMP and conditional jump instructions (instead of the .IF and .ELSEIF
directives).
2. Perform range checking on the credits value; it cannot be less than 1 or greater than 30. If
an invalid entry is discovered, display an appropriate error message.
3. Prompt the user for the grade average and credits values.
4. Display a message that shows the outcome of the evaluation, such as “The student can registe”r or “The student cannot register”.
(The Irvine32 library is required for this solution program.)
50 points

Problem 2
Validating a PIN
Banks use a Personal Identification Number (PIN) to uniquely identify each customer. Let us
assume that our bank has a specified range of acceptable values for each digit in its customers’
5-digit PINs. The table shown below contains the acceptable ranges, where digits are numbered
Page 1
from left to right in the PIN. Then we can see that the PIN 52413 is valid. But the PIN 43534 is
invalid because the first digit is out of range. Similarly, 64535 is invalid because of its last digit.
Digit Number Range
1 5 to 9
2 2 to 5
3 4 to 8
4 1 to 4
5 3 to 6
Your task is to create a procedure named Validate PIN that receives a pointer to an array of
byte containing a 5-digit PIN. Declare two arrays to hold the minimum and maximum range
values, and use these arrays to validate each digit of the PIN that was passed to the procedure. If
any digit is found to be outside its valid range, immediately return the digit’s position (between 1
and 5) in the EAX register. If the entire PIN is valid, return 0 in EAX. Preserve all other register
values between calls to the procedure. Write a test program that calls Validate PIN at least four
times, using both valid and invalid byte arrays. By running the program in a debugger, verify that
the return value in EAX after each procedure call is valid. Or, if you prefer to use the book’s
library, you can display ”Valid” or ”Invalid” on the console after each procedure call.

Solutions

Expert Solution

Answer :

2) The assembly code for pin validation is:

code:

INCLUDE Irvine32.inc
.data
str1 BYTE "valid",0
str2 BYTE "Invalid",0
minArr BYTE 5,2,4,1,3
maxArr BYTE 9,5,8,4,6
arr1 BYTE 5,1,5,3,6
arr2 BYTE 8,4,5,2,5
arr3 BYTE 6,4,5,3,5
arr4 BYTE 5,4,9,2,6
.code
main PROC
call Clrscr
mov ebx OFFSET arr1
mov esi OFFSET minArr
mov edi,OFFSET maxArr
call Validate_PIN
.IF eax==0
mov edx,OFFSET str1
call WriteString
call Crlf
.ELSE
mov edx,OFFSET str2
call WriteString
call Crlf
.ENDIF
mov ebx OFFSET arr1
call Validate_PIN
.IF eax==0
mov edx,OFFSET str1
call WriteString
call Crlf
.ELSE
mov edx,OFFSET str2
call WriteString
call Crlf
.ENDIF
mov ebx,OFFSET arr3
call Validate_PIN
.IF eax==0
mov edx,OFFSET str1
call WriteString
call Crlf
.ELSE
mov edx,OFFSET str2
call WriteString
call Crlf
.ENDIF
mov ebx,OFFSET arr4
call Validate_PIN
.IF eax==0
mov edx,OFFSET str1
call WriteString
call Crlf
.ELSE
mov edx,OFFSET str2
call WriteString
call Crlf
.ENDIF
exit
main ENDP
Validate_PIN PROC USES ecx edx esi edi
mov ecx,5
mov eax,0
L1:
mov a1[ebx]
.IF(a1>=[esi])&&(a<=[edi])
inc ebx
inc esi
inc edi
.ELSE
mov eax,6
sub eax,ecx
ja L2
.ENDIF
loop L1
mov eax,0
l2:
ret
Validate_PIN ENDP
END main

Result:

Invalid

valid

valid

Invalid

=============================================================================

ANSWERED AS PER MY KNOWLEDGE

IF ANY DOUBTS COMMENT IT


Related Solutions

MUST BE WRITTEN IN ASSEMBLY LANGUAGE ONLY AND MUST COMPILE IN VISUAL STUDIO You will write...
MUST BE WRITTEN IN ASSEMBLY LANGUAGE ONLY AND MUST COMPILE IN VISUAL STUDIO You will write a simple assembly language program that performs a few arithmetic operations. This will require you to establish your programming environment and create the capability to assemble and execute the assembly programs that are part of this course. Your \student ID number is a 7-digit number. Begin by splitting your student ID into two different values. Assign the three most significant digits to a variable...
In Assembly Language (Visual Studio 2017), create a procedure that generates a random string of Length...
In Assembly Language (Visual Studio 2017), create a procedure that generates a random string of Length L, containing all capital letters. When calling the procedure, pass the value of L in EAX, and pass a pointer to an array of byte that will hold the random string. Write a test program that calls your procedure 20 times and displays the strings in the console window. In your program, the random string size shall be preset as a constant. Please include...
Please write in x86 Assembly language on Visual Studio Write a program to compare two strings...
Please write in x86 Assembly language on Visual Studio Write a program to compare two strings in locations str1 and str2. Initialize str1 to Computer and initialize str2 to Compater. Assume Str1 holds the correct spelling and str2 may have an incorrect spelling. Use string instructions to check if str2 is correct and if not correct the mistake in str2.
Please write in x86 Assembly language on Visual Studio. IRVINE32 Write a program to copy one...
Please write in x86 Assembly language on Visual Studio. IRVINE32 Write a program to copy one array of size 24 to another array of size 24 using string instructions. Write 3 versions of this code. One code must copy byte at a time. One code must copy word at a time and one code must copy double word at a time. Cut and paste the array in memory to show your code is working.
USING VISUAL STUDIO 2017, LANGUAGE VISUAL C# I have struggled on this program for quite some...
USING VISUAL STUDIO 2017, LANGUAGE VISUAL C# I have struggled on this program for quite some time and still can't quite figure it out. I'm creating an app that has 2 textboxes, 1 for inputting customer name, and the second for entering the number of tickets the customer wants to purchase. There are 3 listboxes, the first with the days of the week, the second with 4 different theaters, and the third listbox is to display the customer name, number...
Please use assembly language x86 Visual Studio Write a program to add the following word size...
Please use assembly language x86 Visual Studio Write a program to add the following word size numbers:15F2, 9E89, 8342, 99FF, 7130 using adc instruction and a loop. The result must be in DX, AX. Show the result in debug window.
Make a Program in Visual Studio / Console App (.NET Framework) # language Visual Basic You...
Make a Program in Visual Studio / Console App (.NET Framework) # language Visual Basic You will be simulating an ATM machine as much as possible Pretend you have an initial deposit of 1000.00. You will Prompt the user with a Main menu: Enter 1 to deposit Enter 2 to Withdraw Enter 3 to Print Balance Enter 4 to quit When the user enters 1 in the main menu, your program will prompt the user to enter the deposit amount....
Microsoft Visual C++ Assembly language Problem 3. Write a program that uses a loop to calculate...
Microsoft Visual C++ Assembly language Problem 3. Write a program that uses a loop to calculate the first seven values of the Fibonacci number sequence, described by the following formula: Fib(1) = 1, Fib(2) = 2, … Fib(n) = Fib(n-1) + Fib(n-2). Place each value in the EAX register and display it with a call DumpRegs statement inside the loop For example: Fib(1) = 1, Fib(2) = 2, Fib(3) = Fib(1) + Fib(2) = 3, Fib(4) = Fib(2) + Fib(3)...
write a program for the microcontroller-msp430fr6989 using code composer studio not assembly language. write a code...
write a program for the microcontroller-msp430fr6989 using code composer studio not assembly language. write a code that transmits a single character and lights the red LED upon receiving that character. The board will "talk" to itself. The green LED should turn on whenever a message is sent and the LCD will display the message being received.
Objectives: 1. To get familiar with C# programming language 2. To get familiar with Visual Studio...
Objectives: 1. To get familiar with C# programming language 2. To get familiar with Visual Studio development environment 3. To practice on writing a C# program Task 1: Create documentation for the following program which includes the following: a. Software Requirement Specification (SRS) b. Use Case Task 2: Write a syntactically and semantically correct C# program that models telephones. Your program has to be a C# Console Application. You will not implement classes in this program other than the class...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT