Glass Z80 assembler

Page 8/18
1 | 2 | 3 | 4 | 5 | 6 | 7 | | 9 | 10 | 11 | 12 | 13

By santiontanon

Paladin (1014)

santiontanon's picture

29-04-2018, 19:54

I Grauw, just for fun, I was trying to compile some of the players that come with Arkos Tracker ( http://www.julien-nevo.com/arkostracker/ ), and they use an undocumented instruction of the Z80 which I think might not be supported by Glass. Specifically, the Arkos player uses:

  out (c),0

Which is undocumented ( http://z80-heaven.wikidot.com/instructions-set:out ). When I try to compile with Glass, it complains about invalid arguments. Looking at the code in which this is used in the Arkos player, however, I see that this instruction is used to save a few cycles when sending data to the PSG, which is pretty cool :)

By Grauw

Ascended (9156)

Grauw's picture

23-02-2020, 16:53

Hey Santiontanon, I don’t support that because it doesn’t work on the R800. Same applies to “sll”.

The supported undocumented instructions are the ones involving ixh / ixl, etc., and in (c) (which actually is documented by Zilog… kinda). See the list here.

Of course you can still code the opcode with db, or make a macro for it.

By santiontanon

Paladin (1014)

santiontanon's picture

29-04-2018, 21:17

The R800 does not support it?!?! darn it! ok, ok... then I should reconsider the optimizations I had in mind... but in any case, even if the R800 does not support it, I think having a compiler flag to support it would be good, just for completeness sake Smile

By Grauw

Ascended (9156)

Grauw's picture

29-04-2018, 21:39

Future plan is to not include it in the built-in set, but to extend the macro system so that you can overload by pattern matching. E.g. something like out: MACRO (c),0. That way it’ll be easy to add an instruction with that exact syntax yourself, as well as handy shorthands like ld de,(ix + nn). Maybe I’ll include some macro libraries with the download as well.

For now though you’ll have to make an out_c_0 macro or something like that… benefit I guess is that it stands out as something out of the ordinary, could even have two versions of it depending on the compile target being Z80 or R800 Smile.

Though for MSX programming, I would personally recommend to just steer clear of those instructions that don’t work on R800, it’s a bit dangerous potential compatibility pitfall for the unaware that’s not worth the few cycles it saves imo, which is why I didn’t include it.

By hit9918

Prophet (2893)

hit9918's picture

29-04-2018, 23:32

Quote:

then I should reconsider the optimizations I had in mind

show a bit of code so we can see the situation

By santiontanon

Paladin (1014)

santiontanon's picture

29-04-2018, 23:41

Oh, it was just a simple optimization of the code to write to PSG registers. The Arkos tracker player uses that instruction, and can use something like this:

    ld bc,#f6c0
    out (c),b       ;#f6c0
    out (c),0       ;#f600

Whereas I was using a more standard approach like this:

    ld bc,#f6c0
    out (c),c
    ld bc,#f600
    out (c),c

That's about it. I was also wondering if i could use that to optimize some VDP graphics code, but haven't even started thinking about it yet Smile

By hit9918

Prophet (2893)

hit9918's picture

30-04-2018, 00:20

this is code for some unknown CPC ports with B register
no MSX code
the MSX goes
out &ha0,psg register number
out &ha1,value

By santiontanon

Paladin (1014)

santiontanon's picture

28-10-2018, 04:35

Hi Grauw. I think I found a small bug on Glass. This is the smallest program that makes it happen:

	org #ffff
myvariable: db #00

As soon as the address counter reaches #10000, the compiler launches the "Address out of range: 10000H" error message and compilation stops. However, in this case, I am just reaching all the way up to #10000, but not using it. So, it should be fine. It's also very easy to work around this issue, but I thought I'd report Smile

(and yeah, I'm cutting it so short, I'm using up to the very last byte of addressable memory in one of my current projects, hahaha)

By Grauw

Ascended (9156)

Grauw's picture

28-10-2018, 09:30

To be honest I was thinking of removing that error and just letting the address counter wrap around, treating it the same way integers are treated elsewhere. I think it’s only in the way really anyway, it never prevented any real bugs for me…

I did just that in ba2c9a1917da which I’ve pushed.

By santiontanon

Paladin (1014)

santiontanon's picture

29-10-2018, 04:16

Great! and yeah, I think that's a good idea. Maybe a warning or something just to let the user know this happened could be useful though Smile

Page 8/18
1 | 2 | 3 | 4 | 5 | 6 | 7 | | 9 | 10 | 11 | 12 | 13