Author Topic: CC65 and the PCE  (Read 5426 times)

elmer

  • Hero Member
  • *****
  • Posts: 2148
Re: CC65 and the PCE
« Reply #60 on: April 20, 2015, 06:47:30 AM »
Quote
I'm just trying to figure out if your current problem is in the current official Mednafen, or it it is something that only breaks with my msys2 build.
i thought too, but no, the two versions have the same issue, a black screen.

It's good to know that all my patches haven't broken anything!

Quote
i tested a new version of flappy with some optimised code in graphic libraries, and it didn't works, i have a black screen, but it works fine on the old mednafen 0.8 and true hardware .

I can see that you've reported the issue on the official Mednafen board, so I'll keep a watch on it there and see if I need to make a new build.

[EDIT]

Looks like you're doing a naughty thing with the SET instruction that's definitely not documented in the official Hudson manual, or Charles MacDonald's hardware notes.

If you confirm that it actually does work on real SGX hardware, can you please test to see if CMP and LDA also work with SET (just like the Mitsubishi 740 series)?
« Last Edit: April 20, 2015, 07:06:04 AM by elmer »

touko

  • Hero Member
  • *****
  • Posts: 953
Re: CC65 and the PCE
« Reply #61 on: April 20, 2015, 07:17:14 AM »
Quote
If you confirm that it actually does work on real SGX hardware, can you please test to see if CMP and LDA also work with SET (just like the Mitsubishi 740 series)?

For now i cannot, bacause i have a real sgx but no flash card (my sgx stuffs was tested by a friend) .
Set is the instruction that i want to test absolutely on real hardware .
But it seems that SBC works too .

Quote
Looks like you're doing a naughty thing with the SET instruction that's definitely not documented in the official Hudson manual, or Charles MacDonald's hardware notes.
i don't really think that SET is the problem, because it works with the old mednafen version .
And works too with PCE stuffs only, even those that contain the same libraries (with the use of SET) .
« Last Edit: April 20, 2015, 07:27:54 AM by touko »

Mednafen

  • Full Member
  • ***
  • Posts: 140
Re: CC65 and the PCE
« Reply #62 on: April 20, 2015, 10:57:08 AM »
Just tested to reconfirm it, SET does not appear to have any effect on SBC when paired with it, on a HuC6280(in my PC Engine Duo).  So at the very least, if you're making programs targeting the PC Engine, it's erroneous to use SET with SBC and expect it to work as it would with ADC.

Mednafen

  • Full Member
  • ***
  • Posts: 140
Re: CC65 and the PCE
« Reply #63 on: April 20, 2015, 11:05:12 AM »

elmer

  • Hero Member
  • *****
  • Posts: 2148
Re: CC65 and the PCE
« Reply #64 on: April 20, 2015, 02:07:51 PM »
Quick and dirty test program: http://sarsie.fobby.net/junk/set-test-apr20-2015.zip

Thanks for knocking this test program up so quickly!

I've tried it on my Core Grafx II and my 3 Super Grafx consoles (OK, so I'm a bit of a fan) ... and the test fails on all 4 with the same screen as on your Duo.

So unless the test itself is flawed (and it seems good to me from a quick look at the assembly source) then Touko ... I'm afraid that I've got to paraphrase the immortal Inigo Montoya and say ....

"I do not think that instruction does what you think it does."  :wink:
« Last Edit: April 20, 2015, 02:11:19 PM by elmer »

Aladar

  • Newbie
  • *
  • Posts: 39
Re: CC65 and the PCE
« Reply #65 on: April 20, 2015, 08:23:06 PM »
Tested years ago with every single opcode: SET affects only ADC, AND, EOR and ORA.

touko

  • Hero Member
  • *****
  • Posts: 953
Re: CC65 and the PCE
« Reply #66 on: April 20, 2015, 09:31:50 PM »
Tested years ago with every single opcode: SET affects only ADC, AND, EOR and ORA.
Yes i saw that on develo book,SET is mentioned only for these opcodes .

I confirm that removing set with sbc made it to work fine ..  :wink:
luckily it was used only in load_vram function :P

Quote
then Touko ... I'm afraid that I've got to paraphrase the immortal Inigo Montoya and say ....

"I do not think that instruction does what you think it does."  :wink:
:lol:

it worked very well on mednafen 0.8,if it was fine for him then it was fine for me  :mrgreen:
And like the great mulder said " I want to believe" . :wink:


Seriously,now i'll test my picky code directly on real thing to be sure .
« Last Edit: April 21, 2015, 12:39:03 AM by touko »

Debvgger_

  • Newbie
  • *
  • Posts: 27
Re: CC65 and the PCE
« Reply #67 on: April 21, 2015, 11:29:44 AM »
Hey elmer, thank you very much for this version of mednafen :-) It's very much appreciated.

I don't know how many people would be interested, but you can bet I would use CA65 and LD65 :-)

elmer

  • Hero Member
  • *****
  • Posts: 2148
Re: CC65 and the PCE
« Reply #68 on: August 11, 2015, 10:08:03 AM »
I've put up another new Windows build of Mednafen (with my changes) for anyone that wants it ...

https://www.dropbox.com/s/o967dmh3v5kq4hg/mednafen-0.9.38.5-x86-elmer.zip?dl=0

Just to remind any newcomers to this thread, the modifications are in Mednafen's PCE and PC-FX debugger displays in order to make them a bit more pleasant to look at, and readable.

This is still a 32-bit version that only supports the PCE and PC-FX.

New features are ...
[ul][li]Built with the recent Mednafen 0.9.38.5 release (which fixes a PC-FX bug).[/li][li]Built with latest msys2 GCC compiler in the hope that this might run on Windows 10.[/li][/ul]
The patch files and a build script are available at ...

https://www.dropbox.com/s/nuqejdtmxpgur4d/build-msys2-mednafen-0.9.38.5-x86-elmer.zip?dl=0

NightWolve

  • Hero Member
  • *****
  • Posts: 5277
Re: CC65 and the PCE
« Reply #69 on: August 11, 2015, 10:52:56 AM »
Quote from: elmer
then Touko ... I'm afraid that I've got to paraphrase the immortal Inigo Montoya and say ....

"I do not think that instruction does what you think it does."  :wink:
:lol: it worked very well on mednafen 0.8,if it was fine for him then it was fine for me  :mrgreen:
And like the great mulder said " I want to believe" . :wink:

An Inigo Montoya reference followed by one from X-Files in the same thread, great stuff! :)

Interesting read in this thread BTW, tried to catch up and read most of it!

elmer

  • Hero Member
  • *****
  • Posts: 2148
Re: CC65 and the PCE
« Reply #70 on: November 11, 2015, 10:29:13 AM »
Bonknuts posted that CC65 has recently got support for the PCE, so I thought that I'd give it a try.

It's only got console-io at the moment, but it certainly works in Mednafen.

Looks like it's time to start figuring out what library functions could be ported over from HuC!  :wink:

#include <conio.h>

void main (void)
{
   unsigned uLine;
   for (uLine = 2; uLine < 30; uLine += 2)
   {
      cputs( "Hello, World!\n\r" );
      cprintf( "CC65 console line %d\n\r", uLine );
   };
   while (1);
}





« Last Edit: November 11, 2015, 10:31:31 AM by elmer »

elmer

  • Hero Member
  • *****
  • Posts: 2148
Re: CC65 and the PCE
« Reply #71 on: November 28, 2015, 06:08:14 AM »
Since the HuC code for reading/writing a Turbo Everdrive's SD card seems to have been stuck for quite a while now, I thought that I'd see if CC65 could compile one of the more popular open-source FAT32 libraries.

It compiles with no problem at all.  :)

Here's the size of the compiled code with various different options enabled.


FatFs - Generic FAT File System Module
http://elm-chan.org/fsw/ff/00index_e.html

Size            Writable     Long Filename   Limitations
-------------------------------------------------------------
$725B : FATFS : read-write : UNICODE LFN   :
$3E3F : FATFS : read-only  : UNICODE LFN   :
$34F9 : FATFS : read-only  : UNICODE LFN   : no directories
$239F : FATFS : read-only  : no LFN, CP437 : no directories



Petit FAT File System Module
http://elm-chan.org/fsw/ff/00index_p.html

Size            Writable     Long Filename   Limitations
-------------------------------------------------------------
$1A42 : PFF3, : read-write : no LFN, CP437 : no lseek, fat16 & fat32
$1907 : PFF3, : read-write : no LFN, CP437 : no lseek, fat32 only
$16fa : PFF3, : read-only  : no LFN, CP437 : no lseek, fat16 & fat32
$15BF : PFF3, : read-only  : no LFN, CP437 : no lseek, fat32 only



Now, if I could get the TED2 low-level assembly code to actually read blocks of data from the SD card instead of crashing, then we might have something useful.  :-k

ccovell

  • Hero Member
  • *****
  • Posts: 2245
Re: CC65 and the PCE
« Reply #72 on: November 28, 2015, 11:30:55 AM »
Can these actually be made into libraries accessible from ROMs, eg PCEmon, a hacked TenNoKoe Bank ROM, etc?

elmer

  • Hero Member
  • *****
  • Posts: 2148
Re: CC65 and the PCE
« Reply #73 on: November 28, 2015, 12:54:31 PM »
Can these actually be made into libraries accessible from ROMs, eg PCEmon, a hacked TenNoKoe Bank ROM, etc?

I don't think that I quite understand the question?

These are libraries, distributed as "C" source.

You just include them in your CC65 project, decide what code/data segments/banks you want to put them in ... and use them.

CC65 doesn't really impose any limitations on where you choose to place stuff ... it is entirely flexible.

With CC65/CA65, it's easy to mix "C" and assembly code ... so you just write your ROM in whichever language makes you happy.

I still need to finish-off low-level SD-card access functions ... the one's that Mooz did for the TED1 have needed a fair bit of fiddling about to get them even partially-working on the TED2.

I can't see them being much use for hacking into the TenNoKoe Bank ROM. Instead, I'd rather assume that anyone wanting to copy data from Backup Memory to SD card would just write a completely new ROM.

If you're thinking about an expanded Super System Card with something like PCEMon and copying Backup Memory to/from SD card, saving screen grabs on SD card, etc ... then "yes", I'd say that it is certainly possible.

Something along those lines is one of my goals, with the TED2 System Card patch as a 1st-step.

The TED2's built-in USB connection to a PC makes things even easier and more convenient for people.

Arkhan

  • Hero Member
  • *****
  • Posts: 14142
  • Fuck Elmer.
    • Incessant Negativity Software
Re: CC65 and the PCE
« Reply #74 on: November 30, 2015, 05:55:47 PM »
I think the topic of CC65 came up awhilllllle ago one time, and it never went anywhere only because there were (are) like 3 active developers.

at the time I think it was something like, Bonknuts wasn't using C, we were already successfully bitch slapping HuC into producing games that move faster than -12 FPS, Rover was around there too, and Cabbage was using ASM too?

so nobody wanted to make libraries or spend time on it.

Squirrel would have to be re-diddled for CC65 at some point, assuming it's usage takes off.  Without Squirrel, basically any compiler is useless to me.


I don't think it would be too hard.   Famous last words.
[Fri 19:34]<nectarsis> been wanting to try that one for awhile now Ope
[Fri 19:33]<Opethian> l;ol huge dong

I'm a max level Forum Warrior.  I'm immortal.
If you're not ready to defend your claims, don't post em.