First Demo from My New Programming Language, Elena

Show us your work, thrill and amaze us :)

Moderator: Programming Moderators

User avatar
MrKWatkins
Posts: 41
Joined: Tue May 30, 2017 8:37 pm

Re: First Demo from My New Programming Language, Elena

Post by MrKWatkins » Tue May 08, 2018 9:25 pm

SevenFFF wrote:
Tue May 08, 2018 6:55 pm
I also typed Selena instead of Elena, somehow.
Luckily my wife hasn't seen it. :P

User avatar
MrKWatkins
Posts: 41
Joined: Tue May 30, 2017 8:37 pm

Re: First Demo from My New Programming Language, Elena

Post by MrKWatkins » Thu May 10, 2018 6:24 pm


Alcoholics Anonymous
Posts: 508
Joined: Mon May 29, 2017 7:00 pm

Re: First Demo from My New Programming Language, Elena

Post by Alcoholics Anonymous » Thu May 10, 2018 7:23 pm

:thumbsup:

There are finer grain macros than ZXN_WRITE_REG():

ZXN_NEXTREG(r,v) works if both r and v are constants and translates to a "nextreg r,v" instruction.

ZXN_NEXTREGA(r,v) works if r is a constant and translate to a "nextreg r,a" instruction (register a)

ZXN_WRITE_REG(r,v) has both r and v variable and will translate to some sort of "ld bc,nnn; out (c),r ; inc bc; out(c),v" sequence.

ZXN_READ_REG(r,v) has both r and v variables and again uses the full bc sequence, as it must for reading.

For mmu, there are a couple of special macros:

ZXN_WRITE_MMUn(v) changes the 8k page in mmu n, 0<=n<=7. It will be translated to asm as "mmun a" which is equivalent to "nextreg 0x50+n,a"

ZXN_READ_MMUn(v) reads the page in mmu n using the bc sequence.

It's small, but it can make a difference in register allocation if embedded in code someplace.

User avatar
MrKWatkins
Posts: 41
Joined: Tue May 30, 2017 8:37 pm

Re: First Demo from My New Programming Language, Elena

Post by MrKWatkins » Thu May 10, 2018 8:02 pm

Thanks for this, very useful. I had to use ZXN_WRITE_REG initially as r and v were always variables; I've since added a degree of inlining to my compiler so a lot of those cases now become constants. I was also using a version of Z88DK where it looked like nextreg usage had been removed, but a quick look at https://github.com/z88dk/z88dk/blob/mas ... xn_rules.2 seems to imply its back in play. I'll have to upgrade.

SamusDrake
Posts: 250
Joined: Mon Jun 26, 2017 10:11 pm
Contact:

Re: First Demo from My New Programming Language, Elena

Post by SamusDrake » Thu May 10, 2018 8:38 pm

Just a quick update on that horrible palette issue - I found a program called IrfanView that can take an image created with MSPaint and will generate a "best guess" palette and save it into the bitmap file. Loss of colour is something to watch out for but its at least workable.

Thanks for the help the other day! ^_^

User avatar
MrKWatkins
Posts: 41
Joined: Tue May 30, 2017 8:37 pm

Re: First Demo from My New Programming Language, Elena

Post by MrKWatkins » Thu May 10, 2018 9:11 pm

No worries!

In GIMP if you switch from RGB to indexed mode then there is a 'Generate optimum palette' option which does the same if I understand you correctly.

SamusDrake
Posts: 250
Joined: Mon Jun 26, 2017 10:11 pm
Contact:

Re: First Demo from My New Programming Language, Elena

Post by SamusDrake » Thu May 10, 2018 9:47 pm

I've just gone back into gimp...done exactly what you have just said and immediately just saved it as a bitmap.
Why didn't I do that before instead of buggering around with building a palette from scratch?
What possessed me?

Meanwhile, on the bridge of the Enterprise, Captain Jean Luc Picard is experiencing a serious case of face palm...

Kevin, once again, you are brilliant! Cheers! ^_^

Alcoholics Anonymous
Posts: 508
Joined: Mon May 29, 2017 7:00 pm

Re: First Demo from My New Programming Language, Elena

Post by Alcoholics Anonymous » Fri May 11, 2018 4:36 am

MrKWatkins wrote:
Thu May 10, 2018 8:02 pm
Thanks for this, very useful. I had to use ZXN_WRITE_REG initially as r and v were always variables; I've since added a degree of inlining to my compiler so a lot of those cases now become constants. I was also using a version of Z88DK where it looked like nextreg usage had been removed, but a quick look at https://github.com/z88dk/z88dk/blob/mas ... xn_rules.2 seems to imply its back in play. I'll have to upgrade.
Yes we kept the new opcodes out because, first some test boards couldn't fit them and then second, zesarux hadn't implemented them and that's the only emulator able to emulate the whole machine. But now zesarux accepts most of them so slowly we'll be enabling all the new opcodes at c level, starting with that one. The rules file will be next to go - at this stage the code is being inlined after the optimizer so that register shuffling isn't being eliminated. By that I mean stuff like "push hl ; pop hl" or "ld l,e ; out (c),l" which can happen with substitution.

The assembler will accept all opcodes (and special ones for the copper and dma) but that would be for asm code people (or other tools) write rather than the compiler.

User avatar
MrKWatkins
Posts: 41
Joined: Tue May 30, 2017 8:37 pm

Re: First Demo from My New Programming Language, Elena

Post by MrKWatkins » Fri May 11, 2018 7:13 pm

Alcoholics Anonymous wrote:
Thu May 10, 2018 7:23 pm
It's small, but it can make a difference in register allocation if embedded in code someplace.
Switched to use ZXN_NEXTREGA (most cases the value is still not constant, but now the register always is) as well has the MMU macros - definitely made an improvement, thanks!

Post Reply