I gather from elsewhere that your target is a Z80? If so, you need at least an '-mz80' on the command line, thus you would use...
sdcc -mz80 putchar.c On your code - I would comment that you're using a '=' on your if comparison, you probably mean '=='. I would simplify the pointer declarations too with a typedef, then things might be clearer for the compiler. If you're declaring an absolute address in memory, then you should use something like this array declaration I used on a recent project... typedef unsigned char byte_t; volatile byte_t __at 0xD000 VideoRAM[25*40]; The 'volatile' keyword may or may not be appropriate in your application, but the '__at' allows you to declare an absolute address. The byte_t type I declare is useful because 8-bit signed integers (chars) aren't all that useful much of the time. If you need a signed integer, you will probably want short or int. On Tuesday 05 May 2009 02:35:11 Kevin Zee wrote: > I have gotten the libraries to build an am trying (unsuccessfully) to > make a custom putchar.c (I removed the putchar.s file). This is what I > have so far: > > #include "memory.h" > void putchar(char ch) { > *(unsigned char *)pScreen = video; > *(unsigned char *)pX = caratx; > *(unsigned char *)pY = caraty; > > char x; > char y; > > x = pX; > y = pY; > > pScreen += y * 160; > pScreen += x * 2; > > if (ch = 0x0d) { > // Adjust the cursor position, checking to see if we need to > scrool the screen > > return; > } > > return; > } > > > It gets errors on just about every line. The first error says syntax > error: token 'char' where I declare x. Then, everywhere that a variable > is mentioned, it says undefined identifier - even when I declare a variable > > the .h file is. > #ifndef MEMORY_H > #define MEMORY_H > > #define caratx 0x1FFE > #define caraty 0x1FFF > #define video 0x2000 > > #endif > > I simply use "sdcc putchar.c" without quotes to compile. > > I have been trying for hours to get this thing to work. What am I doing > wrong? > <snip> -- Richard. PGP Key-id: 0x5AB3D350 Money is better than poverty, if only for financial reasons. ------------------------------------------------------------------------------ The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your production scanning environment may not be a perfect world - but thanks to Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700 Series Scanner you'll get full speed at 300 dpi even with all image processing features enabled. http://p.sf.net/sfu/kodak-com _______________________________________________ Sdcc-user mailing list Sdcc-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/sdcc-user