Git Product home page Git Product logo

8085's Introduction

8085

The Intel 8085 is a classic 8-bit microprocessor that was widely used in the 1970s and 1980s in a variety of computer systems. This project is a software emulator for the 8085 processor using C++ programming language. The emulator allows users to run programs written for the 8085 on modern computer systems.

Prerequisites

For user ( If you just want to just use this project ) ๐Ÿ‘ฉโ€๐Ÿ”ง

  • Standard C++ compiler ( supporting C++17 or above )
  • [optional] Cmake build tool
  • [optional] Git version control system

for developers ( If you want to contribute to this project ) ๐Ÿง‘โ€๐Ÿ’ป

  • A text editor to view/edit code
  • Git version control system
  • Standard C++ compiler ( supporting C++17 or above )
  • Cmake build tools along with GNU Make
  • Google Test framework ( for running testsuite )

Installation instructions ๐Ÿ‘ฉโ€๐Ÿซ

You can either use Cmake to build the project or compile it manually by hand.

Caveat: I have only built and tested it on macOS and linux, so have very little idea of how things should work on windows, if you are able to build it on windows then please c

If you find any difficulties while building the project or face any error during the process then please feel free to open a new issue regarding the same with all the necessary information ( including output generated by Cmake if used )

using Cmake

Simply navigate to the repository ( $ cd 8085 ) and use cmake to gneerate build makefiles and inturn use make to generate executables

$ cmake . && make

When done, the library should be built as 'src/lib8085.a' ( cmake is currently configured to compile it to a static library ).

without using Cmake

All the source code is present in the /src subdirectoy of the project. The project currently only contains a header file and a source file pair with no additional dependency ( at least none for building ) so compilation command should not be complicated at all.

you can simply use your standard C++ compiler to compile the code and use ar ( archiver ) that usually comes bundled with UNIX to create static/dynamic library ( according to your choice ) from the project.

Here is the sequence of instructions that you would be performing ( you can use whatever compiler you have on your machine, I am using gcc here in this example )

$ cd src
$ g++ -c cpu.cpp -std=c++2a -o cpu.o
$ ar rcs lib8085.a cpu.o

Contribution ๐Ÿคฉ

If you want to contribute to the project, then make sure you can build the project properly before proceeding ( not always applicable for small documentation changes ), feel free to use discussion section or the issue section in case you have any difficulties during the process.

There are multiple ways in which you can contribute to the project

  1. Code contribution
  2. Testing
  3. Documentation
  4. Feedback

have a look at CONTRIBUTING.md ( currently work in progress ) for more detailed explanation about contributing to the project.

The API ๐Ÿค–

WIP

Feedback โœ๏ธ

You can star the project, use discussion section, issue section or even mail me your feedback about what all you like and what all can be improved in future versions of the software

Support the project ๐Ÿ’ช

I currently don't take any monetary support so the only way to support this project currently is to give a feedback which can also be as simple as giving this repository a star on GitHub.

License

License

8085's People

Contributors

arsenic-atg avatar leeneu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

leeneu

8085's Issues

create a issue templates

create issue templates for "add tests for ..." and "implement ... instructions" issues.

it would save me a lot of time.

implement data transfer instuctions

opcodes

      MOV_AA = 0x7F,
      MOV_AB = 0x78, MOV_AC = 0x79, MOV_AD = 0x7A, MOV_AE = 0x7B, MOV_AH = 0x7C,
      MOV_AL = 0x7D, MOV_AM = 0x7E,

      MOV_BA = 0x47, MOV_BB = 0x40, MOV_BC = 0x41, MOV_BD = 0x42, MOV_BE = 0x43,
      MOV_BH = 0x44, MOV_BL = 0x45, MOV_BM = 0x46,

      MOV_CA = 0x4F, MOV_CB = 0x48, MOV_CC = 0x49, MOV_CD = 0x4A, MOV_CE = 0x4B,
      MOV_CH = 0x4C, MOV_CL = 0x4D, MOV_CM = 0x4E,

      MOV_DA = 0x57, MOV_DB = 0x50, MOV_DC = 0x51, MOV_DD = 0x52, MOV_DE = 0x53,
      MOV_DH = 0x54, MOV_DL = 0x55, MOV_DM = 0x56,

      MOV_EA = 0x5F, MOV_EB = 0x58, MOV_EC = 0x59, MOV_ED = 0x5A, MOV_EE = 0x5B,
      MOV_EH = 0x5C, MOV_EL = 0x5D, MOV_EM = 0x5E,

      MOV_HA = 0x67, MOV_HB = 0x60, MOV_HC = 0x61, MOV_HD = 0x62, MOV_HE = 0x63,
      MOV_HH = 0x64, MOV_HL = 0x65, MOV_HM = 0x66,

      MOV_LA = 0x6F, MOV_LB = 0x68, MOV_LC = 0x69, MOV_LD = 0x6A, MOV_LE = 0x6B,
      MOV_LH = 0x6C, MOV_LL = 0x6D, MOV_LM = 0x6E,

      MOV_MA = 0x77, MOV_MB = 0x70, MOV_MC = 0x71, MOV_MD = 0x72, MOV_ME = 0x73,
      MOV_MH = 0x74, MOV_ML = 0x75,

      // Move immediate
      MVI_A = 0x3E, MVI_B = 0x06, MVI_C = 0x0E, MVI_D = 0x16, MVI_E = 0x1E,
      MVI_H = 0x26, MVI_L = 0x2E, MVI_M = 0x36,

      // load immediate (reg pair)
      LXI_B = 0x01, LXI_D = 0x11, LXI_H = 0x21, LXI_SP = 0x31,

      // load/store A direct ( from register pair )
      LDAX_B = 0x0A, LDAX_D = 0x1A, STAX_B = 0x02, STAX_D = 0x12,

      // load/store A direct ( from memory )
      LDA = 0x3A, STA = 0x32,

      // load/store HL direct
      LHLD = 0x2A, SHLD = 0x22,
    
      // exchange HL and DE
      XCHNG = 0xEB;

fill all the necessary information in README.md

current readme doesn't provide any information about using the project or even building it.
of course this would not be the final product but would prove to be a strong foundation to make the project public and then work on it publicly with other possible contributors online.

  • Add installation instructions to the README.md
  • Add contribution guidelines to the README.md
  • Complete the feedback section of the README.md
  • Fill the license section of the README.md

MOV instruction not working perfectly

tested program

#include "cpu.h"
#include <iostream>

int main() {
  emu::Memory mem;
  emu::CPU cpu;
  cpu.reset(mem);
  mem[0] = emu::CPU::LDA;
  mem[1] = 0x0;
  mem[2] = 0x0;
  mem[3] = emu::CPU::MOV_BA;
  int cycles = 4;
  cpu.execute(cycles, mem);
  std::cout << (int)cpu.getBRegister() << " < B\n";
  std::cout << (int)cpu.getARegister() << " < A\n";
  std::cout << (int)cpu.getProgramCounter () << " <pc\n";
  return 0;
}

Create a CONTRIBUTING.md

The project requires a document file containing the contribution guidelines and instructions especially for new contributors those are looking forward to contribute to this repository.

Add a "How to use" section in README.md

The readme still doesn't include a proper API documentation and even if it did, having a small "how to use" section would help new users to directly use this library without much of a hassle.

ar: cpu.o: file format not recognized

without the cmake
it seems doesn't recognize the object file(cpu.o) both in windows and linux
ar: cpu.o: file format not recognized

with cmake
I only tested this at your CMakeLists at /src directory. main.cpp is not recognized when generating the project
removing that from CMakeLists it generates and builds successfully.
but it creates libcpu.a instead lib8080.a (judging by the last parameter of ar command)

both of the cases were tested on linux and windows with GCC and clang

Add tests for MVI instructions

move immediate instructions

containing the following opcodes

    MVI_A = 0x3E, MVI_B = 0x06, MVI_C = 0x0E, MVI_D = 0x16, MVI_E = 0x1E,
    MVI_H = 0x26, MVI_L = 0x2E, MVI_M = 0x36,

create LICENSE

add an open source license to the project to make it accessible for other developers to use.

Add .clang-format file to the project

Add .clang-format file to the project with the formatting standards followed by the project ( the project currently uses LLVM coding standards ).

Add tests for LXI instructions

instructions to implement loading register pair with immediate addressing mode

LXI_B = 0x01, LXI_D = 0x11, LXI_H = 0x21, LXI_SP = 0x31,

Make instruction functions private

currently all the functions of class emu::cpu are publicly visible, ideally these functions should be private and only be used by emu::cpu::execute () to execute the proper instruction.

Doing so would make the program much less error prone and avoid any accidental function calls by users.

Add links to download page/install guides for dependencies

Though most of the dependencies are pretty straightforward and would most probably be present in almost any C++ developer's arsenal, README.md should not make any presumption and at least provide some basic hyperlinks to the download page or the product's official installation instructions.

Add some graphic elements to README.md

the readme is just a giant text wall right now and needs a bit of tweeking to be more appealing to user's eyes.

These include a banner on top and some emojis in the text.

Add tests for MOV instructions

one test for testing each of the following instructions.

      MOV_AA = 0x7F,
      MOV_AB = 0x78, MOV_AC = 0x79, MOV_AD = 0x7A, MOV_AE = 0x7B, MOV_AH = 0x7C,
      MOV_AL = 0x7D, MOV_AM = 0x7E,

      MOV_BA = 0x47, MOV_BB = 0x40, MOV_BC = 0x41, MOV_BD = 0x42, MOV_BE = 0x43,
      MOV_BH = 0x44, MOV_BL = 0x45, MOV_BM = 0x46,

      MOV_CA = 0x4F, MOV_CB = 0x48, MOV_CC = 0x49, MOV_CD = 0x4A, MOV_CE = 0x4B,
      MOV_CH = 0x4C, MOV_CL = 0x4D, MOV_CM = 0x4E,

      MOV_DA = 0x57, MOV_DB = 0x50, MOV_DC = 0x51, MOV_DD = 0x52, MOV_DE = 0x53,
      MOV_DH = 0x54, MOV_DL = 0x55, MOV_DM = 0x56,

      MOV_EA = 0x5F, MOV_EB = 0x58, MOV_EC = 0x59, MOV_ED = 0x5A, MOV_EE = 0x5B,
      MOV_EH = 0x5C, MOV_EL = 0x5D, MOV_EM = 0x5E,

      MOV_HA = 0x67, MOV_HB = 0x60, MOV_HC = 0x61, MOV_HD = 0x62, MOV_HE = 0x63,
      MOV_HH = 0x64, MOV_HL = 0x65, MOV_HM = 0x66,

      MOV_LA = 0x6F, MOV_LB = 0x68, MOV_LC = 0x69, MOV_LD = 0x6A, MOV_LE = 0x6B,
      MOV_LH = 0x6C, MOV_LL = 0x6D, MOV_LM = 0x6E,

      MOV_MA = 0x77, MOV_MB = 0x70, MOV_MC = 0x71, MOV_MD = 0x72, MOV_ME = 0x73,
      MOV_MH = 0x74, MOV_ML = 0x75,

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.