It sounds like it might be trying to compile it in C or use a library.
But why would it do that? I only do the following:
I have a file test.s containing two lines:
On the command prompt I write:
ca65 test.s
It finishes without any output to the screen, but it generates a file test.o
I then write on the command promtpt
cl65 test.o
And it gives me the error message: Unresolved external '_main' referenced in: crt0.s(10)
If I try giving the asm file directly to the linker, like this:
cl65 test.s
I get exactly the same error.
I can't find the file crt0.s anywhere, maybe it's inside the c64.lib file or something, and that it expects a _main label or something, but adding a '_main' label it just complains about a missing ':', and adding '_main:' it still gives the same 'unresolved symbol _main' error.
I never use those features though
And I don't want to use them either
(well, there's no official library for the NES, and I don't know C, heheh), so I only use ca65.exe to assemble and ld65.exe to link the objects.
Could you show me the exact syntax you use to do that?
One difference with ca65 compared to other assemblers is that you can't use .ORG in the usual way, or pad to a certain address. Instead you set up segments for the linker to use,
But do I need to use a segment for my small example?
and use .segment commands in the assembler to output stuff there. I believe there's a linker config for the C64 built-in, but you can make your own if you need to.
My problem is, I don't have any idea how to make a linker config.
If that sounds useable for you, read the docs for ld65 and ca65. There's a lot of info in there.
I did read the docs for ld65, but it only contained 7 almost empty pages, leaving me non the wiser. I've looked through the ca65 documentation quickly, I'm reading through it again more thoroughly now, but it's not of much help either. I just need a single example of code that can be compiled and linked directly and I can figure it out from there, but only code fragments are given.
My problem with the documentation is that it looks like it's written for somebody that allready knows how everything works. It's really frustrating.
I tried following the simple cc65 compiler intro doc, but it starts out by saying I should examine and understand the commands in the file "cc65setup.bat" in the samples/tutorial directory, but there is no .bat file there. The rest of the tutorial works though, but I still don't know whats wrong with my example.
Do you know if there exist any page with just a ca65 .s file ready to be assembled and linked I can look at?
UPDATE: I got it to work!
While writing this post I managed to get it to work. This file
Code: Select all
.export _main
.proc _main
: clc
bcc :-
.endproc
seems to work. At 252 bytes it's a bit bloated, and I still don't understand how to specify where my code should go, but that's just details, I can worry about those later
I looked at the generated code with the monitor in the Vice emulator, and it's there, but it's surrounded by code that I don't know what does (except that it changes the font to the lower case one), but it's probably harmless and only adds one block to the file size, so I don't care (for now

)
There is 13 bytes of Basic code (to start the asm program), 85 bytes of unknown code, my program (3 bytes), and then some more unknown code. I'll take a closer look at it later.
Maybe I could somehow make it not target any platform, and append the bytes needed to make it a .prg file myself?
Thank you for your help, I greatly apreciated it.