Re: [cc65] segment/memory defines

From: Greg King <gngking1erols.com>
Date: 2004-06-19 15:23:50
From: Shawn Jefferson; on Date: Friday, June 18, 2004, at 02:03 PM
>
> Can you use these from a C program?  I looked in the
> docs., and also tried it, to no avail.
>
> I want to printf("%d", __BSS_LOAD__) or similiar.

Yes.  Remove the first underscore, declare them as external names, and use
their addresses.

#include <stdio.h>

extern unsigned char _BSS_LOAD__[];
extern void const _BSS_SIZE__;
#define __BSS_SIZE__ ((unsigned int)&_BSS_SIZE__)

int main(void) {
 printf("%p\n%u\n", _BSS_LOAD__, __BSS_SIZE__);
 return 0;
 }

----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo@musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.
Received on Sat Jun 19 15:28:15 2004

This archive was generated by hypermail 2.1.8 : 2004-06-19 15:28:22 CEST