This UNIX tutorial may be of some assistance.
You are now familiar with basic UNIX tools. You will use your knowledge of UNIX commands to proceed.
This untars the files into your working directory, in a subdirectory called pi3Playground/. For more information on tar, please see the UNIX man pages (e.g. man tar)
The playground template file has been updated to include getInt, a new function necessary to solve this assignment.
You can read about getInt in the comments where it is defined. Essentially, getInt is similar to getnum. But getInt is capable
of getting signed integers (still storing integers in r0), and storing a boolean (in r1) to represent whether input is equal to EOF (end of file / ctrl+D).
Another new function, called toBinary has been included for you. You will use this function in Q1 (ASCII) to convert an integer into binary.
Write an assembler program that takes two values -- low and high -- representing a range of ASCII values (input prompt should match the example).
Print the values in this range, inclusively, with the following format (decimal, hex, binary, character - if any), separated by tab characters for clean output. If EOF (Ctrl+D) is entered (instead of a low/high value), then your program should end. If the low value is less than zero, then it should be corrected and set to zero. Similarly, if the high value is greater than 255 (the ASCII range), then it should be corrected and set to 255.
Important note about formatting: As you can see in the examples below, eight binary digits should be printed. Three decimal digits (the first ASCII value) should be printed. And two hex digits should be printed.
Example 1:
low? 30
high? 36
30 0x1E 0b00011110
31 0x1F 0b00011111
32 0x20 0b00100000
33 0x21 0b00100001 !
34 0x22 0b00100010 "
35 0x23 0b00100011 #
36 0x24 0b00100100 $
All user process have completed.
Example 2:
low? 98
high? 102
98 0x62 0b01100010 b
99 0x63 0b01100011 c
100 0x64 0b01100100 d
101 0x65 0b01100101 e
102 0x66 0b01100110 f
All user process have completed.
Example 3:
low? -3
high? 7
0 0x00 0b00000000
1 0x01 0b00000001
2 0x02 0b00000010
3 0x03 0b00000011
4 0x04 0b00000100
5 0x05 0b00000101
6 0x06 0b00000110
7 0x07 0b00000111
All user process have completed.
Write an assembler program that reads an integer (representing pennies) until EOF, and returns the equivalent in dollar coins, quarters, dimes, nickels, and pennies. The minimal amount of coins must be used. You must adhere to the input and output style that the example shows. In addition, output must have appropriate grammar. For example, "dollars" is used if the integer is zero or greater than one. Otherwise, if there is 1 dollar, then "dollar" is used in the output. If the user enters a negative integer, the result is printed in negative pennies. You may assume that overflow and underflow do not occur.
Example:
? 93
Change:
0 dollars,
3 quarters,
1 dime,
1 nickel,
3 pennies.
? 144
Change:
1 dollar,
1 quarter,
1 dime,
1 nickel,
4 pennies.
? 15
Change:
0 dollars,
0 quarters,
1 dime,
1 nickel,
0 pennies.
? -15
Change:
0 dollars,
0 quarters,
0 dimes,
0 nickels,
-15 pennies.
?
All user process have completed.
Note: The last input in this example is EOF (Control+D)
Write an assembler program that reads two integers until EOF, and prints the Least Common Multiple of the two integers. Your input and output must match the example. Your program should ignore negative integers if they are inputted.. You may assume that overflow and underflow do not occur.
Example:
LCM Calculator
? -22
? 15
? 12
LCM of 15 and 12 is 60
? 4
? 6
LCM of 4 and 6 is 12
? 23
? 30
LCM of 23 and 30 is 690
? 0
? 5
LCM of 0 and 5 is 0
?
All user process have completed.
Note: The last input in this example is EOF (Control+D)