Jump to content
Sign in to follow this  
TGB1718

cc65 question

Recommended Posts

I'm writing a device handler in cc65, it has a .c file and a .s file,

I want to produce a listing of the build, I have '--listing centxe.lst' in the build call, but all it

produces is a listing file of the .s file, not the .c file which is a bit daft as I already have the .s listing.

 

Here's the call to build, any ideas as what I'm doing wrong, pretty sure I've seen the correct ouput before on another project.

 

cl65 -t atari -O -Wl "-D__RESERVED_MEMORY__=1" --static-locals --listing centxe.lst centxe_main.c centxe_asm.s -o centxe.xex

 

this is what I get:-

 

ca65 V2.18 - Git beaa77d
Main file   : centxe_asm.s
Current file: centxe_asm.s

000000r 1                 ; .include "atari.inc"
000000r 1                 HATABS=$31A
000000r 1               
000000r 1                  .export _sethatabs
000000r 1                  .import _popen,_pclose,_pread,_pwrite,_pinit
000000r 1                  .proc _sethatabs: near
000000r 1                  .code
000000r 1                  _sethatabs:
000000r 1  A0 00        INTABLE:  LDY #0
000002r 1  B9 1A 03     FLOOP:    LDA HATABS,Y
000005r 1  C9 50                 CMP #'P'
000007r 1  F0 09                 BEQ FOUND
000009r 1  C8                    INY
00000Ar 1  C8                    INY
00000Br 1  C8                    INY
00000Cr 1  C0 22                 CPY #34
00000Er 1  D0 F2                 BNE FLOOP
000010r 1  38                    SEC
000011r 1  60                    RTS
000012r 1  A9 rr        FOUND:    LDA #<PTABLE
000014r 1  C8                    INY
000015r 1  99 1A 03              STA HATABS,Y
000018r 1  A9 rr                 LDA #>PTABLE
00001Ar 1  C8                    INY
00001Br 1  99 1A 03              STA HATABS,Y
00001Er 1  60                    RTS
00001Fr 1  rr rr rr rr  PTABLE: .WORD _popen,_pclose,_pread,_pwrite,_pinit,_pinit
000023r 1  rr rr rr rr  
000027r 1  rr rr rr rr  
00002Br 1  4C rr rr              JMP _pinit
00002Er 1                  .endproc
00002Er 1               

Share this post


Link to post
Share on other sites

You're using a much later version that I did, but just a -l on the cl65 command should do it. You have a -Wl, but I don't see just the -l. I am not familiar with --listing, they must have added that one (or I ignored it it for the shorter form). At any rate I did not have issues using mixed .c and .s files with output listings.

Share this post


Link to post
Share on other sites

-l = --listing although on the cc65 web page it doesn't mention -l is the short form :)

I changed the build script to

 cl65 -t atari -O "-D__RESERVED_MEMORY__=1" --static-locals -l centxe.lst centxe_main.c centxe_asm.s -o centxe.xex

 

but still only the .s file is produced in the listing

 

Interestingly I just tried with an older project that doesn't have a .s but does have 2 .c files and only one of them is produced

in the listing and again, not the MAIN.C program file, really odd behavior.

Share this post


Link to post
Share on other sites

Think I've solved it, it would appear only one file can be listed at a time and it looks like it's the last file on the

command line, this now producing a listing for the .c file but not the .s

 

cl65 -t atari -O "-D__RESERVED_MEMORY__=1" --static-locals -l centxe.lst -o centxe.xex centxe_asm.s centxe_main.c 

 

So it's a 'quirk/bug' in cc65

Share this post


Link to post
Share on other sites

If you have more than one source file you can compile each source file separately (with optional different option) with the "-c" command line switch. Then link all the object files together.

Example:

 

$ cl65 -t atari -c -o file1.o  file1.s
$ cl65 -t atari -c -o file2.o  file2.c
$ cl65 -t atari    -o prog.com file1.o file2.o

 

  • Like 1

Share this post


Link to post
Share on other sites

And, if an asm source file is OK instead of a "listing", use cc65.

 

cc65 translates a file from C to assembler (it's called under the hood by cl65)

  • Like 1

Share this post


Link to post
Share on other sites

Many thanks @sanny that makes much more sense to compile individually and link later.

 

Update: Works a treat with the -c thanks again

Edited by TGB1718
Update

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...