MZX port The pseudo-journal
#1
Posted 27 May 2004 - 11:58 PM
Goals:
Make MZX easily compilable on other platforms, while retaining full compatability. Source should be as maintainable as possible. After porting is mature, integral changes to MZX itself may be made.
Procedure:
These are the first steps necessary, later more will follow...
* Translate all non-hardware dependant ASM code to C. Keep within DOS MZX for testing.
* Modify all source files to comfortably compile in GCC. Possibly convert to full ANSI C. Replace hardware dependant portions with stubs.
* Add emulations for hardware functionality should be written, using a cross-platform library (SDL is planned). Try to make as translucent as possible to MZX as it is now.
* Further unnecessary code should be taken out of MZX (like all EMS stuff)
* Write new robot editor (incorporating RASM)
Anyway, I'll post progress on this thread and ask for beta testers when I need them (if anyone has a Mac of some sort you might be useful in the distant future).
So far, I've translated game2.asm to C. game2.asm is the single largest ASM file in MZX's source, weighing in at over 3800 lines. It's quite possibly the most daunting thing to deal with in doing a port... There are still some bugs that need to be fixed, but at this point it's fairly mature.
Oh, and some people might be asking why I'm bothering, when BFeely has a port out. While BFeely's port is functional, it's very Windows/MSVC specific and that's no good for my goals. He's also rarely around here and that makes it difficult to properly report bugs or keep up to date with his progress. I intend to at the very least be here constantly.
I'll post more here as I have it. Right now I need to keep fixing game2.cpp bugs.
- Exo
"The fact that I say I've one of the best, is called honesty." -Akwende
"Megazeux is not ment to be just ASCII, it is ANSI!" - T-bone6
"I hate it when you get all exo on me." - emalkay
Exophase can what Rubi-cant.
exoware is ware ur ware is exoware
ps. not loking 4 new membrs kthx
#2
Posted 28 May 2004 - 09:06 AM
I realized that not only has idput.asm already been ported, but we've been using it since MZX 2.51s3. In fact, it's because of it it that many of the new features have made their way to MZX, and sprites have been possible (because it allowed for ways to get the current char from the board). Some of the code is rather messy, though. I might try to work with it to make it friendlier.
I ported idarray.asm. This didn't take long at all, and seems to be working without any problems.
I ported string.asm well over a year ago, but never tested it. I'll get to work on incorporating it next. Besides that, most of the non-hardware dependant ASM in MZX has been converted to C.
- Exo
"The fact that I say I've one of the best, is called honesty." -Akwende
"Megazeux is not ment to be just ASCII, it is ANSI!" - T-bone6
"I hate it when you get all exo on me." - emalkay
Exophase can what Rubi-cant.
exoware is ware ur ware is exoware
ps. not loking 4 new membrs kthx
#4
Posted 29 May 2004 - 12:21 AM
MZX's ASM to portable C. Which files did he do?
#5
Posted 29 May 2004 - 03:06 AM
lipid, on May 28 2004, 07:21 PM, said:
MZX's ASM to portable C. Which files did he do?
Actually it was MenTaLguY that did idput.cpp, not JZig. JZig merely modified it so that it'd compile in BCC. JZig said that he converted game2.asm, but lost the source.
- Exo
"The fact that I say I've one of the best, is called honesty." -Akwende
"Megazeux is not ment to be just ASCII, it is ANSI!" - T-bone6
"I hate it when you get all exo on me." - emalkay
Exophase can what Rubi-cant.
exoware is ware ur ware is exoware
ps. not loking 4 new membrs kthx
#6
Posted 29 May 2004 - 01:39 PM
* Graphics code: This should include all of graphics.asm, egacode.asm, and some new encapsulation functions for accessing characters and the charset. SDL will be used to render the characters. Will emulate SMZX.
* Keyboard code: Part of an event loop. A translation function will have to be used to convert between the codes MZX uses (PC XT keyboard and DOS ASCII codes) and what I'll be using (SDL).
* Mouse code: Part of the same event loop as above. This comes later, since MZX doesn't need it to run.
* Module code (music): Will use libdmodplug for this one, and wizdom offered to let me use his GDM->S3M code. An actual GDM loader for libmodplug would be nice. May use MikWin instead initially, depending. SDL will be used for audio output, with a rudimentary mixer.
* PC speaker code: Will emulate the PC speaker (it's a simple sine wave) and through it on the list of things to be mixed.
* Sample playing: Seperate from the module code. Will convert them straight to the mixer list.
* Directory listing: This has to be redone since it's very DOS specific. Will use POSIX dirent code (may not work on MSVC, but that's okay, I'm using mingw and you should too!)
* Timer code: No real timer code is necessary; MZX has its own timer handler but that's both unnecessary and impossible in a modern OS. Merely using SDL_Delay() and SDL_GetTicks() should suffice. Will probably encapsulate these to simplify. On OS's with low resolution timers some spinlocking may be necessary to compensate lack of granularity (on Windows 98/2k+ this shouldn't be a problem; older Linuces might have problems though)
I'm going to need the display code, keyboard code, and timer replacements to really run anything. I'll code all of the first two with independant testbeds to make sure I can get them working. Display code is the first thing I'll be working on.
- Exo
"The fact that I say I've one of the best, is called honesty." -Akwende
"Megazeux is not ment to be just ASCII, it is ANSI!" - T-bone6
"I hate it when you get all exo on me." - emalkay
Exophase can what Rubi-cant.
exoware is ware ur ware is exoware
ps. not loking 4 new membrs kthx
#8
Posted 29 May 2004 - 11:38 PM
Serious damage to important body parts pretty much ruins any plans you had for living. Bummer.
#9
Posted 30 May 2004 - 04:09 AM
- Exo
"The fact that I say I've one of the best, is called honesty." -Akwende
"Megazeux is not ment to be just ASCII, it is ANSI!" - T-bone6
"I hate it when you get all exo on me." - emalkay
Exophase can what Rubi-cant.
exoware is ware ur ware is exoware
ps. not loking 4 new membrs kthx
#10
Posted 30 May 2004 - 04:15 AM
Exophase, on May 29 2004, 09:09 PM, said:
- Exo
CURSE THE MAN WHO THOUGHT UP THE MZXO!
#12
Posted 01 June 2004 - 02:26 PM
Tokugawa, on Jun 1 2004, 08:47 AM, said:
There won't be EMS issues.
I've pretty much finished the graphics stuff (I think?). graphics.cpp should handle all of the functionality of graphics.asm, egacode.cpp, palette.cpp, cursor.asm, and some others. I've done some keyboard handling code; since SDL both gives keycodes similar to ASCII and the actual hardware scancodes it may fit into MZX okay (we'll see).
- Exo
"The fact that I say I've one of the best, is called honesty." -Akwende
"Megazeux is not ment to be just ASCII, it is ANSI!" - T-bone6
"I hate it when you get all exo on me." - emalkay
Exophase can what Rubi-cant.
exoware is ware ur ware is exoware
ps. not loking 4 new membrs kthx
#13
Posted 01 June 2004 - 02:30 PM
Why-Fi: but I'M MATURE ENOUGH TO BE A MODERATOR!!!!!!!!!!
#14
Posted 01 June 2004 - 09:49 PM
Exophase, on Jun 1 2004, 10:26 AM, said:
Rox0rz. Since progress seems to be zooming along so well, what's taken so long for this to actually be started before now?
<+AFK> dormando's apathy is palpable.
* AFK palpates
<dormando> stop that
<Malwyn> undressing with revvy a little over a metre away. new definition of awkward.
#15
Posted 01 June 2004 - 11:44 PM
Revvy, on Jun 1 2004, 05:49 PM, said:
Exophase, on Jun 1 2004, 10:26 AM, said:
Rox0rz. Since progress seems to be zooming along so well, what's taken so long for this to actually be started before now?
Prior lazyness, a pox suffered by all MZXers.
#16
Posted 02 June 2004 - 02:53 AM
#17
Posted 02 June 2004 - 03:04 AM
EDIT: And yeah, should work fine on Linux and Mac providing Exo sticks with cross-platform compatible libraries. LibModPlug uses portable C++ without requiring OS subroutines (thusly, inherently compatible) afaik, and SDL is compatible with many platforms too.
This post has been edited by Lancer-X: 02 June 2004 - 03:08 AM
<Malwyn> Yes, yes. Don't worry I'd rather masturbate with broken glass than ask you for help again. :(
#18
Posted 02 June 2004 - 03:27 AM
<+AFK> dormando's apathy is palpable.
* AFK palpates
<dormando> stop that
<Malwyn> undressing with revvy a little over a metre away. new definition of awkward.
#19
Posted 02 June 2004 - 01:20 PM
Directory listing is working, preliminarily. Keyboard input was put to the test and works, and I added my own auto-repeat (for some reason it doesn't work so well in SDL..)
For Mac compatability I'm going to have to be careful to make it Endian-safe. FWIW, modplug should be reasonably portable, since it's memory only (works on modules given in memory, and outputs to memory)
- Exo
"The fact that I say I've one of the best, is called honesty." -Akwende
"Megazeux is not ment to be just ASCII, it is ANSI!" - T-bone6
"I hate it when you get all exo on me." - emalkay
Exophase can what Rubi-cant.
exoware is ware ur ware is exoware
ps. not loking 4 new membrs kthx
#20
Posted 02 June 2004 - 03:50 PM
Exo, you are the heart of MZX right now and we are your blood.
#21
Posted 02 June 2004 - 04:08 PM
Lancer-X, on Jun 1 2004, 08:04 PM, said:
Well, you know, a SAM is, in essence, an 8-bit signed WAV file. With no limits, we can pump this up to 16-bits, 44100 Hz audio files...I can exercise my ear for quality.
Serious damage to important body parts pretty much ruins any plans you had for living. Bummer.
#22
Posted 02 June 2004 - 06:06 PM
T-bone6, on Jun 2 2004, 10:50 AM, said:
Since SMzx would work on every computer that the Windows port worked on I could imagine seeing a lot of games using it appear.
This post has been edited by Frobozz: 02 June 2004 - 06:08 PM
#23
Posted 02 June 2004 - 08:16 PM
WildWeasel, on Jun 2 2004, 12:08 PM, said:
Lancer-X, on Jun 1 2004, 08:04 PM, said:
Well, you know, a SAM is, in essence, an 8-bit signed WAV file. With no limits, we can pump this up to 16-bits, 44100 Hz audio files...I can exercise my ear for quality.
The only problem with removal of limits is that game sizes will probably skyrocket. I don't want to download 5-10mb zips with all the latest XMs and professional quality sound effects.
<+AFK> dormando's apathy is palpable.
* AFK palpates
<dormando> stop that
<Malwyn> undressing with revvy a little over a metre away. new definition of awkward.
#24
Posted 02 June 2004 - 09:27 PM
Revvy, on Jun 2 2004, 01:16 PM, said:
Well, just because I can use such high-quality sounds doesn't mean I'll abuse them...why bother with a high-quality stereo sound for a pistol, when it sounds exactly the same at a lower quality?
Serious damage to important body parts pretty much ruins any plans you had for living. Bummer.
#25
Posted 03 June 2004 - 12:18 AM
<Malwyn> Yes, yes. Don't worry I'd rather masturbate with broken glass than ask you for help again. :(
#26
Posted 03 June 2004 - 12:45 PM
So, I haven't been around much (as can be seen) because my connection hasn't been working save for a few hours a day. I've still been working on MZX, of course. Right now I'm essentially running through every file and modifying them, cleaning out unnecessary things and converting other bits. Also making the formatting less offensive to the eyes (so if you don't like my formatting style, sorry. You can change it when it's your turn.) Unfortunately I haven't been able to test anything yet because there are still too many missing things. At this rate it's almost turning into an all or nothing kind of deal.
- Exo
"The fact that I say I've one of the best, is called honesty." -Akwende
"Megazeux is not ment to be just ASCII, it is ANSI!" - T-bone6
"I hate it when you get all exo on me." - emalkay
Exophase can what Rubi-cant.
exoware is ware ur ware is exoware
ps. not loking 4 new membrs kthx
#27
Posted 03 June 2004 - 01:53 PM
As for the PC speaker, technically the speaker outputs a square wave, but it's pretty muffled inside the PC case so you have to filter it to come close of it's metallic sound.
#28
Posted 03 June 2004 - 07:28 PM
MadBrain, on Jun 3 2004, 06:53 AM, said:
Removing the bass from the output of the sample, leaving it with mostly treble, would help in that kind of effect. At the very least it'll make it sound like it's coming over the phone.
Serious damage to important body parts pretty much ruins any plans you had for living. Bummer.
#29
Posted 04 June 2004 - 12:19 AM
Ah yes, I forgot you could include a sample frequency when you played SAMs; haven't used the command in who knows how long.
As for the PC speaker, you could either emulate it with raw sound, or some kind of wave. Better still, you could drop it out altogether, though a rare few games (like Gemini's old sidescroller) actually use PC speaker effects well. Even so, I have PC speaker fx permanently on OFF so it won't bother me no matter what you do.
~ Lancy-Rexxy
<Malwyn> Yes, yes. Don't worry I'd rather masturbate with broken glass than ask you for help again. :(
#30
Posted 04 June 2004 - 02:05 PM
Why-Fi: but I'M MATURE ENOUGH TO BE A MODERATOR!!!!!!!!!!