Jump to content
IGNORED

Modern tool chain for 8bit development


Recommended Posts

I started back into 6502 assembler after a good 30+ years and wanted to use the tools I'm familiar with. That is VS Code as the editor. ATasm was the assembler of choice and Altirra the emulator.

Now getting back into learning some 6502 had me dumping hex codes on the screen until I found out that Altirra has a nice debugger.  Still I had no easy way of finding my code in the disassembly view, so I was padding the points of interest with nops etc.

There had to be a better way. I found some topics here talking about debugging options in Altirra but there was no guide or documentation (none that I could find).  At least the source code for Altirra is available and after getting it to compile and running, I managed to figure out the file format to get source level debugging to work.

I modified ATasm to generate the required symbol and list files so that Altirra could load them. Then I wrote a VSCode extension to bring it all together.  

 

Now I can write my asm code, set a breakpoint in VSCode and launch the debugger and have it stop where I want it.

 

The extension is called Atasm Altirra Bridge

https://marketplace.visualstudio.com/items?itemName=cerebus.atasm-altirra-bridge

Edited by RetroCoder
added tags
  • Like 15
  • Thanks 2
Link to comment
Share on other sites

28 minutes ago, playermissile said:

This looks great! VSCode is cross-platform, so the syntax highlighting should at least work on other systems. When I get a chance I will try it on linux and see if I can start the atari800 emulator by setting the altirra.path variable to point to atari800.

The code is available on Github so a pull request would be great.  Let get this cross-platform

Link to comment
Share on other sites

2 hours ago, RetroCoder said:

The code is available on Github so a pull request would be great.  Let get this cross-platform

I don't know typescript but your code looks clean and easy to follow. Long learning curve ahead from me, but it's possible that I might be able to contribute something eventually.

Link to comment
Share on other sites

I added a Linux version of ATasm 1.11 in version 1.1.0 of the extension.  Should at least be able to assemble your code under Linux now.  I tried running Altirra under wine under WSL2 on Win10 (hmm a bit much there) and did not get it to work, but it should work running on a Linux machine

  • Like 1
Link to comment
Share on other sites

Thought I'd give it a try on MacOS (yeah, I know Altirra doesn't run under MacOS), and can't get it to compile. I set a custom path for atasm in the settings (in my case '/usr/local/bin/atasm'), but it doesn't want to use that setting, seems fixed to trying to use the Linux path:

 

"atasm-altirra-bridge.assembler.atasmPath": "/usr/local/bin/atasm"

Starting build ...
-oout/b-ring.xex -lout/b-ring.lab -gout/b-ring.lst "b-ring.asm"
/bin/sh: /Users/john/.vscode-exploration/extensions/cerebus.atasm-altirra-bridge-1.1.0/bin/darwin/x64/atasm: No such file or directory
Exit code: 127

I wish there was a MacOS version of Altirra, or at least one of the Mac emulators would work (Atari800MacX would be awesome!)

Link to comment
Share on other sites

I just put a link to my already installed atasm in ~/.vscode/extensions/cerebus.atasm-altirra-bridge-1.0.0/out/bin. That got it going. But since my version of atasm does not support the new debug code(-g switch) I had to change this: "withDebug": false.

 

you should be able to do a

ln -s `which atasm` /Users/john/.vscode-exploration/extensions/cerebus.atasm-altirra-bridge-1.1.0/bin/darwin/x64

and then you can change the altirra path to use atari800, now clicking the rocket builds it and pops it up on atari800.

 

Edited by invisible kid
Link to comment
Share on other sites

14 hours ago, tsom said:

Thought I'd give it a try on MacOS (yeah, I know Altirra doesn't run under MacOS), and can't get it to compile. I set a custom path for atasm in the settings (in my case '/usr/local/bin/atasm'), but it doesn't want to use that setting, seems fixed to trying to use the Linux path:

 


"atasm-altirra-bridge.assembler.atasmPath": "/usr/local/bin/atasm"

Starting build ...
-oout/b-ring.xex -lout/b-ring.lab -gout/b-ring.lst "b-ring.asm"
/bin/sh: /Users/john/.vscode-exploration/extensions/cerebus.atasm-altirra-bridge-1.1.0/bin/darwin/x64/atasm: No such file or directory
Exit code: 127

I wish there was a MacOS version of Altirra, or at least one of the Mac emulators would work (Atari800MacX would be awesome!)

Thank you for testing the extension on MacOS.  I don't have a mac to try it on, but will make a plane to get the latest version of ATasm into the extension.

 

At for it using the linux path,  yes that is a bug. I'll fix it and release a new version asap.

Link to comment
Share on other sites

This sounds incredible. I have it similar with my daytime job programming, using a debugger with 4D that takes me through each line.

 

Would it be difficult for someone to convert this to MADS? I have a level of debugging with Mads and Altirra but not from vsCode. I won't volunteer, too many projects on the go...!
 

Link to comment
Share on other sites

Version 1.2.0 of the extension has been released.

- Better integration of the ATasm assembler
- Fixed a bug that reset the path to be always the Windows path of the atasm
- Build Task now also works when 'atasm-build.json' is the currently open file
- Added configuration options to allow for another emulator to be used
  - Set the ownEmulator setting and supply the path and arguments
  - The extension will not add any parameters. You will need to supply them in the correct format.

 

With this release you can specify a different emulator.  The readme had some instructions.  

Should now be able to run any emulator.  You just have to supply the arguments

 

I'll have to find a Mac with a dev environment on it to get atasm v1.11 compiled, then I can have the extension Windows/Linux/MacOS compatible

 

Happy debugging

  • Like 3
  • Thanks 1
Link to comment
Share on other sites

3 hours ago, RetroCoder said:

Version 1.2.0 of the extension has been released.

- Better integration of the ATasm assembler
- Fixed a bug that reset the path to be always the Windows path of the atasm
- Build Task now also works when 'atasm-build.json' is the currently open file
- Added configuration options to allow for another emulator to be used
  - Set the ownEmulator setting and supply the path and arguments
  - The extension will not add any parameters. You will need to supply them in the correct format.

 

With this release you can specify a different emulator.  The readme had some instructions.  

Should now be able to run any emulator.  You just have to supply the arguments

 

I'll have to find a Mac with a dev environment on it to get atasm v1.11 compiled, then I can have the extension Windows/Linux/MacOS compatible

 

Happy debugging

Excellent! I’ll give it a test. As long as it uses the setting and picks up my install of atasm, having it bundled isn’t a huge issue.

 

thanks!

Link to comment
Share on other sites

I'm happy to report that I am able to assemble and run a program using this extension on MacOS, using my own install of atasm. (It's only version 1.10, will have to update...) Debugging doesn't work, obviously, due to running in Atari800MacX, which doesn't understand the Altirra debugging stuff. But some success!

 

Actually, I originally had the path to Atari800MacX in the "Altirra: Path" setting and that seemed to work - it added the compiled file as an argument. However, I noticed the new "Own Emulator" flag and path, so I set that up, but while it launches the emulator, it doesn't pass the name of the compiled file. How do I add that as a parameter?

Edited by tsom
Link to comment
Share on other sites

  • 8 months later...

For those using the VSCode to code their 6502 assembler project there is a bit of news.  The atasm-altirra-bridge plugin has been updated to version 1.6

Two important new features:

1. when using ATasm as your assembler you can now specify the -hv command line flag to export all constant, label, macro and include files data.

  - This can be viewed via the new `Asm Symbol Explorer` view.

  - Get info on where your symbols are defined, what their memory location/value is etc.

2. If your project uses mads then there is a simple configuration switch that lets you use the mads assembler.

  - Mads does not support the new `Asm Symbol Explorer` view (ATasm only feature)

  • Like 5
  • Thanks 1
Link to comment
Share on other sites

I see this thread was started in 2021.  Anyway, I happen to use Visual Studio Code, a Macbook Air M1, and Altirra.

 

Altirra, I have Parallels installed with Windows Developer preview for Arm, and altirra.   Frankly Windows on this setup works so smoothly and fast, that I don't worry about it being developer preview.  It's a problem for Parallels since they cannot sell it with the software, but, works like a charm.

Link to comment
Share on other sites

  • 2 weeks later...

New version of the VSCode plugin has been released.

When using ATasm (latest version) the symbol explorer now shows the comments from the assembler source code:

i.e.

HELLO = 55 ; Give hello a nice value

Loop jmp Loop ; Wait until the end of time or power down

The symbol explorer (which can now be dragged to a different location, thank to VSCode allowing multiple pannels) will show the ; Give hello a nice value

and

; Wait until the end of time ...

 

Just makes for a quicker overview of your code.

 

Also added settings to control single instance of Altirra and which symbols atasm should export to the symbol explorer. If you have plenty of constants defined in your code that section can get very big

  • Like 1
  • Thanks 1
Link to comment
Share on other sites

  • 2 months later...

Thanks a lot for this really cool extension! It works perfectly on my Mac :)!

I have been using Eclipse with WUDSN for a long time, but since I use VSCode for all my other coding projects, I'm really happy to be able to move my workflow here.

 

Since a few people here have been looking for a way to get this working on a Mac, here's what I did:

 

- Install Wine.app:

-- Install brew (if you haven't done so before):

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

-- Install wine:

brew tap homebrew/cask-versions
brew install --cask --no-quarantine wine-stable

- Download and extract Altirra from https://www.virtualdub.org/altirra.html

 

- Test if wine works with Altirra from the terminal (adjust paths to your configuration, but make sure you always use the 64 bit versions), ignore the complaints that "Mono" is missing (just hit cancel) and go through the initial configuration:

/usr/local/bin/wine64 ~/Downloads/Altirra-4.01/Altirra64.exe

- Optionally: Install MADS from https://github.com/tebe6502/Mad-Assembler/releases

brew install fpc
fpc -Mdelphi -vh -O3 mads.pas
cp mads /usr/local/bin

- Install the Atasm Altirra Bridge extension in VS Code

- Configure the extension to your liking but make sure to configure

Atasm-altirra-bridge > Emulator > Altirra: Path

to this:

/Users/<YOUR USERNAME>/altirra.sh

- If you want to use MADS, set the corresponding setting and fill in the full path to the MADS assembler.

 

- Then create altirra.sh with this content (again, adjust paths like above):

#!/usr/local/bin/bash

/usr/local/bin/wine ~/Downloads/Altirra-4.01/Altirra64.exe $@

and change the permissions to executable:

chmod 755 ~/Downloads/Altirra-4.01/altirra.sh

Now create/open a assembly file and press SHIFT + COMMAND + P to open the command palette and search for "Atasm: Assemble source code and run in Altirra" and execute this command. Upon first execution, it will create a atasm-build.json file. It looks like this:

{
	"comment": "Altirra configuration file.",

	"_1": "Which asm file is to be compiled?",
	"input": "theapp.asm",

	"_2": "Array of folders that will be searched when files are .include(d)",
	"includes": [],

	"_3": "Which folder will all the output files be written to. 'out' by default. Always in the workspace!",
	"outputFolder": "out",

	"_4": "Additional atasm parameters:-v -s -u -r -fvalue",
	"params": "",

	"_5": "List of symbols to be set via the parameter list",
	"symbols": [],

	"_6": "If debug is enabled then symbol table and listings are generated for Altirra debugging",
	"withDebug": true
}

- You have to change "input" to the primary file you want to compile and replace "theapp.asm" with it.

- You have to change "outputFolder" from "out" to "."

 

Then you can press SHIFT + COMMAND + P again and run "Atasm: Assemble source code and run in Altirra" again and now it should compile, fire up Altirra and run your compiled program in it.

 

Happy coding :)!

Edited by freetz
  • Like 2
  • Thanks 1
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...