OpenCores
Issue List
Flags alteration with LD A,R and LD A,I #3
Open fbelavenuto opened this issue almost 10 years ago
fbelavenuto commented almost 10 years ago

Hi,

The opcodes LD A,R and LD A,I don't change the flags H, N, Z and S correctly.

This make bugs in some games with ZX Spectrum cloned in FPGA.

The solution:

diff -Naur T80.vhd T80_fixed.vhd

--- T80.vhd Sun Nov 24 13:51:28 2002 +++ T80_fixed.vhd Tue May 6 19:10:00 2014 @@ -604,9 +604,25 @@ when "00" => ACC <= I; F(Flag_P) <= IntE_FF2;

  •                                           if I = X"00" then
  •                                                   F(Flag_Z) <= '1';
  •                                           else
  •                                                   F(Flag_Z) <= '0';
  •                                           end if;
  •                                           F(Flag_H) <= '0';
  •                                           F(Flag_N) <= '0';
  •                                           F(Flag_S) <= I(7);
                                      when "01" =>
                                              ACC <= std_logic_vector(R);
                                              F(Flag_P) <= IntE_FF2;
  •                                           if R = 0 then
  •                                                   F(Flag_Z) <= '1';
  •                                           else
  •                                                   F(Flag_Z) <= '0';
  •                                           end if;
  •                                           F(Flag_H) <= '0';
  •                                           F(Flag_N) <= '0';
  •                                           F(Flag_S) <= R(7);
                                      when "10" =>
                                              I <= ACC;
                                      when others =>

Thanks!!

mikej was assigned almost 10 years ago
mikej commented almost 10 years ago

Hi, I appear to be the maintainer for this still. I need to merge all the versions (including the one I am maintaining at fpgaarcade back here). Thanks for reporting, Mike p.s. if anybody else reads this and has other bug fixes, please enter a report here!


Assignee
mikej
Labels
Bug