Back to DFS's Workshop Page
Back to Agenda Page


Register Addition Problem

This problem is part of the larger CPU Register Math project. It will simulate how addition can be performed with the 8-bit register 6502 CPU.

For this problem, you are to cannibalize any available code and write a pair of scripts which will accept two decimal inputs from the user and show how registers in the CPU can be used to add their binary equivalents.

Your code should produce representations of the CPU registers which look like the one below.

Add Register X to Register A

A00000101
X00000011
Y????????

Provide a short description of the action being taken.

To indicate which register has just been manipulated, display the row entries in red.

If a register has not as yet been used, have a query (?) represent each bit. (In reality, each bit in the CPU would contain a 1 or 0.)

Your solution should utilize two scripts.

  1. The data entry script: add.html
    1. Explain the purpose of the scripts
    2. Accept two addends as inputs in a form
    3. Using a "Add!" button, send the data to a PHP script called add.php
  2. The simulation page: add.php
    It should have three steps.
    1. Load one addend into the accumulator
    2. Load the other addend into the X register
    3. Add the value in the X register to the one in the accumulator, putting the result in the accumulator

To see how this could work, view this possible solution.

Notes


© 2006 DFStermole
Created 7 Jan 06
Last Modified 7 Jan 06