1
0
mirror of https://github.com/specht/champ.git synced 2024-11-26 16:49:35 +00:00
champ/README.md

54 lines
2.3 KiB
Markdown
Raw Normal View History

2018-02-14 22:17:10 +00:00
# Champ - N. Harold Cham's 65C02 Profiler
2018-02-15 10:08:27 +00:00
This is a 6502/65C02 emulator / profiler that enables you to really get to know your APPLE ][ HiRes Graphics Mode Demo.
2018-02-14 22:24:11 +00:00
## Features
2018-02-14 22:51:13 +00:00
* full, cycle-accurate 65C02 emulation
2018-02-14 22:24:11 +00:00
* screen output as animated GIF with exact frame timing
* average frame rate
* see how much time is spent in which subroutine
* watch variables (single variables or pairs)
2018-02-14 22:35:32 +00:00
* no dependencies except Ruby, gcc and Merlin32
2018-02-14 22:31:56 +00:00
## Usage
First, make sure you have gcc, ruby and Merlin32 installed. You need to prepare a YAML file to tell champ about all source and object files and their memory locations.
2018-02-14 22:50:42 +00:00
Take `plot3d.yaml` for example (using [Marc A. Golombeck's excellent 3D-Demo](https://github.com/mgolombeck/3D-Demo)):
2018-02-14 22:31:56 +00:00
```
load:
2018-02-14 22:41:18 +00:00
0x6000: plot3d/plot3d242.s
0x1200: plot3d/multtab.s
0x8400: plot3d/ldrwtab.s
0x8900: plot3d/SINETABLE
0x8b00: plot3d/object2.s
0x9000: plot3d/object1.s
0x9500: plot3d/FONT
0xb600: plot3d/projtab.s
2018-02-14 22:31:56 +00:00
entry: ENTRY
instant_rts:
- LOAD1
```
2018-02-14 22:42:13 +00:00
We specified some source files (they'll get compiled automatically) and some object files along with their locations in memory (`load`). We also specified the entry point for our program (`entry`), this can be a label or an address.
2018-02-14 22:31:56 +00:00
2018-02-14 22:42:13 +00:00
Furthermore, we can disable subroutines by replacing the first opcode with a RTS (`instant_rts`). This is necessary in some cases because Champ does not emulate hardware and thus can not load data from disk, for example.
2018-02-14 22:31:56 +00:00
2018-02-14 22:35:32 +00:00
To start champ, type:
```
$ ./champ.rb --max-frames 100 plot3d.yaml
```
This will run the emulator and write the HTML report to `report.html`. If you do not specify the maximum number of frames, you can still cancel the emulator by pressing Ctrl+C at any time. If you need fast results and don't need the animated GIF of all frames, specify the `--no-animation` flag, which will still give you all the information but without the animation.
2018-02-14 22:36:04 +00:00
## Example report
2018-02-14 22:35:32 +00:00
![Champ Screenshot](doc/screenshot.png?raw=true "Fig. 1 Champ Screenshot")
2018-02-14 22:31:56 +00:00
2018-02-14 22:36:04 +00:00
## Did you know?
2018-02-14 22:44:46 +00:00
By the way, there's a full-fledged, incremental, standalone, no-dependencies GIF encoder in `pgif.c` that writes animated GIFs and uses some optimizations to further minimize space. It's stream-friendly and as you feed pixels in via `stdin`, it dutifully writes GIF data to `stdout` until `stdin` gets closed.