; next.pep // Add one to input number. ;(See fig0515.pep) BR main ;Branch around data ; num: .BLOCK 2 ;Storage for two integers next: .BLOCK 2 prompt: .ASCII "Enter a number (or 0 to stop): \x00" .BYTE 0 msg: .ASCII " + 1 = " .BYTE 0 ; main: STRO prompt,d DECI num,d ;Get the number DECO num,d ;and output it STRO msg,d ;Output ' + 1 = ' LDA num,d ;A <-- the number ADDA 1,i ;Add one to it STA next,d ;Store the sum DECO next,d ;Output the sum CHARO 10,i ;Newline LDA 0,i ;Loop if nonzero CPA num,d BRNE main STOP .END