[Color Computer] [coco] Learning MW C

Charles Richmond richmond at plano.net
Sat Aug 12 01:47:59 EDT 2006


On Aug 11, 2006, at 7:11 PM, George's Coco Address wrote:


> For several years, I've been wanting to learn "C" .. the one that

> comes

> with OS-9.

>

> The hang up is peeks and pokes. I can't find a way to do this with

> "C".

>

> Can anyone help with this?


Declare a character pointer like this:

char *cptr = (char *) 0xabcd; /* abcd is the address to poke */

In the executable instructions, do this:

*cptr = 35; /* this pokes decimal 35 into hex address 0xabcd */

*cptr = 0xff; /* this pokes hex ff into hex address 0xabcd */

cptr = (char *) 0x0100; /* this changes the address to hex 100 */

*cptr = 0xaa; /* this pokes hex aa into hex address 100 */


If you want, you can declare the pointer *without* initializing it to
a value. Just be sure to assign an address to the pointer *before* you
attempt to do a "poke".

--
+----------------------------------------------------------------+

| Charles and Francis Richmond richmond at plano dot net |

+----------------------------------------------------------------+





Brought to you by the 6809, the 6803 and their cousins!
Yahoo! Groups Links

<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/ColorComputer/

<*> To unsubscribe from this group, send an email to:
ColorComputer-unsubscribe at yahoogroups.com

<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/






More information about the Coco mailing list