Enterprise Forever

:UK => Hardware => Topic started by: gflorez on 2018.June.03. 19:25:08

Title: External colour tests
Post by: gflorez on 2018.June.03. 19:25:08
Yesterday I attended a closed doors retro-computer convention. It was a reunion of Retrowiki members on Navia, near Oviedo at north of Spain, just at the Cantabrian sea, about 500Km from Madrid.

Of course I was the only assistant who carried Enterprises, not the others fault, as it is considered a very complete computer, but it was scarcely sold on our country. On the other side, most members of the Spanish website are interested in more than one computer model, not like me....

There was a variety of micro-computers displayed, from  Spectrums on all their many incarnations(even Timex-Sinclair),  to Amstrads CPC PCW CPC+, Oric, MSX, Amiga, Atari, Mac, Silicon Graphics, Raspbwrry-pi, and a lot more that I can't remember now.

But the main intention of the annual reunion is to present, debug and develop new gadgets for the computers, like memory, SD adapters and other peripherals.

I brought my humble contribution, the bus expander and the M-Slot prototype. One of my friends, Dandare, showed a preliminary version of the Dandanator for CPC, that consist on a cheap card(less than 15 Euro) with 512KB FlashRom, able to hold 10-15 games. It is able to load a game instantaneously, and save/load its progress. Nearly 1500 Dandanators for Spectrum have been created up-to-date. Another friend, Habi, presented a card that provides colour and sound to the Amstrad PCW(a silent, only green phosphor monitor CP/M computer, intended only for business).

Talking with Habi  about how a FPGA interprets the colour of the only green screen, the conversation turned to how the microcomputers of that era codified the colour, halving the resolution when doubling the colours. This though lead us to how clever is the design of the LPT table on the Enterprise. Habi himself owns an Enterprise, and asked me how the colour inputs on the expansion connector works. I answered what I know about the tests (https://enterpriseforever.com/hardver/teszteles/) made by Balaguesz. Then he said so quiet: "what if we try to do the same with my 20 euro FPGA? I can take advantage of the already written core for the PCW."

I showed him the Nick description document on Zozo's page an he read it briefly.

The main problem interfacing FPGAs with retro-computers is that they work on 3.3v, but fortunately he has a bridge card that makes the signal conversion.  He gave me some Dupont cables and asked me to connect the required signals to the rear connector of my bus expander.

He needed:

-14MHz clock
-Horizontal and Vertical synchronisms
-Ground only, as the FPGA has its own power supply
-EC0 to EC3
-/EXTC

After a few problems with the Dupont cables connection, soon we had reception of the output signals on the FPGA. Then he made some corrections on the code and tried to compile it. Take in account that the code of a FPGA describes how the real hardware is emulated inside, so it has some strict rules that must be observed. It took about 2 minutes to completely compile the code. But we repeated the procedure several times, because at first time it didn't work as expected. Soon he discovered the real resolution of the Enterprise, did some corrections and after only one hour trying we started to see the effects on the screen.

[attach=1]

[attach=2]

[attach=3]

There is some noise on the injected data, probably due to the proximity of other retro-computers.

Title: Re: External colour tests
Post by: Zozosoft on 2018.June.03. 19:48:48
There is some noise on the injected data,
It is also can be due the wire lenght. Look the schematic of the original expansion board (http://enterprise.iko.hu/schematics/A3PER-12_Enterprise_64-128_Expansion_Motherboard_Schematic.jpg). The video signals only connected to the first slot which is closer to the machine. (Probably due same reason the audio inputs only at the first two slots.)
Title: Re: External colour tests
Post by: gflorez on 2018.June.03. 20:29:20
As always you are right... 

My friend says that it can be very easy to make an expansion card to attach the cheap FPGA. It has a lot of memory and two long headers of all configurable input/output pins.  Imagine the new projects that could be made with it....
Title: Re: External colour tests
Post by: geco on 2018.June.03. 22:18:12
As i see what you did is similar to 1st tests by Balagesz :-) , it is very impressive that it was made within some hours. A very good sprite card could be done, éven a full screen could be displayed with it with 2 color resolution with 16 colors.
Title: Re: External colour tests
Post by: gflorez on 2018.June.04. 09:31:28
Yes the SymbOS screen has 4 colours, but the injected signal has 16 colours at full resolution. The limitation is, the signal can only be injected on displayed zones, not on border zones.

The next weekend he will try to digitalise a graphic to play with it. But then  I need to explain him how the first eight colours of the palette are organised, and how to change the other eight byas colours.

I remember  a chart of colours on some thread.
Title: Re: External colour tests
Post by: geco on 2018.June.04. 10:25:20
And there will be other limitation, colors for external color input are defined by LPT.
Title: Re: External colour tests
Post by: gflorez on 2018.June.04. 10:58:32
Yes, but that is because in the experiment the FPGA is autonomous, its task is very easy, it only admits synchronisms and returns the colours bits and /EXTC. This takes very little of the complete possibilities of this FPGA, not so big as the MIST, but at the side with the ZX-ONE. You can put inside a complete computer, so we can define the needed ROM and RAM segments and communicate the module with the Enterprise buses to take total control. You can, for example, define one or two AY sound chips, like in the other Balagesz project, and inject the output to the Enterprise sound inputs....  It is incredible but possible. We only have to learn how.
Title: Re: External colour tests
Post by: Tutus on 2018.June.04. 11:43:28
This is very promising!
At last someone seriously deals with developments ...

:smt038 :smt038 :smt038
Title: Re: External colour tests
Post by: gflorez on 2018.June.04. 18:34:27
I want a colour chart to show to my friend Habi. Can some one give me a link?
Title: Re: External colour tests
Post by: Zozosoft on 2018.June.04. 18:35:20
I want a colour chart to show to my friend Habi. Can some one give me a link?
http://ep.lgb.hu/colors.html
Title: Re: External colour tests
Post by: gflorez on 2018.June.04. 21:56:16
Thanks!
Title: Re: External colour tests
Post by: gflorez on 2018.June.05. 00:09:11
Habi said:

"I do not think the noise is due to the length of the cables. Probably the color input pins where only in the first slot because only one expansion should access those signals; more than one would make a short."

Later he realised the real cause:

"The noise on the signal is due to wrongly injecting the pixel on the opposite flank. This makes unstable the colour border".
Title: Re: External colour tests
Post by: Zozosoft on 2018.June.06. 20:40:51
With the Balagesz test hw we got nice stable picture, there is a example of full resolution graphics (Istvanv made the pic with epimgconv)
http://enterprise.iko.hu/video/DSCF7972.AVI

Other possible problem: which Nick chip used?
I discovered during the testing, the 08-04 Nick problems still present with external colors :-( Then it is somewhere at the color outputs...
Example on one of worst machines:
http://enterprise.iko.hu/video/DSCF7929.AVI
Title: Re: External colour tests
Post by: szipucsu on 2018.June.07. 11:49:30
http://enterprise.iko.hu/video/DSCF7972.AVI
http://enterprise.iko.hu/video/DSCF7929.AVI
You can embedd the videos on your site. Upload the videos to the Youtube, get the code there under the video and put the code into the html of your site. It looks smarter.
---
Egyszerűen meg lehet csinálni, hogy a videókat az oldalon meg lehessen nézni. Feltöltöd a videót a Youtube-ra, ott a videó alatt van pár opció, ott ki lehet választani a beágyazást. Onnan ki kell másolni a kódot és az oldalad html-jébe betenni, így már az oldaladról megnézhető a videó.
Title: Re: External colour tests
Post by: gflorez on 2018.June.07. 19:04:02
You are right, the first test where made on my old EP that has a defective Nick. But Habi claims to have fixed the noise on his Enterprise at his home, so I don't know what to think...

Meanwhile I have ordered one of these FPGAs to replicate the tests. I have to learn fast.
Title: Re: External colour tests
Post by: gflorez on 2018.June.09. 13:57:17
More tests from Habi on video. Now he has put his logo on the screen, by now  static.

https://www.youtube.com/watch?v=--j_XXJ0MME

The texts that appear on the screen are:

-External video on a Enterprise(sprites).

-Source code on VHDL.

-By now static position.

-Elements of the set.(TV, Enterprise, FPGA, Laptop).

-Starting.

-Sprite active only where there is no border.

-The EXOS palette varies according to the video mode of the Enterprise.

-Transparency test.

-Let's see the real colours.

-End.



The transparency is made programming the FPGA to put high the /EXTC signal on colour 0 when its button is pressed.
Title: Re: External colour tests
Post by: Zozosoft on 2018.June.09. 14:24:13
Nice! :smt038
Title: Re: External colour tests
Post by: geco on 2018.June.11. 08:28:33
cool :smt041
Title: Re: External colour tests
Post by: gflorez on 2018.July.08. 14:35:32
[attach=1]
[attach=2]
[attach=3]

Where is Wally?


I have replicated the FPGA interface. Thanks to Habi for his patience...

[attach=4]
Title: Re: External colour tests
Post by: geco on 2018.July.08. 19:52:59
coool :smt041
Title: Re: External colour tests
Post by: dangerman on 2018.July.09. 00:19:52
Wow - this is amazing. Never seen anything like this on the Enterprise before. I always wondered if the sprite signals actually worked.

16 colour sprites in high resolution - exciting stuff!!!
Title: Re: External colour tests
Post by: gflorez on 2018.July.09. 10:36:03
Yes, very exciting...

But these are very preliminary tests, only a proof of concept. Bad news are that perfect superposition is only possible on Enterprises with a healthy Nick chip. On my older EP, affected  by the defective Nick, a lot of artefacts are produced on the transition colour zones, worse with some combinations. Probably this error have degrees, the very same like the defective flashing pixels on some heavy coloured screens.

But let's continue with good things. The next test I will do is to move the sprite all over the screen, not real computer controlled graphics... only a simulation of a joystick port on the FPGA that will change the coordinates where the sprite is drawn.

Also I will try to put a multicoloured picture other than the mad scientist, the avatar of my friend Habi...

Less than 1% of the space of the FPGA is used by now. But to full exploit it is necessary to connect all the Enterprise bus to it and create ports on the code to communicate the two engines. There are an excess of space and programmable pins to do it, even some to create external interfaces. For example, there is a description of the WD1772 chip that can fit inside the FPGA....

But it is a pity that only Balagezs or Habi (and now I, with all my skill lacks....), can test this approach. Is for that my friend Wilco plan to design a development extension card to fit onto a bus expander or Bridge board, instead of having all the involved parts scattered on the table.

So what we need now is an accelerated  VHDL programming tutorial.
Title: Re: External colour tests
Post by: gflorez on 2018.July.10. 11:22:23
https://www.youtube.com/watch?v=_sOnjeHLapU&feature=youtu.be

This is me controlling the sprite with a joystick on the FPGA. Habi implemented it yesterday.

Sorry for the bad image and sound(I forgot I was whistling....)
Title: Re: External colour tests
Post by: Tutus on 2018.July.10. 12:30:33
:smt041 :smt041 :smt041
Fantastic!!!
Title: Re: External colour tests
Post by: gflorez on 2018.July.10. 13:18:07
Main code is simple:

Code: [Select]
Library IEEE;
Use IEEE.Std_Logic_1164.All;
Use IEEE.Numeric_Std.All;

Entity PCWVid Is
Port (
-- Entradas vídeo (sincronismos)/ Video input (syncs)
HSync : In Std_Logic;
VSync : In Std_Logic;
-- Entrada reloj  / Clock input
Clk14 : In Std_Logic;
-- Salidas vídeo  / video output
ExtN : Out Std_Logic_Vector(3 DownTo 0); -- Los 4 bits a inyectar
ExtC : Out Std_Logic; -- Strobe colores externos
-- Desarrollo (placa)  /development FPGA
Led0 : Out Std_Logic;
Led1 : Out Std_Logic;
Btn0 : In Std_Logic; -- Usado de momento para la transparencia
Btn1 : In Std_Logic;
Clk50 : In Std_Logic;
-- Joystick
Joy : In Std_Logic_Vector(3 DownTo 0) -- Joystick
);
End PCWVid;

Architecture Behavioral Of PCWVid Is
Signal CuentaH : Std_Logic_Vector(9 DownTo 0); -- Posición horizontal /horizontal position
Signal CuentaV : Std_Logic_Vector(8 DownTo 0); -- Posición vertical  / vertical position

Signal LatchH  : Std_Logic;
Signal LatchV  : Std_Logic;

Signal SprAddr : Std_Logic_Vector(12 DownTo 0);
Signal Color : Std_Logic_Vector(3 DownTo 0);

Signal X : Std_Logic_Vector(9 DownTo 0) := "0110010000"; -- 400
Signal Y : Std_Logic_Vector(8 DownTo 0) := "001100100"; -- 100

Begin

-- Para que no queden sín usar; no me gustan los warnings ;)/ I don't like warnings ;)
Led0 <= Btn1;
Led1 <= Clk50;

-- Mapeo ROM / Rom map
MiRom : Entity Work.Rom
Port Map (
    clka => Clk14,
    addra => SprAddr,
    douta => Color
);

ExtN <= Color;

-- Tratamiento sincronismos / sync management
Sync: Process(Clk14)
Begin
If Rising_Edge(Clk14) Then
-- Contador horizontal / horizontal counter
If (LatchH = '1') And (HSync = '0') Then
CuentaH <= (Others => '0');
-- Contador vertical / vertical counter
If (LatchV = '1') And (VSync = '0') Then
CuentaV <= (Others => '0');
Else
CuentaV <= Std_Logic_Vector(UnSigned(CuentaV)+1);
End If;
LatchV <= VSync;
Else
CuentaH <= Std_Logic_Vector(UnSigned(CuentaH)+1);
End If;
-- Latcheo de sincronismos / Syncs latch
LatchH <= HSync;
End If;
End Process;

-- Dibujo sprite / drawing the sprite
Sprite: Process(Clk14)
Begin
If Rising_Edge(Clk14) Then
If (Unsigned(CuentaV)>=Unsigned(Y)) And (Unsigned(CuentaV)<Unsigned(Y)+64) Then
If (Unsigned(CuentaH)>=Unsigned(X)) And (Unsigned(CuentaH)<Unsigned(X)+128) Then
-- Transparencia  / transparency
If (Btn0 = '0') And (Color = "0000") Then
ExtC <= '1';
Else
ExtC <= '0';
End If;
-- Dirección  / address
SprAddr <= Std_Logic_Vector(UnSigned(SprAddr)+1);
Else
ExtC <= '1';
End If;
Else
ExtC <= '1';
SprAddr <= (Others => '0');
End If;
End If;
End Process;

-- Movimiento / movement
Joystick: Process(Clk14)
Begin
If Rising_Edge(Clk14) Then
If (LatchH = '1') And (HSync = '0') Then
If (LatchV = '1') And (VSync = '0') Then
If (Joy(0) Xor Joy(1)) = '1' Then
If Joy(0) = '0' Then
X <= Std_Logic_Vector(UnSigned(X)+2); -- Horizontal is slower than vertical movement
Else
X <= Std_Logic_Vector(UnSigned(X)-2);
End If;
End If;
If (Joy(2) Xor Joy(3)) = '1' Then
If Joy(2) = '0' Then
Y <= Std_Logic_Vector(UnSigned(Y)+1);
Else
Y <= Std_Logic_Vector(UnSigned(Y)-1);
End If;
End If;
End If;
End If;
End If;
End Process;

End Behavioral;
Title: Re: External colour tests
Post by: geco on 2018.July.10. 13:23:00
promising :smt041
Title: Re: External colour tests
Post by: gflorez on 2018.July.11. 22:37:58
I have loaded another mask, guess it....:

[attach=1]
Title: Re: External colour tests
Post by: geco on 2018.July.12. 08:40:09
I have loaded another mask, guess it....:
:ds_icon_cheesygrin: :ds_icon_cheesygrin: