{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

Programming Assignment Two_ PA2

# SPARC Architecture, Assembly Language Programming, and C (2nd Edition)

• Homework Help
• PresidentHackerCaribou10582
• 7
• 100% (1) 1 out of 1 people found this document helpful

This preview shows pages 1–3. Sign up to view the full content.

Programming Assignment Two: PA2 Programming Assignment Two: PA2 Due Wednesday night, February 13 @ 11:59 p.m. For this assignment you will build a BCD (Binary Coded Decimal) clock simulator. BCD is a way to represent decimal digits (0-9) in 4 bits (0000-1001). You will use an array of 3 unsigned chars to store the tens and ones values of the clock's hours, minutes, and seconds. The tens digit will be stored in the upper 4 bits (nibble) of each byte. The ones digit will be stored in the lower 4 bits of each byte. The BCD clock display will be similar to the BCD clock I have in my office. An example display of a time value representing 15:03:27 (15 hours, 3 minutes, 27 seconds) will look like: .. .. .. <- 2 3 .O .. .O <- 2 2 .. .O OO <- 2 1 OO .O .O <- 2 0 15 03 27 A capital-O ( O ) will represent an LED ON (bit in that position = 1) while a dot ( . ) will represent an LED OFF (bit in that position = 0). The actual BCD values will be displayed below the bit patterns. For this example time, the array of 3 unsigned chars would have the following bit values: clock [0] [1] [2] 0 0 0 1 | 0 1 0 1 0 0 0 0 | 0 0 1 1 0 0 1 0 | 0 1 1 1 tens | ones tens | ones tens | ones hours minutes seconds 1 5 0 3 2 7 The purpose of this programming assignment is to gain more experience with SPARC assembly language constructs especially bit-wise operations, memory loads and stores (ld/st), allocating local variables on the runtime stack in the save instruction and accessing them relative to the frame pointer (%fp) by converting a function you wrote in C in PA1 into assembly with an additional parameter. You will use use a couple new Standard C Library routines and use two different techniques to communicate C Preprocessor-derived values to your assembly routines (accessing global variables set in a C function and calling C functions from assembly). Grading Breakdown http://ieng9.ucsd.edu/~cs30x/pa2.html (1 of 7) [2/8/2008 12:35:47 PM]

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document