Browse Source

updating instructions

possible error in compiler: faulty entry point detection
master
constantinfuerst 3 years ago
parent
commit
ab0ac62e5f
  1. 24
      cpu_design_and_emulator/cpu_design_and_emulator.vcxproj
  2. 12
      cpu_design_and_emulator/microprocessor/cpu/cpu.cpp
  3. 4
      cpu_design_and_emulator/microprocessor/cpu/cpu.h
  4. 23
      cpu_design_and_emulator/microprocessor/cpu/instructions.cpp
  5. BIN
      cpu_design_and_emulator/microprocessor/customCPU-INSTR.xlsx
  6. BIN
      customCPU-INSTR.xlsx
  7. 2
      custom_asm_macro_compiler/compiler/compiler.cpp
  8. 7
      custom_asm_macro_compiler/compiler/compiling/wrappers.cpp
  9. 16
      custom_asm_macro_compiler/custom_asm_macro_compiler.vcxproj
  10. 16
      custom_asm_macro_compiler/main.cpp
  11. 24
      xpm_to_ppubytecode/xpm_to_ppubytecode.vcxproj

24
cpu_design_and_emulator/cpu_design_and_emulator.vcxproj

@ -70,23 +70,23 @@
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<OutDir>$(SolutionDir)build\debug\32\build\CPU\</OutDir>
<IntDir>$(SolutionDir)build\debug\32\intermediate\CPU\</IntDir>
<OutDir>$(SolutionDir)build\debug\x86-32\build\CPU\</OutDir>
<IntDir>$(SolutionDir)build\debug\x86-32\intermediate\CPU\</IntDir>
<TargetName>cpudesign-d32</TargetName>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<OutDir>$(SolutionDir)build\release\32\build\CPU\</OutDir>
<IntDir>$(SolutionDir)build\release\32\intermediate\CPU\</IntDir>
<OutDir>$(SolutionDir)build\release\x86-32\build\CPU\</OutDir>
<IntDir>$(SolutionDir)build\release\x86-32\intermediate\CPU\</IntDir>
<TargetName>cpudesign-r32</TargetName>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<OutDir>$(SolutionDir)build\debug\64\build\CPU\</OutDir>
<IntDir>$(SolutionDir)build\debug\64\intermediate\CPU\</IntDir>
<OutDir>$(SolutionDir)build\debug\x86-64\build\CPU\</OutDir>
<IntDir>$(SolutionDir)build\debug\x86-64\intermediate\CPU\</IntDir>
<TargetName>cpudesign-d64</TargetName>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<OutDir>$(SolutionDir)build\release\64\build\CPU\</OutDir>
<IntDir>$(SolutionDir)build\release\64\intermediate\CPU\</IntDir>
<OutDir>$(SolutionDir)build\release\x86-64\build\CPU\</OutDir>
<IntDir>$(SolutionDir)build\release\x86-64\intermediate\CPU\</IntDir>
<TargetName>cpudesign-r64</TargetName>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
@ -99,7 +99,7 @@
<AdditionalIncludeDirectories>$(ProjectDir)</AdditionalIncludeDirectories>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
<PrecompiledHeaderOutputFile>$(SolutionDir)build\debug\32\build\pch-cpu.pch</PrecompiledHeaderOutputFile>
<PrecompiledHeaderOutputFile>$(SolutionDir)build\debug\x86-32\build\pch-cpu.pch</PrecompiledHeaderOutputFile>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
@ -115,7 +115,7 @@
<AdditionalIncludeDirectories>$(ProjectDir)</AdditionalIncludeDirectories>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
<PrecompiledHeaderOutputFile>$(SolutionDir)build\debug\64\build\pch-cpu.pch</PrecompiledHeaderOutputFile>
<PrecompiledHeaderOutputFile>$(SolutionDir)build\debug\x86-64\build\pch-cpu.pch</PrecompiledHeaderOutputFile>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
@ -133,7 +133,7 @@
<AdditionalIncludeDirectories>$(ProjectDir)</AdditionalIncludeDirectories>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
<PrecompiledHeaderOutputFile>$(SolutionDir)build\release\32\build\pch-cpu.pch</PrecompiledHeaderOutputFile>
<PrecompiledHeaderOutputFile>$(SolutionDir)build\release\x86-32\build\pch-cpu.pch</PrecompiledHeaderOutputFile>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
@ -153,7 +153,7 @@
<AdditionalIncludeDirectories>$(ProjectDir)</AdditionalIncludeDirectories>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
<PrecompiledHeaderOutputFile>$(SolutionDir)build\release\64\build\pch-cpu.pch</PrecompiledHeaderOutputFile>
<PrecompiledHeaderOutputFile>$(SolutionDir)build\release\x86-64\build\pch-cpu.pch</PrecompiledHeaderOutputFile>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>

12
cpu_design_and_emulator/microprocessor/cpu/cpu.cpp

@ -73,10 +73,10 @@ cpu::cpu(bus* parent, bool* running_flag, const uint16_t& programCounter, const
instruction(0x12,"0x12 MOV", &cpu::ZP0, &cpu::MOV),
instruction(0x13,"0x13 NOP", &cpu::IMP, &cpu::NOP),
instruction(0x14,"0x14 NOP", &cpu::IMP, &cpu::NOP),
instruction(0x15,"0x15 NOP", &cpu::IMP, &cpu::NOP),
instruction(0x16,"0x16 NOP", &cpu::IMP, &cpu::NOP),
instruction(0x15,"0x15 MSL", &cpu::VAL, &cpu::MSL),
instruction(0x16,"0x16 MSH", &cpu::VAL, &cpu::MSH),
instruction(0x17,"0x17 MSR", &cpu::ABS, &cpu::MSR),
instruction(0x18,"0x18 NOP", &cpu::IMP, &cpu::NOP),
instruction(0x18,"0x18 PCC", &cpu::IMP, &cpu::PCC),
instruction(0x19,"0x19 NOP", &cpu::IMP, &cpu::NOP),
instruction(0x1a,"0x1a NOP", &cpu::IMP, &cpu::NOP),
instruction(0x1b,"0x1b NOP", &cpu::IMP, &cpu::NOP),
@ -90,8 +90,8 @@ cpu::cpu(bus* parent, bool* running_flag, const uint16_t& programCounter, const
instruction(0x22,"0x22 LDA", &cpu::IMP, &cpu::LDA),
instruction(0x23,"0x23 LD1", &cpu::IMP, &cpu::LD1),
instruction(0x24,"0x24 NOP", &cpu::IMP, &cpu::NOP),
instruction(0x25,"0x25 NOP", &cpu::IMP, &cpu::NOP),
instruction(0x26,"0x26 NOP", &cpu::IMP, &cpu::NOP),
instruction(0x25,"0x25 MTL", &cpu::IMP, &cpu::MTL),
instruction(0x26,"0x26 MTH", &cpu::IMP, &cpu::MTH),
instruction(0x27,"0x27 NOP", &cpu::IMP, &cpu::NOP),
instruction(0x28,"0x28 NOP", &cpu::IMP, &cpu::NOP),
instruction(0x29,"0x29 MUL", &cpu::ABS, &cpu::MUL),
@ -173,7 +173,7 @@ cpu::cpu(bus* parent, bool* running_flag, const uint16_t& programCounter, const
instruction(0x70,"0x70 PPU", &cpu::DAV, &cpu::PPU),
instruction(0x71,"0x71 POX", &cpu::VAL, &cpu::POX),
instruction(0x72,"0x72 POY", &cpu::VAL, &cpu::POY),
instruction(0x73,"0x73 NOP", &cpu::ABS, &cpu::PPU),
instruction(0x73,"0x73 PPU", &cpu::ABS, &cpu::PPU),
instruction(0x74,"0x74 NOP", &cpu::IMP, &cpu::NOP),
instruction(0x75,"0x75 NOP", &cpu::IMP, &cpu::NOP),
instruction(0x76,"0x76 NOP", &cpu::IMP, &cpu::NOP),

4
cpu_design_and_emulator/microprocessor/cpu/cpu.h

@ -49,8 +49,8 @@ private:
//cpu instructions
void NOP(); void CLC(); void CLO(); void CLD(); void CLI(); void BRK(); void BRT(); void PUS(); void POP(); void SET();
void MOV(); void MSR(); void JJR(); void MJL(); void MJH();
void LOD(); void LDA(); void LD1();void MUL();
void MOV(); void MSR(); void JJR(); void MJL(); void MJH(); void MSL(); void MSH(); void PCC();
void LOD(); void LDA(); void LD1(); void MUL(); void MTL(); void MTH();
void ADC(); void AC1(); void SBC(); void SC1(); void INT(); void DET(); void IN1(); void DE1(); void INR(); void DER();
void JMP(); void JPR(); void BOE(); void BNE(); void RET();
void BRN(); void BRE(); void BCS(); void BCC(); void BLM(); void BRM(); void BSL(); void BSR();

23
cpu_design_and_emulator/microprocessor/cpu/instructions.cpp

@ -265,6 +265,29 @@ void cpu::POY() {
m_parentBus->write(0x0001, m_parentBus->read(m_addrAbs));
}
void cpu::MTL() {
m_regJoined[0] = m_regTemp;
}
void cpu::MTH() {
m_regJoined[1] = m_regTemp;
}
void cpu::MSL() {
m_regJoined[0] = m_parentBus->read(m_addrAbs);
}
void cpu::MSH() {
m_regJoined[1] = m_parentBus->read(m_addrAbs);
}
void cpu::PCC() {
m_parentBus->write(stackPtr, m_pc >> 8);
stackPtr++;
m_parentBus->write(stackPtr, m_pc & 0x00ff);
stackPtr++;
}
//debugging
void cpu::OTP() {

BIN
cpu_design_and_emulator/microprocessor/customCPU-INSTR.xlsx

BIN
customCPU-INSTR.xlsx

2
custom_asm_macro_compiler/compiler/compiler.cpp

@ -20,7 +20,7 @@ void compiler::loadGraphicsData(const std::string& segmentIn, const std::string&
void compiler::output(const std::string& outputIn) {
std::ofstream output;
output.open(outputIn + ".bin");
output.open(outputIn);
if (!output.is_open()) return;
for (auto& byte : codeVEC)

7
custom_asm_macro_compiler/compiler/compiling/wrappers.cpp

@ -6,7 +6,8 @@ void compiler::assembleProgram() {
for (size_t i = 0; i < functions.size(); i++) {
cdef::function* f = functions[i];
for (size_t j = 0; j < f->data->size(); j++) {
codeVEC.push_back(f->data->at(j));
uint8_t d = f->data->at(j);
codeVEC.push_back(d);
currentAddr++;
}
}
@ -15,7 +16,9 @@ void compiler::assembleProgram() {
codeVEC[14] = currentAddr >> 8;
for (size_t i = 0; i < compiledVEC.size(); i++) {
codeVEC.push_back(compiledVEC[i]->data);
uint8_t d = compiledVEC[i]->data;
codeVEC.push_back(d);
delete compiledVEC[i];
currentAddr++;
}

16
custom_asm_macro_compiler/custom_asm_macro_compiler.vcxproj

@ -70,23 +70,23 @@
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<OutDir>$(SolutionDir)build\debug\x86-32\</OutDir>
<IntDir>$(SolutionDir)build\int\debug\x86-32\</IntDir>
<OutDir>$(SolutionDir)build\debug\x86-32\build\ASM\</OutDir>
<IntDir>$(SolutionDir)build\debug\x86-32\intermediate\ASM\</IntDir>
<TargetName>$(ProjectName)-d32</TargetName>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<OutDir>$(SolutionDir)build\release\x86-32\</OutDir>
<IntDir>$(SolutionDir)build\int\release\x86-32\</IntDir>
<OutDir>$(SolutionDir)build\release\x86-32\build\ASM\</OutDir>
<IntDir>$(SolutionDir)build\release\x86-32\intermediate\ASM\</IntDir>
<TargetName>$(ProjectName)-r32</TargetName>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<OutDir>$(SolutionDir)build\debug\x86-64\</OutDir>
<IntDir>$(SolutionDir)build\int\debug\x86-64\</IntDir>
<OutDir>$(SolutionDir)build\debug\x86-64\build\ASM\</OutDir>
<IntDir>$(SolutionDir)build\debug\x86-64\intermediate\ASM\</IntDir>
<TargetName>$(ProjectName)-d64</TargetName>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<OutDir>$(SolutionDir)build\release\x86-64\</OutDir>
<IntDir>$(SolutionDir)build\int\release\x86-64\</IntDir>
<OutDir>$(SolutionDir)build\release\x86-64\build\ASM\</OutDir>
<IntDir>$(SolutionDir)build\release\x86-64\intermediate\ASM\</IntDir>
<TargetName>$(ProjectName)-r64</TargetName>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">

16
custom_asm_macro_compiler/main.cpp

@ -28,27 +28,29 @@
*/
int main() {
std::string asmFile;
std::string asmFile = "C:\\Users\\Admin\\Desktop\\test.txt",
baseOffset = "0x1010",
paletteFile = "[none]",
segmentFile = "[none]",
outputFile = "C:\\Users\\Admin\\Desktop\\testOUTPUT.bin";
/*
std::cout << "Please enter the full path to a assembly file" << std::endl;
std::cin >> asmFile;
std::string baseOffset;
std::cout << "Please enter the base address offset this program is supposed to utilize (standard is 0x1010)" << std::endl;
std::cin >> baseOffset;
std::string paletteFile;
std::cout << "Please enter the full directory to a palette file, enter [none] if none" << std::endl;
std::cin >> paletteFile;
std::string segmentFile;
std::cout << "Please enter the full directory to a segment file, enter [none] if none" << std::endl;
std::cin >> segmentFile;
std::string outputFile;
std::cout << "Please enter a file descriptor for the output files" << std::endl;
std::cin >> outputFile;
*/
compiler c;
if (segmentFile != "[none]" && paletteFile != "[none]")
c.loadGraphicsData(segmentFile, paletteFile);

24
xpm_to_ppubytecode/xpm_to_ppubytecode.vcxproj

@ -70,23 +70,23 @@
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<OutDir>$(SolutionDir)build\debug\32\build\XPM\</OutDir>
<IntDir>$(SolutionDir)build\debug\32\intermediate\XPM\</IntDir>
<OutDir>$(SolutionDir)build\debug\x86-32\build\XPM\</OutDir>
<IntDir>$(SolutionDir)build\debug\x86-32\intermediate\XPM\</IntDir>
<TargetName>xpmtobyte-d32</TargetName>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<OutDir>$(SolutionDir)build\release\32\build\XPM\</OutDir>
<IntDir>$(SolutionDir)build\release\32\intermediate\XPM\</IntDir>
<OutDir>$(SolutionDir)build\release\x86-32\build\XPM\</OutDir>
<IntDir>$(SolutionDir)build\release\x86-32\intermediate\XPM\</IntDir>
<TargetName>xpmtobyte-r32</TargetName>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<OutDir>$(SolutionDir)build\debug\64\build\XPM\</OutDir>
<IntDir>$(SolutionDir)build\debug\64\intermediate\XPM\</IntDir>
<OutDir>$(SolutionDir)build\debug\x86-64\build\XPM\</OutDir>
<IntDir>$(SolutionDir)build\debug\x86-64\intermediate\XPM\</IntDir>
<TargetName>xpmtobyte-d64</TargetName>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<OutDir>$(SolutionDir)build\release\64\build\XPM\</OutDir>
<IntDir>$(SolutionDir)build\release\64\intermediate\XPM\</IntDir>
<OutDir>$(SolutionDir)build\release\x86-64\build\XPM\</OutDir>
<IntDir>$(SolutionDir)build\release\x86-64\intermediate\XPM\</IntDir>
<TargetName>xpmtobyte-r64</TargetName>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
@ -98,7 +98,7 @@
<LanguageStandard>stdcpp17</LanguageStandard>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
<PrecompiledHeaderOutputFile>$(SolutionDir)build\debug\64\build\pch-xpm.pch</PrecompiledHeaderOutputFile>
<PrecompiledHeaderOutputFile>$(SolutionDir)build\debug\x86-64\build\pch-xpm.pch</PrecompiledHeaderOutputFile>
<AdditionalIncludeDirectories>$(ProjectDir)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
@ -114,7 +114,7 @@
<LanguageStandard>stdcpp17</LanguageStandard>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
<PrecompiledHeaderOutputFile>$(SolutionDir)build\debug\32\build\pch-xpm.pch</PrecompiledHeaderOutputFile>
<PrecompiledHeaderOutputFile>$(SolutionDir)build\debug\x86-32\build\pch-xpm.pch</PrecompiledHeaderOutputFile>
<AdditionalIncludeDirectories>$(ProjectDir)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
@ -132,7 +132,7 @@
<LanguageStandard>stdcpp17</LanguageStandard>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
<PrecompiledHeaderOutputFile>$(SolutionDir)build\release\32\build\pch-xpm.pch</PrecompiledHeaderOutputFile>
<PrecompiledHeaderOutputFile>$(SolutionDir)build\release\x86-32\build\pch-xpm.pch</PrecompiledHeaderOutputFile>
<AdditionalIncludeDirectories>$(ProjectDir)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
@ -152,7 +152,7 @@
<LanguageStandard>stdcpp17</LanguageStandard>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
<PrecompiledHeaderOutputFile>$(SolutionDir)build\release\64\build\pch-xpm.pch</PrecompiledHeaderOutputFile>
<PrecompiledHeaderOutputFile>$(SolutionDir)build\release\x86-64\build\pch-xpm.pch</PrecompiledHeaderOutputFile>
<AdditionalIncludeDirectories>$(ProjectDir)</AdditionalIncludeDirectories>
</ClCompile>
<Link>

Loading…
Cancel
Save