Re: [cc65] c question

From: Markus Stehr <bastetfurry1ircnet.de>
Date: 2010-05-27 10:04:34
Hi!

Am Donnerstag, den 27.05.2010, 02:32 -0400 schrieb Chiron Bramberger: 
>      *(byte*) 0xD800 = 0x12;    /* Store a byte to address $D800 */
>      *(word*) 0xC000 = 0x1234;  /* Store a word to address $C000 */
>      B = *(byte*) 0xD800;       /* Read a byte from address $D800 */
>      W = *(word*) 0xC000;       /* Read a word from address $C000 */
> 
> I'm sorry, but I looked this up in my old C textbook, and even though  
> there are similar examples, I can't find an answer to this question  
> anywhere.
<Hobbyist understanding of the topic follows, beware!>

It only tells the compiler that he should cast a byte _to_ the address
you tell him. Something along the line "Hello Compiler, this is a
pointer to a byte. So even if i give you a short, just put a byte into
the said address."
If you give the compiler just the address he wouldnt know what to make
of it.

BTW: I found out the hard way that not all 8 bit c-compilers do it that
way. Z88dk showed me the middle finger and wanted a complicated solution
involving a second source file and some inline assembler. Still not
ROM-Save, though, so i got back to pure assembler on the Z80 
with wla dx. ;)

Readya,
Markus


----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo@musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.
Received on Thu May 27 10:04:41 2010

This archive was generated by hypermail 2.1.8 : 2010-05-27 10:04:44 CEST