It is currently Tue Dec 11, 2018 6:46 pm

All times are UTC - 7 hours



Forum rules





Post new topic Reply to topic  [ 26 posts ]  Go to page Previous  1, 2
Author Message
PostPosted: Mon Oct 08, 2018 12:53 am 
Offline

Joined: Tue Oct 06, 2015 10:16 am
Posts: 844
byuu wrote:
Quote:
Overall it does seem like the development scene is pretty slow even compared with the NES and Mega Drive, never mind the C64...
There's been a persistent barrier in that even the best, structured 65816 code is basically a write-only language (I've had to abandon several fan translations due to code rot.) And the CPU is just too slow and too limited (*one* accumulator, *two* index registers, awkward 8/16-bit toggling) to pull off a higher level language.

What has made the Mega Drive a breakout hit in homebrew is that you can write the non-critical sections in C. Any attempts at C with the 65xx chips produce unusably slow code.

I disagree. The 816 is relatively suitable for C, its stack modes in particular are useful for that; not as well as m68k, but far from unusable. I have several titles shipped in C for the NES, and Little Medusa for SNES, and given it's not unusably slow for NES, how could it be for the 1.5-2x faster SNES?

It's not the lack of suitability, but the lack of a compiler. Genesis has the latest GCC, arguably the best compiler in the world. SNES has nothing*, though I managed to use cc65 on it, cc65 doesn't count as a "real" SNES compiler in that it doesn't support it fully. It works, but it produces 8-bit code, which is not as fast as it could be on a 16-bit processor.

You can expect more SNES titles now that we have cc65 set up. Even with its limitations, it's a massive productivity improvement over asm.

*No, the WDC blob does not count. See previous threads.


Top
 Profile  
 
PostPosted: Mon Oct 08, 2018 2:39 am 
Offline

Joined: Tue Feb 07, 2017 2:03 am
Posts: 629
while I will agree that 65816 is not the most readable language, and write only as you put it. I will however point out that 65816 is good solid chunk a head of 6502 in this regard, and the superlative specs of the SNES make it less of an issue compared to a C64.


Top
 Profile  
 
PostPosted: Mon Oct 08, 2018 7:56 am 
Offline
User avatar

Joined: Tue Jun 24, 2008 8:38 pm
Posts: 2121
Location: Fukuoka, Japan
@Calima

I'm curious regarding your cc65 comment for the snes. What are the limitation to expect? Since I like more and more to write c code for the nes the logical thing would be to write some for snes too but it's always good to be aware about the trade off to do so.


Top
 Profile  
 
PostPosted: Mon Oct 08, 2018 10:34 am 
Offline

Joined: Tue Oct 06, 2015 10:16 am
Posts: 844
In general, cc65 is limited in that it's not a C-level optimizing compiler. It just translates what you write, and applies some asm-level optimizations. SNES specifically, it doesn't do banking, but just like with NES banking, you can work around that, with trampolines for example.


Top
 Profile  
 
PostPosted: Mon Oct 08, 2018 6:31 pm 
Offline
User avatar

Joined: Tue Jun 24, 2008 8:38 pm
Posts: 2121
Location: Fukuoka, Japan
For banking that is not a big issue. What I would be more concerned is the comment about 8 bit generated code. That seems not much convenient. For UI screen it may be ok but more intensive code, I guess it need to be written in asm anyway.


Top
 Profile  
 
PostPosted: Mon Oct 08, 2018 11:13 pm 
Offline

Joined: Tue Feb 07, 2017 2:03 am
Posts: 629
yeah so not, direct banking, no 16bit code, not ,s stack relative commands, no faster 65816 versions of opcodes, the 65816 has a 6502 emulation mode.


How do you make a trampoline on the SNES, it doesn't have banking registers. Does CA65 at least you do something like
Code:
_asm {
  JSL function
}
I guess it also forces you into LOROM only?

Honestly if you want to use C on the SNES you would be better of using the OCRA/C https://github.com/byteworksinc/ORCA-C it will at least make native 65816 code and use ,s


Top
 Profile  
 
PostPosted: Tue Oct 09, 2018 1:21 am 
Offline

Joined: Tue Oct 06, 2015 10:16 am
Posts: 844
ORCA-C's license has a no commercial use clause. That's a dealbreaker, so I didn't even look further at what it might be able to do.

When told to compile for 816, cc65 uses the best instructions it knows, which are the 65c02 extensions IIRC. Thus the code is better than when targeting NES, even if it doesn't know about 816-exclusive instructions. cc65 allows inline asm, and a SNES trampoline might work by a jump table, but many other ways too. Lorom yes, since it expects RAM in the same address space. It does not use the 6502 emulation mode, it runs natively, meaning any asm functions you've written can use anything new.

That's not much different from the NES; the speed-requiring functions are written in asm and everything else in C.


Top
 Profile  
 
PostPosted: Tue Oct 09, 2018 1:25 am 
Offline

Joined: Tue Feb 07, 2017 2:03 am
Posts: 629
but does it understand 65816 asm or only 65c02 asm?

Also the ORCA suite is available to purchase https://juiced.gs/store/opus-ii-software/ which given its a language development suite would be fine for commercial purposes.


Top
 Profile  
 
PostPosted: Tue Oct 09, 2018 10:28 am 
Offline

Joined: Tue Oct 06, 2015 10:16 am
Posts: 844
Yes, a paid version would not have that limitation. It would then still need to run on an Apple II (emulator), you couldn't change it, etc. which may not be obstacles to you.

cc65 inline asm passes it verbatim. ca65 supports 65816 fully.


Top
 Profile  
 
PostPosted: Tue Oct 09, 2018 10:46 am 
Offline

Joined: Sun Apr 13, 2008 11:12 am
Posts: 7812
Location: Seattle
Oziphantom wrote:
but does it understand 65816 asm or only 65c02 asm?
calima wrote:
cc65 inline asm passes it verbatim. ca65 supports 65816 fully.
To expand on this, cc65 just generates asm, not an object file. So any inline asm simply doesn't get translated from C to asm, instead being copied over.


Top
 Profile  
 
PostPosted: Tue Oct 09, 2018 5:31 pm 
Offline
User avatar

Joined: Tue Jun 24, 2008 8:38 pm
Posts: 2121
Location: Fukuoka, Japan
I guess for my current needs cc65 is more than enough. I'm not ready to jump on a snes project yet but I may want someday to experiment a little bit so this could be what I'm looking for.

Maybe by the time I really make some project some new compiler etc may comes out, who knows? I'm used to take long break so I'm in no rush :D


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 26 posts ]  Go to page Previous  1, 2

All times are UTC - 7 hours


Who is online

Users browsing this forum: Google [Bot] and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group