Re: [cc65] First steps

Date view Thread view Subject view

From: Mike McCarty (jmccarty_at_ssd.usa.alcatel.com)
Date: 2001-01-02 18:50:02


On Sat, 30 Dec 2000, troy silvey wrote:

> >Is there a special reason for avoiding pointers? Pointers are actually
> >memory addresses, so using a pointer is the easiest solution.
> 
> That's me. Never go the easy way :)
> I am curious if you have a smaller faster program when you
> compile if you use some thing like.....
> 
> #define sprite1_x	 *((unsigned char*) 0xD000)
> 	
> main()
> 	....
> 	sprite_x=0x00
> 
> instead of using pointers.
> I have nothing against using pointers. This is just all part of my
> curiosity and transition from asm to C.	

This *does* use a pointer. Just a constant one.

A technique I have used on the 68HC11 is an include file like this:

(file 68hc11.h; it's unfortunate how the 68HC11 terminology of register
collides with C)


#ifndef REGISTER_H
#define REGISTER_H

#define Register8 unsigned char
#define Register16 unsigned short int

extern Register8 HPRIO;
#define RBOOT 		0x80
#define SMOD  		0x40
#define MDA   		0x20
#define IRV   		0x10
#define PSEL  		0x0F
#asm
_HPRIO		equ	$103C
#endasm

#endif

Typedefs for the defines would be nicer, but I'm using a somewhat
limited compiler.

----------------------------------------------------------------------
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