Question: Can you Correct the code: PLEASE help Pep/8 can be downloaded here: http://computersystemsbook.com/software-downloads/ my while loop will not end: num: .EQUATE 0 main: LDA 0,i
Can you Correct the code: PLEASE help
Pep/8 can be downloaded here: http://computersystemsbook.com/software-downloads/
my while loop will not end:
num: .EQUATE 0
main: LDA 0,i
SUBSP 2,i
LDA 5,i
STA num,s
while1: LDA 0,i
LDA num,s
ADDA 1,i
STA num,s
STRO msg1,d
DECO num,s
CHARO ' ',i
BR while1
STRO msg2,d
msg1: .ASCII " -loop value- inside the loop is Less Than -condition value- "
msg2: .ASCII " Loop done, -loop value- equal or exceeds -condition value-"
.END
------------------------------------------------------
for this code only '$' will print:
BR main
ch: .EQUATE 2 ;
main: Subsp 1,i
CHARI ch,d
LDA 0,i
LDx ch,d
if: CPA 'A',i ; if((ch>='A')
BRLT else
LDx ch,d
CPA 'Z',i ;&&((ch<='Z')
BRGT elseif
then: STRO msg1,d ; cout<<'A'
BR endIf
elseif: LDx ch,d
CPA 'a',i ; if((ch>='a')
BRLT else
LDx ch,d
CPA 'z',i ;&&((ch<='z')
BRGT else
then2: STRO msg2,d ; cout<<'a'
BR endIf
else: STRO msg3,d ; cout<<'$'
endIf: STOP
CHARO ' ',i ; << endl
STOP
msg1: .ASCII "A\x00"
msg2: .ASCII "a\x00"
msg3: .ASCII "$\x00"
.END
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
