Specasm: A Z80 assembler designed to run on the spectrum itself

Show us what you're working on, (preferably with screenshots).
markusr
Drutt
Posts: 29
Joined: Sun Feb 20, 2022 3:14 pm

Re: Specasm: A Z80 assembler designed to run on the spectrum itself

Post by markusr »

Specasm v6 has been released. There's only one change in this new release but it is a significant improvement.

It is now actually possible to install Specasm!

Releases v2 to v5 allowed you to re-install Specasm on a sdcard where it had previously been installed, but not it seems, to install it on a sdcard on which Specasm had not been previously installed, or more specifically, on an sdcard that did not contain the /BIN/EXTRA directory. Release v6 fixes the install script so Specasm can now be both installed and re-installed, which I think is a significant milestone in the project. There are no changes to the editor/linker/assembler and Specasm v6 remains backwardly compatible with earlier releases.

Many thanks to @SamC for the bug report.
markusr
Drutt
Posts: 29
Joined: Sun Feb 20, 2022 3:14 pm

Re: Specasm: A Z80 assembler designed to run on the spectrum itself

Post by markusr »

Release v7 of Specasm is now available.

Highlights include
  • A new version just for the ZX Spectrum Next
  • Support for all Z80N instructions (in the Next version)
  • A new tool called samake for automatically generating tap and BASIC loaders ( specially for @PeterJ )
  • A fixed bug which prevented lines containing equ statements from appearing to be selected
Lowlights include
  • The Next and the original 48/128k version of Specasm are not binary compatible, meaning you can’t copy a .x file from your Toastrack and load it up on your Next. This is due to some short shortsightedness on my part when adding support for expressions back in v5 and the simple fact that we’re hitting the limits of the existing binary format. The two versions are source code compatible however, so the same .s file can be saimported on the Next and on the 48k, providing it doesn’t contain any Z80N instructions.
  • The Next version is basically just a straight port of the 48k version, albeit it with all the new instructions. Specasm isn’t currently taking advantage of the extra capabilities of the Next, except for the faster CPU.
Nonetheless, the Next is probably the best way to enjoy, or rather endure, Specasm. The keyboard is nice. Specasm's editor is more responsive as it runs at 28Mhz. The faster CPU and the fact that specasm and salink are now dotn files that do not corrupt your program's BASIC loader, makes the development cycle faster and less tedious. Also, the Next’s built in debugger, accessible via the new nbrk mnemonic, is a great feature.
User avatar
PeterJ
Site Admin
Posts: 6889
Joined: Thu Nov 09, 2017 7:19 pm
Location: Surrey, UK

Re: Specasm: A Z80 assembler designed to run on the spectrum itself

Post by PeterJ »

Thanks @markusr,

I look forward to trying it out!
markusr
Drutt
Posts: 29
Joined: Sun Feb 20, 2022 3:14 pm

Re: Specasm: A Z80 assembler designed to run on the spectrum itself

Post by markusr »

Release v8 of Specasm is now available. It contains numerous updates and improvements:
  • The keyboard handling is much improved. Phantom key strokes are no more and key repeat should feel more natural.
  • Binary files can now be included using the new '!' directive.
  • The existing '+' and '-' directives can now be used to include entire directories rather than individual files. This makes is easier to split programs up over multiple folders.
  • The order in which .x files are linked is now well defined. Previously, the file containing the .Main label was linked first with the remaining files being linked in an arbitrary order. In Specasm v8, the file containing the .Main label is still linked first but the remaining files are now linked in ascending alphabetical order of their path names.
  • The existing contents of the editor are no longer deleted when opening a non-existent file.
  • Specasm now accepts one parameter on the command line, a .x file to open, e.g., .specasm sprite.x. (Next only)
  • There's now a proper clipboard, supporting proper cut, copy and paste. The clipboard is less clunky than the existing copy and move commands and allows code to be moved between files. (Next only)
SamC
Microbot
Posts: 174
Joined: Sun Sep 29, 2019 9:07 pm

Re: Specasm: A Z80 assembler designed to run on the spectrum itself

Post by SamC »

Thank you very much for the continuously development and all the improvements!
When I add tools like the SERCP from PVYM and the (hex)EDITOR from NAMCO, it is a perfect system to do things without an emulator. :)

I recommend adding documentation to the distribution package.
markusr
Drutt
Posts: 29
Joined: Sun Feb 20, 2022 3:14 pm

Re: Specasm: A Z80 assembler designed to run on the spectrum itself

Post by markusr »

SamC wrote: Thu Mar 14, 2024 7:48 am Thank you very much for the continuously development and all the improvements!
When I add tools like the SERCP from PVYM and the (hex)EDITOR from NAMCO, it is a perfect system to do things without an emulator. :)
Thanks SamC. It's great to hear that Specasm is being used.
I recommend adding documentation to the distribution package.
Good idea. I'll add this in the next release, which will hopefully be out later in the Spring.
markusr
Drutt
Posts: 29
Joined: Sun Feb 20, 2022 3:14 pm

Re: Specasm: A Z80 assembler designed to run on the spectrum itself

Post by markusr »

Specasm v9 is now available. There are two main additions in this release

ZX81 Support

Specasm v9 supports cross-assembly for the ZX81. What this means is that samake is now capable of creating .p files and .salink can be instructed to transliterate any string or character constant it encounters from ASCII to ZX81 encoding, by means of a new zx81 keyword. This all works rather nicely on the Next which has built in ZX81 emulator; run salink to build your program, samake to generate the .p file and then run the .p file from the Next’s browser to test.

Unit Testing Support

Specasm v9 supports a new file type, the .t file. .t files are annotated object files, just like .x files, but they are designed to contain test code. Their contents are not included in the main binary generated by salink. The linker will however generate a second binary if it encounters any .t files in a project. This binary will have a .tst extension and it will contain the code from all the .t and the .x files that comprise the project. Unit tests are written as functions in .t files and are identified by labels that start with .Test, e.g., .TestDivide. Each unit test is expected to return with a non zero value in BC when the test fails, and 0 when it succeeds. Samake has been modified to automatically generate test harnesses for unit tests. When run with the ‘tst’ parameter, it generates a BASIC file that loads the project's .tst binary and calls all the .Test functions that it contains, printing their results to the screen. This is all a little bit difficult to explain but it does work well in practice. It allows you to keep your test content separate from your main program source and binary and provides a way to easily execute that test content. For more information see the Specasm documentation.

There are also some support functions that are provided for use when writing unit tests. These functions, TstSaveRegs, TstParseRegs. TstCmpRegs can be used in combination to check that a function under test only modifies the registers it’s allowed to modify. Their usage is a bit clunky to be honest and the way they’re employed may vary from test to test. My original plan for this feature involved decorators declaring registers corrupted, that could be attached to global labels, but in the end, there wasn’t enough memory available for that sort of finery. Despite their clumsiness I hope these functions will help detect register corruption issues, which until now, have plagued my handwritten z80 code.

A few bugs also got fixed along the way.
Post Reply