Write a program to input an address, Computer Engineering

Assignment Help:

  Write a program to input an address i.e. 20 Hex and read the byte (char) contents of that address  

Answer
 
include
void main()
{
char prompt;

Date: 26th August 2012

Version 1.0  
Function : To read an address in memory       
 Modifications:   none*/
unsigned long int address;
unsigned char *add;
unsigned char data;
printf("Please enter in the address  you want to read\n\r");
scanf("%lx",&address);
add = (unsigned char *)address;
data = *add;
printf("The data at the address %08lx is %02x\n\r",address,data);  
printf("Press and key to exit \n\r");
scanf("\n%c",&prompt);
 
}
  
Note: Care should be taken since some operating systems do not allow the user to read any memory address. The PC environment is one of these in that the PC runs under protected memory and hence looking at memory outside this area can yield 'General protection errors '. In order to access the memory in a PC, the operating system must tag the memory area for common use by the program. This is usually achieved by either writing a windows driver for the hardware/address or my poking in an allocated area i.e. allocating static space by an array or using malloc to reserve bytes of area.


Related Discussions:- Write a program to input an address

Which gates are called universal gates, Q. What is Gate? Explain Basic gat...

Q. What is Gate? Explain Basic gates with truth table and necessary circuits. Q. Which gates are called Universal Gates? Why? Q. Give the Dual of the rule 17. Q. Realize

What is minimum spanning tree, Minimum Spanning Tree: Given a weighted gra...

Minimum Spanning Tree: Given a weighted graph G, it is often desired to make a spanning tree T for G, like the sum of weights of the edges in T is the least. Like tree is known as

Explain the typical organization of a computer, Q. Explain the typical orga...

Q. Explain the typical organization of a computer? There are two principal components: hardware and software. The former refers to physical components such as memory unit (MU),

Encryption techniques to ensute secured transaction on net, Two popular enc...

Two popular encryption techniques to ensute secured transactions on the net? 1. Translation table 2. Word/byte rotation and XOR bit masking.

Anti reflection coating, expression for thickness and refractive index of c...

expression for thickness and refractive index of coating material to act as anti reflection coating

What do you mean by interrupts, Q. What do you mean by Interrupts? The ...

Q. What do you mean by Interrupts? The term interrupt is an exceptional event which causes CPU to temporarily transfer its control from presently executing program to a separat

What is hard drive interface, Q. What is Hard Drive Interface? Secondar...

Q. What is Hard Drive Interface? Secondary storage devices need a controller to proceed as an intermediary between device and rest of the computer system. On some computers the

What is fan-out, What is fan-out? Estimate the average count of every "...

What is fan-out? Estimate the average count of every "many" association encountered with the path. Multiply the individual fan-outs who obtain the fan-out of the whole path, wh

Show buffered mode for point-to-point message passing, Q. Show Buffered mod...

Q. Show Buffered mode for Point-to-point Message Passing? Buffered mode: Transmitting can be started whether or not matching receives has been started and transmitting may comp

Expalin johnson counter, Write short note on the Johnson counter. Ans:...

Write short note on the Johnson counter. Ans:  Johnson Counter: It is a synchronous counter, where all flip-flops are clocked concurrently and the clock pulses drive the

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd