2MHz

Started by hydrophilic, January 28, 2007, 07:44 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

hydrophilic

Last night I started on a project to add 2MHz mode to VICE.  Strange that VICE has been out for years and this hasn't been done.  Today I finished (pretty much) and tested it with GEOS 128 and CP/M and now they really rock!

I also tested with a 40-Column C128 game called Stealth Mission, and several C64 games that use 2MHz when run on C128.  In these cases, 2MHz is only enabled during the vertical borders.

I tested with true drive emulation (required for GEOS and CP/M) and the emulated drive (the C64 programs).

For GEOS 128, I tested GeoWrite and GeoBASIC.  It worked flawlessly with 1581, 1541-II, and REU.  It crashed when swapping REU with 1571 but then I tried it with original VICE 1.20 and it also crashed... I was never so happy to see a program crash in my life :)  I don't have a lot of GEOS stuff, so I only spent about an hour.

For CP/M, I tested WordStar, Microsoft BASIC 5.2, and various archiving software.  This was with a 1581, 1571, and REU.  No problems, but I didn't do a lot of testing again maybe an hour.

For the 40-column modes (both C128 and C64 modes) I spent hours playing various games.  Some were 80-column text games, but most were 40-column flight sims.  Hours of fun!  The only problem I had was when my screen saver popped up in windows.   This always crashed VICE.  I haven't yet checked if it happens in the original 1.20 version.

I sent the VICE folks (another) email, but so far no word.  So I was just curious if anyone here might want to try it out?

Blacklord

You wanna zip up the executable & email it to me ? (landover@tpg.com.au) I'll wack it up in the downloads area.

Lance

nikoniko

That's great, Hydrophilic! I'd also love to try it out. T'would be very handy with one of the projects I'm working on.

Golan Klinger

Quote from: adminYou wanna zip up the executable & email it to me ? (landover@tpg.com.au) I'll wack it up in the downloads area.
This would violate the license. The source code must be included with any modified binaries. My feeling is that it would be a lot better (safer and wiser) to allow the VICE team to examine the changes to determine that they work properly and don't cause problems elsewhere. They can include them in a new release. Forking the 128 emulator from VICE is a *bad* idea.
Call me Golan; my parents did.

nikoniko

I don't think anyone's talking about forking here. Hydrophilic has initiated contact with the team and I know they'll review his work once they have time. If there are issues with the code which he hasn't forseen, I'm sure he'll want to work with them on that rather than forking off and doing his own thing.

Regardless, it wouldn't be a violation to distribute a derivative work in executable form without source. The source code needs to be available upon request, and displayed by the program or included as part of the distributed archive need to be the relevant copyright notices, disclaimers, notice of changes, and the full text of the GPL license 2 or later, but as long as those conditions are met, it's not a violation to distribute the executable without source.

I'm actually very happy that many projects do not force me to download source together with the executable, as most of the time I don't intend to make any changes and simply want to run the program. But it's nice to know that I could always obtain the source separately if I wanted to.

hydrophilic

OK, I found out the crash during screen saver is also in the original VICE 1.20 so not my fault :)

I finally got word from a VICE team member today.  In a few minutes I'm gonna create a diff to send to them then I'll pack the Windows binary along with the modified sorce files (not the full distribution) and email for you folks to try.   If anybody really needs the full distrubition they can email me through the forum and I'll make arrangements.

nikoniko

Glad to hear the VICE team will be taking a look at it soon. From old versions of the VICE page in Archive.org, I see that 2MHz has been on the To Do Next (or not) list for some years already. Would be quite amazing if you've accomplished in one night what hasn't been achieved in years. Even if it's not 100% perfect, as long as it doesn't have negative consequences on other parts of the emulation it'll be a big step forward for the project. Thanks for the effort you're putting into this. :)

hydrophilic

I've uploaded the zip to the admin so it should be in the downloads soon.

Quote from: nikonikoFrom old versions of the VICE page in Archive.org, I see that 2MHz has been on the To Do Next (or not) list for some years already. Would be quite amazing if you've accomplished in one night what hasn't been achieved in years.
They don't have the same priorities we do.

I hope people find it useful.  The cool thing, IMHO, is the code is very simple and general.  It would be easy to make the CPU do something like 16MHz, assuming your PC can keep up!

If you try it, let me know what you think.

Blacklord

File's been uploaded - you can find it in the Commodore 128 emulators section at http://www.commodore128.org/down33.html

(It's the very first file listed, so you shouldn't miss it......)

cheers,

Lance

Stephane Richard

Hidrophillic, I'm gonna tattoo your name on my right arn. ;-)...LOL.

It's pretty impressive work, especially for a day thing...I'm downloading it right away, I'll let you know if I come across any problems.  but my guess is if GEOS and CP/M work good so far, it's already a damn good sign :-).

Thank you and I'm glad to see they'll be looking, atleast they answer your emails, I haven't had an answer from them in like 5 months or so...to my last 6 emails.  

I certain appreciate the work since I don't have a C-128 (or a C-128 warehouse like some others here ;-) hehe) All I have is VICE. :-).

Thank you for your efforts.
When God created light, so too was born, the first Shadow!

MystikShadows

nikoniko

I've only had time to take a real quick peek so far, but seems like a good tide-me-over until the whole clock system gets an overhaul. Only one nitpick: the distribution isn't quite GPL-compliant. Take a look at VICE team's copyright section for the licensing information you need to include.

Thanks again for your efforts to improve the VICE experience!

Golan Klinger

Quote from: nikonikoI don't think anyone's talking about forking here.
That's true. I just wanted to preempt the idea. :)

I also want to make it clear that I wasn't poo-pooing the idea. I just wanted to make sure the point about the being in compliance with the GPL was raised as was the concern about splintering. As long as the VICE team is up to speed, it's all good. Any additions and/or improvements to VICE are welcome. The other reason I was concerned about source is that not of all of us (me, for example) use Windows so being able to 'roll our own' is important.
Call me Golan; my parents did.

hydrophilic

Quote from: gklingerThe other reason I was concerned about source is that not of all of us (me, for example) use Windows so being able to 'roll our own' is important.
Yes!  That's why I love VICE because it is open source and you can add missing features (like 2MHz) or port it to different operating systems.  The source files I modified are in the download so you can roll your own; the file listed under src/arch/win32 is not needed for other systems (or even Windows), I just added a message to it saying something like *EXPERIMENTAL 2MHz*.

gklinger, I would be very interested if you could compile it and tell us how (if?) it works.  Maybe you would care to share what system you are using?

UPDATE: Got another email from VICE team today so it seems they are taking interest.  Maybe 2MHz will become official in the next release?  Let's keep our fingers crossed.

nikoniko

Just want to say my AGI interpreter project benefits greatly from the 2Mhz mode, so thank you very much again! Since I'm doing a lot of line drawing and polygon fills, the extra oomph makes a big difference, and gives me a lot of confidence that once I optimize my code things are really going to fly.

Golan Klinger

Quote from: hydrophilicgklinger, I would be very interested if you could compile it and tell us how (if?) it works.  Maybe you would care to share what system you are using?
Will do. I'll try to get to it tomorrow. I'm using a Macbook (2GHz Core2Duo with 2GB RAM) running Mac OS X (v10.4.8).

QuoteUPDATE: Got another email from VICE team today so it seems they are taking interest.  Maybe 2MHz will become official in the next release?  Let's keep our fingers crossed.
That's good news indeed. The development of 128 emulation lags behind 64 emulation which is a pity.
Call me Golan; my parents did.

nikoniko

QuoteI'm using a Macbook (2GHz Core2Duo with 2GB RAM) running Mac OS X (v10.4.8).
Must be nice running emulation on a dual core machine! I'd love to be able to stick some of my processes on different CPU cores.

Guest

Quote from: nikoniko
QuoteI'm using a Macbook (2GHz Core2Duo with 2GB RAM) running Mac OS X (v10.4.8).
Must be nice running emulation on a dual core machine! I'd love to be able to stick some of my processes on different CPU cores.
Dual core is dirt cheap, cheaper than most single core chips.  You can get an Intel Pentium D 805 for about $100, and you can get an AMD Athlon X2 3800 for about $120.  Neither are speed burners, but the dual cores make all the difference in the world in system response.

Golan Klinger

Quote from: nikoniko
QuoteI'm using a Macbook (2GHz Core2Duo with 2GB RAM) running Mac OS X (v10.4.8).
Must be nice running emulation on a dual core machine! I'd love to be able to stick some of my processes on different CPU cores.
Unfortunately OS X doesn't allow a user to specify which processor and core will do what (or it does and I don't know about it.) If only it had an equivalent to Solaris' "psrset" command. On the other hand, with a modern OS, perhaps it is best to leave the scheduler to do its job.

I'll say this, the Core2Duo is a really fast CPU. I can finish an infinite loop in under 10 minutes! ;)
Call me Golan; my parents did.

hydrophilic

*Update* Good and bad news.  First the bad.  The 2MHz feature will not be implemented in the next (1.21) release of VICE.  On the other hand, it may be in the following release.  Here is part of the message I received today
Quote from: Andreas BooseFor the next release it won't be applied for sure. But I consider it
for the overnext release. Because of its minimalistic approach we can
revert it anytime if something better will be available (if ever).

xlar54

I havent downloaded it yet, and I want to say... OUTSTANDING work!

This is not trivial.  Ive dabbled in the VICE code myself, and its not easy to navigate in.  Kudos to you for this accomplishment!

xlar54

Ok i just downloaded it, and I must still say... OUTSTANDING work! :)

blackystardust68

I am currently working on a proposal of a 2mhz mode that would be cycle exact, including 1mhz cycle stretching. It should not break any main cpu clock based modules and could become a permanent part of future releases. It is based on the patch submitted to the VICE team, but improved and cycle exact.

I will know more once I finish the proposal and submit it to my fellow VICE team members.

hydrophilic

Cool.  I hope its zippy.  I didn't want to bog down the emulation so I kept it simple...

Does your version introduce a new clock? Does it work for the Z80 too?

blackystardust68

My version uses the same principal as your patch, it uses an extra variable to indicate fast cycles, the maincpu counter is still based on 1mhz. This is to avoid a complete rewrite of the vicii and cia code.

The difference is in the execution of instructions. At the places where normally the maincpu clock is updated there will be an extra routine for the fast mode of the x128, the routine checks if any cycles needed to be streched to 1mhz and adjusts the cycle counter where needed. It also checks for memory refresh cycles and adjusts the maincpu clock for those cycles as well.

The reset/nmi/irq delay cycles are done with the right amount of cycles as well, and the interrupt delay is also taken care of.

It should ensure a cycle exact emulation of the 2mhz mode without interfering with vicii or cia operations.

The only disadvantage would be that the maincpu clock does not correctly indicate the real amount of cpu cycles that have gone by.

Mathias Roslund

I wonder if this method could be used to add SuperCPU emulation as well. It would require a 65816 CPU core, but as everything but the SuperCPU itself should still run at 1MHz, this method does sound interesting. Would be a fun project I think :)