
Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Some concept of Machine Organization are Anatomy, Cache Access Time, Instruction Formats, Instruction Formats, Instruction Formats, Multidimensional Meshes, Network Processors, Snooping Protocol. Main points of this lecture are: Digit, Program, Keyboard, Prints, Values, Variables, The, Standard, Subroutine, Automatically
Typology: Slides
1 / 1
This page cannot be seen from the preview
Don't miss anything!

Write a C program that requests, reads, and echos the values of the variables X and Y (one digit each) from the keyboard, and then prints the sum of the two numbers. Use the scanf and printf standard I/O functions. Test the program, and show pertinent “snapshots” of the stack.
Now write your own scanf subroutine (function) to replace the standard I/O scanf function used in your program (I would keep it simple). It must be assembled to be placed at the correct location in the simulator (Unfortunately we don’t have a linker to do this automatically for us. That would be the normal procedure.). Again test your program, and show your code replacing the scanf function and pertinent “snapshots” of the stack.
Now, the fun part! Modify your program so that the scanf function operates with an interrupt. You will now need to add an interrupt routine (which you can assemble with your scanf function if you like), and will also need to load the interrupt vector and arm the device (You can do this by hand in the simulator if you like.). Again test your program, and show your code in the simulator and pertinent “snapshots” of the stack. Good Luck!