Glass Z80 assembler

Page 16/16
9 | 10 | 11 | 12 | 13 | 14 | 15 |

By santiontanon

Paladin (933)

santiontanon's picture

28-06-2020, 07:14

Yep, true, I've seen the same thing. I'm so used to it, that I correct in my head by instinct already, but it'd be great if this was fixed Smile

By Grauw

Ascended (9050)

Grauw's picture

28-06-2020, 20:36

pgimeno wrote:

I'm running into a small issue. The line number displayed when reporting an error is off by 1. In about every editor out there, the first line of the file is line 1, but if there's an error in the first line, Glass reports it as 0.

santiontanon wrote:

Yep, true, I've seen the same thing. I'm so used to it, that I correct in my head by instinct already, but it'd be great if this was fixed Smile

Ah, well if there ever was an easy fix… Smile I’ve uploaded a new development build.

By santiontanon

Paladin (933)

santiontanon's picture

28-06-2020, 22:13

Nice!! Thanks for the quick fix!

By santiontanon

Paladin (933)

santiontanon's picture

30-06-2020, 07:08

Hi Grauw, while working on parsing Glass syntax on my optimizer, I think I might have found some corner case in the behavior of Macros in Glass (or maybe just a misunderstanding from my part haha). The documentation specifies that when you define a macro, "the contents are assembled on address 0, effectively turning the inner symbols into offsets", however, I could not understand how did that happen since the symbol values might depend on the parameters of the Macro. So, I did some tests. For example, if I define a macro like this:

mymacro: MACRO ?parameter
	REPT ?parameter
   	db 0
   	ENDM
local_label:
   	db 0
	ENDM

local_label, really depends on the value of ?parameter. Glass assigns "local_label" the value 0, but it really should maybe give a compilation error or warning, as local_label cannot really be determined. Right? When my optimizer is configured to use "Glass" idiom, I thought I would just compile the content of macros assuming all parameters have a numeric value of "0", but that does not sound right. What is the logic that Glass follows? Anyway, just making sure I get it right in my parser Smile

By Grauw

Ascended (9050)

Grauw's picture

30-06-2020, 18:02

Hey santiontanon, this is indeed the case when you dereference labels in the macro definition. It uses either the default if specified, or else a 0. If it can’t compile with 0’s it silently fails and the scope will be empty.

In the future I want to add the ability to explicitly specify the parameter value in expressions (e.g. ld hl,(mymacro 20).local_label), however that is not supported yet. It could indeed also be interesting if it didn’t actually pass zeroes, rather it passed an error value and as long as it’s not evaluated it can yield the values. However for that I need to have more lazy evaluation (also something I’m working on). The feature is originally meant to create structs, and it was useful to allow parameterisation, so I opted for the automatic 0’s at the time as something that was feasible then. But it’s not perfect yet I agree.

By santiontanon

Paladin (933)

santiontanon's picture

30-06-2020, 17:52

Okay! Makes sense! I'll implement it that way then! I just wanted to make sure I got the same semantics Smile

Page 16/16
9 | 10 | 11 | 12 | 13 | 14 | 15 |