Page 1 of 6

Dune II / OpenDUNE for Falcon (and TT)

Posted: Fri May 06, 2016 5:59 pm
by nanard
Hello,
I have been coding for OpenDune for a couple of years now. One of the first thing I've done was to make the code Big endian compatible.
That was to make it run on PPC Macs. Then I added support for Midi under OS X, SDL 2 support, various improvements, Scale2x and Hqx rescaling, etc.

Last week I thought it could be possible to make OpenDUNE run under TOS. It needs a 256 color display, so I focussed on Falcon, who can do 320x200x8bpp
I sucessfully compiled OpenDUNE existing code with Vincent Riviere cross mint, added an assembly Chunky To planar routine.
After seeing the "Westwood studios" logo, I quickly added mouse + keyboard support.
The "port" was quite fast, thanks to work done years ago to be Big-endian compatible ! :)

I don't have a falcon, so I'm testing with Hatari. See the screen captures : http://nanard.free.fr/opendune/showpics.php

You can get the compiled version here : http://nanard.free.fr/opendune/OpenDUNE ... 160506.zip
or start from the source code : https://github.com/miniupnp/OpenDUNE/tree/atari

getting the original DOS Dune II v1.07 datafile is quite easy thanks to abandonware sites.

On an emulated Falcon 030 16mHz, the game is slow as hell. Not playable :(
I remember playing the original DOS game on a 386sx20, it had slowdowns, but was definitely playable. We here have the overhead of the chunky2planar conversion, but that shouldn't be that problematic.

Does anyone want to test the game on a fast machine ?
I can try to add TT support if someone wants/needs it. The 320x480x8bpp mode should be ok :)

Re: Dune II / OpenDUNE for Falcon (and TT)

Posted: Fri May 06, 2016 9:42 pm
by paul92706
oh wow! this game bring's back lots of good memories!! :-) thanks :cheers: i would definitley like the TT supported version!

Re: Dune II / OpenDUNE for Falcon (and TT)

Posted: Fri May 06, 2016 10:54 pm
by Atari030
I'll try it on a CT2. Yes please for the TT. :-) NICE ONE!!!!

Re: Dune II / OpenDUNE for Falcon (and TT)

Posted: Sat May 07, 2016 4:11 am
by Xerus
Superb initiative!
I tested the game on my Falcon.
Under TOS (CT60 / 90MHz), the game is unplayable, too slow.
Under FreeMiNT (CT60 / 90MHz), the game is fast, perfectly playable :)

Without CT60, the game also seems playable at 16MHz (the framerate is acceptable during the intro) with FreeMiNT but I have a problem with the mouse, she is uncontrollable!
Maybe my config has a problem, it would take the opinion of another person.
In summary, the port goes wrong under TOS.

By the way, the sound is missing ;)

Thank you for this port.

Re: Dune II / OpenDUNE for Falcon (and TT)

Posted: Sat May 07, 2016 6:07 am
by nanard
hum the fact that it works under FreeMint but not TOS shows there must be something about a systemcall.
Thank you for your feedback.

About The TT version, any help on how to setup the 256 color mode and how to se palette entry is appreciated :)

Re: Dune II / OpenDUNE for Falcon (and TT)

Posted: Sat May 07, 2016 6:58 am
by nanard
OK I found that the gettimeofday() call was a bad idea :)

Re: Dune II / OpenDUNE for Falcon (and TT)

Posted: Sat May 07, 2016 8:45 am
by penguin
I've wasted hours on Dune II on my PC, thanks for porting the game to the Atari! I will be reviewing it in a future issue of my magazine :)

Re: Dune II / OpenDUNE for Falcon (and TT)

Posted: Sat May 07, 2016 8:46 am
by nanard
OK here is the new version : http://nanard.free.fr/opendune/OpenDUNE ... 160507.zip
gettimeofday() is out of the way, so the game is (almost) playable on a Falcon 16Mhz with TOS. Should be really OK with a small CPU boost :)

I also added some code to make it run on TT : the set palette works, but I've no idea how to properly set video mode, so you better have to launch the game in TT Low resolution ;)
is that possible to get 320x240 256color mode on TT ?
According to my tests in Hatari, the game is playable, but the aspect ratio is difficult to bear with 320x480 resolution

Re: Dune II / OpenDUNE for Falcon (and TT)

Posted: Sat May 07, 2016 9:16 am
by nanard
Still to be done :
    Proper TT video code : either setting a 320x200/320x240 mode, or doubling each line to accommodate 320x480
    Keyboard code : I use Crawcin() for now, It should get IKBD interrupt
    Sound : should not be that difficult to use DMA sound. Dune II only uses 1 channel
    Music : it must be possible to output MIDI music to the Atari Midi ports

Any help from any real Atari Coder is welcome :wink:
specific atari code is there : https://github.com/miniupnp/OpenDUNE/bl ... eo_atari.c

Re: Dune II / OpenDUNE for Falcon (and TT)

Posted: Sat May 07, 2016 11:46 am
by fidzen
Edit: It seems to work with the pak-files from the installation package.

Looks great! I really want to test it on my Falcon and I wonder if some nice
guy could post a link to the data files. I only find installation packages and
it's hard to install on Win 7 64-bit. :-)

Re: Dune II / OpenDUNE for Falcon (and TT)

Posted: Sat May 07, 2016 3:20 pm
by nanard

Re: Dune II / OpenDUNE for Falcon (and TT)

Posted: Sat May 07, 2016 3:25 pm
by Maeke
Try using d-fend dos emulator in windows 7, you should be able to install the game. the latest fans updates of d-fend contein a updated version of dosbox.

Re: Dune II / OpenDUNE for Falcon (and TT)

Posted: Sat May 07, 2016 5:19 pm
by Playmobil
Tried to ran opendune under Aranym+Emutos+XaAes.

Don't work... An error log file is created and he say :

Code: Select all

opendune.ini file not found.
Unsupported machine type.
don't know how to set palette on this machine.


Need to try with plain TOS.

Thanks nanard for your work ! :P :cheers:


EDIT : When crash, Aranym not responding, cause in the error log file, it's always don't know how to set palette, like an infinity loop. If it's help you ! :wink:

Re: Dune II / OpenDUNE for Falcon (and TT)

Posted: Sat May 07, 2016 5:38 pm
by nanard
@playmobil: well it's not an infinite loop, it is there are a lot of palette calls :)
Logo display at start is done with color cycling for fading

You need to have a 256 color mode (8 bitplanes) for the game to display
I don't know if Aranym does this.
If a falcon is detected, VsetMode() is called to set video mode.

I just added DMA sound : sounds weird on Hatari
http://nanard.free.fr/opendune/OpenDUNE ... _SOUND.zip

Re: Dune II / OpenDUNE for Falcon (and TT)

Posted: Sat May 07, 2016 6:21 pm
by Playmobil
Ok ! My Aranym Setup is in TC, not in 256 colors... I need to change my FVDI settings and try again !

Re: Dune II / OpenDUNE for Falcon (and TT)

Posted: Sat May 07, 2016 7:19 pm
by Xerus
The game runs fine with TOS now :)
However, the mouse doesn't work in 030 mode, so FreeMiNT is not responsible.
  
The sound is too fast, I suppose the replay frequency of sample is too high (relative to the original sound).

Continue the fight :cheers:

Re: Dune II / OpenDUNE for Falcon (and TT)

Posted: Sun May 08, 2016 12:06 am
by nanard
OK, I found the sound bug. I swapped the Mono/stereo bit. bit 7 must be SET for MONO.
https://github.com/miniupnp/OpenDUNE/co ... b8e6cbc388

I have to find sample code for keyboard/mouse handling

Re: Dune II / OpenDUNE for Falcon (and TT)

Posted: Sun May 08, 2016 12:18 am
by Atari030
I get the same opendune.ini failure on my CT2, then a crash. TOS 7.04 or in stock Falcon mode running in 256 colours.

Re: Dune II / OpenDUNE for Falcon (and TT)

Posted: Sun May 08, 2016 1:31 am
by nanard
new build : http://nanard.free.fr/opendune/OpenDUNE ... 508dbg.zip
this is a debug build, with messages written to error.log and output.log.

- DMA sound is working better now
- I added proper IKBD handling for both Mouse and keyboard.

still to do :
- Proper TT video code : either setting a 320x200/320x240 mode, or doubling each line to accommodate 320x480
- Midi music : does anyone has a Midi synthetizer plugged to his Falcon or TT ?

@Atari030: which version have you tested ?

Re: Dune II / OpenDUNE for Falcon (and TT)

Posted: Sun May 08, 2016 11:38 am
by mouse_master
I'm on travel unfortunately, so I haven't been able to try this, but I have been following. I have a CT60 Falcon and can hook up to an MT32, unfortunately, I have an extremely busy next 2+ months. :( Besides the Falcon, someone probably should also try this on the Firebee.

I am not sure if this will help, but here is MIDI code from ScummVM for sending midi data

https://github.com/scummvm/scummvm/blob ... stmidi.cpp

Not sure if this will assists you or not. If you have any questions, I can try to answer, but I wrote that small chunk of code a long while ago.

Re: Dune II / OpenDUNE for Falcon (and TT)

Posted: Sun May 08, 2016 1:45 pm
by MM41
Nice work Nanard :D ,
I use a stock Falcon 14Mb TOS 4.02FR , the last opendune.tos freeze at the game selection (no mouse no keyboard).
I load the old version and i can try the game but it's impossible to play (the arrow move crazy).
My MT32 is wired if you want test midi sound :)

It's time to try on TT :D

Re: Dune II / OpenDUNE for Falcon (and TT)

Posted: Sun May 08, 2016 6:44 pm
by MM41
It's the same probleme with TT TOS 3.05FR, freeze after 1 seconde when the arrow is moved.
I can ear the voice intro (no sound on my Falcon?) some words are repeated but it's clear :)
With the older version the sound is too speed and the arrow don't work correctly.

Re: Dune II / OpenDUNE for Falcon (and TT)

Posted: Sun May 08, 2016 8:00 pm
by nanard
Hum I think I need someone to look at the IKBD code to debug it. As everything works fine with Hatari, I don't know what is wrong :-(
I'm looking at midi code from ScummVM. looks pretty simple

Re: Dune II / OpenDUNE for Falcon (and TT)

Posted: Sun May 08, 2016 8:34 pm
by nanard
with test midi output : http://nanard.free.fr/opendune/OpenDUNE ... I_test.zip
Tell me if you hear something

Re: Dune II / OpenDUNE for Falcon (and TT)

Posted: Sun May 08, 2016 8:48 pm
by Eero Tamminen
nanard wrote:- Midi music : does anyone has a Midi synthetizer plugged to his Falcon or TT ?


You can use Hatari to test MIDI if you're on Linux, see:
https://hg.tuxfamily.org/mercurialroot/ ... -linux.txt