PCEngineFans.com - The PC Engine and TurboGrafx-16 Community Forum

Tech and Homebrew => Turbo/PCE Game/Tool Development => Topic started by: Fabrizio Caruso on February 05, 2018, 11:53:18 PM

Title: [CC65][linker][help] How can I configure CC65's linker to build PCE roms > 8k
Post by: Fabrizio Caruso on February 05, 2018, 11:53:18 PM
Hi everyone!

I am developing CROSS CHASE,
https://github.com/Fabrizio-Caruso/CROSS-CHASE
which is a universal 8 bit game for ALL 8-bit computer/consoles/handhelds. The very SAME code is used for about 100 different targets.


For targets with the 6502 CPU (and derivaties) I am using CC65.
For the PCEngine I have not been able to get it to build any rom bigger than 8k.
Currently I can get a working build if I use 8k in $E000-$FFFF.

Could someone please help me on this?

  Fabrizio

Title: Re: [CC65][linker][help] How can I configure CC65's linker to build roms > 8k
Post by: Arkhan on February 06, 2018, 06:45:29 PM
I honestly have no clue.  have you asked at NES or C64 forums? 

If someone else here doesn't answer and you find answers elsewhere, let us know!
Title: Re: [CC65][linker][help] How can I configure CC65's linker to build roms > 8k
Post by: Fabrizio Caruso on February 06, 2018, 07:35:48 PM
This is PCE-related. Sorry for not being explicit about it.
Title: Re: [CC65][linker][help] How can I configure CC65's linker to build PCE roms > 8k
Post by: spenoza on February 07, 2018, 11:15:55 AM
Ping Elmer. I think CC65 is his bag.
Title: Re: [CC65][linker][help] How can I configure CC65's linker to build PCE roms > 8k
Post by: Arkhan on February 07, 2018, 02:31:48 PM
This is PCE-related. Sorry for not being explicit about it.

Oh, I figured there were other 6502s in the 100s of targets.

Elmer probably has some idea of it.

I only ever used CC65 with a C64 and it was about 8 years ago.
Title: Re: [CC65][linker][help] How can I configure CC65's linker to build PCE roms > 8k
Post by: elmer on February 08, 2018, 08:13:10 AM
For targets with the 6502 CPU (and derivaties) I am using CC65.

For the PCEngine I have not been able to get it to build any rom bigger than 8k.
Currently I can get a working build if I use 8k in $E000-$FFFF.

Could someone please help me on this?

See here ...

http://www.pcenginefx.com/forums/index.php?topic=18654.msg448587#msg448587

But, after further investigation ...

I *really* don't recommend using CC65 on the PCE at this point, because the compiler and assembler really don't like that our PCE's HuC6280 processor has zero page at $2000 instead of $0000.

Also, their PCE library support was woeful the last time I looked.

They've been mulling-over how to fix CA65 for nearly 9 months now, and the trail has gone dead.


That's why I started putting so much effort into fixing up and improving HuC instead.
Title: Re: [CC65][linker][help] How can I configure CC65's linker to build PCE roms > 8k
Post by: ccovell on February 08, 2018, 11:47:44 AM
I *really* don't recommend using CC65 on the PCE at this point, because the compiler and assembler really don't like that our PCE's HuC6280 processor has zero page at $2000 instead of $0000.

Is the compiler/assembler actually referencing ZP as word addresses each time?  :/
Title: Re: [CC65][linker][help] How can I configure CC65's linker to build PCE roms > 8k
Post by: elmer on February 08, 2018, 06:45:55 PM
Is the compiler/assembler actually referencing ZP as word addresses each time?  :/

If a label is tagged as a ZP label, then (IIRC) it will usually use ZP addressing ... except inside procedures, when all the rules change because nested label space handling is horribly broken in CA65.

BUT ... any label in $00xx range is automatically addressed as ZP if possible, and anything in our $20xx range is word-addressed.

I proposed a couple of quick-hack workarounds ... but they would still break in nested label spaces.

CA65 needs some serious work ... and the current maintainers are treating the source code like the Holy Grail.

Another reason for me to mess with HuC ... it *can* be messed with, and the only reason that its code sometimes sucks vs CC65, is because of specific CC65 peephole optimizations that could (not trivially, but with some work) be applied to HuC.

Both compilers are based off of Ron Cain's original Small C.
Title: Re: [CC65][linker][help] How can I configure CC65's linker to build PCE roms > 8k
Post by: Gredler on February 09, 2018, 05:18:17 AM
Good to see you back around these parts Elmer, hope all is going well with you sir.

I have such little knowledge on this I didn't want to chime in, but I also wanted to say that Elmer would know whats up and that last I heard CC65 was a dead end and your efforts on HuC were due to that rabbit hole avoidance.

Title: Re: [CC65][linker][help] How can I configure CC65's linker to build PCE roms > 8k
Post by: Arkhan on February 09, 2018, 05:30:28 PM
I apparently read all about this last year and don't even remember doing so, which shows you how "if you don't use it, you lose it" is a thing.

lol