2019-09-13 01:32:26 +02:00
|
|
|
[![saythanks](https://img.shields.io/badge/say-thanks-ff69b4.svg)](https://saythanks.io/to/irmen)
|
|
|
|
[![Build Status](https://travis-ci.org/irmen/ksim65.svg?branch=master)](https://travis-ci.org/irmen/ksim65)
|
|
|
|
|
2019-09-14 17:25:41 +02:00
|
|
|
# KSim65 - Kotlin/JVM 6502/65C02 microprocessor simulator
|
2019-09-13 01:32:26 +02:00
|
|
|
|
|
|
|
*Written by Irmen de Jong (irmen@razorvine.net)*
|
|
|
|
|
|
|
|
*Software license: MIT, see file LICENSE*
|
|
|
|
|
|
|
|
|
|
|
|
![6502](https://upload.wikimedia.org/wikipedia/commons/thumb/4/43/KL_MOS_6502.jpg/320px-KL_MOS_6502.jpg)
|
|
|
|
|
2019-09-14 17:25:41 +02:00
|
|
|
This is a Kotlin/JVM library that simulates the 8-bit 6502 and 65C02 microprocessors,
|
|
|
|
which became very popular in the the early 1980's.
|
2019-09-13 01:32:26 +02:00
|
|
|
|
2019-09-14 17:25:41 +02:00
|
|
|
Properties of this simulator:
|
|
|
|
|
|
|
|
- Written in Kotlin. It is low-level code, but hopefully still readable :-)
|
2019-10-11 01:44:20 +02:00
|
|
|
- Designed to simulate various hardware components (bus, cpu, memory, i/o controllers)
|
2019-09-14 17:25:41 +02:00
|
|
|
- IRQ and NMI simulation
|
2019-10-11 01:44:20 +02:00
|
|
|
- Aims to simulate correct instruction cycle timing, but is not 100% cycle exact for simplicity
|
2019-09-14 17:25:41 +02:00
|
|
|
- Aims to implements all 6502 and 65c02 instructions, including the 'illegal' 6502 instructions (not yet done)
|
|
|
|
- correct BCD mode for adc/sbc instructions on both cpu types
|
|
|
|
- passes several extensive unit test suites that verify instruction and cpu flags behavior
|
2019-10-12 12:35:18 +02:00
|
|
|
- provide a few virtual example machines, one of which is a Commodore-64
|
2019-10-11 01:44:20 +02:00
|
|
|
|
2019-09-14 17:25:41 +02:00
|
|
|
|
2019-09-19 21:29:33 +02:00
|
|
|
## Documentation
|
|
|
|
|
|
|
|
Still to be written. For now, use the source ;-)
|
|
|
|
|
|
|
|
|
2019-09-19 01:22:11 +02:00
|
|
|
## Virtual machine examples
|
|
|
|
|
2019-09-19 21:29:33 +02:00
|
|
|
Three virtual example machines are included.
|
2019-09-19 01:22:11 +02:00
|
|
|
The default one starts with ``gradle run`` or run the ``ksim64vm`` command.
|
2019-09-19 21:29:33 +02:00
|
|
|
There's another one ``ehBasicMain`` that is configured to run the "enhanced 6502 basic" ROM:
|
2019-09-19 01:22:11 +02:00
|
|
|
|
2019-09-19 21:29:33 +02:00
|
|
|
![ehBasic](ehbasic.png)
|
2019-09-14 17:25:41 +02:00
|
|
|
|
2019-09-19 21:29:33 +02:00
|
|
|
Finally there is a fairly functional C64 emulator running the actual roms (not included,
|
2019-10-12 12:35:18 +02:00
|
|
|
but can be easily found elsewhere for example with the [Vice emulator](http://vice-emu.sourceforge.net/).
|
|
|
|
The emulator supports character mode, bitmap mode (hires and multicolor), hardware sprites and
|
|
|
|
various timers and IRQs. It's not cycle perfect, and the video display is drawn on a per-frame basis,
|
|
|
|
so raster splits/rasterbars are impossible. But many other things work fine.
|
2019-09-19 21:29:33 +02:00
|
|
|
|
|
|
|
![C64 emulation](c64.png)
|