[Z88dk-users] Galaksija

Bridge to the z88dk-users mailing list
Post Reply
stefano
Well known member
Posts: 1534
Joined: Mon Jul 16, 2007 7:39 pm

[Z88dk-users] Galaksija

Post by stefano »

Hey,
I just wanted to announce the insertion of a new target platform.
The Galaksija is quite unknown but it was very easy to reuse the existing VZ200 and TRS80 code, so here it is !

The "appmake" portion is based on the "Galaksija Tools" by Avian (Toma?); I reduced its functionalities to meet just the z88dk requirements and to make it compatible to the currently supported platforms.
Tomaz already reported that the basic functionalities run correctly on the real computer.

An interesting point for the Z80 hardware lovers is that a Galaksia clone can be assembled with a minimal number of standard TTL components due to a video circuit similar to the ZX81 one but with less software hassles.

Well, I know.. it is crazy.
But funny :P



------------------------------------------------------------------------------
SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada.
The future of the web can't happen without you. Join us at MIX09 to help
pave the way to the Next Web now. Learn more and register at
http://ad.doubleclick.net/clk;208669438 ... itmix.com/
RobertK
Well known member
Posts: 199
Joined: Mon Feb 26, 2018 12:58 pm

Post by RobertK »

The successor machine "Galaksija Plus" was downward compatible (z88dk-compiled Galaksija programs run on it without any problem), but featured - among other additions - a 256x208 monochrome graphics mode. It would be nice if this graphics mode could also be supported by z88dk, provided that it isn't too complicated to add.

The plus model is emulated in MAME (galaxyp) so you can check the MAME source to find out what the machine does to produce graphics.

Only three software titles for the Plus model are listed here.
RobertK
Well known member
Posts: 199
Joined: Mon Feb 26, 2018 12:58 pm

Post by RobertK »

Here is a memory map of the Galaksija Plus model. The high-res video memory area starts at &C600 and ends before &E000.
RobertK
Well known member
Posts: 199
Joined: Mon Feb 26, 2018 12:58 pm

Post by RobertK »

I think that I have noticed a possible bug with the Galaksija target: the program crashes whenever a floating point calculation needs to be done.

Here is a little test program where you can reproduce this problem:

Code: Select all

// Floating point calculation test
// Crashes on the Galaksija computer
// Author: RobertK, 2018-12-29

// Compile with:
// zcc +gal -create-app -lm -o fct floatcalctest.c
// zcc +zx81 -create-app -lm -startup=2 -o fct_zx81 floatcalctest.c
// zcc +zx80 -create-app -lm -o fct_zx80 floatcalctest.c

// Test it in MAME like this:
// mame64 galaxy -cass C:\Projects\z88dk\FloatCalcTest_galaksija.wav
// Then type "OLD" to load the program and start the tape
// Press F10 to speed up loading, and F10 once more to return to normal speed.

#include <stdio.h>

void main()
{
printf("\nhello world\n");
printf("\npress any key to calculate 5*0.1...\n");
fgetc_cons();        // wait for keypress
printf("\n5*0.1 is %.1f\n",5*0.1);
printf("\npress any key to exit...\n");
fgetc_cons();        // wait for keypress
}
RobertK
Well known member
Posts: 199
Joined: Mon Feb 26, 2018 12:58 pm

Post by RobertK »

The successor machine "Galaksija Plus" was downward compatible (z88dk-compiled Galaksija programs run on it without any problem), but featured - among other additions - a 256x208 monochrome graphics mode. It would be nice if this graphics mode could also be supported by z88dk, provided that it isn't too complicated to add.
Today I had a look at the Github issues and noticed that Galaksija Plus hires graphics is now supported - many thanks Dom!

I can confirm that the screen replication at the right edge is a Mame emulation problem. I don't have the original hardware, but I tried it on a ZX-Uno FPGA computer implementing the Galaksija Plus hardware, and there everything looks good.

Here is a picture of the oncoming Galaksija Plus version of my game H-Tron, which looks entirely different from the standard Galaksija version, and it performs much better. The ZX-Uno is the little thing on the right with the yellow and white cables attached to it.

Image

I'm currently working on another little cross-platform program that will make use of the full resolution, but I can't get it to work on the Galaksija because of the floating point problem mentioned above (calculating screen coordinates fails).

@Dom: you can speed up MAME emulation by pressing F10, and pressing F10 again will return to normal speed. Pressing F10 has no effect when you have the Tape Control window open, but the trick is to simply close all UI windows and then press F10, and then the tape will be flying! :-)
I wish I had found this out earlier, I spent a lot of time waiting for my programs to load in MAME...

Happy new year!
User avatar
dom
Well known member
Posts: 1194
Joined: Sun Jul 15, 2007 10:01 pm

Post by dom »

On Tue, 1 Jan 2019, at 11:10 PM, RobertK (robert.kacsich@...) wrote:
I can confirm that the screen replication at the right edge is a Mame
emulation problem. I don't have the original hardware, but I tried it on
a ZX-Uno FPGA computer implementing the Galaksija Plus hardware, and
there everything looks good.
That's good to know that it works outside of Mame! I think of the 3 games that supposedly support it, I only got one of them to work - hopefully you'll be releasing game number 4 soon!
I'm currently working on another little cross-platform program that will
make use of the full resolution, but I can't get it to work on the
Galaksija because of the floating point problem mentioned above
(calculating screen coordinates fails).
genmath uses the index registers, and I think the Galksija reserves iy for the video processing routine. I'll try it out myself, but switching to math48 (use -lmath48 rather -lm) might unblock you there.
@Dom: you can speed up MAME emulation by pressing F10, and pressing F10
again will return to normal speed. Pressing F10 has no effect when you
have the Tape Control window open, but the trick is to simply close all
UI windows and then press F10, and then the tape will be flying! :-)
I wish I had found this out earlier, I spent a lot of time waiting for
my programs to load in MAME...
I'll miss that thinking time! Thank you so much for that tip.

cheers,

dom
User avatar
dom
Well known member
Posts: 1194
Joined: Sun Jul 15, 2007 10:01 pm

Post by dom »

On Sun, 6 Jan 2019, at 10:50 PM, Dom Morris wrote:
genmath uses the index registers, and I think the Galksija reserves iy
for the video processing routine. I'll try it out myself, but switching
to math48 (use -lmath48 rather -lm) might unblock you there.
Yup, that works - I've now switched the Galaksija over to using math48 by default.

cheers,

dom
RobertK
Well known member
Posts: 199
Joined: Mon Feb 26, 2018 12:58 pm

Post by RobertK »

The Hires Galaksija Plus version of H-Tron is already available on available on my Sourceforge site.

Yes, using -lmath48 instead of -lm had indeed solved the floating point problem, my WIP program works fine now.

However, I have found another issue that I could reproduce on both MAME and the ZX-Uno. After switching back from graphics mode to text mode for the first time, the text screen is no longer centered.

Here is a test program to reproduce this:

Code: Select all

// smt.c
// Test program for screen mode switching on the Galaksija Plus and the NEC PC-6001 Mk2
// (also for MC-1000, Tiki-100 or Samsung SPC-1000, but not tested yet on these systems)
// Author: RobertK, 2019-01-07
// Compile with:
// zcc +gal -subtype=galaxyp -create-app -pragma-redirect:fputc_cons=fputc_cons_generic -pragma-redirect:CRT_FONT=_font_8x8_bbc_system -o smtgalplus smt.c -D__GALPLUSHIRES__
// zcc +pc6001 -subtype=rom -pragma-redirect:fputc_cons=fputc_cons_generic -pragma-redirect:CRT_FONT=_font_8x8_bbc_system -create-app -o smt_pc6001Mk2 smt.c

#include <stdio.h>
#include <graphics.h>
#include <sys/ioctl.h>                // required for switching the screen mode

void myCls()        // Clear the screen (generic or VT100 console)
{
printf("%c",12);
printf("\x0c");  // the "\x0c" (0x0c character) resets the cursor position to the top left corner
}

void main()
{
int XScreenSize,YScreenSize;                // dimensions of the text screen
int xMax,yMax;                                                // dimensions of the graphics screen
int mode; // for screen mode switching
int x,y;
char c; // for keyboard input
int exitProgram=0;

// determine screen size
screensize(&XScreenSize, &YScreenSize);

/* main loop */
while(exitProgram<1)
{
// Text screen
myCls();        // Clear the screen

// Draw a screen border using the character "x"
for (x = 0; x <XScreenSize; ++x)
{
gotoxy(x,YScreenSize-1);
printf("x");
gotoxy(x,0);
printf("x");
}
for (y = 1; y <YScreenSize; ++y)
{
gotoxy(0,y);
printf("x");
gotoxy(XScreenSize-1,y);
printf("x");
}

gotoxy(2,2);
printf("text screen test");
gotoxy(2,4);
printf("screen size: x=%d, y=%d\n",XScreenSize,YScreenSize);
gotoxy(2,6);
printf("press x to exit, any");
gotoxy(2,7);
printf("other key to switch");
gotoxy(2,8);
printf("to graphics mode...");
c = fgetc_cons();        // wait for keypress

if (c=='x' || c=='X')
exitProgram=1;
else
{
// Graphics Screen
// switch to hires mode
mode = 1;
console_ioctl(IOCTL_GENCON_SET_MODE, &mode);
// clg();

// determine the screen dimensions for this system
// coordinates go from 0 to this max value
xMax=getmaxx();
yMax=getmaxy();

// Draw a screen border
for (x = 0; x <=xMax; ++x)
{
plot(x,yMax);
plot(x,0);
}
for (y = 1; y <=yMax; ++y)
{
plot(0,y);
plot(xMax,y);
}

gotoxy(2,2);
printf("graphics screen test");
gotoxy(2,4);
printf("screen size: x=%d, y=%d\n",xMax+1,yMax+1);
gotoxy(2,6);
printf("press x to exit, any");
gotoxy(2,7);
printf("other key to switch");
gotoxy(2,8);
printf("to text mode...");
c = fgetc_cons();        // wait for keypress
if (c=='x' || c=='X') exitProgram=1;

// switch back to text mode
mode = 0;
console_ioctl(IOCTL_GENCON_SET_MODE, &mode);

}

}
myCls();        // Clear the screen
return;
}
And here is the result, first in MAME...

Image
Image
Image

...and here in FPGA on the ZX-Uno:

Image
Image
Image

(On the second screen it should of course be "switch to text mode" instead of graphics mode, I didn't notice that error before I made the screenshots.)

For some reason, on the FPGA in graphics mode only the top line of the screen border is visible. This could be a bug in the ZX-Uno Galaksija core, there can of course be errors in such an FPGA implementation just as in an any emulator.

On the FPGA Galaksija Plus, when you type GRAPHICS and then TEXT, you briefly see the vertical full block line appearing, but then it goes away and the screen goes into position to the left again, so the characters are always at the same locations (you see their font changing) - probably the real hardware also behaves like that.
User avatar
dom
Well known member
Posts: 1194
Joined: Sun Jul 15, 2007 10:01 pm

Post by dom »

On Tue, 8 Jan 2019, at 8:24 AM, RobertK (robert.kacsich@...) wrote:
However, I have found another issue that I could reproduce on both MAME
and the ZX-Uno. After switching back from graphics mode to text mode for
the first time, the text screen is no longer centered.
Thanks for another great test program - do you have any objections if I actually commit them to the/a repo? I use pretty much all of them to test new platforms and behaviour. Who knows, one day I might be able to add a port without any bugs!

I've reset some variables to the default values when the mode is switched back to text. One of them is HORIZ_POS ($2ba8) , and the other I really don't know it is, but since it's modified for hires mode it should be set back. As a result the display is now centred when switching between the modes.

cheers,

dom
RobertK
Well known member
Posts: 199
Joined: Mon Feb 26, 2018 12:58 pm

Post by RobertK »

Problem solved, thank you!

Sure, you may put all my test programs on a repository. This screen switching test program still needs some #if #elif #endif for various targets (different mode numbers, some targets need clg() while others don't support it, etc.), but apart from that it is ready to be used.

In my plot test program I will need to update the comments at the top, some of the issues mentioned there have already been solved.

BTW, the platform list on the wiki also needs some updates (Galaksija hires graphics, maybe also PC-8001 for those parts that are already officially released).
Post Reply