Setting up a block of space

Is it possible to setup a block of RAM using constants?

<I am going to use compiler commands which make what I want to do obvious but they are just made up and/or mixed with old assembler commands in order to demonstrate what I want.>

In assembler I could do something like:

loc_hello: #defstring "Hello",0
loc_Goodbye: #defstring "Goodbye",0
loc_Error: #defstring "Error",0

so that referring to "loc_Goodbye" would give the address of the "G" in "Goodbye" etc

I could even replace the "Hello" with a constant from a table so....

loc_hello: #defstring $const_hello$

Also each of the definitions is relative to the previous one... Is it possible to make one relative to another but offset by a fixed amount so:

loc_hello: #defstring "Hello",0
loc_Goodbye: #defstring "Goodbye",0
a1: #defspace (30-a1-loc_hello)
loc_Error: #defstring "Error",0

So that loc_Error is 30 bytes after loc_hello ??

Also is it possible to compile code to the EEPROM ???

So that I could have say the text for the sketch compiled straight to the EEPROM rather than programming space?

not exactly sure what you want, why program in assembler ?
its possible dough but its often slow or developing software, update or remove bugs.
Never the less it is possible.

You might perhaps use a fixed array of char (bytes).

Then read a little bit about pointers in C++ ( http://www.cplusplus.com/doc/tutorial/pointers/ )
A pointer will get you the offset of where the array is stored
Pointers can point to objects, functions, variables,...
Basically they point to the memory location

next you might take a dive into this http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1207370768/2

I think before you start assembler, first try c++
It might sound cool to be able to do it (i one could write assembler for the MSX), but its not an easy road
It might require lots of time to learn, and you be able to create small things with it, the same investment in other programming languages leads programmes who can do more (but 'might' not be as fast as assembler, on the other hand these program languages do a good job of translating code to assembler too, so you can focus better on higher goals and achieve more with less code to invent yourself.

Is it possible to setup a block of RAM using constants?

Like this?

char* explanation [] = "This string exists in PROGMEM but gets copied to RAM before \"main\" runs";
char loc_hello = "Hello";
char loc_Goodbye = "Goodbye";
char loc_Error = "Error";

Then use loc_Hello etc to reference the strings.

If you really need the string to be 30 apart then maybe

char myArray [3][30] = {
   "Hello",  "Goodbye", "Error"
}

or

char myArray [100];

strcpy (myArray, "Hello");
strcpy (myArray + 30, "Goodbye");
strcpy (myArray + 60, "Error");

or

char myArray [] = {"Hello                    Goodbye                Error"}

This is all very wasteful of space though, there is usually a better way. What are you trying to do?

Also is it possible to compile code to the EEPROM ???

No, you may have to write it yourself at run time, although IIRC there are AVRdude/linker options to put stuff in EEPROM.


Rob

You seem to be trying to control the layout of your data. The way to do that is to define your variables and types correctly so that the correct space is allocated for them, rather than trying to tell the linker how to do its job.

cowasaki:
So that I could have say the text for the sketch compiled straight to the EEPROM rather than programming space?

Wait, what???