[cc65] ca65 question

From: <silverdr1inet.com.pl>
Date: 2008-01-21 03:13:22
Hello!

I recently decided to reorganise the code of one of my projects to  
make use of the advanced features of ca65/ld65 (possibly later also  
cc65). I wrote nice Makefile and started reorganising the code but I  
hit a bump right on the beginning. I have a main file, which contains  
something like:

.include "basicstub.asm"

main:
	lda #$00
	[...]


and the basicstub.asm looks like:

;----------------------------------------
	.word basicstub

.ORG	$0801
basicstub:
	.word _nextline				; pointer to next BASIC line
	.word 2005				; line number
	.byte $9e				; token for SYS command
	.byte <(((main / 1000) .mod 10) + $30)	; SYS address
	.byte <(((main / 100 ) .mod 10) + $30)
	.byte <(((main / 10  ) .mod 10) + $30)
	.byte <(((main       ) .mod 10) + $30)
	.byte ":"
	.byte $8f				; token for REM
	.byte $14, $14, $14, $14		; remove the REM keyword
	.byte $0d				; print the rest on the next line
	.byte $0d				; print the rest on the next line
	.byte PROGRAM_NAME
	.byte $20
	.byte VERSION_TAG
	.byte $0d				; print the rest on the next line
	.byte COPYRIGHT_NOTICE
	.byte $0d				; print the rest on the next line
	.byte $00
_nextline:
	.word $0000				; double zero means no more lines
;-----------------------------------------------------------------------------------

Now, when I link it with "ld65 -t c64 -Ln $(PROGRAM).labels" I get a  
warning:

ld65: Warning: [builtin config](6): Segment `STARTUP' does not exist

and the resulting file loads at $20EE rather than $0801!


Thus I added

.segment "STARTUP"
.include "basicstub.asm"

main:
	lda #$00
	[...]


Which seems to cure the problem but... the documentation says about  
"STARTUP" segment that: "This segment contains the startup code which  
initializes the C software stack and the libraries. It is placed in  
its own segment because it needs to be loaded at the lowest possible  
program address on several platforms."

I don't initialise "C software stack and the libraries" here. I just  
want the file to be assembled and load into the address I want it to.  
What if I wanted it to load at a different address - say $5000? I  
assume .segment "STARTUP" wouldn't help there..

Please enlighten me what am I doing wrong here.

----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo@musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.
Received on Mon Jan 21 03:13:30 2008

This archive was generated by hypermail 2.1.8 : 2008-01-21 03:13:33 CET