Introduction:

The binary number system plays a central role in how information of all kinds is stored on computers. Understanding binary can lift a lot of the mystery from computers, because at a fundamental level they’re really just machines for flipping binary digits on and off.

To test and evaluate these circuits we will need to present digital bit patterns as inputs.  In this project, we build a circuit and write a 6502 Assembly program that generates and displays the binary value between 0 and 15 (i.e. 0000 through 1111) or the binary representation of ASCII.

Purpose:

To provide a practical application of your knowledge of the binary number system and its relationship to Machine Language programming.To develop and implement a 6502 Xxcelr8r Assembly program to generate binary bit patterns and to build a simple circuit to display them. In this workshop  you are tasked to implement and work with 6502 Xxcelr8r Assembly source code.

Things you will need :

Making The Circuit :

The schematic shows the physical layout of the circuit and its connection to the W65C02SXB board.  In this version of the circuit we use pins on the peripheral I/O W65C22 VIA port B brought to the breadboard using a 8-wire connection.  The positive side of four LEDs (longer leads) are attached to pins 24-17 as shown.  The negative sides of these LEDs are connected through 330Ω resistors (we use a resistor array here) to ground.  There is a vertical bar on the resistor array indicating the common lead.  One end of each of the 330Ω resistors in this array are attached to this lead.   Each of the other leads of the resistor array are connected to the other ends of the individual resistors.

8LED-circ

Binary Counter Program:

The binary counter program will apply 5V (HIGH) and 0V (LOW) levels to four of the eight LEDs to generate all 16 possible bit patterns for the binary values between 0000 and 1111.  In this sequence the least significant bit (LSB) is represented by the rightmost LED and is connected to pin 17.   Each successive bit moving from right to left has a place value that is twice the previous bit (i.e. 1, 2, 4, 8) so that the bit pattern for the integer value 13 is 1101( 8x 1 + 4x 1 + 2×0 + 1×1 = 8 + 4 + 0 + 1 = 13).

Step 0: Before we start working with the code we need a good idea of the program approach.  This program will use an integer array to hold the W65C02SXB pin numbers being used and will make use of for-loops where possible to reduce code size and complexity.   Since the process of setting the pin output levels for a given binary value is a clearly defined sequence of operations we will encode this process in its own method to be called from the main program loop.

Binary chart

ASCII Alphabet Program:

Note on Code Design:  You are encouraged to write your own version of this program.  As part of this exercise, you should probably try to sketch out your own version of this program before reviewing the programming guide. Below are some links to creating a new project and the WDC GitHub for project code example.

GitHub:

https://github.com/WesternDesignCenter/W65C02SXB-Demo7Seg