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 assembly language source code do not write in python:
Main inputs an integer and gives it as parameter to a method, which multiplies this integer the parameter by and returns this value to main. Main outputs a message giving the initial integer and the result.
For example, if the input was main will output
multiplied by is
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 example code to use as reference:
;Input a number
;Output whether it is greater than or equal to
;or less than
; Here is the program below in pep: isGEwithParameter.pep
BR main
msg: ASCII is greater than or equal to x
msg: ASCII is less than x
;
n: equate ;formal parameter #d
isGE: LDA ns ;load n into A ; replaced if
CPA i ; compare A with
BRLT else ; if result
STRO msg d ; output message
BR endGE
else: STRO msgd ;output message saying less than
endGE: RET ;end of function
;
num: EQUATE ;local variable #d
main: SUBSP i ;allocate #num
DECI num,s ;
DECO num, s ;output num
LDA num, s
STA s
subsp i ; push #n
call isGE
addsp i ;pop #n
ADDSP i ;deallocate #num
STOP
END
Rubric for num and num:
Num Main puts input on stack
Num Main puts parameter on stack
Method correctly picks up parameter and multiplies by
Num Method returns value to place on stack UNDER parameter
Main outputs output is correct
Num Main picks up character and places on stack
Num 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 num
This criterion is linked to a Learning OutcomeAll equates and tags are correct in num
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
