GithubHelp home page GithubHelp logo

stahta01 / 6502-compilers-bench Goto Github PK

View Code? Open in Web Editor NEW

This project forked from sgadrat/6502-compilers-bench

0.0 1.0 0.0 76 KB

Easing the task of comparing code generated by cc65, vbcc, and 6502-gcc

License: BSD 2-Clause "Simplified" License

Shell 1.89% C++ 29.35% Python 25.55% C 31.93% Assembly 10.59% Batchfile 0.69%
mos6502

6502-compilers-bench's Introduction

6502 C compilers benchmark

Easing the way to compare code generated by cc65, 6502-gcc, vbcc, and KickC.

This repository contains scripts to:

  • Compile the same source with various 6502 compilers,
  • Show the code generated,
  • Emulate generated binaries,
  • Show performance information.

Running benchs

Setuping your environement

Dependencies

You will need an up and running installation of:
  • cc65: mandatory, benchmarks for all compilers use CA65 assembler
  • Python: highly recomended, automation scripts are written in Python
  • gcc or clang: to build the emulator that run banchmarks
If you want to benchmark extra emulators, you will need them ready to compile some source:

Build the emulator

The emulator is necessary to run benchmarks. It is not a NES/C64/AppleII/... emulator, it has its own expectations about memory layout.

$ cd emulator/
$ g++ -Imos6502 emulator.cpp mos6502/mos6502.cpp -o emulator

You should now have an executable named emulator in the emulator/ folder.

Setting your environment variables

Automation scripts heavily rely on environment variables to find compilers.

Note: you can skip any *_BIN if you have the binary in your PATH

Always needed:

$ export CA65_BIN=/somewhere/cc65/bin/ca65
$ export LD65_BIN=/somewhere/cc65/bin/ld65

Needed for benching cc65:

$ export C65_BIN=/somewhere/cc65/bin/cc65
$ export CC65_LIB=/somewhere/cc65/lib

Needed for benching vbcc:

$ export VBCC=/somewhere/vbcc6502/vbcc6502_linux/vbcc
$ export VBCC_BIN=/somewhere/vbcc6502/vbcc6502_linux/vbcc/bin/vc

Needed for benching 6502-gcc:

$ export GCC6502_BIN=/somewhere/gcc-6502-bits/prefix/bin/6502-gcc

Needed for benching KickC:

$ export KICKC_BIN=/somewhere/kickc/bin/kickc.sh

Running a benchmark

Running the unzip bench with cc65:

compilers/cc65/bench code_samples/unzip/unzip.c code_samples/unzip/unzip_data.s

This will produce a fat json on standard output. It contains:

  • The number of cycles taken by the generated code
  • The size of the generated code
  • The memory dump after execution
  • The generated assembler

You may add --options="-Oirs" to pass these flags to the compiler.

You may add --verbose to have compiler commands being print before executing them.

All compilers/*/bench scripts share the same comand line interface. Feel free to run the same test with different compilers.

Impacting environment variables

  • CA65_BIN: path to ca65 binary (default: ca65 [aka search in PATH])
  • CC65_BIN: path to cc65 binary (default: cc65 [aka search in PATH])
  • LD65_BIN: path to ld65 binary (default: ld65 [aka search in PATH])
  • CC65_LIB: path where cc65's standard *.lib can be found (default: tries to link without --lib-path, doomed to fail)
  • GCC6502_BIN: path to 6502-gcc binary (default: 6502-gcc [aka search in PATH])
  • VBCC_BIN: vc binary from VBCC toolchain (default: vc [aka search in PATH])
  • VBCC: shall point to VBCC's root dir for vbcc compilation to work
  • KICKC_BIN: path to kickc.sh (or equivalent for your platform) (default: kickc.sh [aka search in PATH])
  • EMU65: path to the emulator compiled from the emulator/ dir

6502-compilers-bench's People

Contributors

asiekierka avatar sgadrat avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.