News:

Printed Amstrad Addict magazine announced, check it out here!

Main Menu
avatar_megachur

CPCEPower v1804

Started by megachur, 19:16, 01 October 18

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

megachur

Here is the new version of my amstrad cpc emulator : CPCEPower v1804

see file CPCEPower_SDL_HELP.html for help !

see for details about this emulator : http://cpc-power.com/cpcarchives/index.php?page=articles&num=446
--> I've asked Kulkucan since months to update with this new version on cpcarchives but he haven't got the time yet  ;) !

all is in the archive provided, the SDL2 (2.0.4) dll is the only thing used !
Decompress all the archive in the same directory and run the .exe !

It works on windows and linux (use Wine).

As ACE for example, this emulator has been written to be as close as possible of a real cpc hardware !
Todo LIST :- CRTC3 & 4- add a .ini config file (to avoid use of command parameters for default configuration)
- add better floppy disk and cdt user interface (last files used, more buttons, etc.)
- finish virtual keyboard (not very 'user friendly' now and usable) !
- add hardward extensions (mf2, etc.)- the sound of the floppy disk drive cut the ay output which is not good on a musical loader for example !
etc.

If you add better waves or images (keep the actual dimensions), send them to me to add to the official release !

I hope you will enjoy this emulator !


Aeliss

#1
Nice ^^
I have some compatibilities problem, but it 's the kind of emul I like, light/portable.
The joystick support is finished ? It can't detect mine.
And I rly like the UI, rly instinctive.

megachur

Quote from: Aeliss on 20:15, 01 October 18
Nice ^^
I have some compatibilities problem, but it 's the kind of emul I like, light/portable.
The joystick support is finished ? It can't detect mine.
And I rly like the UI, rly instinctive.
Thanks you for your feedback

Tell me what are the compatibilities problem ? I'm always interested to know ! All dsk, cdt on cpc-power have been tested with my emulator !
--> But warning, it's important that what you're trying can work on a real cpc hardware !

Can you tell me also the joystick model you use !? I know that newer version of SDL2 library add more joystick support recently -> I can try to switch to the last version 2.0.8 of this library instead of the 2.0.4 version I used...

roudoudou

onescreen colonies 0 "does not work"
the CRTC detection fails (tested with CRTC 0 or 1)
My pronouns are RASM and ACE

Aeliss

Ok, my bad, I had problems on some dsk but was 6128+ system, after some new tries, no more compatibilities problems for the moment.
Try "LED Storm", graphical glitch, and my joystick is a compatible XBox 360 gamepad, working with Xinput.

arnoldemu


Quote from: megachur on 04:48, 02 October 18
Can you tell me also the joystick model you use !? I know that newer version of SDL2 library add more joystick support recently -> I can try to switch to the last version 2.0.8 of this library instead of the 2.0.4 version I used...
I believe it will be the SDL2 game controller messages you need to listen to for Aeliss' controller.

My games. My Games
My website with coding examples: Unofficial Amstrad WWW Resource

robcfg

It certainly works nicely under wine.


Do you plan to release the source code? It would be nice to make native versions which I think it's possible as you have almost no dependencies.


Keep on the good work!

megachur

Quote from: roudoudou on 12:22, 02 October 18
onescreen colonies 0 "does not work"
the CRTC detection fails (tested with CRTC 0 or 1)
Very strange : Are you sure ?  :o
It work without problem here, see attached screenshot for CRTC0,1 & 2 with 128ko RAM !
:D

megachur

Quote from: robcfg on 18:29, 02 October 18
It certainly works nicely under wine.


Do you plan to release the source code? It would be nice to make native versions which I think it's possible as you have almost no dependencies.


Keep on the good work!
I've tried to port it to Linux... The devtool are g++ (mingw32 on windows) and Codeblocks ;-)...simple to do, no ?

But when I've optimized the z80 core in javascript then ported to C++ (which is executing all the steps of the z80 core instructions ;-) it's like the real hardware z80 ! ), I've used a variable function pointer which don't work now in g++ linux actual version !!!So without this problem, I can make the source on linux, rasbery pie, anywhere the SDL2 dll is ported !I've tried to compil the last version of gcc but take many times, and as Wine do the job for now...never finished it !

perhaps this can change in the next months !

roudoudou

Quote from: megachur on 19:26, 02 October 18
Very strange : Are you sure ?  :o
It work without problem here, see attached screenshot for CRTC0,1 & 2 with 128ko RAM !
:D
Not "one screen colonies" -> "one screen colonies 0" !
http://www.cpc-power.com/index.php?page=detail&num=15200
My pronouns are RASM and ACE

megachur

Quote from: Aeliss on 17:11, 02 October 18
Ok, my bad, I had problems on some dsk but was 6128+ system, after some new tries, no more compatibilities problems for the moment.
Try "LED Storm", graphical glitch, and my joystick is a compatible XBox 360 gamepad, working with Xinput.
--> send me a screenshot for LED STORM (screenshotLeft click on the 'camera icon' or take a screenshot with F7).I will add the new SDL dll and recompilate the last source to see if it's better with this joystick...stay tuned !

roudoudou

Quote from: megachur on 19:26, 02 October 18
Very strange : Are you sure ?  :o
It work without problem here, see attached screenshot for CRTC0,1 & 2 with 128ko RAM !
:D
Or maybe i miss the point, the message Wrong CRTC is always displayed  >:(
;D
My pronouns are RASM and ACE

megachur

Quote from: roudoudou on 19:35, 02 October 18
Not "one screen colonies" -> "one screen colonies 0" !
http://www.cpc-power.com/index.php?page=detail&num=15200
sorry for the mistake...

Ok, I will try to explain you what append : you start the emulator, the cpc start with crtc0.
start the demo run"-OSC0"... firstly it detect crtc0, and you can only go to the first part !
-> Ok

If you change the crtc (1 for example) with the emulator... it's ok in hardware emulation but the program detection isn't run again...
1) so you must change crtc to crtc1
2) then f9 or reset button
3) then start the demo again run"-OSC0"... it detect crtc1, and you can start all 3 parts !

ok for you now !?

megachur

#13
Quote from: roudoudou on 19:44, 02 October 18
Or maybe i miss the point, the message Wrong CRTC is always displayed  >:(
;D
--> Try it on your cpc crtc1 ;-) ! if it's the same (as I think), it's ok ;-) !  :D

--> Tell the big boss of VANITY ; It can tell the truth about this strange things !!!

Aeliss

For LED Storm, it' s a moving glitch, so I can't take a sreenshoot, better to see it in live, but for information this glitch is present on almost all emul I m using ^^. I have make comparaison with video on youtube from real computer to be sure.

megachur

Quote from: Aeliss on 17:11, 03 October 18
For LED Storm, it' s a moving glitch, so I can't take a sreenshoot, better to see it in live, but for information this glitch is present on almost all emul I m using ^^. I have make comparaison with video on youtube from real computer to be sure.
If it's in the bottom of the screen, for me it's due to the vertical scrolling and the use of crtc register 5 with no compensation at the end of the screen (ou use of black colored line to not see this) !  :D

Ast


@megachur : Please make this demo working on CPCePower!


Note that this is a big challenge because this demo only runs on original Cpc.
On all emulators (winape, arnold... & this one) this demo loads but resets too.

_____________________

Ast/iMP4CT. "By the power of Grayskull, i've the power"

http://amstradplus.forumforever.com/index.php
http://impdos.wikidot.com/
http://impdraw.wikidot.com/

All friends are welcome !

megachur

#17
Quote from: Ast on 18:22, 03 October 18
@megachur : Please make this demo working on CPCePower!


Note that this is a big challenge because this demo only runs on original Cpc.
On all emulators (winape, arnold... & this one) this demo loads but resets too.
I've tested this demo on many cpc 6128... And I found one (CRTC1) which do the same -> reset !and there is another demo that don't work to between 2 cpc 6128 too !

I've tried on another CRTC1 and the demo works ?! --> see bellow !

I discover then, that one of the chip is a revised version of the first -> maybe it's a corrected bug on PPI ou CRTC ???


see https://cpcrulez.fr/forum/viewtopic.php?f=7&t=5835 thread to see all the story !
here is a google translate of my original post here :
Quote1) Equalizor demo of P007

  It does not work on a CPC 6128 with CRTC1 at the moment the program this decompress / decrypt ... here is the portion of code in question (use of the register R to verify that the code is the original one because R is used as decryption key (XOR (HL)) code:

  Code:   8438: ei
  8439: ld b, & f5
  843B: in a, (c)
  843D: rra
  843E: jp nc, & 843B
  8441: halt
  8442: ld a, & da
  8444: ld r, a *
  8446: ld hl, & 0140
  8449: ld's, & 81D2
  844C: ld a, r
  844E: xor (hl)
  844F: ld (hl), a
  8450: inc hl
  8451: dec of
  8452: ld a, d
  8453: gold e
  8454: jp nz, & 844C


  here is my analysis on emulator:
  decoding from 8442

  in 8451 interrupt!  when we should be in 8452!

  the shift of R from 1 to the return of the interrupt!

  -> detection of the HSYNC too early a microsecond which will trigger the interruption of z80 too early a micro second!

  if I shift the detection of the HSYNC by a microsecond, it works on the emulator in question, so not linked to a bad emulation code z80!

  Do I assume that this is a CRTC1 behavior different from CRTC0, for example, where this demo works?  or on the two different Z80s, especially on the HALT instruction just before in & 8441 or other timing difference on the ld A, R for example?

2) ReSeT 0 - Outer World Music

  For this time, the difference between the two CPC 6128 (CRTC0 and CRTC1) that I tested may be related to the PPI (or Z80) ???

  The CPC 6128 CRTC 0 on which we hear the music has a PPI Toshiba TMP8255AP-5 (8804A), the cpu: Z8400APS Z80 CPU (8609)
  The CPC 6128 CRTC 1 on which the music is not heard (and meters remain at 0): PPI NEC D8253AC-5 (8609EJ), the cpu: Z0840004PSC Z80 CPU (8803)


  pb with out (#ff), a!  either out (# E6FF), # E6 or out (# A6FF), # A6 that does not work with the second PPI ??

  Code:   org # 9541
  ld hl, # 96b9
  ld of, # e6a6
  ld bc, # f400
  .l954a
  ld a, d
  out (#ff), a
  out (c), c
  ld b, d
  out (c), 0
  dec b
  outi
  ld a, e
  out (#ff), a
  inc c
  ld a, # 0d
  cp c
  jr nz, l954a
  bit 7, (hl)
  jr nz, l956d
  ld a, d
  out (#ff), a
  out (c), c
  inc b
  ld a, e
  out (#ff), a
  outi
  .l956d
  ld b, d
  out (c), 0
  ret

  Should I infer that this is a different behavior between the two brand different PPI ??


  Comparison of the two Z80s: http://www.cpu-world.com/Compare/977/Zilog_Z80_4_MHz_(Z0840004PSC)_vs_Zilog_Z80_4_MHz_(Z8400APS).html

  i just found a reference here on a difference on z80s and outs: are the two problems encountered related?

  Differences between NMOS and CMOS Z80s http://faqwiki.zxnet.co.uk/wiki/Z80#OUT_.28C.29.2C0_or_OUT_.28C.29.2C255_instruction

  To quote :  LD A, I and LD A, R bug

  The NMOS Z80s a problem of LD A, I and LD A, R record of the state of IFF2.  This behavior, along with workarounds for this, is documented in the Z80 Family Questions and Answers section of the Zilog Product Specifications Databook, and is useful for detecting the model of Z80 in assuming it is a genuine NMOS or CMOS Z80) provides an 'OUT (C), 0' instruction (NMOS), or 'OUT (C), 255' instead (CMOS).

  OUT (C), 0 or OUT (C), 255 instruction

  In 1996, Simon Cooke noted in a Usenet posting that the undocumented instruction usually referred to as 'OUT (C), 0' behaves instead as 'OUT (C), 255' on CMOS Z80s.

  Later, in 2004, Colin Pigot rediscovered this with his own SAM Coupe, when running for SCPDU 6, coincidentally written by Simon Cooke.  With the CMOS Z80, a white background color was set over the screen in the demo.  This article was published in SAM Revival Issue 9 (March / April 2004).

  In 2008, this was once again rediscovered by the MSX community.


  I hope this challenge interests you too... :winner::biere::winner::biere:

:winner:  Feel free to post your analysis here !!! :winner::sweatingbullets::sweatingbullets::winner:


Quote

for the second demo, Supersly have tested on a CPC6128 CRTC1 and it's ok...
This would confirm that on the PPI NEC D8253AC-5 one behaves differently than on the PPI Toshiba on this point!

krusty_benediction

Quote from: megachur on 19:34, 02 October 18
I've tried to port it to Linux... The devtool are g++ (mingw32 on windows) and Codeblocks ;-)...simple to do, no ?

But when I've optimized the z80 core in javascript then ported to C++ (which is executing all the steps of the z80 core instructions ;-) it's like the real hardware z80 ! ), I've used a variable function pointer which don't work now in g++ linux actual version !!!So without this problem, I can make the source on linux, rasbery pie, anywhere the SDL2 dll is ported !I've tried to compil the last version of gcc but take many times, and as Wine do the job for now...never finished it !

perhaps this can change in the next months !
I have not really understood the issue: mingw is similar to g++. If issue comes from g++, have you tried clang++ ? However Stl has this object to manipulate functions https://en.cppreference.com/w/cpp/utility/functional/function and it should work on any compiler.

gerald

#19
Quote from: megachur on 18:49, 03 October 18
I've tested this demo on many cpc 6128... And I found one (CRTC1) which do the same -> reset !and there is another demo that don't work to between 2 crtcs !
I've tried on another CRTC1 and the demo works !!!
When you say you tested an other CRTC1, did you use the same 6128 or an other one ?
What was the gate array in the 6128 with the CRTC1 that did not work ?
The falling edge (ie the active one for the CRTC) happen one 16MHz clock earlier on the 40007 than on the 40010. (edit or the opposite ?)

arnoldemu

#20
@Megachur:
Please would you run the program in this thread on your CPCs and tell me if you see different data bus value?
http://www.cpcwiki.eu/forum/amstrad-cpc-hardware/data-on-bus-at-interrupt-time/

I have seen differences between PPI too.
Did you try my acid test programs?

http://www.cpctech.org.uk/test.zip
I am trying to identify and test all differences here.
My games. My Games
My website with coding examples: Unofficial Amstrad WWW Resource

Targhan

QuoteI've used a variable function pointer which don't work now in g++ linux actual version !!!


I use that a lot with Arkos Tracker 2, and it compiles with Visual Studio, GCC and Clang without problem, so your problem must be elsewhere. As Krusty said, you can use all the std::function / std::bind, the syntax is a bit strange but it works great.
Targhan/Arkos

Arkos Tracker 2.0.1 now released! - Follow the news on Twitter!
Disark - A cross-platform Z80 disassembler/source converter
FDC Tool 1.1 - Read Amsdos files without the system

Imperial Mahjong
Orion Prime

megachur

Quote from: Targhan on 22:51, 03 October 18

I use that a lot with Arkos Tracker 2, and it compiles with Visual Studio, GCC and Clang without problem, so your problem must be elsewhere. As Krusty said, you can use all the std::function / std::bind, the syntax is a bit strange but it works great.
Thanks to you and Krusty for the support !
Here what I'm using : remember it's a port from javascript at first !  :o
in the header :

class Z80CPU {
public:
    typedef void (Z80CPU::*func_ptr)();
...
//Instruction Execute
    func_ptr exec;
...
    func_ptr opcode_exec[256];
...
...
    void nop();
    void ld_rr_nn();
...

then I'm using it in the main z80 code like that :...

exec=opcode_exec[opcode];
....
opcode_exec is the table of function of all simple (one byte) instructions functionsand it's initialized like this at the constructor of this class z80 :

    opcode_exec[0x00]=&Z80CPU::nop;      // 00000000 nop
    opcode_exec[0x01]=&Z80CPU::ld_rr_nn; // 00000001 ld bc,nn
    opcode_exec[0x02]=&Z80CPU::ld_bcde_a;// 00000010 ld (bc),a
...

--> g++ on linux don't accept this kind of self modifying function ptr !!!

megachur

#23
Quote from: arnoldemu on 20:53, 03 October 18
@Megachur:
Please would you run the program in this thread on your CPCs and tell me if you see different data bus value?
http://www.cpcwiki.eu/forum/amstrad-cpc-hardware/data-on-bus-at-interrupt-time/

I have seen differences between PPI too.
Did you try my acid test programs?

http://www.cpctech.org.uk/test.zip
I am trying to identify and test all differences here.
@arnoldemu & @gerald : here is the result for the CPC 6128 CRTC 1 :

3 values are show by getvect :

5f
7f
ff


--> Equalizor demo of P007/Malibu Crackers don't work on this one only !

The ReSeT 0 - Outer World Music works good on this one...so it's not the same hardware particularity...

I will check all the hardware information on the motherboard of this one and post them here as soon as possible ! ;-)

krusty_benediction

#24
Here is a modern C++ version
#include <functional>

class Z80CPU {
public:
    using func_ptr = std::function<void(void)>;

    func_ptr opcode_exec[2];
    func_ptr exec;

    void nop(){}
    void ld_rr_nn(){}

    Z80CPU():
      opcode_exec {
        std::bind(&Z80CPU::nop, this),
        std::bind(&Z80CPU::ld_rr_nn, this)
          },
      exec {opcode_exec[0]}
    {
    }
};


int main(int argc, char ** argv) {
    Z80CPU cpu;
}





edit: By the way your initial code compiles on my machine. Here is the version of my compiler :g++ -v
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/7/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 7.3.0-27ubuntu1~18.04' --with-bugurl=file:///usr/share/doc/gcc-7/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++ --prefix=/usr --with-gcc-major-version-only --program-suffix=-7 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib --enable-objc-gc=auto --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 7.3.0 (Ubuntu 7.3.0-27ubuntu1~18.04)

Quote from: megachur on 06:21, 04 October 18Thanks to you and Krusty for the support !
Here what I'm using : remember it's a port from javascript at first !  :o
in the header :

class Z80CPU {
public:
    typedef void (Z80CPU::*func_ptr)();
...
//Instruction Execute
    func_ptr exec;
...
    func_ptr opcode_exec[256];
...
...
    void nop();
    void ld_rr_nn();
...

then I'm using it in the main z80 code like that :...

exec=opcode_exec[opcode];
....
opcode_exec is the table of function of all simple (one byte) instructions functionsand it's initialized like this at the constructor of this class z80 :

    opcode_exec[0x00]=&Z80CPU::nop;      // 00000000 nop
    opcode_exec[0x01]=&Z80CPU::ld_rr_nn; // 00000001 ld bc,nn
    opcode_exec[0x02]=&Z80CPU::ld_bcde_a;// 00000010 ld (bc),a
...

--> g++ on linux don't accept this kind of self modifying function ptr !!!



Powered by SMFPacks Menu Editor Mod