Please no explanations pep code only write, assemble and run an assembly languag
ID: 3547584 • Letter: P
Question
Please no explanations pep code only
write, assemble and run an assembly language program that will simulate following c++ code to pep8:
{
const int m=4;
const int n=3;
int i,j;
for(i=0;i<m;i++)
for(j=0;j<n;j++)
cout<<i<<j<<endl;
return;
}
fill in the rest of the code using the code below using pep8:
br main
m: .equate 4
n: .equate 3
i: .block 2
j: .block 2
main: lda 0x0000,i
sta i,d ;initialize 'i'
ag1: sta j,d ;initialize 'j'
;INSERT CODE HERE TO IMPLEMENT C++ NESTED LOOP
ag2:
;INNER LOOP:UPDATE AND CHECK 'J'
ldx j,d
addx 0x0001,i;increment 'j'
stx j,d
cpx n,i
brlt ag2
;OUTER LOOP:UPDATE AND CHECK 'I'
ldx i,d
addx 0x0001,i ;increment i
stx i,d
cpx m,i
brlt ag1
stop
.end
Explanation / Answer
nestfor
br main
x: .word 0x0000
y: .word 0x0000
main: sta x, d
stx y, d
outer: adda 1, i
cpa 5, i
breq endo
sta x, d
ldx x, d
inner: charo '*', i
charo ' ', i
subx 1, i
cpx 0, i
brne inner
charo ' ', i
br outer
endo: stop
.end
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.