Assembly language
PLEASE WRITE AN ASSEMBLY CODE
WRITE CODE
Don't explain the answer
please write the code
- please Do not post an existing answer
- please make sure it's work in emu8086
- please read project requirements carefully
Input: Your program should prompt the user for three separate inputs from the keyboard, as follow.: 1. The prompt: IF YOU WANT TO ENCRYPT, TYPE E; IF YOU WANT TO DECRYPT, TYPE D: The user will type E or D. A real-world program should also detect any other character typed and respond with THAT IS AN ILLEGAL CHARACTER. PLEASE TRY AGAIN. We will assume in this assignment that the user can type an E or D correctly. Your program will accept that character. store it in 3100. and use it, as we shall see momentarily. 2. The prompt: ENTER THE ENCRYPTION KEY (A SINGLE DIGIT FROM 1 TO 9): The user will type a single digit from 1 to 9. Again, we will assume the user is not an Aggie and can successfully hit the digit keys on the keyboard. Your program will accept this digit. store it in 3101, and use it to encrypt or decrypt the message. 3 .The prompt: INPUT A MESSAGE OF NO MORE THAN 20 CHARACTERS. WHEN DONE, PRESS . The user will input a character string from the keyboard. terminating the message with the ENTER> key. Your program will store the message. starting in location 3102. Since the message is restricted to #20 characters, and there is a key at the end (which you may want to store). you must reserve locations x3102 to 3116 ( #21 locations) to store the mersage. (Note that #21=x15.) One constraint: Messages must be less than or equal to #20 characters. (Recall: \# means the number is decimal.) Hint: to continually read from the keyboard without first printing a prompt on the screen, use the appropriate interrupt (such as INT 21). For each key you wish to read, the EMU8086 operating system must execute this interrupt service routine. Don't forget to follow the input interrupt with the instruction for interrupt for output, the character the user types will be displayed on the screen. Algorithm: Basic Cipher Scheme (BCS) The encryption algorithm is as follows. Each ASCII code in the message will be transformed as follows: 1 .the low-order bit of the code will be toggled. That is, if it is a 1 , it will be replaced by a 0 ; if it is a 0 , it will be replaced by a 1 . 2. The key will be added to the result of step 1 above. For example, if the input (plain text) is A and the encryption key is 6, the program should take the ASCII value of A. 01000001, toggle bit [0:0], producing 01000000, and then add the encryption key, 6. The final output character would be 01000110 , the ASCII value F. The decryption algorithm is the reverse. That is, 1. Subtract the encryption key from the ASCII code . 2. Toggle the low-order bit of the result of 1 . For example, if the input (ciphertext) is F, and the encryption key is 6. we first subtract the encryption key (i.e.., add -6) from the ASCII value of F. 01000110+11111010, yielding 3 Cybersecurity Department, PSUT 01000000. We then toggle bit [0:0]. producing 01000001, which is the ASCII value for A. The result of the encryption/decryption algorithm should be stored in locations 3117 to 312A. Output: Your program should output the encrypted or decrypted message to the screen. Note that the encryption/decryption algorithm stored the message to be output starting in the location. - Use MASM assembler to create your segments, constants, variables \& others. - The user can select one operation from a list of items (menu numbered 0,1,2 ). - The program should run in video mode (the black screen - DOS Screen). - The output should be colored with highlights on the important outputs, such as results. - Your code should generate a useful error message such as overflow, underflow, out-oforder, wrong choice, div-by-zero, ...etc. - Your program should be well-documented with an explanation of addressing modes. - Any extra options are welcomed. It will be graded as a bonus if useful. You need to design the program, implement and test it using the EMU8086 Emulator available in the lab \& with you. Consider the following steps while designing this project: - A. Design a Flow Chart Diagram for your design. B. Design the program in Assembly language. C. The program must be Assembled. Emulated, and Run successfully on EMU8086. D. Your program should call a subroutine/macro for each operation and use software interrupts for I/O operations