redcode / z80 Goto Github PK
View Code? Open in Web Editor NEWHighly portable Zilog Z80 CPU emulator written in ANSI C
Home Page: https://zxe.io/software/Z80
License: GNU Lesser General Public License v3.0
Highly portable Zilog Z80 CPU emulator written in ANSI C
Home Page: https://zxe.io/software/Z80
License: GNU Lesser General Public License v3.0
Hi, i port your code and i have a question about the case 0:
There is the ROL(value) and after that carry flag evaluation.
In cases 1-7 there is first the carry flag evaluation and after that the operation.
Is that a typo or is it the expected behavior?
(starting at about line 540 in Z80.c)
switch ((DATA[offset] >> 3) & 7)
{
/* rlc .----------------.
.----. | .---------. |
| CF |<-----| 7 <-- 0 |<--'
'----' '--------*/
case 0:
ROL(value);
cf = value & 1;
break;
/* rrc .----------------.
| .---------. | .----.
'-->| 7 --> 0 |----->| CF |
'---------' '---*/
case 1:
cf = value & 1;
ROR(value);
break;
/* rl .-------------------------.
| .----. .---------. |
'--| CF |<--| 7 <-- 0 |<--'
'----' '--------*/
case 2:
cf = value >> 7;
value = (zuint8)((value << 1) | F_C);
break;
/* rr .-------------------------.
| .---------. .----. |
'-->| 7 --> 0 |-->| CF |--'
'---------' '---*/
case 3:
cf = value & 1;
value = (zuint8)((value >> 1) | ((zuint8)F_C << 7));
break;
/* sla .----. .---------.
| CF |<--| 7 <-- 0 |<-- 0
'----' '--------*/
case 4:
cf = value >> 7;
value <<= 1;
break;
/* sra .---------. .----.
.-->| 7 --> 0 |-->| CF |
| '---------' '----'
| |
'----*/
case 5:
cf = value & 1;
value = (zuint8)((value & 128) | (value >> 1));
break;
/* sll .----. .---------.
| CF |<--| 7 <-- 0 |<-- 1
'----' '--------*/
case 6:
cf = value >> 7;
value = (zuint8)((value << 1) | 1);
break;
/* srl .---------. .----.
0 -->| 7 --> 0 |-->| CF |
'---------' '---*/
case 7:
cf = value & 1;
value >>= 1;
break;
/* Uncoment to avoid compiler warnings */
/*default: cf = 0;*/
}
Running the zexall test suite with your Z80 core is showing some result mismatches. The very first ADC/SBC hl,rr test is failing, though since it's just a batched test it doesn't help identify what the problem is. Some of the later tests also report issues, but it could be from the same root cause.
I've run the same zexall.tap test through some of the popular Spectrum emulators and they're passing, so I believe the tests to be valid. I haven't had a chance to investigate it yet, but wanted to check you weren't already aware of it.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.