(classic) New target: Krokha/ Кроха

Discussion about other targets
Post Reply
User avatar
dom
Well known member
Posts: 2072
Joined: Sun Jul 15, 2007 10:01 pm

(classic) New target: Krokha/ Кроха

Post by dom »

I've just added support for this very simple (and obscure!) target.

It's a barely released console - about 200 of them were made and were only given to employees of the factory - there's more detail on the page here: http://alemorf.ru/comps/kroha/index.html - there's only one cartridge/rom available for the machine.

The machine is pretty bare bones and consists of:

* 8080 clone
* A joystick interface (I think two, but mame one emulates one)
* A 64x32 character mapped display
* 2k of RAM (of which 1.5 is used for VRAM)
* A beeper

The default character set has a good selection of graphics available including the usual 2x2 block set. I think the intention was that cartridges included both the game ROM and a character ROM so don't feel limited by what's pre defined - use your own font!

In terms of z88dk features we've got:

- Generic console (48x32, B&W only)
- 96x64 lores graphics
- Joystick

The 1 bit sound library isn't available yet - it uses z80 features fairly heavily so it needs a bit of work to run on 8080 machines.

Wiki page is here: https://github.com/z88dk/z88dk/wiki/Platform--Krokha which has details on how to run software.
amateus
Member
Posts: 46
Joined: Fri Nov 15, 2019 9:13 am

Re: (classic) New target: Krokha/ Кроха

Post by amateus »

Obscure is the right word, never heard of it :)

Will try to dig more info on this one.
stefano
Well known member
Posts: 2137
Joined: Mon Jul 16, 2007 7:39 pm

Re: (classic) New target: Krokha/ Кроха

Post by stefano »

Never heard it either, but .. now it will have some software to run! Well done :)
I felt a similar satisfaction when I worked on the J ACE or the Aquarius, long time ago 😁
User avatar
dom
Well known member
Posts: 2072
Joined: Sun Jul 15, 2007 10:01 pm

Re: (classic) New target: Krokha/ Кроха

Post by dom »

I hadn't heard about it until about midnight last night. No idea how I stumbled on it.

I do know that @RobertK likes porting his apps to these relatively unknown targets.
stefano
Well known member
Posts: 2137
Joined: Mon Jul 16, 2007 7:39 pm

Re: (classic) New target: Krokha/ Кроха

Post by stefano »

I know Robert, he is incredibly active
User avatar
RobertK
Well known member
Posts: 347
Joined: Mon Feb 26, 2018 12:58 pm

Re: (classic) New target: Krokha/ Кроха

Post by RobertK »

That was quite a terrible system for 1990 standards! :-)

Although the target itself is quite usable for my needs, I've got H-Tron already running.

One interesting bug (or feature?) I have encountered is that random seeding does not work, the first random value is always the same. In H-Tron the random seed depends on the time until the user starts the game, and here is a little test program to reproduces this:

Code: Select all

// Random Seed Test (requires games.h so that it runs on consoles without keyboard)
// Author: RobertK, 2021-02-07

#include <stdio.h>
#include <games.h>

#define JOYSTICK_1 4
#define JOYSTICK_BUTTON_TRIGGER1 MOVE_FIRE1

void main(void)
{
  int randomSeed=0;
  
  // clear the screen    
  printf("%c",12);
  printf("\x0c");  // the "\x0c" (0x0c character) resets the cursor position to the top left corner

  printf("*** rand test ***\n");
  printf("(joystick version)\n\n");
  printf("press trigger...\n\n\n");

  while (!(joystick(JOYSTICK_1) & MOVE_FIRE1))
  {	  
	randomSeed++;
	if (randomSeed>32766) randomSeed=0;	// reset counter to avoid overflow				  
  }  
  srand(randomSeed);
  
  printf("random seed is %d\n",randomSeed);
  printf("first rand value is %d\n\n",rand());
  msleep(250);

  printf("press trigger to exit...\n");
  while (!(joystick(JOYSTICK_1) & MOVE_FIRE1));

  // clear the screen    
  printf("%c",12);
  printf("\x0c");  // the "\x0c" (0x0c character) resets the cursor position to the top left corner
}
Compile it for the Casio PV-1000 target...

zcc +pv1000 -create-app -o RandJoyTest_pv1000 RandJoyTest.c

...to see how it should work, and then for the Krokha:

zcc +krokha -create-app -pragma-redirect:fputc_cons=fputc_cons_generic -o RandJoyTest_krokha RandJoyTest.c
User avatar
dom
Well known member
Posts: 2072
Joined: Sun Jul 15, 2007 10:01 pm

Re: (classic) New target: Krokha/ Кроха

Post by dom »

It truly is a terrible machine for the time period: I find it odd how the U880 wasn't really used for the Soviet machines, though I may be demonstrating a massive hole in my geo-political-economics knowledge of the tail-end of Comecon by saying that.

Anyway, this one was caused by not generating a ROM correctly so the seed ended up in ROM rather than RAM. Should be ready for you in the next nightly.
User avatar
RobertK
Well known member
Posts: 347
Joined: Mon Feb 26, 2018 12:58 pm

Re: (classic) New target: Krokha/ Кроха

Post by RobertK »

The attached H-Tron version is ready for release. But a strange issue is affecting my other two programs, and you can reproduce it with htron.c:

Code: Select all

// Krokha: when these lines get uncommented, text output becomes incredibly slow!
/*
  myCls();
  printf("\n\nrandom seed is %d\n",randomSeed);
  printf("first rand value is %d\n",rand());
  msleep(3000);
  myCls();
*/
I was trying to check the random seed starting value and added these lines. With these lines of code, text output is running in slow motion. Remove these lines, and speed gets normal again.

P.S. The wiki platforms list and your post above mention a text resolution of 64x32, but I think it should be 48x32.
You do not have the required permissions to view the files attached to this post.
Last edited by RobertK on Tue Feb 09, 2021 7:30 pm, edited 1 time in total.
User avatar
dom
Well known member
Posts: 2072
Joined: Sun Jul 15, 2007 10:01 pm

Re: (classic) New target: Krokha/ Кроха

Post by dom »

That is a weird side effect: I'm guessing it needs all 4 lines? I'll take a look and see what silliness is going on.

Ah yes, you're quite right, 64x32 = 2k so that really wouldn't work!
User avatar
RobertK
Well known member
Posts: 347
Joined: Mon Feb 26, 2018 12:58 pm

Re: (classic) New target: Krokha/ Кроха

Post by RobertK »

I've just tried it: it takes all these five lines to reproduce the problem. Remove any single one of them, and the speed will be normal again.
User avatar
dom
Well known member
Posts: 2072
Joined: Sun Jul 15, 2007 10:01 pm

Re: (classic) New target: Krokha/ Кроха

Post by dom »

RobertK wrote: Tue Feb 09, 2021 11:32 pm I've just tried it: it takes all these five lines to reproduce the problem. Remove any single one of them, and the speed will be normal again.
I'm going to be honest, I'm not going to investigate too deeply as to what is happening at this time of night. From my poking around I can see that when this issue is happening there's a lot of things happening on the interrupt which makes me think that the interrupt vector list is being corrupted in some way.

But how to solve it: I noticed a load of warnings when I first compiled it:

Code: Select all

htron.c:1424:9: warning: Implicit definition of function 'gotoxy' it will return an int. Prototype it explicitly if this is not what you want. [-Wimplicit-function-definition]
htron.c:1425:10: warning: Implicit definition of function 'cprintf' it will return an int. Prototype it explicitly if this is not what you want. [-Wimplicit-function-definition]
htron.c:1553:8: warning: Implicit definition of function 'msleep' it will return an int. Prototype it explicitly if this is not what you want. [-Wimplicit-function-definition]
htron.c:1747:42: warning: Implicit definition of function 'rand' it will return an int. Prototype it explicitly if this is not what you want. [-Wimplicit-function-definition]
So instinctively I put on:

Code: Select all

#include <conio.h>
and then I couldn't reproduce it. My hunch at the moment is that calling the SDCC entry point for cprintf (which is what happens when conio.h isn't included), which is of course a variadic function is causing some issues - variadic functions with l->r calling are very fragile things.
User avatar
RobertK
Well known member
Posts: 347
Joined: Mon Feb 26, 2018 12:58 pm

Re: (classic) New target: Krokha/ Кроха

Post by RobertK »

I think the problem is that with these four lines the program requires too much memory, and without them it just fits into memory.
I had the same slow printing problem in MastermindRK (with conio.h already included), and when I had removed the instructions screen to save memory, the problem was gone. Maybe conio.h somehow helps to save some memory.

A new release of H-Tron and MastermindRK is out now, with support for the Krokha target.

I couldn't get EPB running yet, I will have to investigate further what's going wrong there.
Post Reply