I am trying to get this lab done

Lab #8: I/O Procedures, Simple

Encryption and Decryption.

Purpose:  The purpose of this lab assignment is to

further familiarize the student with the basic procedures in Intel Architecture by implementing I/O procedures for a simple encryption and decryption

application .





In this lab, we are going to write several I/O procedures that use specific OS/BIOS

Interrupts to do our input and output functions. Some procedures will also be

used to encrypt and decrypt text. Some of these procedures have been given to

you or already written in previous lab assignments. For instance WriteDec has

already been written as part of the previous assignment whereas both ReadChar

and ClrScr have been given to you. Please see that attached program file.


Write the following procedures using INT 21h function code AH=06h ONLY including reading

single or multiple string of characters/numbers from the keyboard, and writing single

or multiple characters to the screen. Characters can be transferred through

registers or memory as the case might be as specified below. In the

specification below, all parameters are passed via registers. However, you can

choose pass input parameters via the Stack but Output parameters must be placed

in the registers specified.

P1. ClrScr; Scroll the whole

screen window. CODE GIVEN. This uses BIOS Int 10h

P2. WriteChar;            Writes character to screen. Char in

AL on entry

P3. WriteString;          Writes NUL (0) terminated ASCII string

to the screen. DX = Address of String; Returns nothing

P4. CrLf ;        moves the cursor to a newline (Carriage

Return and  Line Feed). No parameters



P5. ReadChar ;            Read single character from std input

(keyboard). Char in AL on exit. It does NOT ECHO to the screen. CODE GIVEN. It

uses Int 21h function ah=06h

P6. GetKey (unsigned);          Read the encryption/decryption key as

multiple Decimal Digits from keyboard 

(ie ASCII to Binary). Stops when user presses ENTER key (0dh). Returns

binary number in AX

P7. GetPlainText;       Read string of text from keyboard and

store in memory.

Entry: DX = offset of bytes

where data is stored. CX: max # of characters to be read. Exit: actual count of

bytes read in CX. Stops when user presses ENTER key (0dh)

P8. WriteDec; Write Decimal Digits to Screen (ie. Binary to

ASCII). Entry: Integer in AX. Returns nothing. Used in this assignment to Print

the number of characters typed in.        

P9. Encrypt; Used to Encrypt

or Decrypt Text from memory and place the results into memory. Entry: SI = ptr

to source, DI= ptr to destination, CX= buffer count, AX=Key . Thus to encrypt

SI = ptr to plaintext and DI= ptr to encrypted text. To Decrypt, SI=ptr to

ciphertext and DI= ptr to plaintext.

Exit: Nothing

P10. WriteText; Print text to

the screen. Used in this assignment to Print Encrypted or Decrypted  Text on the screen. Entry:     DX= pointer to Text Buffer; CX= Buffer

count. Exit: Nothing



1. You cannot use any library. If you use any external library, you will not

get any credit for the assignment.

2. For all I/O, your program MUST use only Int 21h, function 6. (except for the

given ClrScr function which uses BIOS Int 10h).

3. A MAIN procedure will be supplied in a separate file. Your program should

work perfectly with the supplied MAIN procedure. Please note that the supplied

main program is designed to work with the above procedure specification where

all parameters are passed via the specified registers. If you choose to pass

input parameters via the Stack you must change the main program accordingly but

the procedures should work perfectly with the modified main program and the

session should still work exactly as shown. The supplied main program is also

designed with work with MASM. Thus if you use emu8086 you should change the

syntax of the data definitions for it to run in that environment.

4. None of the procedures should use the data segment to store any data

directly except through parameters that are passed via the registers as defined

in the procedures.

5. As usual, the program must

be demonstrated. The program has been separated into two parts for testing

purposes. However, both parts should be demonstrated together. You can also

answer No for certain parts you want to skip before you are ready to text them.

7. Your program should have

adequate detailed comments (as usual)

8. None of the procedures should modify any of the registers, (except if it is

part of the functionality, such as ReadChar, which modifies the AL register.)

or if the register is returned as an output parameter.


Int 21h, function 6, when used for input, reads a character from the standard

input WITHOUT WAITING. Thus this is used in conjunction with some sort of loop,

to retrieve the characters you are requesting from the user. It is probably

easiest to first spend time designing  and testing the WriteChar and ReadChar

procedures, and then call these procedures to get all character input and

output, such as with WriteString, GetKey, etc procedures. This way, you won't

need to put Int 21h calls in all your procedures, and instead put calls to the

WriteChar and ReadChar procedures.

The following Procedures can

be gleaned from Lab 7


GetKey is a special form of  GetInput Procedure

WriteDec is same as OutW


The following procedures were

given to you



Be sure to save all the values in the registers you use when you enter a

procedure and restore them when you leave. But be aware that some procedures,

by definition, modify certain registers so be careful what you push and pop.



Supplied MAIN Procedure and Specification of the Procedures are in a Separate


The main procedure assumes you have all the parts completed. If you want to

test a subset of the procedures using the MAIN procedure, you may need to

comment parts of it out. Alternatively, you may provide your own main procedure

for some parts for testing purposes but all the parts must work with this

supplied MAIN procedure.



Testing:  Be sure to test your program before you

demonstrate it to your instructor.


Demonstrate your program to the instructor. During the Demonstration the

Instructor will check whether all the procedures have been written, they are

well-documented and work with the main program under different conditions.

Submission: Submit

well documented electronic copy of your program to CANVAS including the source

code (both .asm and .txt), Output session, and report (.doc, docx). The source

code should include the main program and the 10 procedures. The report should

include program design (in pseudocode and/or flowchart), lessons learned,

problems encountered, how long it took you to complete this assignment, and

suggestions (if any)  for the future. The

output should include sessions you used to test it.


In the sessions below notice that because the key must be

kept secret, three astericks are displayed regardless of the key size. Also the

user is asked to type the key before the encrypted data is decrypted. This is

supposed to serve as a test that the decryption works. In a real system the

encrypted text will be sent over a network so that an observer will have

difficulty figuring out what is being sent. The message can also be in a file

such that any one opening the file will see garbled information until they

produce a valid key before the file is decrypted.

In the 2nd 

session the message is the same but the key is different

In the 3rd 

session the user failed to type in the correct key.

You can try these and other sessions, including ones where

we don’t want to print encrypted text, etc and put it in your output file. I

you want me to validate your work include the key you used to produce those

sessions. However, you don’t have to because I can put it my own text and keys

to see if your program works. 

Get Help With a similar task to - I am trying to get this lab done

Login to view and/or buy answers.. or post an answer

Related Questions

Similar orders to I am trying to get this lab done
Java Customer Program
Problem 1: Customer Max has opened his own pet supply store so he can help himself to treats and toys whenever he wishes. In order to encourage customers to shop at his store more, he is implementing a customer loyalty program. For every $100 spent, the c...
Literature Review for Smart Case for tracking monitoring and tracing packages being delivered
They're three attachments below one being the handbook to help guidance during this progress another being the first proposal of the project and then the assignment that needs completing, the Literature review....
c++ lab 1 intro lab
P ROBLEM STATEMENT: A review and extension of cs132: sort a file with 120 records. However, due to memory restrictions only 20 records may be placed into memory. You are to implement a “quasi” external sort CODE/DIRECTIONS: For the sake of si...
Cryptography Assignment C
1. Write two programs that use some of the build-in Cryptographic APIs a. Write one C program that uses Symmetric-Key algorithm b. Write one C program that used Asymmetric-key algorithm c. Use C programming language to write your code d. Make sure tha...