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 :)
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.
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
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 .
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.
then I should reconsider the optimizations I had in mind
show a bit of code so we can see the situation
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
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
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
(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)
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.
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