Showing posts with label minus4j. Show all posts
Showing posts with label minus4j. Show all posts

Monday, December 15, 2008

Change of direction.

So with Christmas comming up it's almost time for my anual direction change. I was hoping that my ATmega devkit would arrive in time, but its looking less likely as time goes on - pooh. Oh well. I've pretty much completed what I wanted to do with Minus4j, although I'd like an option to pick a file fom the ZIP to switch to or load, but until Plus4world allows real access to ZIP files, this isn't that important. I'll probably wrap up what I've got into another release and leave it there for now, although I've yet to look at the sid filters but that may also be defered until later.

As to what project I'll do at Christmas time, well I'm not sure. I'd love to get back into electronics a little, but theres also my debugger and getting it running on a C64 and emulator. I'm also starting to think I need to restart RetroEdit. When I started it I hadn't done much C#, and over the years I've learnt how to do things properly. This means I could make a real stab at a proper system but as i've seen with the debugger, this means some serious effort. That said, I'd love a very simple interface so that I could draw tiles/graphics for myself.

I also really need to get a basic MAP editor togther even if its a very simple interface so that we can make levels for Xeo3. The old one works but is a little crude in paces - it would be nice to fix that.

So I have a few things I'd like to play with, I guess time will tell if I actually GET to...

Tuesday, December 09, 2008

Java, java everywhere and not a drop to drink.

So it turns out the ZIP file issue I was having is a bug, and SUN have now filed it. This is good as it means I'm not going mad! Someone from Sun got in touch and I was able to send them the offending file, so with any luck no one else will have to pull their hair out in frustration.

It's also good to know that it is indeed simple to read ZIPs, and I have been making steady progress now. I now have the ZIP being downloaded, and the first D64 being loaded and run. I really need to orginise the file processing better as it - well sucks. Its hacked in really badly and is sorely in need of a re-orginisation so that the normal rules about loading D64s and PRGs then apply to the contents of the ZIP. That said, I feel like I'm getting sucked further and further into emulator development again, and thats not something I want to do again (or at least, not right now).

This means I'll be hacking together a simple version and then I may update it later to allow better support and the zipping of everything.

I have also started using collections inside java (more to see what they're like than any real need), and while similar to C#, they just aren't as nice. C# has lots of little features like array access to them and handy functions like sorting all built in, where as its a little cruder in Java. Still, at least they're there...

Sunday, December 07, 2008

It never rains but it pours..

So, I've figured out what was wrong...ready? The ZIP file. And I have no idea why. I unzipped it, then rezipped it, and it all works. Sugar. Does this mean I have to go and rezip every file on Plus4world? Who knows... But at least it appears to be working...kind of. I wonder if I could send the broken ZIP to sun and have them fix it, because I can only assume theres a bug in the JVM. I'll need to see if I can find an unzipping program that CAN'T unzip it, because if they all work then its definitelty broken in the java JVM.

Saturday, December 06, 2008

I hate java, I hate java, I hate java, I hate java....etc..

So, back with Minus4j once more. I'm trying to get some ZIP support in here so that more files on Plus4world will work, but once moe=re I'm struggling to get Java to behave and do what its supposed to do. Opening a ZIP file in java is pretty is (supposedly) but will it work for me? Will it strawberry. All that should happen is I pass it an input stream and then read files, and while I appear to get no error, it also doesn't appear to actually read any file inside....Oh chocolate.

       BufferedInputStream bis = new BufferedInputStream(_stream, 16384);
try
{
ZipInputStream in = new ZipInputStream(bis);
ZipEntry entry;
while( (entry = in.getNextEntry())!=null )
{
// process the ZIP
}
in.close();
}

So in the above code, it just never gets into the inner while loop and I've no idea why - so if you have any idea...let me know. I did think it was because it was coming over HTTP, so I read it all in and build a memory stream, but that doesn't seem to matter. On top of this, no one else seems to have this problem, so I can't find any answers on the net either..... *sigh*

Thursday, December 04, 2008

PHP'ing

I've been reading through my PHP for dummies book and I'm actually having fun with it! Its very like C/C++/C# with only minor differences really, so I'm thinking of using the Plus4world database to try a few things out; read only mode of course, I;m not stupid! So what I think I'll try first is to see if I can make a "play online" page.

The reason for this is that i've spent quite a bit of time going through all the games and testing them out with the new Minus4j, and their working pretty well. But I'd like to get them all listed so I can see how many we have and get them all under one roof - as it were. It'll also (obviously) teach me more about PHP, and the more I know, the more I can help Csabo out on the site - or thats the plan.

I'm obviously no where near that stage yet, but I find that doing a real project helps focus what your doing and helps you learn. So here we go!

I took was also speaking to someone about multi monitor setups a while back and was saying that while I have 3 monitors at home, I actually have 4 at work! So I've taken a piccy of my development setup (I should really do a home one too - even though its a hell of a mess) for you all to mock. I've got a really old TFT for my main source monitor as it rotates and gives me more lines to read - which is cool. All those monitors are from one machine and gives a lovely big desktop, which means I have loads of programs open at once, So much so...I think I need more RAM - Vista being the power hog that it is. Good fun though!

Oh...and you'll notice I'm still a fan of the good old "clunky" keyboard - I had to look long and hard for a good "click" one! I hate these springy things.

Tuesday, December 02, 2008

SNOOOOOOOOOOOOOW!

We've got SNOOOOOOOOOOOOOOOOOOW!!! Good, proper, BIG snow! This is the view from the Realtime Worlds office, and its great!! I hope it hangs around for a while, but its getting quite bright and sunny just now..pooh.

I got on pretty well with Minus4j over the week end as I managed to get 1551 disk emulation in and working! This means that we should be able to get more games online at Plus4 world. However, I'll need to add ZIP support before we really get invloved in it as most disks on plus4 world actually have 2 sides and are packaged up. Still I think this should be okay, but I'll have to look at it later this week.

I've also got a couple of PHP books so that I can learn a little bit of PHP and help out a bit more on Plus4world; well, that and my DMA Site. It's in desprate need of re-vamping and I'd like to make the whole thing database driven. However, first things first - I need to learn PHP first! I'm looking forward to it I have to say!

I've also been reading through the Yape SID code to see if I can get something from it. The filter stuff is pretty complex and I need to figure out exactly what its doing before I can decided to use itor not.... I'm fairly optimisitc that I'll get something from it.

Saturday, November 29, 2008

Vista x64 upload working!

I've managed to get the upload program working once more with the x64 driver, however I now need to press F8 whenever the machine is booting up so I can disable driver signing. Stupid stupid stupid vista! I wonder how much it costs to sign a driver. This is a VERY popular driver, so it may be possible for everyone to club together and pay for it.

There used to be a work around where you could just switch it off, but Microsoft in their infinite wisdom disabled it. Its thing like this which will drive folk to other operating systems. (Course... MAC doesn't HAVE a parallel port...)

I think one of the things on my to-do list should be a simple USB to parallel wire. Now I know there ARE some, but I'd love to have a proper one that acts EXACTLY like a parallel port and does all the crap for you. I imagine this would sell pretty well, particually if it could get signed properly. Oh well... another one to add to the list.

Still, for now its working and means I can now test Plus4 code again. The original uploader hasn't changed, but I now have a new DLL and SYS file that I use on VISTA.

So what else is new; well I've added basic SID support to Minus4j but its a bit pooh to say the least. The lack of filter support really sucks and since most music/fx uses them, they just dont sound right at all.Attila has kindly sent me the core of the SID emulator from YAPE and I'll see if I can wedge that in. It's very much like trying to put a square peg in a round whole though as YAPE and Minus4j are not only very different langauges, but have very different design philosophies. Still, its worth a go! With any luck I'll get it added and we can get some good sounds playing in demos.

Speaking of demos, I noticed that many appear to over run their rasters, and I think I've finally figured out why. I dont think Minus4j (or Minus4w) are letting them have a whole scanline. Basically the "newline" function is being called at the start/end of a scanline (HBLANK) but thats not where the timing is working from. The horizontal dot clock is being reset by the newline function and losing clock ticks. This means you dont get all your processing cycles, and would also be the cause of my inability to load tapes. Tape loading is in fact VERY easy (once you have a good sample), all you do is set a bit on/off as it plays, and at the right time. But if the CPU timing is out, it'll never work - explains a few things.

It may however be a nightmare to fix, so I'll have to look into it. It would be great to be able to load PRGs, D64s and TAPs into Minus4j, but I'll wait and see how everything else goes. I really really don't want to get sucked wasting all my time on emulators again...I have bigger fish to fry.

EDIT: Oh, and if anyone else does want to use the uploader on Vista64, then let me know and post a ZIP with the new drivers and installation instructions.

Thursday, November 27, 2008

A sound idea and Vista kicking you when you're down.

I was fixing some sound issues with Minus4j last night, as I suddenly discovered it was actually pretty broken. If both channels went quite loud and high frequency, it all started to break up - samples too in point of fact. So I spent some time fixing this and its all much nicer, samples sound pretty clean and music in Commando and Monty on the Run are much much nicer.

This then lead me to look at D64 support. I was trying to load TerraNova and it started to work, then didn't. It gets stuck in some odd loop which i think is sample based, but I'm not sure, and I think I have my interrupt flagging wrong. Currently I flag them only when $FF0A is also set, but I believe this is wrong. I think you should always flag them, they just dont kick off an interrupt!

So i thought I'd do some test code on the real machine and see what happens. It was at this point I realised I haven't downloaded anything since I've upgraded (and I use that term losely) to Vista x64. Parallel port access requires a system driver, and under x64 all system drivers must be x64 based. This means my great little 32bit dll which gives me raw access to a parallel port under windows, now no longer works, which in turn means I can no longer download directly to the plus4 - OR carry on with my debugger. FEK!

So I've managed to find a 64bit version of the driver, but its just not working, and now I dont know if thats because the driver isn't working, isn't being found or simply because the parallel port on my machine is set up wrongly. FEK.

So tonight I hope to fix this and test out the interrupt registers a bit more. At the same time, I've started adding D64 support via the Commodore 1551 parallel port registers. This is why turbo loaders dont work on Minus4 as I assume its one of these devices. I used to just intercept calls to the LOAD command, but this is a little better. Anyway, I hope to get basic D64 support in soon although with all the disk turbo loaders around I'm not sure how much use it'll be.

As a little aside.. I was looking at the Minus4sim I started years back. This was a cycle perfect version of Minus4, but I got bored with emulation and mechanic was a little too messy for my likeing. However... C# has some really, REALLY cool constructs for pausing code mid execution, and i think if I ported it over to C#, it would all become VERY elegent and simple to follow. No longer would you have to hold partial states etc. You just pause and resume. So I may play with this at a later date as it would give some very simple code but yield some amazing results. It would also allow me to finally do a fully emulated 1541, which I've been meaning to do for years.

Still mustn't get too side tracked. I have to finish up with Minus4j, then the debugger, then back on to Xeo3.

Sunday, November 23, 2008

JAR files.

I've been having a little trouble getting resources inside JAR files working, I took some code from my mobile phone days and used it inside Minus4j without any luck. The idea being that I could package the ROM and WAVE files up in the JAR file, and so I wouldn't have to do a slow load over HTTP.

I've now managed to get this working by using the main minus4j class rather than a java object. No idea why this matters, but it does, and it's now working. This means I can now package up ROMs and samples without having the extra paramaters or load commands, which it turn will spead up loading.

I'm also planing to add a virtual keyboard that will let you click keys rather than search for them - Saying I don't get bored of all this first of course....

Friday, November 21, 2008

Minus4j Version 1.5 released.

I've just released the latest version of Minus4j, this is the one thats been up on plus4 world for a week or so. Its got some major improvements like Audio, joystick/key combos and auto starting via the filename.

  • Added a paramater for the initial frameskip value.
  • Removed software screen scale and now use built in JAVA one - should be MUCH faster.
  • Added ESCAPE key (Escape)
  • Added RUN STOP key - ` (backwards apostrophe, beside 1 key)
  • Added the * key (numpad)
  • Added undocumented opcode LAS,Y ($BB) command. Danger Diamonds now runs.
  • Minus4j now picks up sys0000 style RUN commands from the filename. So games like "mercenary_sys23552.prg" now work without a seprate RUN command.
  • Minus4j now picks up g12AB style RUN commands from the filename. So games like "mercenary_g5C00.prg" now work without a seprate RUN command.
  • TED Sound!!!
  • TED Samples!!
  • New "sound" paramater. sound=off or sound=on are valid. ON by default.
  • You can now press F7 while running to toggle sound (mute).
  • Added VOLUME control register.
  • If joystick is enabled, CursorKeys and Space key is disabled.
  • INSERT now does a soft reset.
  • Emulator now shuts down better.

    You can get the latest version from minus4.plus4.net.
  • Sunday, November 16, 2008

    Virtual Machine JOY!!

    I've just installed Microsoft's Virtual PC 2007 with Ubuntu running as a VirtualMachine, and its all going pretty well for a first install....so much so, that I'm typing this inside the Ubuntu VM! I've been testing the java version of Minus4 and it runs pretty well here, of course this is a pretty big machine (quad core, 4gig ram etc.) so its not a big surprise... still, at 50fps its pretty solid.

    Once you scale the screen it starts to get sluggish, but a single frameskip pushes it up into the mid 40s and another to an solid 50. This is fine for games like mercenary that didn't draw the screen that much - or even XeO3 as I only draw the screen every second frame.

    I still have to get sound working - and get the screen res fixed as its currently locked to 896x600 for some odd reason. Once I've done that I'm going to try and get mono installed ready for some real work! Then I want to get a Mac VM created (if possible) and try the same stuff there. This would give me a solid development platform and let me do ALL my work from a single machine/desktop! How fekin' cool is that!

    Let there be sound!

    After a marathon day yesterday I managed to get some audio into Minus4j, and it really does make a huge difference. For the moment its TED sound only, and I do still have a little bit to do yet before its really nice, for a start volume isn't used at all! I ported this code directly from Minus4w and have only just noticed that theres no volume control on it, doppy bugger that I am. Still, you now get 2 TED channels (tone and noise) and samples (using the TED). Samples are a bit crude to say the least, so I'll need to work on that a little - although I think I'm driving my wife mad listening to odd sounding beeps all day, oh well.

    Once I have TED music in a better state, I'll port over my SID music player, and although its far from great (its a little rough and uses NO filters), it's still a good 1st step. After that, D64 support will almost bring it in line with Minus4w! Almost.... I'll need to see if its possible to save data to the local machine which would allow you to save games etc. other wise adventure games would be a pain. The solution to this I guess would be to port Minus4 to C# and Mono, this would allow it to run on any machine, AND on silverlight at a later date. It might also be a good time to use my cycle exact CPU I wrote about 6 years ago! It was designed to be more in line with YAPE than my scanline based one.

    Still, thats a loooooooooooooooooooooong way off, and theres loads to do before that. Russell also pointed out that I could let Minus4j host my debug stub as well, meaning you could develop and debug Plus4 apps on Linux or Mac OS, which would be cool.

    Anyway, head over to www.PlusWorld.com to see (and hear) the latest one in action! I've also started validating demos on Plus4 world, and although some just dont work, many work fine and its a much easier way of browsing them. We should really do an online demo page so you can have simple access to them.

    Saturday, November 15, 2008

    Even more java love.

    I've updated Plus4 World with the latest version of Minus4j. I've added a couple of handy features that allow even more games to run. The change list is below, and although I've not offically released this you can go and sample its goodness at plus4world.

  • Added a paramater for the initial frameskip value.
  • Removed software screen scale and now use built in JAVA one - should be MUCH faster.
  • Added ESCAPE key (Escape)
  • Added RUN STOP key - ` (backwards apostrophe, beside 1 key)
  • Added the * key (numpad)
  • Added undocumented opcode LAS,Y ($BB) command. Danger Diamonds now runs.
  • Minus4j now picks up sys4172 style RUN commands from the filename. So games like mercenary_sys23552.prg now work without a seprate RUN command.
  • Minus4j now picks up g12AB style RUN commands from the filename. So games like mercenary_g5C00.prg now work without a seprate RUN command.

    I'm also looking to add sound just now. This is a long standing issue that I'd love to fix so I've been looking at a couple of other emulators and how they handle sound. I not have my Java applet buzzing with noise so thats a good start! I should now only have to port over my TED sound stuff (and later SID sounds) in order to get it playing. Although theres obviously a long way to go before that, but at least theres a buzz about the place now.
  • Sunday, November 09, 2008

    More Java - man I hate java...

    So with the release yesterday Minus4j is actually in pretty reasonable shape. Sure it needs the source cleaned a little - theres loads of commented out crap in there, but on the whole not bad. So as I was adding another paramater to it (allowing you to specify the initial frame skip - since Xeo3 runs at 25Hz, you never NEED 50fps drawing), I suddenly realised that these days, Java probably provides image scaling as part of the API!

    And sure enough.... there it is. So, I've now removed the software scale I was using and now use the API. This is of couse good for 2 reasons. One... being part of the API means it might be assembler optimised, and not just some tacky code I did, and second it reduces the code I've to maintain. Its all good.

    Before I set it all aside again, I'm going to look into sound. I do this every 3 years or so to see how much effort it would be to add sound to Minus4j. When I started, you just couldn't, but there are now a few apps which do what I need to, so chances are its not too hard. All I really need is a buffer or two that plays music at a specific rate through a software buffer. I can then fill this up as I emulate things. This would let me plug in TED and SID music - not to mention samples that Minus4w can play. That would be cool - then all I'd need is some basic D64 support!

    Oh... and while I won't release all these little bits, I will update both my blog and Plus4world to use all the latest stuff, then release it when theres enough to package it all up.

    Saturday, November 08, 2008

    Speed UP! Slooooow down....

    So, it turns out the Java compiler is fine (I think). My timing code (that makes the game run at a specific FPS) appears to be crippling things. But I have no idea how. If I take out my timing code and run the game unscaled it ticks along at 350fps - or 7 times the normal frame rate. It looks like thats correct too as everything is moving about 7x the speed, so I think the FPS counter is working.

    So... whats wrong with my timing loop thats crippling it so much? I've tried to set and FPS of 200, but as soon as I do that, it tops out at 65fps. If I remove a couple of lines (the bit that makes it work), it jumps up to 350 again. So somethings rotten right in the state of Denmark... So, heres the timing loop, perhaps someone out there will spot it and save me staring at boring code for hours on end.....


    long tLastGameFrame = System.currentTimeMillis();
    long tNextGameFrame = tLastGameFrame + FPSRate;

    Last = tLastGameFrame;
    while (true)
    {
    long tNow = System.currentTimeMillis();

    // Quick check to see it timer has gone backwards!!
    if( tNow < tLastGameFrame ){
    tLastGameFrame= tNow;
    }

    // Check to see if system is stuttering due background OS stuff.
    // if jumped ahead over 5 seconds, then just reset...
    if( (tNow-tNextGameFrame) > 5000 ){
    tNextGameFrame = tNow;
    }

    // Timer has gone backwards
    if( tNow < tLastGameFrame ){
    tLastGameFrame= tNow;
    }


    dTime = (int)(tNow - Last);
    if (dTime >= 1000){
    dTime -= 1000; // dont get 0 (1000/1001)
    actualfps = CurrentFPSCount;
    CurrentFPSCount=0;
    Last = tNow;
    }

    // Now the main timing loop
    if( tNextGameFrame >= tNow )
    {
    // do nothing...or yield/sleep
    } else
    {
    while( tNow>tNextGameFrame){
    tLastGameFrame = tNextGameFrame;
    tNextGameFrame += FPSRate;
    }
    CurrentFPSCount++;
    }


    And there you go... pretty simple. Oh, and the reason for the backwards check is because in the modern world of clock syncing (to time.com or something), your clock might briefly go backwards. If this happens timer loops break - had this happen twice! Once on mobile phones, and once on a PC. Took me AGES to figure out the Mobile phone one, but fortunately I remembered about it for the PC.

    New version of Minus4j released.

    Well, I've decided to release what I've done so far so that Plus4world (and anyone else) can get the new bits.so head over to my MINUS4 site and get the latest one if you need it. Heres a list of the changes...

  • Updated rendering engine ported from Minus4w, should handle more cases.
  • Updated CPU processing ported from Minus4w. More games should run.
  • Fix a crash in the CPU processing.
  • Changed the colours to what Yape uses (much nicer)
  • Added FLASH attribute, so things now...flash. (Manic Miner keys, Monty pick-ups etc.)
  • Fixed the rendering frameskip - it was always skipping at least 1 frame *idiot*
  • Fixed the overflow flag (V) on the ADC instruction. Mercenary now works!
  • Added the new "joy" paramater
  • Fixed commando - added several undocumented NOP codes.
  • SOME vertical scrolling games work.
  • More Progress.








    I've managed to fix Mercenary, although it wasn't the BCD mode it was the overflow flag inside the ADC instruction. Anyway... Here (I hope) is the current version. Click on the screen and then use the cursor keys to move and space to shoot. F9 is frameskip which may help speed it up on some slower machines. I'll be doing a release of this soon for Plus4World, but in the meantime - Enjoy!

    This is pretty neat as it means I can show new things as code rather than video. However the new version of Java appears to be a little sluggish for some reason, and frame rate has dropped a lot. In the past I used to get upto 450FPS but that has now dropped to around 70fps - without scaling...pooh. I hate Java...

    Still, when all said and done - how cool is it to have xeo3 actually PLAYING in a web page!!

    Tuesday, November 04, 2008

    Intermission....

    Albatross!! Albatross!!! Get yar Albatross here!


    okay... Got slightly side tracked as a beta of Call of Duty 5 came out today so I had to have a blast at it... FAB game, got to be one of my fav all time games the COD series. Anyway... Aside from that I'm trying to update Minus4j for Plus4world so they can get more games on line, and so its well....better.

    It does have some issues and I thought I'd port back some Minus4w stuff. This should be easy as the source for Minus4w originally came from Minus4j. So it was all going swimingly well, then BANG! It all fell apart. I have the drawing code ported back and as far as I can tell its now identical, except Minus4w works, and Minus4j jumps up and down like a rabbit on a pogo stick. So now I find myself in need of an applet debugger. Im sure it'll be obvious once I debug it, but until I do... I'm a bit stuck. Fek. I could undo it all and then just fix one issue at a time, but that seems silly as Minus4w is much bette over all.

    *sigh*