473,385 Members | 1,337 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Accessing memory locations in C programming

Hi

I'm working on a 32-bit DSP processor.

I want to access memory location with address 0x3000h and clear all the memory locations from 0x3000h to 0x3300h to '0'.

Is the following an effective way to do it ?? If not, kindly be elaborate on your suggestions.

memset( (void*)0x3000, 0, 0x0300 );

thanks heaps..

krish
Mar 20 '07 #1
2 2846
horace1
1,510 Expert 1GB
it depends on the processor and compiler. Generally you create a pointer to the type of variable in memory you wish to manipulate, then assign an address to that pointer and use it as one would any pointer by dereferencing it, e.g. a DOS program to clear the video RAM on a PC
Expand|Select|Wrap|Line Numbers
  1.    byte *video_start = (byte *) 0xB8000000L;     /* define start of PC video RAM */
  2.  
  3.     byte *video_mem = video_start;        /* pointer initialised to video RAM */
  4.  
  5.     /* clear 25 lines of 80 characters (character plus attribute byte) */
  6.     while (video_mem < video_start + 160 * 25)
  7.         {
  8.          *video_mem++ = ' ';                        /* set character to space */
  9.          *video_mem++ = (byte) attribute;                    /* set attribute */
  10.         }
  11.  
have a look thru the compiler manuals and help pages - it should tell you how to do this type of operation on your system
Mar 20 '07 #2
dmjpro
2,476 2GB
if the program runs under DOS then it uses 16 bit runtime env.......

what u r doing .... that does not depend on processor env
Mar 20 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: prodirect | last post by:
Hi all, I hope someone can help me. I've recently created a database and wanted to put it up on an ftp sight so that multiple people could access the same tables at the same time from different...
5
by: Alfonso Morra | last post by:
Hi, I am writing a messaging library which will allow me to send a generic message structure with custom "payloads". In many cases, a message must store a non-linear data structure (i.e....
1
by: Ronald de Feijter | last post by:
In a mechatronic system I can control some motors and servos by setting values between 0 and 255 at specific memory addresses. My problem is how to access these memory addresses within C#. I know...
8
by: nkrisraj | last post by:
Hi, I have a following structure: typedef struct { RateData rdr; int RateID; char RateBalance; } RateInfo;
29
by: tele-commuter | last post by:
Hi folks, I want to understand how exactly is an image(compiled c code and loaded into memory) stored in memory. What exactly is a linker script? I work with a lot of c code on a daily...
13
by: hurry | last post by:
In order to avoid declaring static variables in a function I was asked to write a scratch memory. Reserve a block of memory outside the function and assigning pointers to the memory locations as...
94
by: smnoff | last post by:
I have searched the internet for malloc and dynamic malloc; however, I still don't know or readily see what is general way to allocate memory to char * variable that I want to assign the substring...
1
by: techie82 | last post by:
Hello all I'm a fresher to Microcontroller programming. I have defined certain global variables that I need to store at consecutive memory locations, say starting from 0x8000h . Will appreciate...
39
by: Ravi | last post by:
Can you all please suggest a program which tell us the range of memry addresses occupied by the given c program?
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.