Welcome, Guest. Please login or register.


Author Topic: Távoli EP hozzáférés - Remote EP access (Read 3170 times)

Offline Tuby128

  • EP addict
  • *
  • Posts: 1448
  • Country: hu
Távoli EP hozzáférés - Remote EP access
« on: 2018.May.22. 18:43:03 »
-- English version below --

Az jutott eszembe, hogy kellene egy PC program, amivel rákapcsolódhatnék egy EP-re.
Úgy képzelem el, hogy USB-RS232 átalakítóval, vagy külön erre tervezett USB-EP hardverrel rákapcsolódhatok a PC-vel az Enterprise-ra, és ablakban láthatnám, hogy éppen mi történik.
 Első sorban a karakteres kép átvitele és billentyűnyomások átvitele lenne a cél, aztán bővülhetne.
 Nekem vagy egy mikrokontrollerem, amivel USB-n keresztül adatokat tudok küleni és fogadni. Ezt a Windows "Custom-HID" eszközként ismeri fel.
 Az eszköz 64 Byte-ot képes írni és olvasni, a maximum sebessége 64kB/s.
 Van egy egyszerű windows forráskódom, amivel megnyitom a kapcsolatot (CreateFile) majd írni és olvasni tudom (ReadFile és WriteFile).
 Ezt az USB-Mikrokontrollert aztán összekapcsolhatnám az EP-vel bármelyik porton, és akár memóracímet vagy I/O-t is olvashatnék direktben, vagy akármit.
 Lehetőségem van a mikrokontrollerben gyűjteni a küldendő adatokat és lelassítva átadni az EP-nek.

Kérdés:
- hogy hogyan legyen a kommunikáció, melyek a maximálisan szükséges adatok amelyeket átküldünk?
- Ki tudná megírni a PC és EP szoftvert úgy, hogy képernyőinformációt és billentyűleütést átadjanak egymásnak?
 
 === English ver ===

 Following thing came to my mind: Imagine a PC Program, which is made for access to EP remotely. It can work via USB/RS232 converter, or with a special designed hardware I can directly connect to a real Enterprise, and in the program window we can see what happens on the EP.
 First of all we need to transfer the character mode screen and the keypresses (image transfer would be too complex), but later we can expand it.

 I have a microcontroller, which is good for read and write data via usb interface of it. Windows recognises my device as "Custom-HID" device.
 This device can recive and send 64 bytes at a time. Maximum theoretical speed is 64kb/sec.
 I have also a very simple windows sourcecode (created in ansi-c), which is goot to open the device (CreateFile) and I can read and write this 64Byte (ReadFile and WriteFile).
 I would be able to conntect the microcontroller to the EP (any port) and I could maybe read some memory adress, or I/O ports, or connect to anything.
 Via microcontroller I am able to buffer the data, and slow it down the communication to the speed of EP.

Question:
- How the communication should work, which are the most important data to be sent?
- Who can contribute to write  the PC- and EP-side software, that the screen-information and keypress information is passed to each other?

Offline Tuby128

  • EP addict
  • *
  • Posts: 1448
  • Country: hu
Re: Távoli EP hozzáférés - Remote EP access
« Reply #1 on: 2018.May.22. 18:46:46 »
Nincs kéznél EP-m, esetleg lehetséges lenne az emulátort módosítani, hogy PIPE-on keresztül fogadja az adatot? A tesztidőszak idejére?

I don't have EP in my Home, is it possible to change the emulator, that I can send data via PIPE-s? I meant for testing time only.

Offline Tuby128

  • EP addict
  • *
  • Posts: 1448
  • Country: hu
Re: Távoli EP hozzáférés - Remote EP access
« Reply #2 on: 2018.May.22. 22:01:28 »
-- Magyar verzió lent --

I was thinking on the way to home driving. I was trying to find out, how could communicate the EP and the Microcontroller.
I find out a solution:
- we have to place a 50Hz IRQ (Interrupt) in the USER ISR (interrupt service routine).
- the routine sets a dedicated (not used) segment on an address-domain e.g 0xc000-0xFFFF of the Z80
- Z80 then copies some data into that page (e.g. screen information)
- Microcontroller catches these data and send back to the PC via USB
- On the same time, Z80 can also read some data from this segment (e.g. keystrokes, files from PC, etc)

The only question is, how can we place a routine in the USER ISR? I would like to avoid to use extra software on the EP.
 My first thought was, that the microcontroller is also able to carry a ROM.
 We can "boot-up" the Enterprise with our ROM, which starts the IS-Basic (available in the cartridge) and places his routine at the point at USER ISR.

 If this is not working, or too complicated, I have a second idea:
For sending screen information (EP -> PC)
The microcontroller (and the brother FPGA Chip on the same extension card) can catch all the read and write of the Z80. So we can mirror the video memory in a SRAM (static RAM), and the microcontroller can search for the LPT (line parameter table) and copies each lines to send via USB. So we can have the screen of the EP on the PC, without extra load of the Z80.

 For keysrokes (direction PC->EP),
 Frankly I have no idea. The only way I can see is a modified Interrupt Service Routine, which fills the Exos buffer with the latest keystroke.

 Before we test on hardware, I strongly advised to prepare the latest Enterprise Emulator, that we can send data from external program by using PIPE. I would emulate the Enterprise's Expansion connector  (z80 halt, z80 RD, z80 WR etc.).
 Is it possible to use 2 emulator at the same time? Because it is easier to test, getting data from one, and show it on the other.
  
=== Magyar verz. ===

Gondolkodtam a hazafelé menet. Azt próbáltam kitalálni, hogyan lehetne a kommikációt felépíteni az EP és a mikrokontroller között.
A következőt találtam ki:
- el kell helyezni egy 50Hz-es megszakítást az USER ISR-ben (felhasználói megszakítás rutin)
- a rutin egy nem használt szegmenst lapoz be valahova pl. 0xc000-0xffff
- a Z80 átmásol néhány adatot erre a lapra (pl képinformáció)
- a mikrokontroler elkapja ezeket az adatokat és továbbküldi a PC-nek USB-n keresztül
- közben a Z80 olvashat is innen néhány adatot (pl. billentyűlenyomás, fájl a pc-ről, stb)

Az egyetlen kérdés az, hogy hogyan helyezzünk el egy saját rutint az USER ISR-ben? Szeretném elkerülni az extra szoftverbetöltést EP-n.
Az első gondolatom az volt, hogy a mikrokontroller egy ROM-ot is tartalmazna.
A gép újraindulásakor az EP betöltődhet innen, amely csak annyit tesz, hogy betölti az IS-Basic-et (a Cartridge-ből) ét elhelyezi a megszakítási rutint az USER ISR-ben.

 Ha ez nem működne, vagy túl komplikált, akkor van egy másik ötletem:

Képtartalom küldése (EP => PC)
A mikrokontoller (és a "testvér" FPGA Chip ugyanazon a bővítőkártyán) el tud kapni minden írás/olvasás műveletet, amit a Z80 végez. Így egyszerűen tükrözzük a video memóriát egy SRAM-ban. A mikrokontroller megkeresné ebben a memóriában a sorparaméter táblát, és átmásol minden sort, majd elküldené USB-n. Ezzel megkaphatnánk az EP képernyőjét a PC-n anélkül, hogy a Z80-at külön terhelnénk.

Billentyű lenyomás küldése (PC => EP)
 Őszíntén, fogalmam nincs. Az egyetlen ami eszembe jut, csak a megváltoztatott megszakítási rutin, ami megtölti az EXOS bufferét az utoljára lenyomott gombbal.

 Mielőtt ezt valódi hardveren tesztelnénk, azt ajánlanám, hogy a legfrissebb EP Emulátort átalakítjuk, hogy egy külső program PIPE-on keresztül adatokat tudjon küldeni. Egyszerűen az EP busz kiterjesztő egységét emulálva (z80 halt, z80 RD, z80 WR stb).

Lehetséges volna két emulátort használni egyidőben? Azért kérdezem, mert a teszt egyszerűbb lenne, adatot venni az egyiktől és azt megmutatni a másikon.
« Last Edit: 2018.May.22. 23:21:04 by Tuby128 »

Offline IstvanV

  • EP addict
  • *
  • Posts: 4822
Re: Távoli EP hozzáférés - Remote EP access
« Reply #3 on: 2018.May.22. 22:49:14 »
Nincs kéznél EP-m, esetleg lehetséges lenne az emulátort módosítani, hogy PIPE-on keresztül fogadja az adatot? A tesztidőszak idejére?

Nem tudom, mennyire használható ilyen célra, és a dokumentáció szerint rendszer függő, de Lua scriptekben elvileg lehetséges az io.popen() segítségével.

Offline Tuby128

  • EP addict
  • *
  • Posts: 1448
  • Country: hu
Re: Távoli EP hozzáférés - Remote EP access
« Reply #4 on: 2018.May.22. 23:20:02 »
Nem tudom, mennyire használható ilyen célra, és a dokumentáció szerint rendszer függő, de Lua scriptekben elvileg lehetséges az io.popen() segítségével.

In theory it is possible to do that in LUA-script with io.popen()
 Whether it is good for such a pupose, I don't know. According to the documentation, it is system dependent.

Azt gondoltam, hogy te vagy valakik innen a forumról teljesen hozzáférnek és jól ismerik a forráskódot, és a fent említett dologokat könnyen létrehozzák az EP emulátor forráskódjában.

 I thought, that you or some people from this forum have full access to the source code, and the above mentioned things are easily makeble in the source code of the EP emulator.

Offline Zozosoft

  • Global Moderator
  • EP addict
  • *
  • Posts: 14723
  • Country: hu
    • http://enterprise.iko.hu/
Re: Távoli EP hozzáférés - Remote EP access
« Reply #5 on: 2018.May.24. 14:09:09 »
Őszintén szólva én nem jöttem rá, hogy mi értelme lenne ennek :oops:

Kompatibilis megoldás, ha írsz egy új KEYBOARD és VIDEO eszközt, ami lecseréli a beépített eredeti eszközöket, és aztán ezek intézik a küldést/fogadást.
Viszont mindez az egyszerűbb BASIC programokon túl nem sok mindenre lenne jó.

Az említett hardveres megoldásod elvileg kivitelezhető, csak éppen a fél EP-t kéne nagy pontossággal emulálnod, hogy megkapd a képet. Ennél akkor már sokkal egyszerűbb eleve emulátort használni :oops:
Vagy rákötni az EP-t egy videóbemenetes TV tuner kártyára, és akkor szintén nézhető a PC monitorán...

A billentyűzet még nehezebb, ehhez a gépben a billentyűzet csatlakozóra kell rákapcsolódni, ott tudod a billentyű lenyomásokat szimulálni.

Offline Tuby128

  • EP addict
  • *
  • Posts: 1448
  • Country: hu
Re: Távoli EP hozzáférés - Remote EP access
« Reply #6 on: 2018.May.24. 14:48:26 »
-- English version

Frankly I don't see the point of your plan.

Compatible solution if you write a new KEYBOARD and VIDEO device, which replaces the built-in devices, and then these devices can handle the send/receive.
This solution is good for simple basic programs but not for other purposes.

 The described solution of yours is in theory makeable, but for that, you should be able to emulate the half of the EP with high precision, for capturing the screen. It is simplier to use the PC emulator.
 Or connect the EP to a video input tuner card in PC, thus you are able to see the EP on your monitor.

 Emulation of the keyboard is more difficult, because you have to connect your device to the keyboard connector, only there can be simulated a keystroke.

== Original ==

Őszintén szólva én nem jöttem rá, hogy mi értelme lenne ennek :oops:

Kompatibilis megoldás, ha írsz egy új KEYBOARD és VIDEO eszközt, ami lecseréli a beépített eredeti eszközöket, és aztán ezek intézik a küldést/fogadást.
Viszont mindez az egyszerűbb BASIC programokon túl nem sok mindenre lenne jó.

Az említett hardveres megoldásod elvileg kivitelezhető, csak éppen a fél EP-t kéne nagy pontossággal emulálnod, hogy megkapd a képet. Ennél akkor már sokkal egyszerűbb eleve emulátort használni :oops:
Vagy rákötni az EP-t egy videóbemenetes TV tuner kártyára, és akkor szintén nézhető a PC monitorán...

A billentyűzet még nehezebb, ehhez a gépben a billentyűzet csatlakozóra kell rákapcsolódni, ott tudod a billentyű lenyomásokat szimulálni.


Offline gflorez

  • EP addict
  • *
  • Posts: 3607
  • Country: es
    • Támogató Támogató
Re: Távoli EP hozzáférés - Remote EP access
« Reply #7 on: 2018.May.24. 15:24:04 »
And what about some form of bus spy? A very fast processor could interpret the signals of what is actually happening, travelling by the Z80-Nick bus.

------
És mi van a busz kém valamilyen formájával? Egy nagyon gyors processzor értelmezheti a ténylegesen bekövetkező jeleket, a Z80-Nick buszon.

Offline Tuby128

  • EP addict
  • *
  • Posts: 1448
  • Country: hu
Re: Távoli EP hozzáférés - Remote EP access
« Reply #8 on: 2018.May.24. 15:33:03 »
Exactly this is my aim, to make a device, which is "spying" the system bus.
I think for capturing the screen it is a good solution. I simply copy the line parameter table (LPT), and the data of each lines.
I am going to overwrite the EPemu128 on PC, to receive the video memory of a real Enterprise.

-- HU

Pontosan ez a célom, hogy készítsek egy "kém" eszközt ami figyeli a rendszer buszt.
A kép átviteléhez ez egy jó megloldás. Egyszerűen átmásolom a sorparaméter-táblát (LPT), és minden sorhoz tartozó adatokat.
Át fogom írni a PC-s EPemu128-at, hogy fogadja egy valódi EP videomemóriáját.

Offline gflorez

  • EP addict
  • *
  • Posts: 3607
  • Country: es
    • Támogató Támogató
Re: Távoli EP hozzáférés - Remote EP access
« Reply #9 on: 2018.May.24. 15:54:55 »
But that such system couldn't interfere with the processes, for example it couldn't read memory by itself because it would collide with the Z80 access to memory. I mean a silent observer of the signals on the bus, starting from the reset point, and then the data reconstructed by a faster processor.

-----------------

Azonban ez a rendszer nem zavarhatja a folyamatokat, például nem képes önmagában olvasni a memóriát, mert összeütközésbe kerülne a memóriában lévő Z80 processzorral. A buszban lévő jelek csendes megfigyelője, a visszaállítási ponttól kezdve, majd a gyorsabb processzorral rekonstruált adatok.

Offline Tuby128

  • EP addict
  • *
  • Posts: 1448
  • Country: hu
Re: Távoli EP hozzáférés - Remote EP access
« Reply #10 on: 2018.May.24. 16:26:41 »
Yes Sir! The "sniffer" or "spy" device can only listen and copy the system if it is connected at the start of the system, it cannot command the CPU.
 An external ASIC copies the video memory into a 2 port external memory. And the same time the memory data is sent to PC via USB. (64kB/50 times/sec)= ca 3,4MB/s over USB is pity, I made an USB project, where I could send and receive 50MB/s)
 So this solution is for screen capture.

 If I want to send/recive data, for example send a ready compiled code to a real EP, I need a program whch works together with the ASIC device. And after that Z80 asks data from the ASIC.
 The 2. option, when I extend the memory from 128k with an external memory, and the other 128k is under control of the external device.
 There is an option to "hold" the Z80 for some time, to prepare the data.

Offline gflorez

  • EP addict
  • *
  • Posts: 3607
  • Country: es
    • Támogató Támogató
Re: Távoli EP hozzáférés - Remote EP access
« Reply #11 on: 2018.May.25. 00:30:06 »
I don't have the skills, but.... you have to notice that Nick's registers can't be read, only written, so your "sniffer" could only collect data and recreate the real contents  on the PC. The same with Dave registers, some are only readable, while other only writeable, a few  are R/W, but the input not the same as the output....

------

Nincsenek készségeim, de ... meg kell jegyezned, hogy Nick regisztereit nem lehet olvasni, csak írásban, így a "szippantó" csak adatokat gyűjthet és újra létrehozhatja a valóságos tartalmat a számítógépen. Ugyanez a Dave regiszterek, néhány csak olvasható, míg más csak írható, néhány R/W, de a bemenet nem ugyanaz, mint a kimenet ....

Offline Tuby128

  • EP addict
  • *
  • Posts: 1448
  • Country: hu
Re: Távoli EP hozzáférés - Remote EP access
« Reply #12 on: 2018.May.25. 14:28:15 »
Yes, good advice! The starting address of the LPT is stored in the Nick as I/O. Normally it starts at 0xF900, but it is changable.
So the sniffer, has to monitor these porst also.
I don't see the point, why I need to read Dave registers to remote access. They don't have much useful info, do they?