VIA 6522 support in Emulator

Chat about anything CX16 related that doesn't fit elsewhere
ZeroByte
Posts: 714
Joined: Wed Feb 10, 2021 2:40 pm

VIA 6522 support in Emulator

Post by ZeroByte »


I've been getting a hankering to tackle this beast myself, as it's languished in the TODO state since always. The current state of the VIAs in emulation is just enough shim code to make VIA talk to the peripherals such as the joysticks/ps2/i2c devices. The timers do nothing but return a random value. It would be nice to actually use these chips as timing sources so we can get other signal rates than 60Hz VSYNC w/o having to do clever things like Concerto does (pokes some samples into the PCM buffer and generates Buffer Low IRQs from VERA).

My question is regarding licensing - I believe the x16emu uses BSD license, and any other open-source libraries brought into the project should either use that, or be compatible with it. I've never dealt much with the legality/licensing side of things, and would hate to bring in a functional VIA library and integrate it to the project, only to find that my pull request can't get merged because of licensing issues.

I feel like I could actually write an implementation from scratch if need be, but why reinvent the wheel if you don't have to? Plus the various forums of other emulator communities makes it seem that accurate VIA emulation is hard to accomplish. (not that I'd be aiming for cycle exact emulation)

 

Elektron72
Posts: 137
Joined: Tue Jun 30, 2020 3:47 pm

VIA 6522 support in Emulator

Post by Elektron72 »



10 minutes ago, ZeroByte said:




My question is regarding licensing - I believe the x16emu uses BSD license, and any other open-source libraries brought into the project should either use that, or be compatible with it.



If you find a VIA emulation library licensed under the MIT, BSD, Apache, or similar licenses, then using it in the project should be fine. On the other hand, we cannot use GPL-licensed code in the emulator (due to this, we'll probably have to replace the ambiguously-licensed YM2151 emulation at some point; luckily, someone has already found a suitable replacement).

User avatar
StephenHorn
Posts: 565
Joined: Tue Apr 28, 2020 12:00 am
Contact:

VIA 6522 support in Emulator

Post by StephenHorn »


Yes, the emulator uses the BSD 2-Clause license. It's an extremely permissive license. And yes, if you're going to submit a PR with someone else's work, you should ensure their license permits its inclusion into the emulator. This generally isn't too difficult, as long as you stay away from copyleft licenses, such as most licenses from the GNU people. Still, if there is any question whatsoever whether the author's code would be allowed to be used in this way, you should attempt to contact them and ask. I think you'll be surprised at how many people don't think terrible hard about their license selection and will reconsider the license, issue a one-off license for use, or otherwise permit their code to be used.

Developer for Box16, the other X16 emulator. (Box16 on GitHub)
I also accept pull requests for x16emu, the official X16 emulator. (x16-emulator on GitHub)
ZeroByte
Posts: 714
Joined: Wed Feb 10, 2021 2:40 pm

VIA 6522 support in Emulator

Post by ZeroByte »



1 hour ago, Elektron72 said:




someone has already found a suitable replacement



This wouldn't happen to be Nuked OPM would it? That one is cycle-accurate, and supports the busy flag behavior - nope - it's GPL2.1

ZeroByte
Posts: 714
Joined: Wed Feb 10, 2021 2:40 pm

VIA 6522 support in Emulator

Post by ZeroByte »


So what is it about GPL that is so incompatible? I mean, I haven't gotten out my legalese decoder kit and started reading to know what it is. Every time I read GPL, it seems like it basically says "anyone can do anything except not include the source and the list of changes" - is it this last proviso? I have been finding several emu projects that have good VIA support, but they all seem to be using GPL because, at least from my own perspective, that's "just the one everybody uses" - I think I'd rather go hungry than be a lawyer, so if there's a TL;DR version of why GPL is incompatible with BSD licensing, I'm very curious.

I mean, I've even used plenty of proprietary closed-source commercial applications and devices which made use of GPL software, and there's usually a README or "ABOUT" page that mentions the presence of opensource code being available upon request / available in the "extra crap" folder, etc... Couldn't x16emu do the same thing - i.e. include a GPL license for the YM code and make that an explicitly-mentioned thing in the sources / license documents? Again, I'm not legal-savvy so this is an "educate me plz" post, not a "let's do this and everything will be fine" post.

I suspect it's the part that says nothing more restrictive can ever happen to this code... (section 6)

Elektron72
Posts: 137
Joined: Tue Jun 30, 2020 3:47 pm

VIA 6522 support in Emulator

Post by Elektron72 »


The current YM2151 emulation seems to be a slightly modified version of the emulation used in the MAME project. Although the version used in the X16 emulator contains no licensing comments, the one that was used in MAME appeared to be licensed under GPLv2. However, someone on the x16-emulator repo on Github posted that MAME has since replaced their YM2151 emulation with a BSD-licensed one.


5 minutes ago, ZeroByte said:




So what is it about GPL that is so incompatible?



The BSD license is commonly stated to be "GPL-compatible," as BSD-licensed code can be used in a GPL-licensed project. However, the reverse is not true. The GPL requires (if you'd like to see the exact requirements, go to this page and scroll to section 5) that any work using GPL-licensed code must also be licensed under the GPL. Therefore, the Commander X16 emulator cannot use GPL-licensed code without being GPL-licensed itself.

ZeroByte
Posts: 714
Joined: Wed Feb 10, 2021 2:40 pm

VIA 6522 support in Emulator

Post by ZeroByte »


I think I'm just going to release most of my stuff into public domain - lol.

User avatar
StephenHorn
Posts: 565
Joined: Tue Apr 28, 2020 12:00 am
Contact:

VIA 6522 support in Emulator

Post by StephenHorn »



39 minutes ago, ZeroByte said:




I think I'm just going to release most of my stuff into public domain - lol.



Honestly, the potential pitfalls and headaches are why I personally use simple licenses that are about as free as possible. My personal projects on GitHub are MIT, mostly because I didn't see "CC BY" or "CC0" in GitHub's list of baked-in licenses. MIT is a short, permissive license that basically says "You can do whatever you want with my code, just-- if you do use my code, keep my copyright notice with it (and, of course, the license). Basically the only thing forbidden is straight-up poaching it and pretending I had nothing to do with it. And liability - hell no I don't warranty my stuff with your random stuff, that's 100% user beware. ? And the liability clause is about the only reason I can think of not to just use CC BY or CC0.

I'm actually not sure, either, to what extent GPL is still protecting or accomplishing their mission of "more and better free software for everyone". Being a bunch of soviet-style communists (you must also be communist or else) tends to scare people away, making it just another walled-garden fortress of the same sort their people claim to be against in the first place (and also claim is unhealthy for the progress of software everywhere). MIT's hippie-style, free-love for code license has no walls.

Developer for Box16, the other X16 emulator. (Box16 on GitHub)
I also accept pull requests for x16emu, the official X16 emulator. (x16-emulator on GitHub)
ZeroByte
Posts: 714
Joined: Wed Feb 10, 2021 2:40 pm

VIA 6522 support in Emulator

Post by ZeroByte »



8 minutes ago, StephenHorn said:




Being a bunch of soviet-style communists (you must also be communist or else) tends to scare people away,



LOL - yeah, the BSD license reads to me kind of like they say strange matter behaves - it turns anything it touches into strange matter as well. It's like a viral midas touch.

I'm not the biggest Richard Stallman fan, but his contributions to the world cannot be denied. I mean, hell, I'm on a Linux box writing this post, and a large portion of the stuff that makes it a usable OS is GNU software.

Elektron72
Posts: 137
Joined: Tue Jun 30, 2020 3:47 pm

VIA 6522 support in Emulator

Post by Elektron72 »



16 minutes ago, StephenHorn said:




I'm actually not sure, either, to what extent BSD is still protecting or accomplishing their mission of "more and better free software for everyone".






7 minutes ago, ZeroByte said:




LOL - yeah, the BSD license reads to me kind of like they say strange matter behaves - it turns anything it touches into strange matter as well. It's like a viral midas touch.



Are you referring to the BSD license or to the GPL and the FSF?

Post Reply