Jump to content
IGNORED

Mac OSX: How to use Altirra/Wine and Eclipse/WUDSN/MADS for development


Recommended Posts

Hi everyone,

I have switched from Windows to Mac four years ago and have since missed very few programs. Altirra is one such thing I really miss as a native application on the Mac, especially when it comes to developing software for the 8-Bit Atari. Atari800MacX is great, no doubt about that, but when it comes to debugging etc., Altirra has the upper hand (see here for many more examples).

While standalone Alitrra runs fine using Wine, it's a bit tricky to make use of the more sophisticated features that emerge when using Altirra in combination with the development combo consisting of Eclipse, Peter Dell's WUDSN plug-in and the MADS cross-compiler. Really cool things like watching variables or setting breakpoints right in the source code by using ;##TRACE and ;##ASSERT become possible as well as automatically importing labels as well the source code into the debugger.

Two main obstacles get in your way if you want to prepare a setup in this way:
1. MADS on Mac does not generate a proper header of the .lst file (the "Source: " line is missing despite including the "-p" parameter) and thus TRACE and ASSERT among other things don't work;
2. When using the /singleinstance parameter (necessary to reuse a running Alitrra instance, so you can continue in the debugger where you left it after the new file is started), Altirra/Wine does not accept slash-encoded filenames any more (though it does so upon the first start of the application).

 

EDIT: Problem no. 1 has been fixed with current versions of MADS (I'm running MADS 2.0.8 here), so the altirra.sh file needs to be altered, see below!

It took me a while (and some valuable tipps from Phaeron) to figure out an almost-perfect solution which I would like to share with you here:

1. In Eclipse, use these values under the Altirra tab:
application path: /some/path/to/altirra.sh
command line: ${runnerExecutablePath} "${outputFilePath}"
Note the double quotes and that no other command line options should be defined here, this will come later.

2. Create the file /some/path/to/altirra.sh and use this code:

#/!bin/bash
fullpath="${1//\"}"
lstfile=${fullpath%.xex}.lst
WineExec=/Applications/Wine.app/Contents/Resources/bin/wine
AltirraExec=/Applications/Altirra.app/Contents/Resources/wineprefix/drive_c/winebottler/Altirra.exe

# Do not include the lines from here...
sed "/mads /a\\
Source: $lstfile
" $lstfile > $lstfile.temp
mv $lstfile.temp $lstfile
# ...to here if you are running MADS versions 2.0.8 and above!

cd "$(dirname "$fullpath")"
$WineExec $AltirraExec /singleinstance /run $(basename "$fullpath") &

I have installed Wine as an app and created an Altirra.app using Winebottler, but all the above script needs is a valid path to a wine installation and the location of Altirra. Put all command line options (such as /singleinstance) here in the last line rather than in Eclipse, as otherwise the bash script might be confused about what is $1, $2 etc. In any case, the first parameter ($1) needs to be the full path incl. filename of the xex-file.
The reason why this is important is that the path and/or filename of the xex-file might contain spaces and thus needs to be quoted. However, the leading and trailing quotes unfortunately remain when splitting the full path into path and file, so they have to be removed first (second line above).

With this, Altirra only sees the filename and not the path, so it runs the xex without complaining, and it's possible to reuse the previous instance etc. The only drawback is that after subsequent calls to Altirra, the wine executable remains in the background and you need to switch to it manually. Calling wine via OSX's "open -a" does not help because it ignores the preceding change of directory and sets the current path to presumably the location of the app. Setting the focus of a program based on its PID also didn't work based on the code I got from here. Other possibilities I've tried rather started the actual wine configuration program, and did not bring Altirra to the foreground. But maybe some Mac pros have a better idea here?

 

In any case, this approach enables programmers on Mac to make much better use of Alitrra's possibilities, and I wish I had explored this before I finished my last project ;), so I hope this is of good use for some of you...

 

F.

Edited by freetz
  • Like 11
Link to comment
Share on other sites

  • 1 month later...
  • 5 months later...

Thank you so much freetz, it is working nice now!

 

First it didn´t start Altirra, because the ownership of Altirra.sh was too restrictive. After changing it with "chmod 777 Altirra.sh" it worked as expected. Thanks for your work figuring this out. :)

  • Like 1
Link to comment
Share on other sites

Thank you so much freetz, it is working nice now!

 

First it didn´t start Altirra, because the ownership of Altirra.sh was too restrictive. After changing it with "chmod 777 Altirra.sh" it worked as expected. Thanks for your work figuring this out. :)

Can you try if 555 is sufficient?

Link to comment
Share on other sites

  • 8 months later...

I never wanted to own Apple stuff (again after the stilly iPod drove me crazy years ago).

But last week I bought a Mac Mini for 199 EUR, so I can test WUDSN IDE and my other tools on it. Once I have it running, I'll check out the description there.

 

If I get it correctly, the main issue is MADS and it also appears under Linux. That should be easy to fix. I'll contact tebe for that.

 

Where I'd need help is setting up Wine/Packaging Altirra in a way that is self-contained, so I can provide it as part of the read-to-run download archive.

 

- Peter.

  • Like 3
Link to comment
Share on other sites

I never wanted to as well, but once I had a MacMini (first at work), there was no way back to Windows for me. Linux is still nice® for programming, but having a consistent user interface that only changes in minor things over the years plus the underlying Unix background is really the best compromise for me - but I disgress ;)...

 

I have used WineBottler (http://mike.kronenberg.org/) - in the advanced section you can set a few parameters that will create a self-contained Alitrra app. Most important are the libraries that are to be in- (or ex-)cluded as these can save a lot of harddisk space (well, a lot is relative nowadays). Unfortunately, it's been so long ago that I did this that I forgot which sections in "Winetricks" I activated. I could send you my Alitrra App so you could have a look what I removed from the App directory structure to save space.

Later on, it is sufficient to replace the altirra.exe (and maybe the help file) within the app bundle when updating Altirra (one of the reasons why I never really wrote down the install settings).

 

If you need any further help, let me know.

 

F.

  • Like 2
Link to comment
Share on other sites

Sounds good. I'll check out Winebottler. Being able to simply exchange the EXE sounds great, because it means I and automate build the process like I planned to do it with the IDE itself (on native linux/mac: download windows package, exchange files, upload linux/mac package). So yes, please send me you package as reference.

 

Tebe already provided a working fix for the "Source:" problem also.

Link to comment
Share on other sites

@JAC!: PM

@Mathy: That would of course be great, but I'm not sure to what extent Altirra makes use of Windows' graphics/screen libraries which may be very specific to the OS. Then again, if a WINE emulation is around 30MB only, it shouldn't be too hard.

 

Is the new MADS version available for download anywhere? The project's home page still only has the 2.07 version online...

Link to comment
Share on other sites

MADS:

http://atariage.com/forums/topic/114443-mad-assembler-mads/?p=3881963

it is not an official version yet.

 

@Mathy:

The MADS assembler is console application and has only dependencies to the file IO and console of the OS, which is basically the same on all OSes.

It is designed to be compiled on other platforms. Therefore it can simply be recompile to obtain a native executable.

 

The Altirra emulator on the other hand is a "hardcore" Windows application which makes heavy use of the graphics APIs and libraries available for/specific for Windows.
These API/libraries do not exist in that as source or binary form on other OSes.

Here the approach to mimic the required parts of Windows is actually the more natural approach. And it'll even save time because you can just "plug in" new Altirra versions then.

Link to comment
Share on other sites

I plan to offer zero-installation downloads for WUDSN and Linx / Mac OS.

On Windows I've used "C:\jac" as the assumed default folder.

What would be the preferred default for Linux Mac OS X?

 

"~/jac"

"~/Documents/jac"?

 

I want to keep it equal for both systems. Opinions?

  • Like 1
Link to comment
Share on other sites

On Windows I've used "C:\jac" as the assumed default folder.

 

 

C:\jac is bad. I hate programs which always assume a C: drive. Use "%SystemRoot%\jac .

 

That said, I don't care what you take. Haven't used Windows for serious work since six years....

Link to comment
Share on other sites

 

 

C:\jac is bad. I hate programs which always assume a C: drive. Use "%SystemRoot%\jac .

 

That said, I don't care what you take. Haven't used Windows for serious work since six years....

 

And why should wusdn be installed at the root drive, whichever that is? Unless you did something really screwy with Windows there'll always be a C: drive. But if you went and did something screwy you probably know what you're doing and don't need a zero installation solution in the first place, right?

Edited by ggn
Link to comment
Share on other sites

 

And why should wusdn be installed at the root drive, whichever that is? Unless you did something really screwy with Windows there'll always be a C: drive. But if you went and did something screwy you probably know what you're doing and don't need a zero installation solution in the first place, right?

 

Just annoying defaults, and even worse if they cannot be changed. Saw this often on programs. We had a name for such programs in my previous work, "stupid C: root program".

 

C: might be a DOS or other partition. Why would or should I install a Windows program on a DOS partition? It consumes space there for no real reason. After all, this program cannot be run when I boot the DOS partition.

Link to comment
Share on other sites

As written above I was asking specifically for a the preferred default for Mac OS X/Linux.

Default implies that is of course not mandatory and you are free to put it where you want.

https://www.youtube.com/watch?v=36MFqY55yR0&t=14s

 

None of the OS file APIs handle environment variables (they are properties of the shells).

Hence the suggestion above is not feasible to handle the fact that the freely configurable paths on the IDE should come with a path that works by default.

Default in the sense: Download, unzip, click, run - even though your could configure dozens of individual paths. No script. No promtpt. No chmod. No installer.

  • Like 1
Link to comment
Share on other sites

I plan to offer zero-installation downloads for WUDSN and Linx / Mac OS.

On Windows I've used "C:\jac" as the assumed default folder.

What would be the preferred default for Linux Mac OS X?

 

"~/jac"

"~/Documents/jac"?

 

I want to keep it equal for both systems. Opinions?

 

/Applications/ would be the preferred location on OS X. Or, if you are installing it per user, then ~/Applications/.

 

And it would probably make sense to name it WUDSN instead of jac. :-)

  • Like 1
Link to comment
Share on other sites

Installing an unsigned application in /Applications (automagically) will probably be prevented by Apple's security mechanisms. ~/Applications will probably be easiest and cleanest, and I would also prefer ~/WUDSN instead of ~/jac - makes it easier to find :)... If you provide Altirra as part of the package, I would put Alitrra in the directory structure parallel to WUDSN so that it's possible to re-use it for other purposes as well without having to find it somewhere in the directory structure below WUDSN. (JDownloader does this with unrar2 etc., so you might end up having it twice on your drive unnecessarily).

 

Anyway, thanks for the effort, I really appreciate this!

 

F.

  • Like 1
Link to comment
Share on other sites

As written above I was asking specifically for a the preferred default for Mac OS X/Linux.

Default implies that is of course not mandatory and you are free to put it where you want.

https://www.youtube.com/watch?v=36MFqY55yR0&t=14s

 

Very good. I somehow didn't notice the "default" in your message. Sorry.

 

 

None of the OS file APIs handle environment variables (they are properties of the shells).

Hence the suggestion above is not feasible to handle the fact that the freely configurable paths on the IDE should come with a path that works by default.

Default in the sense: Download, unzip, click, run - even though your could configure dozens of individual paths. No script. No promtpt. No chmod. No installer.

 

I don't know. Are these paths somehow stored in a configuration file? If yes, I'd suggest to extenct your config file parser to handle environment variables in an entry. Then %SystemRoot%\jac would work.

 

But %SystemRoot% might not be a good place.

 

There's a difference if you want to install it for all users, or just the current user.

 

For all users it should be in "Program Files", for the current user somewhere in his home directory.

 

 

And it would probably make sense to name it WUDSN instead of jac. :-)

 

On Windows at least many companies seem to use locations like this:

 

Program Files\<company name>\<product name>

 

So installing for all users would be

 

Program Files\jac\wudsn

 

For one user would be

 

<home dir>\jac\wudsn

 

 

OSX, like mentioned above:

 

all users: /Applications/jac/wudsn

current user: ~/Applications/jac/wudsn

 

Linux:

 

all users: /opt/jac/wudsn

current user: ~/jac/wudsn

Link to comment
Share on other sites

Thanks for you feedback.

"On Windows at least many companies seem to use locations like this: Program Files\<company name>\<product name>"
That is exactly the reason for the jac subfolder. I already have other projects besides WUDSN IDE the follow the same base path.
Basically I have a local directory with everything working and pre-configured and a script to clean, ZIP and upload this to my site.
Today that exists for Windows. For the other platforms I want to do it the very same way.

 

"re these paths somehow stored in a configuration file? If yes, I'd suggest to extend your config file parser to handle environment variables in an entry."
It's not my configuration file/parse but the one that is built-into Eclipse.

 

Regarding central installation: in /Applications / opt
You can already do that if you follow the regular installation instructions.
My aim here is to have a simple download you an test drive even without admin rights.

I use essentially the same bash scripts for Linux and MacOS now (partly even for Windows using cywin).
Target is to download the Window ZIP, extract the common parts, replace them locally and create a platform specific ZIP and upload it again.
Therefore I'd would want to keep the paths & scripts equal on both systems.

  • Like 1
Link to comment
Share on other sites

  • 10 months later...

Today I tried to finally setup WUDSN ide on my mac. I can compile any .asm file with mads and automatically start it in Altirra 3.1 and wine with the above shellscript provided by freetz (thanks for that). The only thing that is not working is debugging within Altirra. Wudsn creates the files example.asm, example.atdbg, example.lab, example.lst and example.xex and executes example.xex but although I set some breakpoints Altirra doesn't stop execution in order to debug.

 

Edit: Perhaps someone can help?

 

I am using mads 1.9.9 (that's the latest version I could find for mac os). When I manually (F8) break the program Altirra seems confused because when I step (F11) into it shows the wrong sourcecode line in the .lst window breakpoint is at line 8 in my source code but in the .lst window Altirra always jumps to line no. 6.

 

Here is the sourcecode (Breakpoints at line 4 and 8 ):

 

1 org $4000
2
3 start
4 lda #52
5 sta 712
6
7 endless
8 jmp endless

9

10 run start

 

This is the .atdbg file:

 

.sourcemode on
.echo
.echo "Loading executable..."
.echo
bc *
.onexerun .echo "Launching executable..."
bp `/Users/patjomki/Documents/workspace/Wudsn-Test/example.asm:4`
bp `/Users/patjomki/Documents/workspace/Wudsn-Test/example.asm:8`

 

And that is the .lst file:
mads 1.9.9
1 org $4000
2
3 start
4 FFFF> 4000-4007> A9 34 lda #52
5 4002 8D C8 02 sta 712
6
7 4005 endless
8 4005 4C 05 40 jmp endless
9
10 02E0-02E1> 00 40 run start

Edited by patjomki
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...