microprocessor ie hl lab _manual

23
ASSIGNMENT NO.: 1 FILE I/O (Simulation of TYPE command) Problem statement : Write an assembly language program using Program Segment Prefix (PSP) to provide file handling utility functions. 1. Open a file. 2.Read a file. 3.Display a file in text and dumped mode. Definitions : Refer Ray Duncan Platform : DOS/Win-98 Algorithms and Requirements : Read a Display File: a)Algorithm: 1) Read PSP. 2) Read command length. 3) If length = 0,generate error1 and end. 4) Else get command tail (filename). 5) Search if file is present. 6) If file is present generate error2 and end. 7) Else open file. 8) Read File. 9) Display file. 10) Close file 11) End. b) Functions Required: INT 21h 1) 1.Search File: 4EH 2) 2.Open File: 3DH 3) 3.Read File: 3FH 4) 4.Close File: 3EH

Upload: dinesh-choudhary

Post on 22-Nov-2014

2.019 views

Category:

Documents


3 download

TRANSCRIPT

Page 1: Microprocessor Ie HL LAB _manual

ASSIGNMENT NO.: 1FILE I/O

(Simulation of TYPE command)

Problem statement: Write an assembly language program using Program Segment Prefix (PSP) to provide file handling utility functions.

1. Open a file.2.Read a file.3.Display a file in text and dumped mode.

Definitions: Refer Ray Duncan

Platform: DOS/Win-98

Algorithms and Requirements:

Read a Display File:a) Algorithm:

1) Read PSP.2) Read command length.3) If length = 0,generate error1 and end.4) Else get command tail (filename).5) Search if file is present.6) If file is present generate error2 and end.7) Else open file.8) Read File.9) Display file.10) Close file11) End.

b) Functions Required: INT 21h 1) 1.Search File: 4EH2) 2.Open File: 3DH3) 3.Read File: 3FH4) 4.Close File: 3EH

Test/Expected Results: All options stated, are executed with all validations (e.g. Required parameter missing, file not found etc).

Conclusion: All options stated above are tested and executed successfully.

Page 2: Microprocessor Ie HL LAB _manual

ASSIGNMENT NO.: 2FILE I/O

(Simulation of COPY command)

Problem statement: Write an assembly language program using Program Segment Prefix (PSP) to provide file handling utility functions.

1.Create a file.2.Read a file.3. Write a file.

Definitions: Refer Ray Duncan

Platform: DOS/Win-98

Algorithms and Requirements:

I. Create a file:c) Algorithm:

1) Read PSP.2) Read command length.3) If length = 0,generate error1 and end.4) Else get command tail (filename).5) Search if file is present.6) If file is present generate error2 and end.7) Else create file.8) Get data from user.9) Write data in the file.10) Close the file.11) End.

d) Functions Required:1) Search File: 4EH2) Create File: 3CH/5BH3) Write File: 40H4) Close File: 3EH

II. Read a File:a) Algorithm:

1) Read PSP.2) Read command length.3) If length = 0,generate error1 and end.4) Else get command tail (filename).5) Search if file is present.6) If file is present generate error2 and end.7) Else open file.8) Read File.

Page 3: Microprocessor Ie HL LAB _manual

9) Display file.10) Close file11) End.

b) Functions Required: INT 21h 1) 1.Search File: 4EH2) 2.Open File: 3DH3) 3.Read File: 3FH4) 4.Close File: 3EH

III. Write/Append File:a) Algorithm:

1) Read PSP.2) Read command length.3) If length = 0,generate error1 and end.4) Else get command tail (filename).5) Search if file is present.6) If file is present generate error2 and end.7) Else open file in read/write access mode.8) Check carry.9) If set display error2 and end.10) Else set file pointer to the end of the file.11) Get the data from user to append.12) Write file with new data.13) Close file.14) End.

b) Functions Required: INT 21h 1) Search File: 4EH2) Open File: 3DH3) Set file pointer: 42H4) Write File: 40H5) Close File: 3EH

Test/Expected Results: All options stated, are executed with all validations (e.g. Required parameter missing, file not found etc).

Conclusion: All options stated above are tested and executed successfully.

Page 4: Microprocessor Ie HL LAB _manual

ASSIGNMENT NO.: 3ARITHMATIC OPERATIONS Using Co-Processor

Problem statement: Take a real no find: square root

Definitions: Please refer D.Hall (Black), 2nd addition, TM (Page No. 365).

Platform: DOS/Win-98

Algorithm: 1. Accept the value of the whole no.2. Push it in stack3. Accept real part & push it in stack4. Divide real part by 10 no of times=digit present in real part5. Add whole no in division6. Find squareroot7. Pop BCD part of result8. Print BCD part9. Subtract BCD part from result10. Pop result11. Print result12. End.

Requirements:Intel 8087 Instruction Set

Test/Expected Results: Given different values of radius the calculated results and results from program are matched.

Conclusion:. Co-processor 8087 instructions studied(required) & program executed successfully.

Variations:

1. Temperature conversion from degree C to degree F.2. Accept two points P1 (x1, y1) and P2 (x2, y2). Find distance between these two

points.3. Accept length of square and find:

a) Length of Diagonal.b) Area.c) Volume of Cube.

Page 5: Microprocessor Ie HL LAB _manual

ASSIGNMENT NO.: 4DISK I/O: INLINE CODING

Problem statement: Write Inline Code (interfacing ‘C’ with assembly language) for -

Boot Sector display for 1.44 MB Floppy disk.

Definitions: For Boot Sector definitions refer Ray Duncon.For interfacing C with assembly language refer to Using Assembly Language by Allen Wyatt, PHI, Third edition, pp 307-325.

Platform: DOS/Win-98

Algorithms and Requirements:I. Display Contents of Boot Sector

a) Algorithms:1) Check if floppy is present in the media.2) If no, generate the error.3) If yes, read the boot sector from the floppy.4) Display its contents.5) End.

b) Requirements:1) DOS INT 25h or BIOS INT 13h

Test/Expected Results: All options stated, are executed with all validations (e.g. Required parameter missing, file not found etc).

Conclusion: All options stated above are tested and executed successfully.

Page 6: Microprocessor Ie HL LAB _manual

ASSIGNMENT NO.: 5DISK I/O: INLINE CODING

Problem statement: Write Inline Code (interfacing ‘C’ with assembly language) for -

Display the file contents using Root Directory and FAT.

Definitions: For Root Directory and FAT structure definitions refer Ray Duncan.For interfacing C with assembly language refer to Using Assembly Language by Allen Wyatt, PHI, Third edition, pp 307-325.

Platform: DOS/Win-98

Algorithms and Requirements: Display the file contents using Root Directory and FAT.

c) Algorithm:1) Read PSP and get the filename.2) Read the root directory sectors in the buffer1.3) Search the filename in the root directory entries.4) If not found, generate the error message and end.5) If found, get the first sector number from the directory entry. 6) Read the FAT sectors in buffer2. 7) Search the next sector entries in FAT.8) Repeat till end of the file is encountered.9) End.

Functions Required:10) INT 21h – Function 62h 11) DOS INT 25h or BIOS INT 13h

Test/Expected Results: All options stated, are executed with all validations (e.g. Required parameter missing, file not found etc).

Conclusion: All options stated above are tested and executed successfully.

Variations: -

* Extra assignment can be displaying cluster chain for a file.

Page 7: Microprocessor Ie HL LAB _manual

ASSIGNMENT NO.: 6PRINTER DEVICE DRIVER

Problem statement: Write an Installable DOS Device Driver for a printer.

Definitions: For DOS Device Driver refer Writing MS-DOS Device Drivers by Robert Lai, Waite Group.

Platform: DOS 6.22

Algorithms and Requirements:A. For printer device driver :

-Write device driver header.-Write interrupt routine.-Write command code routine.

B. To load and execute:1. TASM & TLINK the driver.2. Use EXE2BIN utility to convert to .sys3. Edit CONFIG.SYS, with device = <filename>.sys command.4. Reboot the machine, check for initialization message.5. Use type command with logical printer name to print any file.

Test/Expected Results: With proper execution printer is installed and printout is taken for a test file.

Conclusion: Driver tested and works ok.

Page 8: Microprocessor Ie HL LAB _manual

ASSIGNMENT NO.: 7STUDY AND TROUBLESHOOTING OF PC

Problem statement: Study assignments A. Study and troubleshooting of Pentium motherboard, memory video

adapters, keyboard, FDD, HDD, serial, Parallel ports, etc.B. Study of PC diagnostic toolsC. Study of PC add-on cards.

Definitions: Refer to IBM-PC & Clones by Govindrajalu.Motherboard and peripheral manuals by the manufacturers.For troubleshooting Upgrading and Repairing Your PCs by Scott Muller.

Platform: -

Algorithms and Requirements:Explanation of different components of motherboard and add-on cards e.g. CMOS, RAM, BIOS, CPU, Buses, keyboard, types of keys, etc.

TroubleshootingHardware – Using PC explorer or Kits.Software –Using utilities for CPU performance, benchmarking, testing peripherals like mouse, keyboards, monitors, etc.Audio – Testing using beeps (sound).Note: Either software or hardware along with beep diagnostics can be done.

Test/Expected Results: With proper explanation and demonstration study is completed.

Conclusion: Study of Pentium motherboard and add-on cards is performed. The sudy of diagnostic tool is completed.

Page 9: Microprocessor Ie HL LAB _manual

ASSIGNMENT NO.: 8 PC ASSEMBLY

Problem statement: PC Assembly Set up and Installation:

Definitions: Refer to installation information for Windows OS/ Best help is from Maintenance engineer!

Platform: Win-98/2000

Algorithms and Requirements:1. Assemble the PC and carry out CMOS & other settings.2. Partition the hard disk.3. Install operating system (win98/2000)4. Install/configure necessary drivers for peripherals such as printer, modem,

scanner, zip drive, pen drive, CDROM, LAN card, Camera, etc5. Configure the system for intranet and internet application.

Test/Expected Results: With proper set up, installation is completed.

Conclusion: PC assembly is studied, OS loading and driver details are studied.

Page 10: Microprocessor Ie HL LAB _manual

ASSIGNMENT NO.: 9 PC-TO-PC COMMUNICATION

Problem statement: PC-TO-PC communication using null modem (Using ‘C’ language only).

Definitions: Refer TC technical manual for C function for serial port, PC/XT manual for 8250 UART programming.

Platform: DOS / Windows 98

Algorithms and Requirements:FOR TRANSMITTER:

1. Initialize data segment and extra segment.2. Accept no of bytes.3. Set the DLAB in LCR.4. Set baud rate in DLAB msb & lsb.5. Check if THRE & TSRE are set.6. If no go to step 6 else send start byte, no of bytes and data bytes.7. If THRE & TSRE = 1,calculate check sum.

i. Checksum = (Addition of bytes)/M (std) factora. = (0) + (1) + (2) +------+ (n-1)/n

8. Send the check sum.9. Receive acknowledgement from receiver.10. Print message ‘positive acknowledgement’, if it is positive otherwise ‘Negative

acknowledgement’.11. Ask user for continuation, If yes go to step 3.12. Stop.

FOR RECEIVER:1. Initialize data segment and extra segment.2. Set the DLAB bit in LCR3. Set baud rate.4. Initialize receiver.5. Check for 6. Receive no. of bytes.7. Calculate check sum.8. Checksum = (Addition of bytes)/M (std) factor

i. = (0) + (1) + (2) +------+ (n-1)/n9. Receive the check sum.10. Compare received check sum with calculated checksum. 11. If both are equal, send ‘+ve’ ack else ‘-ve’ ack.12. Check for end of transmission.13. If no go to step 2.14. Stop.

Test/Expected Results: If data is typed on the any PC, it starts transmitting data, receiver displays the data and vice versa.

Page 11: Microprocessor Ie HL LAB _manual

Conclusion: PC-to-PC communication theory studied and programming performed.

Variations:

1. Menu driven for different baud rates.2. Implementation of small protocols like Stop-n-wait.3. Parity bit, CRC checking.4. Transfer the whole file using above parameters, accept the file name and transfer

whole file, type using DOS commands at receiver.

Page 12: Microprocessor Ie HL LAB _manual

ASSIGNMENT NO.: 10MOUSE INTERFACING ASSIGNMENTS

Problem Statement: Write an ALP to understand working of a mouse.

Definitions: Refer to Ray Duncan

Platform: MSDOS/ Windows 95/ 98

Algorithms:1. Check if mouse driver is already present.2. If not generate error message and end.3. Fix a target position.4. If yes, show mouse pointer.5. If mouse is moving, get new position of mouse pointer.6. If new position is center of the screen, generate beep (using 8253 programming) 7. Else if new position is target position, go to end.8. If any key pressed, acquire the ASCII.

a. If key is 'Q', go to end.b. If key is 'H', hide the mouse pointer.c. If key is 'S', show the mouse pointer.

9. Else repeat.10. End.

Test/Expected Results: When the program is executed, if the mouse driver present appropriate message is displayed. Then the mouse can be moved and can be terminated if it is clicked on the target position.

Conclusion: Mouse interface interrupts are studied and programming done.

Variations: Accept the target position from the user.The target position can be generated as random numbers within program.

Page 13: Microprocessor Ie HL LAB _manual

ASSIGNMENT NO.: 11PENTIUM BASED ASSIGNMENTS

Problem Statement: Write an assembly language program to perform detection of DOS Protected Mode Interface (DPMI), make CPU Identification, Capture Machine Status Word and display the contents of Task register, GDTR,IDTR and LDTR.

Definitions: Refer to The Pentium Processor by J. Antonakos

Platform: MSDOS & Windows 95/ 98

Algorithm:1. Get the DPMI entry point.2. if host is not present, generate error message and end.3. else, save the entry address.4. save time stamp counter and display5. save machine status word and display6. Get CPU identification and display7. Save task register and display8. Save GDTR and display9. Save IDTR and display10. Save LDTR and display11. End.

Test/Expected Results: When the program is executed, in DOS mode, error message is displayed. In Windows, the contents can be observed.

Conclusion: DPMI host is tested on DOS and Windows successfully.

Page 14: Microprocessor Ie HL LAB _manual

ASSIGNMENT NO.: 12 8051-BASED ASSIGNMENTS

Arithmetic assignments

Problem statement: To find:1. Factorial of no.2. Fibonacci series for given no.

Definitions: For instructions refer 8051 Intel Manual

Platform: DOS/WINDOWS

Algorithms:For factorial of no:1. Accept the no from user.2. If no is ‘0’ the factorial is ‘1’ and stop.3. Initialize factorial to 1 and multiply it by decrementing counter.4. When counter becomes zero the value of factorial is answer.

For fibonacci series: 1. Accept the no of terms.2. If no of terms <= 2 then it invalid, stop.3. Initialize a =0,b= 14. Sum = a + b. then a =b, b =sum.5. Decrement counter, if not zero go to step 2.

Test/Expected Results: program executed and results displayed with validations for inputs.

Conclusion: study of 8051 Instruction set and memory organization studied.

Variations: code conversions using Lookup table( this is stored in external data memory or external program memory).

Page 15: Microprocessor Ie HL LAB _manual

ASSIGNMENT NO.: 13 8051-BASED ASSIGNMENTS

Problem Statement: To generate delay of 1sec using 8051 timer(programmed in mode1 or 2) and to interface 8255 with 8051 and glow LEDs on port A or port B. LEDs should be made on one after another.

Definitions: For instructions refer 8051 Intel Manual.

Platform: DOS/WINDOWS

Algorithms:1. Configure the interrupt enable and the interrupt priority registers for using

timer0 in mode2 or auto-reload mode. Load TH0 with the initial value and start the timer by setting TR0 bit.

2. Whenever the timer reaches the value FFh, an overflow will occur and TF0 will get set.

3. This is when the Timer ISR should get executed, set a counter counting till FFh * 0Ch every time this overflow occurs.

4. Once the counter has counted FF*0Ch values, out the data 01h to port A of 8255.If initially the LEDs are OFF, this will make the LEDs ON or vice versa.

5. Reset all the counters and jump to step 3 for continuous switching of the LEDs.

Test/Expected Results: The timer is programmed and LEDs show the delay generated. message should be displayed regarding overflow, number of overflow of timer and delay of require timing generated

Conclusion: The Timer of 8051 studied and programming is performed.

Variations: LEDs can be directly interfaced to port P1 of 8051 and the above experiment can be performed.

Page 16: Microprocessor Ie HL LAB _manual

ASSIGNMENT NO.: 14 8051-BASED ASSIGNMENTSSerial port:

Problem statement: To configure serial port of 8051 in mode 3 and transmit & receive 5 bytes of data, parity bit. Validate the received data accordingly. Program should be menu driven for different baud rate, number of bytes to be sent.

Definitions: For instructions refer 8051 Intel Manual

Platform: DOS/WINDOWS

Algorithms:1. Configure serial port in mode 3, timer 1 in mode 2.2. Accept the first byte from user to be put on transmission line.3. Check the parity and set or clear TB8 accordingly.4. Start transmitting and wait for reception.5. Once the data is received check RB8 for its parity bit.6. If it is same as the earlier parity then display message that data is received

successfully else display message that data received is erroneous.7. Repeat 3 to 7 for 5 bytes of data.

Test/Expected Results: The serial port programming performed byte sent and received are displayed with appropriate messages.

Conclusion: : Study of serial port is done and programming for same is performed.

Variations:

a. Implementation of small protocols like Stop-n-wait.b. CRC checking.

Page 17: Microprocessor Ie HL LAB _manual

ASSIGNMENT NO.: 15 PIC 16C71-BASED ASSIGNMENTS

I/O port assignments:Problem statement: To :

Accept BCD i/p from portB and convert it to Excess-3 or ASCII and output on portB itself.

Definitions: For instructions refer Microchip manual (source: internet )

Platform: WINDOWS 98/2000/XP

Algorithms:Accept the no from portB(lower/upper). for this configure STATUS register

and set portB in i/p port by writing to TRISB register.

Test/Expected Results: program executed and results displayed with validations for inputs.

-

Conclusion: study of 8051 Instruction set and memory organization studied.

Variations: code conversions using Lookup table( this is stored in external data memory or external program memory).