A. Introduction:
- In this lab 4 for Assembly 6502 architecture, we will be making a program to receive 2 digits, add the received numbers and print the result
- To view the code, please visit this pastebin link
- Unfortunately, I’m unable to figure out how to perform calculations on numbers with 2 or more digits. The above code can only receive integers with 1 digit and perform calculation accordingly.
B. Code explanation:
I. ROM routines and predefined variables:
- ROM routines are builtin utilities that can assist you in string operations, more information can be found in Seneca CDOT wiki
- Subsequently, there are predefined variables will be used throughout the program to store the numbers from users, result digit, locations and so on
II. Get digits:
- The programs begins with a message asking for a digit, this will be the digit for the calculation
- Once a digit is received, there are several labels to filter out the wrong inputs. If the inputs are correct then it will be shown on the text screen
- However, the digit received is not in a proper format and we must perform extra operations to ensure the correct format. To guarantee the format, we will remove the high byte
- Finally, the digits will be stored in corresponding location as predefined in the above section
III. Calculation:
- Initially, we will need to change to decimal mode using
SEDinstruction, the result will then be stored in their assigned location in the memory - Once we have the result, we need to separate the left and right digit to prepare for printing operation