GithubHelp home page GithubHelp logo

mxcpu's Introduction

MXCPU

Arecibo / MXCPU Billboard Puzzle

MXCPU Instruction Set

Note: The results of all operations are modulo 256 and all memory slot addresses are modulo 16.

Op-code Operand 1 Operand 2 Explanation
B1 byte # -- Set PC to byte #
B2 Memory slot [00-0F] byte # If accumulator equals register, jump to byte, otherwise, advance program counter 3 bytes (to next instruction)
B3 Value byte # If accumulator equals value, jump to byte, otherwise, advance program counter 3 bytes (to next instruction)
C0 Memory slot [00-0F] -- Add memory slot value to accumulator
C1 Value to add to accumulator -- Add value to accumulator
C2 -- -- Increment the counter
C3 -- -- Decrement the counter
C4 -- -- Reset the counter to zero
C5 -- -- Copy counter to accumulator
C6 -- -- Copy accumulator to counter
D0 Memory slot [00-0F] -- Copy memory slot value to accumulator
D1 Value -- Set accumulator to value
D2 Memory slot [00-0F] -- Store accumulator in memory slot
00 -- -- Halt program execution

Run

Download a stand-alone JavaScript interpreter such as rhino.

Write your program into a file. For example, to sum the numbers from 1 to 10 and store the result in memory slot 0x00:

C4 D1 00 D2 00 C2 C5 B3 0B 10 C0 00 D2 00 B1 05 00

Run your program: $ rhino mxcpu.js myprogram.txt

Running program
Terminating
PC			0x10
INC			0xb
ACC			0xb
MEMORY			0x37,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0

mxcpu's People

Contributors

joshbodily avatar sshock avatar

Stargazers

Marciano C. Preciado avatar Andrew Carr avatar Nigel avatar

Watchers

Devin Christensen avatar Brandon Dewitt avatar James Cloos avatar Garrett Thornburg avatar Brian avatar  avatar  avatar

mxcpu's Issues

ReferenceError: readFile is not defined

Encountered "ReferenceError: readFile is not defined" when trying to run the emulator using Node.js (I had some trouble installing rhino).

Note: When mapping out the sample problem (sum of 1-10), I couldn't figure out why the sample output in the README.md shows a value for memory slots 0x0E and 0x0F (0x3 and 0x8, respectively). Maybe these values carried over unintentionally from the first exercise?

Cool stuff! :)

mxcpu.js misses formatting error if it is deep in the program

I referenced 0F in one part of some code I was messing around with, but I accidentally put the letter O instead of zero. While both the tests on mx.com/cpu as well as when running through Rhino locally caught other issues similar to this, it missed this issue for some reason. When running locally, it succeeded, and then when running against tests online, the program goes into an infinite loop, blocks the UI, and eventually crashes the page.

I don't want to post the actual code here, since it's pretty close to a working solution, but it was when I used the B2 op code. Also, when using the B2 op code earlier in the code with the same format issue, it breaks as expected and throws an error on Rhino and shows a message on the webpage that I need to match the requested format. It's only later, with the B2 op that's in a for loop that it swallows the error or goes into an infinite loop.

Feel free to reach out to me personally if you want the full code for reference. I submitted a working solution, so you should have my contact info. I'm probably the only person so far who has the initials JJ, and I submitted this morning, so it should be pretty easy to track me down :).

Completing the challenge results in SPAM

Steps to Reproduce

  1. Successfully complete the coding challenge.
  2. Provide your email address

Expected
One or several of the following:

  • Email acknowledging completion of coding challenge.
  • Email containing recruiting information.
  • Email following up on submitted solutions.
  • No email.

Actual
MX propaganda emails to the tune of:

  • MX THE MOBILE REVOLUTION IN BANKING: FROM CHINA TO THE US
  • The state of aggregation & open banking: why it matters for you and your customers
  • MX ONLINE AND MOBILE BANKING FOR EVERYONE
  • MX 50+ YEARS OF EVOLUTION IN THE FINANCIAL INDUSTRY
    ... and many more!

Safe to assume initial 0 values?

Is it safe to assume that the accumulator, counter, and all memory addresses are initialized to 0? This seems to be the case in the emulator but I don't see anything about it in the specs.

Submission error

I finished the challenge and verified my answers. However, when I go to submit my answers and information it fails to submit and just sits on the page.

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.