| 1 |
;File: fig0526.pep |
| 2 |
;Computer Systems, Fourth edition |
| 3 |
;Figure 5.26 |
| 4 |
; |
| 5 |
BR main |
| 6 |
bonus: .EQUATE 5 ;constant |
| 7 |
exam1: .BLOCK 2 ;global variable #2d |
| 8 |
exam2: .BLOCK 2 ;global variable #2d |
| 9 |
score: .BLOCK 2 ;global variable #2d |
| 10 |
; |
| 11 |
main: DECI exam1,d ;cin >> exam1 |
| 12 |
DECI exam2,d ; >> exam2 |
| 13 |
LDA exam1,d ;score = (exam1 |
| 14 |
ADDA exam2,d ; + exam2) |
| 15 |
ASRA ; / 2 |
| 16 |
ADDA bonus,i ; + bonus |
| 17 |
STA score,d |
| 18 |
STRO msg,d ;cout << "score = " |
| 19 |
DECO score,d ; << score |
| 20 |
CHARO '\n',i ; << endl |
| 21 |
STOP |
| 22 |
msg: .ASCII "score = \x00" |
| 23 |
.END |