Re: [cc65] First steps

Date view Thread view Subject view

From: Ullrich von Bassewitz (uz_at_musoftware.de)
Date: 2000-12-30 21:05:29


		  
On Sat, Dec 30, 2000 at 03:08:45PM -0500, troy silvey wrote:
> A quick question. Is it possible to access the
> contents of a memory location directly in C
> with out using variables and pointers?

Is there a special reason for avoiding pointers? Pointers are actually
memory addresses, so using a pointer is the easiest solution.

> I havn't found this mentioned in my stack of
> C books. Some thing similar to the asm
> instructions like sta $d000?

Use something like

	*((unsigned char*) 0xD000) = 0x00;

You may also give the location a name:

	#define VIC    	((unsigned char*) 0xD000)

	*VIC = 0x00;

Or, even better, use the predefined structs from the C64 header file (the
struct definitions are actually in _vic.h, _sid.h ...):

	#include <c64.h>

	VIC.spr0_x = 0x00;

All these instructions translate to something like

	lda    	#$00
	sta	$D000

Regards


	Uz


--
Ullrich von Bassewitz                                  uz_at_musoftware.de
----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo_at_musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.


Date view Thread view Subject view

This archive was generated by hypermail 2.1.3 : 2001-12-14 22:05:37 CET