|
|
1.1 root 1: file "arith.s"
2:
3: global runerr
4: global ckadd
5: global cksub
6: global ckmul
7:
8: text
9: even
10: ckadd:
11: link %a6,&0
12: mov.l 8(%a6),%d0 # Perform addition
13: add.l 12(%a6),%d0 # " " "
14: #jvs oflow # Branch if overflow
15: trapv # This trap untested!!
16: unlk %a6
17: rts # Return result in d0
18:
19: even
20: cksub:
21: link %a6,&0
22: mov.l 8(%a6),%d0 # Perform subtraction
23: sub.l 12(%a6),%d0 # " " "
24: #jvs oflow # Branch if overflow
25: trapv
26: unlk %a6
27: rts # Return result in d0
28:
29: even
30: ckmul:
31: link %a6,&0
32: mov.l 8(%a6),%d0 # Perform multiplication
33: muls.w 12(%a6),%d0 # " " "
34: trapv
35: #jvs oflow # Branch if overflow
36: unlk %a6
37: rts # Return result in d0
38:
39: oflow: # Got overflow on an operation
40: pea 0
41: pea 203
42: jsr runerr # runerr(203,0)
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.