Glass Z80 assembler 0.5

Glass Z80 assembler 0.5

by Grauw on 18-01-2017, 21:32
Topic: Development

Glass is a cross-platform assembler for the Z80 processor. It’s been a while since the last release, with quite a number of improvements since, so a release was past due!

What’s new in Glass 0.5:

  • The incbin directive is now supported.
  • The ternary ?: operator is now supported.
  • The . member operator is now an official operator.
  • Sequences can now be indexed with the [] operator.
  • Symbols can now also start with the $ character.
  • Include now supports the once annotation.
  • The 0x and 0X prefix can now be used for hexadecimal numbers. Thanks to Paul Bosselaar.
  • Macro arguments can now specify default values with =.
  • Expressions can now span multiple lines.
  • The org statement no longer affects the address of a preceding label (bc).
  • Some invalid instructions now throw errors (e.g. bit 7,ixh).
  • Contexts are now resolved through macro arguments.
  • Instructions and macros can now be passed into macro arguments.
  • Section identifiers are now resolved like any other expression.
  • Examples for COM, ROM and BIN files are now included in the source code.
  • Error messages were improved.
  • Java 8 is now required.

Download Glass here.

Relevant link: Glass project page

Comments (6)

By snout

Ascended (15187)

snout's picture

20-01-2017, 01:02

Kudos to Grauw for taking MSX assembly to the next level.

By Grauw

Enlighted (7519)

Grauw's picture

20-01-2017, 09:47

Trying to... not quite there yet, but trying to... Smile

By sd_snatcher

Prophet (2879)

sd_snatcher's picture

20-01-2017, 21:07

Thank you for all these nice software you create, Grauw. Smile

By gdx

Prophet (2350)

gdx's picture

22-01-2017, 14:49

I'm looking for a good disassembler.

By sd_snatcher

Prophet (2879)

sd_snatcher's picture

04-02-2017, 00:52

Is it possible to do OOP with Glass? That would be a really nice feature for a new assembler.

By Grauw

Enlighted (7519)

Grauw's picture

05-02-2017, 13:47

I try to be as supportive of OOP style in Glass as I can, because it is how I write my software myself. However things like polymorphic calls and how objects are created etc. is more about the libraries and implementation choices of code and not so much about the assembler itself.

E.g. there are several ways to instantiate objects, statically, on a heap, with or without a template, etc. And there are also several ways to do virtual calls, with different performance, memory usage and flexibility trade-offs. The assembler isn’t much of a help there except to try and facilitate it.

For example I define and use a class as follows:

ClassTest: MACRO
		db 0

ClassTest_class: Class ClassTest, Heap_main

; ix = this
	ld (ix + ClassTest.dummy),255

; ix = this

	call ClassTest_TestConstructDestruct

	call ClassTest_class.New
	call ClassTest_Construct
	call ClassTest_Destruct
	call ClassTest_class.Delete

There are some syntactic sugar things where Glass is helpful here, e.g. being able to pass ClassTest into the Class definition macro, to determine its size, instantiate a template, and to reference .New and .Delete static members on it. In principle OOP can be done in any assembler, however definitely I started work on Glass to simplify the syntax of these things for me.

My MSX profile