Debian Codegraph @

help/figures/fig0645.pep

raw
1 ;File: fig0645.pep
2 ;Computer Systems, Fourth edition
3 ;Figure 6.45
4 ;
5 BR main
6 first: .EQUATE 0 ;struct field #1c
7 last: .EQUATE 1 ;struct field #1c
8 age: .EQUATE 2 ;struct field #2d
9 gender: .EQUATE 4 ;struct field #1c
10 bill: .BLOCK 5 ;global variable #first #last #age #gender
11 ;
12 ;******* main ()
13 main: LDX first,i ;cin >> bill.first
14 CHARI bill,x
15 LDX last,i ; >>bill.last
16 CHARI bill,x
17 LDX age,i ; >>bill.age
18 DECI bill,x
19 LDX gender,i ; >>bill.gender
20 CHARI bill,x
21 STRO msg0,d ;cout << "Initials: "
22 LDX first,i ; << bill.first
23 CHARO bill,x
24 LDX last,i ; << bill.last
25 CHARO bill,x
26 CHARO '\n',i ; << endl
27 STRO msg1,d ;cout << "Age: "
28 LDX age,i ; << bill.age
29 DECO bill,x
30 CHARO '\n',i ; << endl;
31 STRO msg2,d ;cout << "Gender: "
32 LDX gender,i ;if (bill.gender == 'm')
33 LDA 0,i
34 LDBYTEA bill,x
35 CPA 'm',i
36 BRNE else
37 STRO msg3,d ; cout << "male\n"
38 BR endIf
39 else: STRO msg4,d ; cout << "female\n"
40 endIf: STOP
41 msg0: .ASCII "Initials: \x00"
42 msg1: .ASCII "Age: \x00"
43 msg2: .ASCII "Gender: \x00"
44 msg3: .ASCII "male\n\x00"
45 msg4: .ASCII "female\n\x00"
46 .END