Welcome, Guest. Please login or register.


Author Topic: Pasziansz (Solitaire) from Hsoft, need EnterMice support (Read 18693 times)

Offline gflorez

  • EP addict
  • *
  • Posts: 3615
  • Country: es
    • Támogató Támogató
Re: Pasziansz (Solitaire) from Hsoft, need EnterMice support
« Reply #15 on: 2016.April.20. 22:07:28 »
Tomorrow I will put here a video with the program working. May be Xep depends on the host Pc?

Offline lgb

  • EP addict
  • *
  • Posts: 3563
  • Country: hu
  • æðsta yfirmaður
    • http://lgb.hu/
Re: Pasziansz (Solitaire) from Hsoft, need EnterMice support
« Reply #16 on: 2016.April.20. 22:24:31 »
Tomorrow I will put here a video with the program working. May be Xep depends on the host Pc?

Of course it depends, since it runs under the host OS - it won't work without any OS :) But it depends what you mean about the depending on host OS, of course.

Offline gflorez

  • EP addict
  • *
  • Posts: 3615
  • Country: es
    • Támogató Támogató
Re: Pasziansz (Solitaire) from Hsoft, need EnterMice support
« Reply #17 on: 2016.April.20. 22:40:51 »
This game works on halts. May be on some computers this is better emulated than in others.

Offline gflorez

  • EP addict
  • *
  • Posts: 3615
  • Country: es
    • Támogató Támogató
Re: Pasziansz (Solitaire) from Hsoft, need EnterMice support
« Reply #18 on: 2016.April.20. 22:52:04 »
In my house, on a Lenovo laptop running on XP, it also works.

As it doesn't work on the real EP, may be interruptions are worse emulated on XP?

Offline lgb

  • EP addict
  • *
  • Posts: 3563
  • Country: hu
  • æðsta yfirmaður
    • http://lgb.hu/
Re: Pasziansz (Solitaire) from Hsoft, need EnterMice support
« Reply #19 on: 2016.April.20. 22:53:54 »
This game works on halts. May be on some computers this is better emulated than in others.

On halts? Do you mean the HALT Z80 opcode? Basic hardware emulation (CPU, memory) should not depend on the host OS at all, I mean the host OS / computer exact type does not matter (I also tried Xep128 on Raspberry Pi, which has ARM CPU, not even x86 ... but not so surprising as it's written in C, so it should work on all platforms the same way which has well bug free C compiler). Of course some interaction still depends on host OS more. Eg mouse events are from the host OS after all, and whatever the Entermice emulation does in Xep128, host OS may decide to route mouse movements in "big chunks" or small ones, etc, so maybe not the *very* same input an EP software in Xep128 will get even if - in theory - you can move the mouse the *exact* same way (which is not possible too much, but that's another question). It was only a stupid example, of course ...

Offline lgb

  • EP addict
  • *
  • Posts: 3563
  • Country: hu
  • æðsta yfirmaður
    • http://lgb.hu/
Re: Pasziansz (Solitaire) from Hsoft, need EnterMice support
« Reply #20 on: 2016.April.20. 22:55:57 »
In my house, on a Lenovo laptop running on XP, it also works.

As it doesn't work on the real EP, may be interruptions are worse emulated on XP?

No, it shouldn't. Z80 interrupts are nothing to do with the host OS. Even if a computer is very slow, and Xep128 can't go real-time, the Z80 emulation code counts Z80 t-cycles etc not the real time of the host OS, etc. But surely, nobody can say at 100% that something is bug free, but it would sound quite odd for me ...

Offline gflorez

  • EP addict
  • *
  • Posts: 3615
  • Country: es
    • Támogató Támogató
Re: Pasziansz (Solitaire) from Hsoft, need EnterMice support
« Reply #21 on: 2016.April.20. 22:57:32 »
I mean this:

Code: [Select]
IDOMERES:       LD A,0CH
                OUT (0BFH),A
                LD HL,0C937H
                LD (38H),HL
                LD HL,5000
                LD A,30H
                OUT (0B4H),A
                EI
                HALT
                OUT (0B4H),A
                EI
                OR A
IDOMERES10:     DEC HL


Edit: tomorrow I will test on a Vista OS.
« Last Edit: 2016.April.20. 23:15:22 by gflorez »

Offline lgb

  • EP addict
  • *
  • Posts: 3563
  • Country: hu
  • æðsta yfirmaður
    • http://lgb.hu/
Re: Pasziansz (Solitaire) from Hsoft, need EnterMice support
« Reply #22 on: 2016.April.20. 23:54:59 »
I mean this:

Code: [Select]
IDOMERES:       LD A,0CH
                OUT (0BFH),A
                LD HL,0C937H
                LD (38H),HL
                LD HL,5000
                LD A,30H
                OUT (0B4H),A
                EI
                HALT
                OUT (0B4H),A
                EI
                OR A
IDOMERES10:     DEC HL


Edit: tomorrow I will test on a Vista OS.

EI enables interrupts only after the *end of next* opcode. So after HALT ... This code fragment seems to be strange for me, at the first glance, but it's possible that I'm tired only :) Of course if interrupts were enabled even before EI, it may does not cause too much headache, but if interrupts are disabled, this would halts the CPU, as interrupts are enabled by EI only after the HALT, but it won't occur, as HALT waits for an interrupt ... But I am really unsure ... As HALT can be imagined as a re-executed opcode without incrementing PC. So maybe it's still possible that the stuff above works, because on the "second iteration" of HALT that's already an opcode away from EI, so an interrupt can "kick off" Z80 from HALT state.

http://www.z80.info/zip/z80-documented.pdf

As far as I can see, my second explanation is the right, if you read things about EI and HALT in this nice (and quite useful, in my opinion) documentation on not-so-well-known Z80 features :)

But anyway, I haven't written the Z80 emulation code itself, it's from Z80EX project, which is basically based on FUSE, which is a Spectrum emulator by the way (Free Unix Spectrum Emulator, or something like that). I can't say that Z80EX is bug-free, but even if it's not, that behaviour is nothing to do too much with the host OS/machine.

Moreover, of course HALT will stop the execution regardless of EI, if no interrupt is got by the Z80 ... Since in EP, all maskable interrupts comes through/from Dave, it's possible, that there is some specific problem in the Dave emulation itself, not the Z80 part. I even have some faint idea ... On a real EP, Dave just runs in "parallel" with CPU, I mean its counters for example. This is not possible in an emulator too much, as emulator is a single sequence of code (ok, you can have more CPU cores, multithreading etc, but then it won't work too much as you can't keep stuffs in sync using a host OS which has its own idea on scheduling processes/threads/etc in this very low scale time factor at least). So Xep128 in reality runs one Z80 opcode and _then_ runs the Dave "tick" function which emulates amount of Dave cycles calculated from the Dave / Z80 clock ratio (fractions are not lost ....). That "tick" funcion is responsible also to decrement Dave counters and causing interrupt for example if it's enabled. Usually this should not make any difference, but I think it will, if very tight cycle exact reaction is needed. But I am really unsure now. In theory, interrupts are not accepted of course within an opcode execution by the Z80, so it won't cause difference, however, there is one exception: if a CPU opcode is long enough (in T-cycles) that multiple Dave ticks "fits", then Dave tick function is called more times without Z80 activity in the emulator code level at least. With the current code structure, I can't avoid that, otherwise the CPU/Dave frequency ratio cannot be kept at all. Well, it's just one possible reason that Xep128 can behave a bit different than a real EP, if accurate timing is important. Some  other areas where Xep128 is not exact:

* VRAM timing it totally missing :( It's a quite *big* difference from a real EP! In fact, I think, more important than the case of Dave/CPU sync which is about to be good, just few cycles difference maybe (those inaccurate cycles would "average out" each other on long term, but can cause problem if ONE cycle exact emulation is needed for some reason!)
* Nick/CPU exact timing is also not exact, well this cause the previous VRAM timing problem :) But it can be detected by other means, if someone plays with rapid modification of data Nick would read very soon, etc ... I don't think too much people used tricks like this ever ... Maybe IstvanV had a nick program (which even doesn't work on ep128emu) playing with _reading_ Nick registers which would reflect the last bus state between Nick and its RAM (VRAM). Not so easy to do it at a very exact way ...
« Last Edit: 2016.April.21. 00:07:54 by lgb »

Offline gflorez

  • EP addict
  • *
  • Posts: 3615
  • Country: es
    • Támogató Támogató
Re: Pasziansz (Solitaire) from Hsoft, need EnterMice support
« Reply #23 on: 2016.April.21. 01:50:33 »
Tested on a mini laptop Asus running on Win 8.1.

 It works as on XP.

Offline lgb

  • EP addict
  • *
  • Posts: 3563
  • Country: hu
  • æðsta yfirmaður
    • http://lgb.hu/
Re: Pasziansz (Solitaire) from Hsoft, need EnterMice support
« Reply #24 on: 2016.April.21. 10:41:40 »
I'm still unsure what is wrong for you about the code pattern above. Since it writes 0x30 to port 0xB4, tt should be (enable INT1 and reset INT1 latch) something with Dave INT1 which is connected to the VINT output of Nick, that is "video interrupt". Since the label in asm code says "idomeres" it means "measure time" in Hungarian. Maybe the fact that VINT is generated 50Hz rate if VINT bit is set on a single LPB during the LPT normally. But what I still can't understand that what's your problem with this, it should work differently in other emulators and/or on real EP? Exactly what is the difference, it would be nice to know :)

Offline gflorez

  • EP addict
  • *
  • Posts: 3615
  • Country: es
    • Támogató Támogató
Re: Pasziansz (Solitaire) from Hsoft, need EnterMice support
« Reply #25 on: 2016.April.21. 11:26:53 »
For me it is fine that the game worked perfectly on your emulator as it means I am near from achieving the same on the real EP.

What annoys me is, why it doesn't work for Zozo? 

Now I have tested your XEP128 with Paszians on a Win7 Pc and it behaves exactly the same how Zozo describes it.

On the other side, on the same Pc, mouse on EGI works. It is strange, isn't it? Not your fault, it can be again Windows jungle...

Offline lgb

  • EP addict
  • *
  • Posts: 3563
  • Country: hu
  • æðsta yfirmaður
    • http://lgb.hu/
Re: Pasziansz (Solitaire) from Hsoft, need EnterMice support
« Reply #26 on: 2016.April.21. 11:33:53 »
On the other side, on the same Pc, mouse on EGI works. It is strange, isn't it? Not your fault, it can be again Windows jungle...

Never say "not", it can be mine :) That's why I am insterested, you can never know, that you may found some bug which is hard to find, but still :)

Offline gflorez

  • EP addict
  • *
  • Posts: 3615
  • Country: es
    • Támogató Támogató
Re: Pasziansz (Solitaire) from Hsoft, need EnterMice support
« Reply #27 on: 2016.April.27. 01:21:28 »
There is no way.

Paszians seems to be incompatible with EnterMice mode, but on the other side probably I could implement a Boxsoft mode.

This game works constantly writing and reading port  0B4H(Dave enable/reset interrupt sources/latches), and writing port 0BFH(Dave sysconfig register, wait states, clkdiv).

Probably this corrupts the lecture of bit 1 (K column) of port 0B6H(game ports), but leaves untouched bit 0 (J column).

I don't know how many games use this interrupt system, but it can be that choosing the unused K column for EnterMice has not been the best idea.

Why K and L remained undocumented so many years? May be the developers discovered the incompatibilities and abandoned their use?

At least we still can switch to Boxsoft mode on the EnterMice adapter.


------

May be someone can explain me why this happens. Paszians writes 110000b to port B4h.
« Last Edit: 2016.April.27. 01:28:26 by gflorez »

Offline geco

  • EP addict
  • *
  • Posts: 7219
  • Country: hu
    • Támogató Támogató
Re: Pasziansz (Solitaire) from Hsoft, need EnterMice support
« Reply #28 on: 2016.April.27. 10:29:19 »
May be someone can explain me why this happens. Paszians writes 110000b to port B4h.
This is reset video interrupt. :)

Offline Zozosoft

  • Global Moderator
  • EP addict
  • *
  • Posts: 14776
  • Country: hu
    • http://enterprise.iko.hu/
Re: Pasziansz (Solitaire) from Hsoft, need EnterMice support
« Reply #29 on: 2016.April.27. 10:36:33 »
I guess the problem are: executing the EnterMice routine need more CPU time, then the next interrupt come in wrong time.
In the XEP128 the timings not emulated yet, then the IRQ come at different point than the real machine.