Question: I've been using the Pep 8 Assembler vers. 8 . 1 . 3 and I've been having trouble trying to convert this java code to

I've been using the Pep 8Assembler vers. 8.1.3and I've been having trouble trying to convert this java code to assembly code. This is the java code
Translate into Pep8assembly language with equates and methods to call. no python or java responses please
import java.util.Scanner;
public class CW10{
public static void main(String[]args){
Scanner scnr =new Scanner(System.in);
int x =scnr.nextInt();
printStars(x);
int y =scnr.nextInt();
printRange(x,y);
int z =scnr.nextInt();
inRange(x,y,z);
}
public static void printStars(int a)
{
for (int k=0; k=e && g <=f)
System.out.println("in range");
else
System.out.println("outside range")
}
}
This is the assembly code. So far, I am capable of printing out the stars to correspond with the input from the prntstar method, but I have been having trouble trying to get the correct outputs from the prntrnge method and inrange method and putting them into the main method
Br main
n1: .equate 2 ;#2c
n2: .equate 0 ;#2d
n3: .equate 0 ;#2d
msg1: .ASCII "\x00 :outside range "
msg2: .ASCII "\x00 inside range "
prntstar: lda 0, i
loop: CPA n1, s
BRGE endstar
Charo '*', i
adda 1, i
BR loop
endstar: charo '
', i
ret0
prntrnge:lda 0, i
CPA n1, s
BRGE endRge
deco n2, i
CPA n1, s
adda 1, i
endRge: charo '
', i
ret0
inrange: lda 0, s
sta n1, s
CPA n3, s
BRGE endrnge
lda n2, s
sta n2, s
CPA n3, s
endrnge: ret0
num1: .equate 0 ;#2d
num2: .equate 0 ;#2d
main: subsp 4, i;allocate #num1#num2
deci num1, s
LDA num1, s
sta -2, s
subsp 2, i ; push #num1
call prntstar
addsp 2, i ; pop #num1
lda 2, s
sta -2, s
lda 0, s
sta -4, s
subsp 2, i ;push #num1
stro msg1, d
call prntrnge
addsp 2, i ;pop #num1
lda 2, s
sta -2, s
lda 0, s
sta -4, s
subsp 2, i ;push #num1
stro msg1, d
call inrange
addsp 4, i; deallocate #num2#num1
stop
.end

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!