arsenic-atg / 8085 Goto Github PK
View Code? Open in Web Editor NEW8085 emulation library implemented in C++
License: MIT License
8085 emulation library implemented in C++
License: MIT License
create issue templates for "add tests for ..." and "implement ... instructions" issues.
it would save me a lot of time.
load and store accumulator direct
LDAX_B = 0x0A, LDAX_D = 0x1A, STAX_B = 0x02, STAX_D = 0x12,
The generated library has name liblib8085.a
It is also not in correct place as specified by README.md.
instruction to exchange data between HL and DE register pair
// exchange HL and DE
XCHNG = 0xEB,
currently the only way to write memory is using the subscripting operator "[]", we still need a way to write program to memory maybe from a file.
instructions to load and store HL register pair using direct addressing mode
// load/store HL direct
LHLD = 0x2A, SHLD = 0x22,
LXI_B = 0x01, LXI_D = 0x11, LXI_H = 0x21, LXI_SP = 0x31,
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.
#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;
}
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.
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.
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,
load and store accumulator direct
LDA = 0x3A, STA = 0x32
create a sample interface to see and display the changes a program does on registers/memory of the microprocessor.
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;
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 an open source license to the project to make it accessible for other developers to use.
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,
instructions to implement loading register pair with immediate addressing mode
LXI_B = 0x01, LXI_D = 0x11, LXI_H = 0x21, LXI_SP = 0x31,
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 .clang-format
file to the project with the formatting standards followed by the project ( the project currently uses LLVM coding standards ).
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.
Cmake have a bunch of generators for different command line tools ( https://cmake.org/cmake/help/latest/manual/cmake-generators.7.html ) so user/developer can use their preferred generator instead of relying only on GNU Make ( especially on windows machine )
So the README.md should contain information about the same and remove GNU make as a mandatory dependency.
create .gitignore
file to keep the repository clean and free of messy build files.
on a reset, the stack pointer should be reset to memory address FFFF
currently the built test binary is not ignored by git and might add clutter to the source code if overlooked at later stage.
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.
set up build environment using Came for both building and testing using google test
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.