Skip to content

This c++ library emulates a pocket calculator's microprocessor. It implements basic arithmetic operations (+, –, ×, ÷, %, √, MU, ±) and basic memory operations (M+, M-, MR, MC).

License

Notifications You must be signed in to change notification settings

DmitryDzz/calculator-comrade-lib

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Calculator Comrade Library

Calculator Comrade Library

This C++ library emulates a pocket calculator's microprocessor. It implements basic arithmetic operations (+, –, ×, ÷, %, √, MU, ±) and basic memory operations (M+, M-, MR, MC).

The emulator doesn't implement BCD encoding (binary-coded decimals) since it was designed for 8-bit microprocessors and higher. However, in all other aspects, the architecture and algorithms were scrupulously reproduced.

The library was used in Calculator Comrade Android app. The app is free, and you can get it on Google Play.

Get it on Google Play

License

The code was released under the MIT License.

Getting Started

Clone the project:

git clone --recurse-submodules [email protected]:DmitryDzz/calculator-comrade-lib.git

How to build in pure cmake

Select the latest googletest release:
cd calculator-comrade-lib/tests/google test/ Run git tag to find the latest version. E.g.: git checkout release-1.12.1 Return to the previous directory: cd -

Create a directory next to the project:
mkdir build-cmake
cd build-cmake

Generate a build system:
Linux: cmake -G "Unix Makefiles" ../calculator-comrade-lib
Windows: cmake -G "MinGW Makefiles" ..\calculator-comrade-lib

Build the project:
Linux: make
Windows: mingw32-make

Run tests:
Linux: ./bin/tests
Windows: bin\tests.exe

How to build a cross-platform release

Currently, only Windows host system is supported.

The library is generated for the following target systems:

  • Android arm64-v8a
  • Android armeabi-v7a
  • Android x86
  • Windows x86
  • Windows x86_64

To build the libraries, run the script build.cmd xxx, where xxx is a version number. See the result in the output directory.

API

See the list of exported functions in libcalc.h file.

For embedded applications, use Calculator class (calculator.h).

About

This c++ library emulates a pocket calculator's microprocessor. It implements basic arithmetic operations (+, –, ×, ÷, %, √, MU, ±) and basic memory operations (M+, M-, MR, MC).

Resources

License

Stars

Watchers

Forks

Packages

No packages published