help/figures/fig0608.pep
raw| 1 | ;File: fig0608.pep |
| 2 | ;Computer Systems, Fourth edition |
| 3 | ;Figure 6.8 |
| 4 | ; |
| 5 | BR main |
| 6 | limit: .EQUATE 100 ;constant |
| 7 | num: .EQUATE 0 ;local variable #2d |
| 8 | ; |
| 9 | main: SUBSP 2,i ;allocate #num |
| 10 | DECI num,s ;cin >> num |
| 11 | if: LDA num,s ;if (num >= limit) |
| 12 | CPA limit,i |
| 13 | BRLT else |
| 14 | STRO msg1,d ; cout << "high" |
| 15 | BR endIf |
| 16 | else: STRO msg2,d ; cout << "low" |
| 17 | endIf: ADDSP 2,i ;deallocate #num |
| 18 | STOP |
| 19 | msg1: .ASCII "high\x00" |
| 20 | msg2: .ASCII "low\x00" |
| 21 | .END |