Re: [cc65] meaning of "bss" and "data" in the library files

Date view Thread view Subject view

From: Ullrich von Bassewitz (uz_at_musoftware.de)
Date: 2001-01-08 10:15:25


On Mon, Jan 08, 2001 at 04:53:06PM +0800, tony fu wrote:
> Could you explain the meaning of "bss" and "data" in
> the library files?

BSS is an uninitialized segment, it is not written to the output file but
cleared (zeroed out) on program startup (for C programs only!). ".bss" is the
assembler command that makes the BSS segment the current segment.

DATA is the segment for initialized data. ".data" is the assembler command
that makes the DATA segment the current segment.

Uninitialized static variables go into the BSS segment, initialized static
variables go to the DATA segment, static const variables go into the RODATA
segment:

	static int i;	       	    		/* --> BSS */
	static int i = 3;      	    		/* --> DATA */
	static const int i = 3;	    		/* --> RODATA */
	static const char hello[] = "hello";	/* --> RODATA */

> What are these two words meaning?
>       1: 	.word  	__BSS_RUN__+__BSS_SIZE__
>       2:	ldx	#>__BSS_SIZE__

These are linker defined symbols related to the BSS segment. They are
explained in more detail in the linker documentation (see there). In short:

	__BSS_RUN__	is the run address of the BSS segment	
	__BSS_SIZE__	is the size of the BSS segment

> Where are can I get details about assembler directives
>  such as ".word	.import.  export.  importzp"?

The assembler documentation explains these directives in detail.

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:38 CET