1
0
mirror of https://github.com/cc65/cc65.git synced 2025-01-17 05:31:45 +00:00
Sidney Cadot 7980b81ddb sim65: Fix instruction timings for 6502 and 65C02.
This PR fixes all discrepancies of sim65 instruction timings, for both the 6502 and the 65C02 processors.

The timings as implemented in this PR have been verified against actual hardware (Atari 800 XL for 6502; and WDC 65C02 for 65C02).

These timings can also be verified against the 65x02 test suite. However, in this case, a single discrepancy arises; the 65x02 testsuite suggests that the 65C02 opcode 0x5c should take 4 clocks. However, tests on a hardware 65C02 have conclusively shown that this instruction takes 8 clock cycles. The 8 clock cycles duration for the 65C02 0xfc opcode is also confirmed by other sources, e.g. Section 9 of http://www.6502.org/tutorials/65c02opcodes.html.

This test makes sim65 correct both in terms of functionality (all opcodes now do what they do on hardware) and in terms of timing (all instructions take as long as they would on real hardware).

The one discrepancy that remains, is that on a real 6502/65C02, some instructions issue R or W cycles on the bus while the instruction processing is being done. Those spurious bus cycles are not replicated in sim65. Sim65 is thus an instruction-level simulator, rather than a bus-cycle level simulator. In other words, while the clock cycle counts for each instruction are now correct, not all clock cycles are individually simulated.
2024-12-24 09:24:02 +01:00
2024-06-16 19:14:24 +03:00
2024-12-18 09:04:20 +01:00
2024-12-09 18:26:00 +01:00
2023-05-05 21:56:52 -04:00
2024-08-10 15:29:50 +02:00

The cc65 cross-compiler suite

cc65 is a complete cross-development package for 65(C)02 systems, including a powerful macro assembler, a C compiler, linker, archiver, simulator and several other tools. cc65 has C and runtime library support for many of the old 6502 machines. For details look at the cc65 web site:

Company / People Machine / Environment
Apple Apple II
Apple IIe enhanced
Atari Atari 400/800
Atari 2600
Atari 5200
Atari 7800
Atari XL
Lynx
Tangerine Oric Atmos
Eureka Oric Telestrat
Acorn BBC series
Commodore C128
C16
C64
CBM 510/610
PET
Plus/4
VIC-20
VTech CreatiVision
Commander X16 Community Commander X16
Bit Corporation Gamate
Berkeley Softworks GEOS (Apple/CBM)
LUnix Team LUnix (C64)
Nintendo Nintendo Entertainment System (NES)
Ohio Scientific OSI C1P
MOS Technology, Inc. KIM-1
NEC PC Engine (PCE)
Dr. Jozo Dujmović Picocomputer (RP6502)
Watara Watura/QuickShot Supervision
Synertek SYM-1

A generic configuration to adapt cc65 to new targets is also around.

People

cc65 is originally based on the "Small C" compiler by Ron Cain and enhanced by James E. Hendrix.

Project founders

  • John R. Dunning: original implementation of the C compiler and runtime library, Atari hosted.
  • Ullrich von Bassewitz:
    • moved Dunning's code to modern systems,
    • rewrote most parts of the compiler,
    • rewrote all of the runtime library.

Core team members

External contributors

(The above list is incomplete, if you feel left out - please speak up or add yourself in a PR)

For a complete list look at the full team list or the list of all contributors.

Contact

For general discussion, questions, etc subscribe to the mailing list or use the github discussions.

Some of us may also be around on IRC #cc65 on libera.chat.

Documentation

  • The main Documentation for users and developers.
  • Info on Contributing to the CC65 project. Please read this before working on something you want to contribute, and before reporting bugs.
  • The Wiki contains some extra info that does not fit into the regular documentation.

Downloads

Snapshot Build

Description
cc65 - a freeware C compiler for 6502 based systems
Readme Zlib 404 MiB
Languages
C 62.4%
Assembly 35.6%
PHP 0.7%
Makefile 0.6%
Perl 0.3%
Other 0.3%