Hi every 1
I'm from UK doing an HNC Computing course (via distance learning...ie limited tutorial support)
I've been given a copy of the TASM user manual, and need to complete the following task:
I am a novice and done no programming at all so after reding this, given that i've only been given this manual, i hope somebody can help.
This is my penultimate exercise.
Assessment Details
1. Design a program to meet the attached specification. This design must conform to the appropriate Organisational Requirements, and so should be block-structured and developed using a process of stepwise refinement. All levels of the refinement and any rough work should be submitted.
2. Implement the design by writing, testing and debugging an assembly language program for the 6502 processor. This program must :
4(b)q
· Accurately reflect the design produced above and meet the specification;
4(c)q
· Conform to Organisational Requirements for layout, content and style;
4(d)q
· Correctly and efficiently use syntax, addressing modes and constructs;
4(e)q
· Work! It must be tested and debugged effectively using the appropriate software, with Test Log sheets completed to show at least the following :
The execution of the get_7segcode function for one legal input value and one out-of-range input value.
Specification
This program will form part of the display driver for a portable metal detector. A sensor indicates the strength of the magnetic field used to detect metallic objects by an analogue voltage level which is fed into an ADC. This converts the input signal into a 7-bit value in the range 0..7910. Any reading higher than 7910 indicates that the sensor needs to be recalibrated by the user. The ADC signals that it has completed conversion and has a valid value ready for reading by setting Bit 7 of its capture register to 1. Whenever software reads the register, this bit is automatically reset to 0. While this bit remains 0, the ADC result is not yet valid.
Your task is to construct a program which monitors the ADC, detects when a conversion is complete, reads the value and scales it down by a factor of 8 for output as a single digit between 0 and 9 on a seven-segment LED mounted on the handset. (i.e. Divide the reading by 8 and ignore any remainder.) Any out-of-range input from the sensor should result in the character “C” being displayed to indicate to the user that manual calibration is required.
The ADC capture register is at address $C000.
The 8-segment LED output latch is at address $C010, and is wired as shown in the following table :
Bit 7 6 5 4 3 2 1 0
Segment N/C g f e d c b a
The LED segments are labelled in the conventional manner, i.e.
Implementation Requirements
The program should be located at address $2000, with any data required placed after the program code. You may not use any address within Page 0, but you may freely initialise and use the stack as required. The program must not terminate at any point, but must loop continually to read and display sensor readings.
You must implement and use a macro called m_div8 to scale the reading down by a factor of 8.
You must implement and use a function subroutine called get_7segcode, which has the following interface :
ENTRY: A = Reading from ADC, previously divided by eight.
EXIT : A = 7-segment bit pattern for display, or pattern to display the character “C” if the input value was greater than 9.
You must use indexed addressing mode appropriately at least once in your program.
END OF SPECIFICATION
if ne 1 can help please respond
many thanx in advance
Neil