Development Environments

The place for codemasters or beginners to talk about programming any language for the Spectrum.
Post Reply
User avatar
PeterJ
Site Admin
Posts: 6852
Joined: Thu Nov 09, 2017 7:19 pm
Location: Surrey, UK

Development Environments

Post by PeterJ »

There has been a lot of talk over the last few weeks about development environments for assembly language on the Spectrum. I thought I would share the work I have been doing with the Atom editor from the people at GitHub. Its available for Windows, Linux and Mac.

I start by installing two additional packages:

atom-shell-commands
Customize shell commands. Similar to 'Run Commands' in NotePad++, 'User Tool' in EditPlus/UltraEdit, 'External Tool' in GEdit and 'Shell Commands' in TextMate.

language-assembler-pasmo
The package enables syntax-coloring for Z80 Assembler like pasmo.

I have Pasmo installed in C:\Pasmo on my Windows box so in 'File' > 'Config' I add the following:

Code: Select all

"atom-shell-commands":
    commands: [
      {
        arguments: [
          "--tapbas"
          "{FileName}"
          "{FileNameNoExt}.tap"
        ]
        command: "c:\\pasmo\\pasmo.exe"
        name: "Pasmo Compile"
        options:
          cwd: "{FileDir}"
          keymap: "ctrl-2"
          save: true
      }
    ]
I can then compile my code by just pressing 'Ctrl+2'. I could make it start an emulator as well, but because I make so many errors its not a good move!


Image
User avatar
Guesser
Manic Miner
Posts: 639
Joined: Wed Nov 15, 2017 2:35 pm
Contact:

Re: Development Environments

Post by Guesser »

is this a thread about how you do it, or an invitation for a "post your speccy dev environment setups" thread?
User avatar
PeterJ
Site Admin
Posts: 6852
Joined: Thu Nov 09, 2017 7:19 pm
Location: Surrey, UK

Re: Development Environments

Post by PeterJ »

Hi [mention]Guesser[/mention], It's the later.
User avatar
Guesser
Manic Miner
Posts: 639
Joined: Wed Nov 15, 2017 2:35 pm
Contact:

Re: Development Environments

Post by Guesser »

PeterJ wrote: Sun Apr 01, 2018 6:17 pm Hi Guesser, It's the later.
I'll write one up in a bit then after I've had my dinner :)
User avatar
Guesser
Manic Miner
Posts: 639
Joined: Wed Nov 15, 2017 2:35 pm
Contact:

Re: Development Environments

Post by Guesser »

Righto, development environments.

I edit using notepad++ with a custom function labels definition

I assemble and link using gnu binutils z80-unknown-coff target compiled with and installed into msys2

I prepare tap files using Winston's bin2tape from the spectranet project and use Tapir and the fuse-utils for anything special.

All building and generation of files is done using makefile and from the command line in console2 tabs

Generally I have my makefiles copy the completed binary to a directory on my network share which is served up by a TNFS server and have a boot.zx file which launches the program at single keypress. I have Fuse set up with a snapshot that boots with spectranet configured and auto-connecting to the tnfsd.
User avatar
PROSM
Manic Miner
Posts: 472
Joined: Fri Nov 17, 2017 7:18 pm
Location: Sunderland, England
Contact:

Re: Development Environments

Post by PROSM »

Thought I'd weigh in here a bit:

My development environment is quite primitive in comparison to the setups of others.

I use Notepad++ for editing source files and HxDen for hex editing of binary files.

To assemble programs, I use Pasmo and for creating the final tape files of my software, I use Tapir.

Most of my work is done through the Windows Command Prompt, which is opened via a batch file which sets up the path to my command-line utilities and makes a virtual drive Z: for the development folder, letting me move the folder elsewhere without disturbing too much. It is from this terminal window where I run Pasmo and other utilities; I don't have shortcut keys set-up in Notepad++.

FUSE is used for testing my software, and occasionally SPIN is brought out if more extensive debugging needs to be done, since SPIN is a bit more user-friendly in that department.
All software to-date
Working on something, as always.
User avatar
lister_of_smeg
Microbot
Posts: 145
Joined: Thu Nov 16, 2017 1:44 pm

Re: Development Environments

Post by lister_of_smeg »

Sublime Text for me with the Z80Asm plugin, and zasm as my assembler.

I use zasm's native support for building .TAP files and a build file which assembles and launches the TAP in Fuse.
namco
Manic Miner
Posts: 247
Joined: Mon Dec 04, 2017 8:55 pm

Re: Development Environments

Post by namco »

Spectrum:
Editor - Notepad++
Assembler - Pasmo
Tape maker - Pasmo and a bit of concat from cmd prompt to put my Z80 code, loader and screen loader together - see this for further details: http://little-shop-of-pixels.blogspot.c ... part2.html
ZX Spin v 0.666 for testing

Spectrum Next:
Editor - Notepad++
Assembler - Pasmo
ZEsarUX for testing
User avatar
Alessandro
Dynamite Dan
Posts: 1908
Joined: Wed Nov 15, 2017 11:10 am
Location: Messina, Italy
Contact:

Re: Development Environments

Post by Alessandro »

I type and edit ASM code with Notepad++ and assemble it with Pasmo. I also created some command line batch files to speed things up.

I used Tapir a lot in the past, now I assemble files in the various formats, add turbo data etc. almost exclusively with ZX-Blockeditor.

ZX-Editor is my choice when I have to compose BASIC programs and ZX-Paintbrush for creating pictures, sprites, background and scenery elements etc.

For beeper and AY music I employ Beepola and Vortex Tracker II respectively.

Testing, other than with real hardware - mainly, but not exclusively, the 48K and +2A -, and debugging is made with Spectaculator, which I also use to test Beta Disk and PlusD files before release. I employ SpecEmu to emulate the DivIDE/DivMMC, especially to sort out and correct compatibility problems found while running software through my DivMMC EnJoy, and test compatibility with the Brazilian Beta Disk clones.
Nomad
Manic Miner
Posts: 600
Joined: Thu Dec 28, 2017 12:38 pm

Re: Development Environments

Post by Nomad »

As far as text editors go I don't realy mind much depends on if I just need to make a quick edit or if I need to make extensive changes. For small stuff I just use ed. anything more than a few lines I will use vim or if my machine is behaving itself sublime editor.

It's all wrapped in a Forth program that runs a simple menu loop. I can edit the source, assemble and run the tap file in fuse all with a few key presses. :lol: Low-fi but I am lazy. One of the advantages is if I want to change my emulator, assembler or text editor I can and it won't break my workflow.

Forth is a great systems language - I could have written the same thing in C but it would have been a lot more painful and less flexible.

by entering a 3 char code i can load any program usually use or sequence of commands.

SevenUp or Zxpaintbrush for the spectrum graphics. but there is a more general tool called Grafx2.

If I want to prepare stuff for pdf I use latex. Once you get over the learning curve for tex its actually a very powerful language.

For music I prefer trackers, Milkytracker is great for modern tracking. But I also like sunvox. That said sunvox needs a more modern PC than what I have :lol: Beepola is great for spectrum projects. But really there are some great trackers for the spectrum.

I use Fuse for the emulator, I get salty at some of the limitations of it but I can't think of a better alternative for the moment. I like the fact I can print out my programs to a text file. One thing I cant figure out is how to print the graphics characters in this way though. It would be nice to be able to generate a pdf with the graphics characters left intact.

The system I use with Fuse is a +3.

Assembler I use the command line assembler for Zeus. I find it to be the most powerful of all spectrum assemblers. I wish the IDE would work well in linux under wine but I have hope one day that will get fixed. The thing I like about Zeus was you get a ton of examples to show all the different parts of the assembler. At first it feels like a nagging partner because it asks a lot of questions about the project but once the task becomes complicated you realize it makes seance to know everything from the start. :lol:

Spend time at the start setting stuff up with Zeus makes later development faster.

Pasmo is ok for testing stuff out, but for a big project I would say zeus is a better choice.
User avatar
Ast A. Moore
Rick Dangerous
Posts: 2640
Joined: Mon Nov 13, 2017 3:16 pm

Re: Development Environments

Post by Ast A. Moore »

Nomad wrote: Thu Apr 05, 2018 11:42 am One thing I cant figure out is how to print the graphics characters in this way though. It would be nice to be able to generate a pdf with the graphics characters left intact.
Well, obviously, you can’t output them to a simple TXT file, so Fuse replaces them with spaces. You can, however, have Fuse generate a PBM of the printout along with the TXT of your BASIC listing. Use LLIST or LPRINT, and both files should be generated.
Every man should plant a tree, build a house, and write a ZX Spectrum game.

Author of A Yankee in Iraq, a 50 fps shoot-’em-up—the first game to utilize the floating bus on the +2A/+3,
and zasm Z80 Assembler syntax highlighter.
User avatar
Blerkotron
Dizzy
Posts: 90
Joined: Mon Nov 13, 2017 12:36 pm

Re: Development Environments

Post by Blerkotron »

Here's my setup:

Microsoft's 'Visual Studio Code' for editing (it has a plug-in for Pasmo/Z80 highlighting which should also work for most assemblers).
Pasmo for assembling.
SpecEmu for debugging.
BitBucket for source control.

VS Code makes for an excellent Z80 editor, it's not just for modern languages. It's extensible, so I can have highlighted Z80 formatting and easily set it up to call build and run scripts on hotkeys, plus it has built in Git support so I can hook it straight up to BitBucket to keep all my code safe. Then SpecEmu's excellent debugger makes it really easy to breakpoint, single-step, check registers/memory, etc.

It's not quite a fully integrated dev environment, but it's not far off. And there's also a highlighting plug-in for Boriel's ZXBasic - I've used the exact same setup for that too.

Image
User avatar
Morkin
Bugaboo
Posts: 3250
Joined: Mon Nov 13, 2017 8:50 am
Location: Bristol, UK

Re: Development Environments

Post by Morkin »

Blerkotron wrote: Fri Apr 06, 2018 10:49 pm Here's my setup:

Microsoft's 'Visual Studio Code' for editing (it has a plug-in for Pasmo/Z80 highlighting which should also work for most assemblers).
Pasmo for assembling.
SpecEmu for debugging.
BitBucket for source control.

VS Code makes for an excellent Z80 editor, it's not just for modern languages. It's extensible, so I can have highlighted Z80 formatting and easily set it up to call build and run scripts on hotkeys, plus it has built in Git support so I can hook it straight up to BitBucket to keep all my code safe. Then SpecEmu's excellent debugger makes it really easy to breakpoint, single-step, check registers/memory, etc.

It's not quite a fully integrated dev environment, but it's not far off. And there's also a highlighting plug-in for Boriel's ZXBasic - I've used the exact same setup for that too.

Image
That looks like some distressingly organised and well-commented code... :o
My Speccy site: thirdharmoniser.com
User avatar
PeterJ
Site Admin
Posts: 6852
Joined: Thu Nov 09, 2017 7:19 pm
Location: Surrey, UK

Re: Development Environments

Post by PeterJ »

Blerkotron wrote: Fri Apr 06, 2018 10:49 pm
VS Code makes for an excellent Z80 editor, it's not just for modern languages. It's extensible, so I can have highlighted Z80 formatting and easily set it up to call build and run scripts on hotkeys
Hi [mention]Blerkotron[/mention], I have looked at Microsoft Visual Code. It looks promising as it runs on both Linux and Windows. I did try and read the bit about calling external commands to make build calls but I got thoroughly confused! Is there any chance you could expand on this with some examples?
User avatar
Blerkotron
Dizzy
Posts: 90
Joined: Mon Nov 13, 2017 12:36 pm

Re: Development Environments

Post by Blerkotron »

Morkin wrote: Sun Apr 08, 2018 1:24 pm That looks like some distressingly organised and well-commented code... :o
Partly because I do code for a living and partly because it helps greatly while I'm learning. Quite often I come back to routines weeks later and can't remember for the life of me why I did something a certain way, so leaving tons of comments really helps.
User avatar
Blerkotron
Dizzy
Posts: 90
Joined: Mon Nov 13, 2017 12:36 pm

Re: Development Environments

Post by Blerkotron »

PeterJ wrote: Sun Apr 08, 2018 1:31 pm I have looked at Microsoft Visual Code. It looks promising as it runs on both Linux and Windows. I did try and read the bit about calling external commands to make build calls but I got thoroughly confused! Is there any chance you could expand on this with some examples?
Sure - VS Code is a bit bare-bones when it comes to config, it expects you to be happy editing .json files so it's not quite as user-friendly as some. The good news is that once you've set them up you don't need to touch them again.

You need to select a folder where your source will live. Once there, choose 'configure default build task' from the Tasks menu (it will appear when you hit alt if it's not visible by default) and then choose 'create tasks.json file from template' from the pop-up that opens and then select 'others' (because we're going to feed it a script file). That'll make a file for you with practically nothing in it, like this:

Code: Select all

{
    // See https://go.microsoft.com/fwlink/?LinkId=733558
    // for the documentation about the tasks.json format
    "version": "2.0.0",
    "tasks": [
        {
            "label": "echo",
            "type": "shell",
            "command": "echo Hello"
        }
    ]
}
I replaced the contents of that file with a configuration like this (most of which was ripped from Internet examples), which sets up both the build and the test/run tasks:

Code: Select all

{
    // See https://go.microsoft.com/fwlink/?LinkId=733558
    // for the documentation about the tasks.json format
    "version": "2.0.0",
    "tasks": [
        {
            "label": "pasmo",
            "command": ".\\make.cmd CosmicJanitor",
            "type": "shell",
            "group": {
                "kind": "build",
                "isDefault": true
            },
            "presentation": {
                "echo": true,
                "reveal": "always",
                "focus": true,
                "panel": "shared"
            }
        },
        {
            "label": "test",
            "command": "c:\\games\\emulators\\spectrum\\specemu\\specemu.exe",
            "args": [
                "c:\\dropbox\\code\\speccy\\CosmicJanitor\\CosmicJanitor.tap"
            ],
            "type": "shell",
            "group": {
                "kind": "test",
                "isDefault": true
            },
            "problemMatcher": [],
            "presentation": {
                "echo": false,
                "reveal": "never",
                "focus": false,
                "panel": "shared"
            }
        }
    ]
}
Most of the options in there you won't need to worry about, but the bits which are custom to building Speccy code should stand out pretty well. The build task runs a Windows batch file called make.cmd and feeds it the game name as a parameter. That file lives in the root of the folder we selected at the start and looks like this (but yours could look like anything you like, obviously):

Code: Select all

@echo off
setlocal
set PASMODIR=C:\Dropbox\Code\Speccy\_Tools\Pasmo

"%PASMODIR%\pasmo" --alocal --tapbas --name CosmicJanitor %1.asm %1.tap %1.symbol

endlocal
The test task is even simpler - it basically locates and runs SpecEmu and feeds it the .tap file that Pasmo generates as an argument.

With the tasks.json file saved, I can now hit CTRL/Shift-B to run a build. CTRL/Shift-P opens the tasks menu, and you should find that 'run test task' is the first entry in there - selecting it should run SpecEmu and fire up the .tap file.

This config persists just for this project, so if you set up a new one in a new folder you'd need to copy the file across or generate a new one.

Hopefully that makes some sense - please ask if anything seems weird or unclear. It might seem a bit unfriendly (and it is) but literally it's the only bit of config I've done apart from installing the Pasmo plug-in - everything else is 'out of the box'.
User avatar
djnzx48
Manic Miner
Posts: 729
Joined: Wed Dec 06, 2017 2:13 am
Location: New Zealand

Re: Development Environments

Post by djnzx48 »

Thanks for the VS Code suggestion. I wasn't a fan of it when it was first released but it turns out it's well suited to Spectrum development and a nice editor overall.

Has anyone tried using the Zeus IDE's built in debugger? It sounds like it would be really useful as you can see the source while you're debugging, but when I try it I just get garbled screen output and weird bugs. Even writing to the display gives errors like "Illegal write to 48D3".

EDIT: OK I found out what the problem was: I had hidden my loader program in the loading screen, so trying to write to it must have registered as an error. I also had some code located directly after the attribute area at $5B00, that was seemingly being overwritten by some BASIC system variables or something. Is there a way to get around this?
User avatar
Seven.FFF
Manic Miner
Posts: 735
Joined: Sat Nov 25, 2017 10:50 pm
Location: USA

Re: Development Environments

Post by Seven.FFF »

I would uncheck Trap On Error unless you’re going to going to use the mem_* diectives to set the access flags for all your memory addresses. This is what’s triggering your Illegal Write error.
Robin Verhagen-Guest
SevenFFF / Threetwosevensixseven / colonel32
NXtel NXTP ESP Update ESP Reset CSpect Plugins
User avatar
djnzx48
Manic Miner
Posts: 729
Joined: Wed Dec 06, 2017 2:13 am
Location: New Zealand

Re: Development Environments

Post by djnzx48 »

Thanks, that solved the problem! I discovered what was causing the memory corruption as well - I had a DI instruction in the loader but not in the main program, so the BASIC interrupts were writing over code.

I just have one other question: is it possible to get procedures to show up in the symbol table with all the other labels? Right now I'm using procedures for each separate routine but it becomes difficult to deal with them if you can't find out where they are in memory easily.
Post Reply