Click here to Skip to main content
15,887,214 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I'm attempting to configure the ZAMC assembler to compile code in my workspace with .asm extension. I've used VSC for some time but with standard file extensions that didn't require anything special to compile and run but now I want to set up a launch.json file to compile an zmac assembly file. Googling didn't produce anything that I could use and am wondering where to even begin?

Do I need to set up a task.json file to configure the asm type to use in launch.json or am I totally off base?

Any help appreciated.

What I have tried:

Not sure where to begin, maybe point me to a link or post that could give me some place to begin.
Posted

1 solution

Hi Mike, great to see you on the Q&A side of the world for a change :)... I am not at all familiar with ZMAC at all and took the "easy but stupid" way out, sometimes it helps, sometimes it is a waste of time, your choice to try it - I have asked GPT (Yeah we know) and it came up with this -

Trying this might point you in the right direction - I HOPE :) -

Plain copied and pasted as is -

Quote:
Setting up compilation for ZMAC assembly code in Visual Studio Code involves configuring tasks in the tasks.json file and specifying the launch configuration in the launch.json file. Here's a step-by-step guide to help you get started:


Quote:
Install ZMAC Assembler:
Make sure you have ZMAC installed on your system. You can usually find installation instructions on the official ZMAC GitHub repository or the project's website.

Create a tasks.json file:
In your Visual Studio Code workspace, create a tasks.json file if you don't have one already. This file is used to define tasks such as building and compiling.


JSON
// tasks.json
{
  "version": "2.0.0",
  "tasks": [
    {
      "label": "assemble",
      "type": "shell",
      "command": "zmac",
      "args": ["${file}"],
      "group": {
        "kind": "build",
        "isDefault": true
      }
    }
  ]
}


Quote:
This example assumes that the zmac command is available in your system's PATH. Adjust the "command" and "args" values if necessary.

Create a launch.json file:
Now, create a launch.json file in your workspace. This file is used to configure how your program should be launched.


JSON
// launch.json
{
  "version": "0.2.0",
  "configurations": [
    {
      "name": "Debug ZMAC",
      "type": "cppdbg",
      "request": "launch",
      "program": "${workspaceFolder}/your_executable_name",
      "args": [],
      "stopAtEntry": false,
      "cwd": "${workspaceFolder}",
      "environment": [],
      "externalConsole": false,
      "MIMode": "gdb",
      "setupCommands": [
        {
          "description": "Enable pretty-printing for gdb",
          "text": "-enable-pretty-printing",
          "ignoreFailures": true
        }
      ],
      "preLaunchTask": "assemble",
      "miDebuggerPath": "/path/to/your/gdb"
    }
  ]
}


Quote:
Adjust the "program" and "miDebuggerPath" values based on your setup. If you're not debugging or using GDB, you can modify the configuration accordingly.

Compile and Run:
Open your ZMAC assembly file in Visual Studio Code, press Ctrl + Shift + B to build using the defined task, and then use the appropriate configuration to run or debug your program.

Remember to replace placeholders like ${file}, ${workspaceFolder}, and others with your actual file paths and configurations. This setup assumes a simple scenario, and you might need to adjust it based on your specific project structure and requirements.
 
Share this answer
 
Comments
Mike Hankey 9-Nov-23 14:03pm    
Awesome thanks Andre, I thought it would be something similar but had no idea of syntax and couldn't find anything from Mr. Google.

Haven't played with/tried any of the GPT's yet, guess I might outta try.

Thanks again!
Andre Oosthuizen 9-Nov-23 14:13pm    
Only a pleasure! Don't always believe what GPT or any other machine feeds you though, many a time it's all bull but they do tend to point you in the right directions.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900