#zenas

2025-10-14

Debugging my macros. The good thing is that after you have some well designed macros, most of the simple text user interface things behave almost like BASIC, or terminal printing in Pascal.

Also a good chance to dog food myself using the barely improved editor, and trying to make the zenas assembler work and assemble my non-trivial Z80-based text editor. Dog food is good food!
The only problem I found today was a regression in the vim-like command to jump to a line number. One other thing I noticed is that horizontal scroll doesn't work reliably when you have very long lines that extend beyond the right margin.

That being said, It's a little miracle I have never seen it crash, not a single time, during actual development work.
The best of news is that there are not many news on that front!

#bim #tbim #zenas #z80 #zen80 #zenzx #retrocomputing #ZXSpectrum #speccy #Spectrum

2025-10-11

tbim, bim, zenas, zen80

Yes, of course all of these things can be done mixing and matching disparate tools in some other ways, but as a matter of access and code legibility you will be able to directly examine every single bit of the toolset and toolchain.

Every single bit traceable, nowhere left for bits to hide. That's something you can't do unless you're a highly sophisticated specialist today.

#bim #tbim #zenas #zen80 #zenzx #retrocomputing #golang #foss

2025-10-11

zenas, zen80, bim and assorted tools

Things starting to fall into place like Tetris bricks!

I still can't glue the ZenZX emulator to the text mode editor, but when I decouple the text mode renderer from the editor logic (sometime next year), I should be able to render the editor and other tools using Deluxe UI in a GL-accelerated window, and I should be able to embed ZenZX in a bim pane.

But essentially everything you see in this screenshot, from tiling manager, to editor, to assembler, to emulator, is one single coherent and consistent codebase (with the sole exception of the Spectrum ROM!)

Lots of work ahead in 2026!

Longer term project beyond 2026 will be to get the language ual off the ground and port all these things to ual.

#bim #tbim #zenzx #zen80 #zenas #foss #golang #retrocomputing #z80

2025-09-20

And if we replace that 255 with a 256 we'd be occupying the space of a 16-bit integer, which the test_func shouldn't accept.

And now it won't! It works!

#zenas #z80

2025-09-20

That's not too bad.

#zenas #z80

2025-09-20

zenas - z80 assembler

zenas gains basic C-style macros. The .MACRO_STYLE directive works for the most basic cases passing simple parameters.

Notice the very subtle difference between these two most basic code examples. One of them uses a constant value, the other uses a variable parameter to perform an operation.

Up next I'm working on call-block style (not inline) function calls, juggling multiple parameters, return values and other nice things on the drawing board. Possibly the most important external tool is the z88dk library importer, which I'm still drafting on the back of my mind.

#zenas #asm #assembler #z80 #golang #foss

2025-09-19

Ok traditional-style assembler macros are working almost perfectly now.

Work on C-style macros is ongoing. Zenas is already able to parse C macro definitions and use that to generate inline Z80 code using the fast register calling convention.

In C-Style mode, you must have at least one routine called 'main', otherwise the assembler will emit zero bytes. You not only need to implement your macros, you need them to be called by somebody in order for them to be instantiated and inlined, and that initialisation is typically done in main().

More work needs to be done to support C-style macros that call C functions in compact reusable / re-entrant mode (not emitted inline).

It's not C, but I can imagine these C-like fearures being helpful to reduce programming errors.

I'm also working on an importer that allows you to reuse most Z88DK assembler libraries, whilst translating all of Z88DK's C stubs to Zenas C-style macros.

#zenas #z80 #retrocomputing #assembler

2025-09-18

Now entertaining the possibility of crafting a minimally working version of ual using zenas.

Not sure how far away from that I am, could still be a year or more away.

#ual #zenas

2025-09-18
8 .MACRO_STYLE TRADITIONAL
  9 .CALLING_CONVENTION REGISTER_FAST
 10 
 11 ; Simple delay macro
 12 MACRO DELAY_CYCLES(cycles)
 13     PUSH BC
 14     LD B, cycles
 15 DELAY_LOOP:
 16     DJNZ DELAY_LOOP
 17     POP BC
 18 ENDMACRO
 19 
 20 ; Memory copy macro
 21 MACRO COPY_BYTES(count)
 22     PUSH BC
 23     LD BC, count
 24 COPY_LOOP:
 25     LD A, (HL)
 26     LD (DE), A
 27     INC HL
 28     INC DE
 29     DEC BC
 30     LD A, B
 31     OR C
 32     JR NZ, COPY_LOOP
 33     POP BC
 34 ENDMACRO
 35$ ./zenas assemble example9-macros.asm example9.bin --hex
Assembled 133 bytes

Symbol Table:
  DELAY_LOOP_1_4 = $0000 (0)
  COPY_LOOP_2_5 = $0000 (0)
  COPY_LOOP_2_2 = $0010 (16)
  SOURCE_DATA  = $0020 (32)
  DEST_BUFFER  = $0033 (51)
  BUFFER       = $0045 (69)
  TRADITIONAL_DEMO = $0000 (0)
  DELAY_LOOP_1_1 = $0009 (9)
  WORK_AREA    = $0043 (67)

Hex Dump:
0000: 21 20 00 11 33 00 C5 06 
0008: 32 10 00 C1 C5 01 10 00 
0010: 7E 12 23 13 0B 78 B1 20 
0018: 00 C1 3E 2A 87 87 87 76 
0020: 48 65 6C 6C 6F 2C 20 5A 
0028: 38 30 20 4D 61 63 72 6F 
0030: 73 21 00 00 00 00 00 00 
0038: 00 00 00 00 00 00 00 00 
0040: 00 00 00 00 00 00 00 00 
0048: 00 00 00 00 00 00 00 00 
0050: 00 00 00 00 00 00 00 00 
0058: 00 00 00 00 00 00 00 00 
0060: 00 00 00 00 00 00 00 00 
0068: 00 00 00 00 00 00 00 00 
0070: 00 00 00 00 00 00 00 00 
0078: 00 00 00 00 00 00 00 00 
0080: 00 00 00 00 00 
Assembly successful: example9-macros.asm -> example9.bin (charset: ascii)
2025-09-18

Experimental. Doesn't work well yet. Will take time to get this right.

#zenas #z80 #assembler #asm

1 ; Test C-style macros in isolation
  2 .MACRO_STYLE C
  3 .CALLING_CONVENTION REGISTER_FAST
  4 
  5 // Simple C-style macro
  6 uint8_t add_two(uint8_t value) {
  7     asm {
  8         ADD A, 2;
  9     }
 10 }
 11 
 12 // Another C-style macro
 13 void set_led() {
 14     asm {
 15         LD A, 1;
 16         OUT (144), A;
 17     }
 18 }
 19 
 20 // Main program using C-style macros
 21 void main() {
 22     uint8_t result;
 23 
 24     result = add_two(5);    // Should add 2 to 5
 25     set_led();              // Turn on LED
 26 
 27     asm {
 28         HALT;
 29     }
 30 }
 31 
 32 .END
2025-09-17

zenas Z80 assembler

Adding translation of UTF-8 string literals for international character sets of well known speccies, cpc, and msx.

Should probably add blocky characters and other non-alphanumeric glyphs. That will come later.

#z80 #retrocomputing #ZXSpectrum #tk90x #inves #speccy #spectrum #zenas #zen80 #didaktik #tk95 #cpc #msx

2025-09-17

So... I've had this under wraps for months, whilst I've been adding features and ironing out bugs...

I've already been showing:

The next logical piece is:

  • zenas: Z80 assembler (WIP)

zenas is a new Z80 assembler (work in progress) following a simpler design than my earlier attempt. This is designed to work together with zen80 and zenZX, to hot test and benchmark the code the assembler emits

I'm already seeing some promising results. I think it's a cool feature if your assembler can actually run the code it emits (using zen80) with the potential to verify your object code actually works, and every single cycle is accounted for. I can imagine in the future we can expect to have things like register colouring and other neat features.

If we consider the zenXX tools together with the tape handling tools, and with the floppy image tools, we're approaching the status of lovely toolset that could one day be quite useful.

#zen80 #zenzx #zenas #asm #z80 #golang #foss #assembler #retrocomputing

Client Info

Server: https://mastodon.social
Version: 2025.07
Repository: https://github.com/cyevgeniy/lmst