Galaksija

Discussion about other targets
User avatar
RobertK
Well known member
Posts: 302
Joined: Mon Feb 26, 2018 12:58 pm

Galaksija

Post by RobertK »

There was only this locked thread on the Galaksija computer, so I'm starting a new one.

I am trying to compile a Galaksija Plus hires version of the dstar.c game. I have added these modifications...

Code: Select all

#if defined(__GALPLUSHIRES__)
	#include <sys/ioctl.h>		// required for switching the screen mode
#endif

[...]

void main()
{
	
  #if defined(__GALPLUSHIRES__)
	int mode;
	mode=1;
	console_ioctl(IOCTL_GENCON_SET_MODE, &mode);	// switch to hires mode
  #endif
	
	Level = (STARTLEV-1);
	SetupLevel(); /* Display the first level */

	/* Loop keyhandler till you finished the game */
	while (CheckNotFinished())
	  Gamekeys();
  
  #if defined(__GALPLUSHIRES__)
	mode=0;
	console_ioctl(IOCTL_GENCON_SET_MODE, &mode);	// switch to text mode
  #endif  

}
...and compiled it like this...

Code: Select all

zcc +gal -subtype=galaxyp -create-app -pragma-redirect:fputc_cons=fputc_cons_generic -Dspritesize=16 -pragma-redirect:CRT_FONT=_font_8x8_bbc_system dstar.c -o dstar -D__GALPLUSHIRES__
(the font is probably not required here, as the game has no text output)

...and basically it's working, the screen looks good, but keyboard input does not work proberly. Same on the standard Galaksja model (-Dspritesize=4). Keys G and H are working, but the directional controls (QAOP) are not.

When I compile with the 2018-07-04 version, keyboard input is fine. I tried the earlier versions when Galaksija Plus support was added (8 January 2020), but the keyboard problem is already present there.

Please check what could be wrong here...
User avatar
dom
Well known member
Posts: 1678
Joined: Sun Jul 15, 2007 10:01 pm

Re: Galaksija

Post by dom »

I'm surprised that was the only thread, we must have done the Galaxy+ work off forum.

Anyway, I've now tracked this down to a missing export of xorpixel in the Galaksija library. I've checked other machines and it looks like the sv8000 and lviv were similarly affected. All have now been corrected.

I've not tried your Galaxy+ code - I'll let you have the joy of first light for that one!
User avatar
RobertK
Well known member
Posts: 302
Joined: Mon Feb 26, 2018 12:58 pm

Re: Galaksija

Post by RobertK »

Now keyboard input is working fine, thanks!

Sprite movement is a little slow, but it's good like that, it makes you plan your moves better instead of randomly moving across the room.

The half row of blocks at the right edge is an emulation bug in MAME, it replicates the pixel rows from the left edge there.

GalaksijaPlus_DStar.jpg
You do not have the required permissions to view the files attached to this post.
User avatar
dom
Well known member
Posts: 1678
Joined: Sun Jul 15, 2007 10:01 pm

Re: Galaksija

Post by dom »

I suspect that an optimised putsprite would improve the performance somewhat - at the moment it will be setting individual pixels but in the + mode we could manipulate the display bitmap directly.

It’s working though - that’s great!
User avatar
RobertK
Well known member
Posts: 302
Joined: Mon Feb 26, 2018 12:58 pm

Re: Galaksija

Post by RobertK »

In case that any of you should need testing on the real hardware: I have now built my own Galaksija Plus computer.

GalaksijaPlus_TV.jpg
GalaksijaPlus_Board.jpg

Here is a Youtube video showing my building process:
https://youtu.be/Uxc2ua1hdcY

If anyone else wants to build it: I have put all required files (Gerber files, BOM, EPROM images) on my Google drive:
https://drive.google.com/drive/folders/ ... CqWDRKv7X2

I have already discovered a z88dk problem: while Galaksija Plus highres graphics works correctly in MAME and on the ZX-Uno in FPGA, on the real hardware every highres graphics screen looks like this:
GalaksijaPlus_HiRes_BrokenScreen.jpg

My hardware should be working correctly, because other highres games like svetleci.gtp work without any problem.

I fear that this issue could be tough. Maybe you could somehow check what svetleci.gtp does differently from e.g. the z88dk-compiled megatoll demo?

In addition, I still haven't found out how to run .GTP files in MAME. Loading such a file as a snapshot on the galaxyp system seems to be working, and I believe it could be started by typing
A=USR(&...)
but I'm not sure what memory adress to use instead of ..., I thought it must be &C23A (the RAM starting address), but this does not work.

Here is a GTP to WAV converter, but I haven't been able to compile it for Windows yet.
You do not have the required permissions to view the files attached to this post.
User avatar
dom
Well known member
Posts: 1678
Joined: Sun Jul 15, 2007 10:01 pm

Re: Galaksija

Post by dom »

My best guess at the moment is that memory size is different and the screen is ending up at the wrong place?

Scanning a disassembly of svetleci, the setup we use to switch to hires mode is quite a bit different, I must have got it from somewhere though - do the other two Gal+ games work?

The address should be &2c3a
User avatar
RobertK
Well known member
Posts: 302
Joined: Mon Feb 26, 2018 12:58 pm

Re: Galaksija

Post by RobertK »

dom wrote: Sun Mar 06, 2022 5:45 pmdo the other two Gal+ games work?
From the three existing gal+ games listed here, Svetleci and PacMan Plus work. Tetris Plus does not work (with RUN nothing happens, LIST shows nothing), I haven't tried it on the ZX-Uno yet.
User avatar
dom
Well known member
Posts: 1678
Joined: Sun Jul 15, 2007 10:01 pm

Re: Galaksija

Post by dom »

Interestingly Pacman Plus was written using an older version of z88dk.

As with Svetleci I can't spot the mechanism used to switch to hires mode so I'm not sure how it does it.

Tetris seems to be where I got the method for z88dk from so I'd expect it to behave in the same way as a z88dk compiled program.
User avatar
RobertK
Well known member
Posts: 302
Joined: Mon Feb 26, 2018 12:58 pm

Re: Galaksija

Post by RobertK »

dom wrote: Sun Mar 06, 2022 10:32 pmAs with Svetleci I can't spot the mechanism used to switch to hires mode so I'm not sure how it does it.
I think that in Pac Man Plus you won't find anything, because here it says: "Type in GRAPH first". However, this seems to be outdated, because I remember that the loader program of at least one of these two programs looks like this:

10 GRAPH:A=USR(&....)

Conclusion: to get things running, maybe you could add a compiler option that would add the GRAPH command to the loader?

P.S. I've just noticed that a new online Galaksija Plus Emulator has been released just a few days ago:
http://galaksija.net/?i=1
User avatar
RobertK
Well known member
Posts: 302
Joined: Mon Feb 26, 2018 12:58 pm

Re: Galaksija

Post by RobertK »

RobertK wrote: Mon Mar 07, 2022 7:48 am because I remember that the loader program of at least one of these two programs looks like this:
10 GRAPH:A=USR(&....)
I've just checked it: both programs do it like that. I still haven't been able to get Tetris Plus working yet (neither in MAME nor anywhere else).

I have just made a quick test and disabled the inital screen mode switching in my megatoll.c test. I manually changed to graphics mode before loading the program, but that didn't help. Nothing appears on the screen (the screen remains unchanged), and when I press the button at the end, which switches back to text mode, for a fraction of a second I can see the broken screen again.

So it seems that the problem is not only in the screen mode switching. Or, maybe that's even working correctly.
Can you check what Pacman Plus is doing to bring the pixels on the screen?
I could contact the author for the source code.
User avatar
dom
Well known member
Posts: 1678
Joined: Sun Jul 15, 2007 10:01 pm

Re: Galaksija

Post by dom »

I've had a look through both working programs and it looks like PacMan uses the ROM screen printer. Svetleci uses the ROM printer too, but also accesses the screen memory directly in places using the same mechanism that z88dk does.

With a few tweaks it should be possible to preset the screenmode though it's no ideal.
User avatar
RobertK
Well known member
Posts: 302
Joined: Mon Feb 26, 2018 12:58 pm

Re: Galaksija

Post by RobertK »

Just to inform the rest of the world: Dom got it finally working, highres graphics works on the real hardware since Friday's nightly!

GalaksijaPlus_Chessboard_800px.jpg

Another small issue: I've noticed that the virtual joystick option 5678-0 does not make any sense on this target, I have never seen any other than the usual keyboard configuration on the web. It seems that this has been copied from some Sinclair target, this virtual joystick should IMHO be replaced with QAOP-NM.

Next things that would be nice to have:

- Speed improvement for highres graphics (and maybe also for text output)

- Improving AY sound on the Galaksija Plus target. In the attached zip is the compiled psgtest.c playing Frère Jacques, which currently sounds recognizable but somewhat broken. For comparison, I've attached a demo named GMUSICAY.gtp demonstrating what it could sound like.
For testing AY sound, there is another online emulator, you can activate AY sound by selecting a Plus model and clicking the speaker icon at the bottom.

- Can we get the VT2 tracker running on the Galaksija Plus target? I'm getting these errors when trying to compile it:

Code: Select all

main.c::playmusic::0::0:22: error: undefined symbol: ay_vt2_play
  ^---- ay_vt2_play
main.c::setup_int::0::1:31: error: undefined symbol: _add_raster_int
  ^---- _add_raster_int
main.c::main::0::3:45: error: undefined symbol: _mysong
  ^---- _mysong
main.c::main::0::3:45: error: undefined symbol: ay_vt2_init
  ^---- ay_vt2_init
main.c::main::0::3:45: error: undefined symbol: ay_vt2_start
  ^---- ay_vt2_start
main.c::main::0::3:45: error: undefined symbol: ay_vt2_stop
  ^---- ay_vt2_stop
main.c::main::0::3:45: error: undefined symbol: ay_vt2_start
  ^---- ay_vt2_start
You do not have the required permissions to view the files attached to this post.
stefano
Well known member
Posts: 1772
Joined: Mon Jul 16, 2007 7:39 pm

Re: Galaksija

Post by stefano »

I created those chessboard pieces on a Spectrum in the nineties, it's very nice to see them on such a different hardware !
User avatar
dom
Well known member
Posts: 1678
Joined: Sun Jul 15, 2007 10:01 pm

Re: Galaksija

Post by dom »

I'm not having much luck with getting either WYZ or VT2 to run nicely unfortunately - either crashing or some of the channels not actually sounding.

You wouldn't think I could mess up ~20 lines of code, but small changes are leading to weird side effects.
User avatar
RobertK
Well known member
Posts: 302
Joined: Mon Feb 26, 2018 12:58 pm

Re: Galaksija

Post by RobertK »

No worries if you can't get it running.

Attached is a working player for .pt2 and .pt3 files for the Galaksija Plus. I don't know if this can be run in an emulator because it loads the files from mass storage, but you can have a look at the disassembly and see what's going on there, maybe this will help.

SoundGeneratorPVV_03.png
You do not have the required permissions to view the files attached to this post.
User avatar
dom
Well known member
Posts: 1678
Joined: Sun Jul 15, 2007 10:01 pm

Re: Galaksija

Post by dom »

Hmmm, interesting. The core code is this (addresses are off):

Code: Select all

                    xor     a                               ;[0869] af
                    ld      c,$00                           ;[086a] 0e 00
                    ld      hl,$3580                        ;[086c] 21 80 35
                    out     (c),a                           ;[086f] ed 79
                    inc     c                               ;[0871] 0c
                    outi                                    ;[0872] ed a3
                    dec     c                               ;[0874] 0d
                    inc     a                               ;[0875] 3c
                    cp      $0d                             ;[0876] fe 0d
                    jr      nz,$086f                        ;[0878] 20 f5
                    out     (c),a                           ;[087a] ed 79
                    ld      a,(hl)                          ;[087c] 7e
                    and     a                               ;[087d] a7
                    ret     m                               ;[087e] f8
                    inc     c                               ;[087f] 0c
                    out     (c),a                           ;[0880] ed 79
                    ret                                     ;[0882] c9
Which is identical to the first version of the code I wrote.

Frustrating.

EDIT: Ah, it might be the usage of iy that's causing the crashes with wyz - let me work around that.
User avatar
dom
Well known member
Posts: 1678
Joined: Sun Jul 15, 2007 10:01 pm

Re: Galaksija

Post by dom »

So, I think they wyz and vt2 examples should now work - I've added interrupt support for the machine and the players are hooked in that way.

I've only been able to test in mame and everything sounds correct - do you mind running some tests on the real hardware to confirm?
User avatar
RobertK
Well known member
Posts: 302
Joined: Mon Feb 26, 2018 12:58 pm

Re: Galaksija

Post by RobertK »

Excellent! I've tested wyz and vt2 in the JSGalMin emulator and they both sound great!

I haven't built the sound card yet but I definitely will. I'm still in the process of designing the PCB, so this will take some time until I can test it on real hardware.

Do you think you can also make examples/sound/psgtest.c sound better?
User avatar
dom
Well known member
Posts: 1678
Joined: Sun Jul 15, 2007 10:01 pm

Re: Galaksija

Post by dom »

I've tweaked some timing constants so psgtest now sounds better.

And I've just realised that a lot of my problems with JSGalMin were because it was caching the previously generated gtp file - must reload the page in between compilation attempts.
User avatar
RobertK
Well known member
Posts: 302
Joined: Mon Feb 26, 2018 12:58 pm

Re: Galaksija

Post by RobertK »

Very good, AY sound seems to be complete now, thanks!

And could you please replace the virtual joystick 5678-0 with QAOP-NM? The former makes no sense on a real Galaksija keyboard.

There is another issue with the generated WAV tape files, we will probably need two WAV output formats (like on the Laser 500): one that loads into MAME and one that loads on the real machine. I can't test it on my Galaksija Plus yet (I will need some small amplifier, even with a cassette recorder the sound output is too week even at full volume, I have found out that this was a common Galaksija problem). But I have contacted the author of the galaksija.net emulator (I reported a bug with negative integers to him which he has fixed now): he would like to do some z88dk testing on his classic Galaksija, and the only way for him to load programs is via tape input, but the ones z88dk creates cannot be loaded.
I will do some more research and then report the details.

P.S. There is a lot of Galaksija info on http://galaksija.epizy.com/, and it's all OCRed or typed in, so this text can be automatically translated.
User avatar
RobertK
Well known member
Posts: 302
Joined: Mon Feb 26, 2018 12:58 pm

Re: Galaksija

Post by RobertK »

The WAV issue: it should be possible to create a WAV that will load both in MAME and on the real machine. Dragoljub, the author of the GALe emulator, had a look at the z88dk code, attached are his annotations for the required changes, these are:

1. skipping the .GTP header
2. recording a slightly longer "leader" section (important when playing the file into the Galaksija tape input)

He has updated his emulator so that it can now create .WAV files from the program loaded in memory, following the steps mentioned above. He can load these WAV files without any problem into his Galaksija, and I have tried loading such a file into MAME, and that worked as well without any problem.
You do not have the required permissions to view the files attached to this post.
User avatar
RobertK
Well known member
Posts: 302
Joined: Mon Feb 26, 2018 12:58 pm

Re: Galaksija

Post by RobertK »

P.S. The resulting WAV file can be "mono, 8-bit, 8kHz" to keep it as small as possible. That's the way his emulator does it, and he says that there is no need for 16 Bit or a higher sample rate.
stefano
Well known member
Posts: 1772
Joined: Mon Jul 16, 2007 7:39 pm

Re: Galaksija

Post by stefano »

I chose the "fake 16bit" format because at the time the CD quality looked like the one less prone to waveform quality loss if "cropped" by the digital players or audio converters. I tend to consider it still a good standard, the waveform is digitally created and permits a *very* high compression ratio if zipped (just try it yourself).

The leader. It could have been my fault, on many targets a long lasting lead tone made sense only to give the old tape recorders time to auto-set the recording level, and I may have shortened some too much.
To be honest I don't remember this "sync" case, though.

If you think you can tune the conversion tool yourself, just don't be shy, you might have more possibilities to check the results :) If you prefer not to touch it, just tell.
User avatar
RobertK
Well known member
Posts: 302
Joined: Mon Feb 26, 2018 12:58 pm

Re: Galaksija

Post by RobertK »

stefano wrote: Fri Mar 25, 2022 3:53 pm If you think you can tune the conversion tool yourself, just don't be shy, you might have more possibilities to check the results :) If you prefer not to touch it, just tell.
Please do it this time. I am willing to contribute for such easier tasks, but I am still struggling to get the building process running on Windows in Git Bash following the steps described here, I will open another thread for that.
P.S. I've also noticed that adding an appmake disk format for a new CP/M target doesn't seem to be difficult, so I would like to do that myself for a start.
User avatar
dom
Well known member
Posts: 1678
Joined: Sun Jul 15, 2007 10:01 pm

Re: Galaksija

Post by dom »

I made those tweaks a couple of days ago and the loading on mame still works: https://github.com/z88dk/z88dk/commit/f ... 9d091d39a9
Post Reply