Question: this is the question.... - Translate the following C program to Pep / 9 assembly language. ( 3 0 % ) #include const int limit

this is the question....- Translate the following C program to Pep/9 assembly language. (30%)
#include
const int limit =5;
int main(){
int number;
scanf("%d", &number);
while (number < limit){
number++;
printf("%d ", number);
}
return 0;
}.........."BR main
limit: .EQUATE 5 ;constant
num: .EQUATE 0 ;local variable #2d
;
main: SUBSP 2,i ;push #num
DECI num,s ;scanf("%d", &num)
while: LDWA limit,s ;while ()
CPBA (number < limit),i ;
BREQ endWh
msg1: .ASCII "high
\x00"
msg2: .ASCII "low
\x00"
.END"...........still didnt work"; BR main ;ERROR: Missing .END sentinel.
; limit: EQUATE 5 ; constant
; num: EQUATE 0 ; local variable #2d
BR main
limit: .EQUATE 5
num: .EQUATE 0
SUBSP 2, i ; push #num ;WARNING: num not specified in .EQUATE
DECI num, s ; scanf("%d", &num)
while: LDWA limit, s ; load limit into accumulator A
CPBA num, i ; compare num with accumulator B (limit)
BREQ endWhile ; if equal, branch to endWhile
ADDA 1, i ; increment num
STWA num, s ; store incremented num
LDWA num, s ; load num into accumulator A
LDWA msg2, i ; load address of space into accumulator A
BR while ; branch to while
endWhile: DECO num,d ; printf("%d ", num)
msg1: .ASCII "high \x00"
msg2: .ASCII "low \x00""what ive rn

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!