Question: Write the following assignments in pep / 8 assembly language source code do not write in python: 1 . Main inputs an integer and gives

Write the following assignments in pep/8 assembly language source code do not write in python:
1. Main inputs an integer and gives it (as parameter) to a method, which multiplies this integer( the parameter) by 4 and returns this value to main. Main outputs a message giving the initial integer and the result.
For example, if the input was 5 main will output
5 multiplied by 4 is 20
2. Practice with characters. Main inputs a character and passes it to the method. If this character is lowercase, the method will make it uppercase and return this value to main. If the parameter is anything else the method will return '?' to main. Main will output the initial input and the result.
pep/8 example code to use as reference:
;Input a number
;Output whether it is greater than or equal to 5
;or less than 5
; Here is the program (below) in pep8: isGE5withParameter.pep
BR main
msg1: .ASCII " is greater than or equal to 5\x00"
msg2: .ASCII " is less than 5\x00"
;
n: .equate 2 ;formal parameter #2d
isGE5: LDA n,s ;load n into A ; replaced if
CPA 5, i ; compare A with 5
BRLT else ; if (result <0)
STRO msg1, d ; output message
BR endGE5
else: STRO msg2,d ;output message saying less than
endGE5: RET0 ;end of function
;
num: .EQUATE 0 ;local variable #2d
main: SUBSP 2,i ;allocate #num
DECI num,s ;
DECO num, s ;output num
LDA num, s
STA -2, s
subsp 2,i ; push #n
call isGE5
addsp 2,i ;pop #n
ADDSP 2,i ;deallocate #num
STOP
.END
Rubric for num1 and num2:
Num1. Main puts input on stack
Num1. Main puts parameter on stack
Method correctly picks up parameter and multiplies by 4
Num1. Method returns value to place on stack UNDER parameter
Main outputs (output is correct)
Num2. Main picks up character and places on stack
Num2. Main puts parameter on stack and leaves room for return value
Method picks up character and returns result to correct place on stack
Main outputs. Output is correct
All equates and tags are correct in num1
This criterion is linked to a Learning OutcomeAll equates and tags are correct in num2

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!