Answered step by step
Verified Expert Solution
Question
1 Approved Answer
The code language required is HC12 Assembly Language Programming. The image of the code is just a template that shows how the code should be
The code language required is HC12 Assembly Language Programming. The image of the code is just a template that shows how the code should be formatted.
Lab 3.1.1: Straight Line Create a new project for this lab. Write and test an assembly language program that solves the following straight line equation for y: y = mx + b Generate an integer result as close as possible that solves the following straight-line equation for y. Generate an integer result as close as possible to the actual answer. Assume variable x is always an unsigned 8-bit number. The slope (m) is equal to 0.68 and the offset (b) is equal to 12. Leave the result in accumulator A. Assume value x is in the memory location labeled val. Use assembler directives to define these values. Note that the result will always fit in 8 bits Test and confirm the program is working properly by testing the following values in Val. Modify Val using the data window in the debugger. Val = 0 Result: Val = 10 Result: Val = 75 Result: Val = 200 Result: Val = 255 Result: Extra Credit: The number after the decimal point will always be truncated off of the result. The result will not be rounded up. For extra credit on the lab checkout, display the number to the left of the decimal point in register A and the result to the right of the decimal point in register B. XDEF Entry XREF _SEG_END_SSTACK Variables: Section ds.b 1 Constants: consb: cansm: Section dc.b 1, 2, 3 dc.b $11/$19 Code: Section Entry: LDS LDAA #_SEG_END_SSTACK - ; You should comment your code Make sure the formatting is correct STAA vari Lab 3.1.1: Straight Line Create a new project for this lab. Write and test an assembly language program that solves the following straight line equation for y: y = mx + b Generate an integer result as close as possible that solves the following straight-line equation for y. Generate an integer result as close as possible to the actual answer. Assume variable x is always an unsigned 8-bit number. The slope (m) is equal to 0.68 and the offset (b) is equal to 12. Leave the result in accumulator A. Assume value x is in the memory location labeled val. Use assembler directives to define these values. Note that the result will always fit in 8 bits Test and confirm the program is working properly by testing the following values in Val. Modify Val using the data window in the debugger. Val = 0 Result: Val = 10 Result: Val = 75 Result: Val = 200 Result: Val = 255 Result: Extra Credit: The number after the decimal point will always be truncated off of the result. The result will not be rounded up. For extra credit on the lab checkout, display the number to the left of the decimal point in register A and the result to the right of the decimal point in register B. XDEF Entry XREF _SEG_END_SSTACK Variables: Section ds.b 1 Constants: consb: cansm: Section dc.b 1, 2, 3 dc.b $11/$19 Code: Section Entry: LDS LDAA #_SEG_END_SSTACK - ; You should comment your code Make sure the formatting is correct STAA variStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started