Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding CH376 chip emulation for Orix/telemon30 #95

Merged
merged 13 commits into from Feb 4, 2017
Merged

Adding CH376 chip emulation for Orix/telemon30 #95

merged 13 commits into from Feb 4, 2017

Conversation

jedeoric
Copy link
Collaborator

@jedeoric jedeoric commented Jan 31, 2017

Hello, as explained on defence-force forum, here is the ch376 emulation.

This emulation is for telestrat only, because i did not finished the electronic card for the atmos, but telestrat mode on Oricutron will do the job.

I did some "ifdef WIN32" because i did emulation on windows. For linux, it should work, but someone should test without ifdef. Morphos should work too because emulation works on Morphos, but i did not compile oricutron on Morphos.

Other thing, when you start telestrat, ch376 emulation starts. If it's a problem let me know.

I would like to add telemon3.0 roms and Orix roms, but i don't know where the rom are in this repository. How can i share theses ROMs in oricutron ?

I did a plugins folder because i think that it's better to prepare any plugins management. And it should be clear in this way. Anyway, if it's a problem let me know.

Docs are here : http://orix.oric.org

Usbdrive is the main folder. Emulation will read files in this directory.

If something is wrong let me know :)

I would like to add some binary on usbdrive folder, let me know if it's a problem for you

machine.c Outdated
#ifdef WIN32
case 0x040:
return ch376_oric_read(oric->tele_ch376, addr);
break;
Copy link
Collaborator

@polluks polluks Jan 31, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dead code because of return above

@jedeoric
Copy link
Collaborator Author

Corrected real ch376 page 3 address in machine.c as Polluks noticed

void ch376_oric_config(struct ch376 *ch376);
void ch376_oric_destroy(struct ch376 *ch376);

void ch376_oric_reset(struct ch376 *ch376);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

EOL

@jedeoric
Copy link
Collaborator Author

Corrected :)


static CH376_BOOL system_init_context(CH376_CONTEXT *context, UNUSED void *user_data)
{
/* Nothing to do */
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need: return CHS376_TRUE;
or ch376_create() will return NULL when compiled on Linux

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed


static void system_file_close(CH376_CONTEXT *context, CH376_FILE file)
{
fclose(file);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

must be enclose by:
if (file) { }

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed


static void system_finish_examine_directory(CH376_CONTEXT *context, CH376_DIR fib)
{
closedir(fib->handle);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

must be enclosed by:
if (fib) { ... }

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

machine.c Outdated
@@ -1091,6 +1114,10 @@ SDL_bool emu_event( SDL_Event *ev, struct machine *oric, SDL_bool *needrender )
via_init( &oric->via, oric, VIA_MAIN );
via_init( &oric->tele_via, oric, VIA_TELESTRAT );
acia_init( &oric->tele_acia, oric );
#ifdef WIN32
oric->tele_ch376=ch376_oric_init();
ch376_oric_config(oric->tele_ch376);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe add a test to check the value of oric->tele_ch376 against NULL in case of memory allocation or context initialization failure in function ch376_create() called by ch376_oric_init()

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

@pete-gordon
Copy link
Owner

I would like to add telemon3.0 roms and Orix roms, but i don't know where the rom are in this repository. How can i share theses ROMs in oricutron ?

Original Oric ROMs are not present in the git repository, because ownership and licensing are unclear. I take the risk of including them in the binary releases, but it is not appropriate for them to be in the repo.

If the Orix ROM is yours, you are welcome to add it to the repo.

@pete-gordon
Copy link
Owner

Please change the "#ifdef WIN32" to a check for "oric->ch376enabled" (or so), and add it as an option to the hardware options menu (and commandline).

@jedeoric
Copy link
Collaborator Author

jedeoric commented Feb 1, 2017

@pete-gordon I added Orix rom managed in gitignore.
For "oric->ch376enabled", i prefer to manage it by configuration file, are you ok ?

@pete-gordon
Copy link
Owner

Yes, that's fine. We can add menu items and command line options later.

@jedeoric
Copy link
Collaborator Author

jedeoric commented Feb 2, 2017

He will try to add menu items.

Adding ch376 into menu
Adding ch376 option in oricutron.cfg
Removing some crap comment
@jedeoric
Copy link
Collaborator Author

jedeoric commented Feb 3, 2017

Hello,

I added ch376 into the menu in hardware section below serial option. ch376 option is also added in .cfg
it's working.
Please note that i did the code to have ch376 working on telestrat emulation. ch376 will work easily on atmos but i don't like the idea to activate the chip in atmos, when i did not released my new card with others stuff on the Atmos

@pete-gordon
Copy link
Owner

What you can do is make it so that if you select "ch376" it automatically switches to telestrat mode. That's what happens when you select other impossible configs, it just switches to the right combination. Do you want to do that on this pull request, or shall I take this one now?

machine.c Outdated
if (addr == 0x340 || addr == 0x341)
ch376_oric_write(oric->ch376, addr, data);
}
break;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't quite correct. If ch476 is NOT activated, writes to 0x34x do nothing, instead of the normal VIA write.

Please move the 0x40 case to just before the "default:" and only do "break" inside the if(), that way if ch376 is NOT enabled, it'll drop into the default case.

machine.c Outdated
return ch376_oric_read(oric->ch376, addr);
}
break;

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as the comment above.

@jedeoric
Copy link
Collaborator Author

jedeoric commented Feb 4, 2017

hello, for telestrat switch, i prefer to release my card before, and i'll add ch376 for others machines.

For the bug noticed, i totally forgot this (VIA6522 answer on the whole page 3 when there is no hardware behind.

@pete-gordon pete-gordon merged commit e235c79 into pete-gordon:master Feb 4, 2017
@pete-gordon
Copy link
Owner

Thanks :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants