GithubHelp home page GithubHelp logo

mos-6502-simulator's Introduction

MOS-6502-Simulator

A MOS 6502 simulator written in C++.

Prerequisites

How to Use

Compile Simulator

msbuild  "MOS 6502 Emulator.sln" -target:MOS_6502_Executable:Rebuild -p:Configuration=Debug,Platform=x86

Note: It only allows to use "Debug | x86" mode to compile.

Create a Hello World C Program

The memory address 0xFFFF is mapping to the console, so writing into the address means to print the word to console.

File: helloworld.c

int main()
{
    char *console = (char *)0xFFFF;
    *console = 'H';
    *console = 'E';
    *console = 'L';
    *console = 'L';
    *console = 'O';
    *console = 'W';
    *console = 'O';
    *console = 'R';
    *console = 'L';
    *console = 'D';
    *console = '\n';

    return 0;
}

Compile Program to Binary

cc65 helloworld.c --target sim6502
ca65 helloworld.s
ld65 -o helloworld -t sim6502 helloworld.o sim6502.lib

Note: Please don't use cl65 to compile the c code. I don't know why, but it's not working.

Run Binary on Simulator

Please put the simulator MOS_6502_Executable.exe and the binary helloworld in the same folder, and then type

MOS_6502_Executable.exe helloworld

you will see the output likes blew

the number of the arguments: 2
HELLOWORLD
Emulator is terminated. return code = 0

mos-6502-simulator's People

Contributors

yu830425 avatar

Stargazers

 avatar  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.