📄 chap.3.assemblylang.ps
字号:
3451(each)X3658(having)X3950(a)X4023(special)X920 2819(meaning.)N1309(A)X1411(simple)X1701(example)X2061(of)X2174(one)X2346(of)X2459(these)X2690(is)X2787(the)X2938(`Z`)X3093(bit)X3227(which)X3494(is)X3590(used)X3798(to)X3905(determine)X920 2931(whether)N1254(the)X1396(result)X1634(of)X1738(a)X1805(subtraction)X2257(operation)X2645(was)X2818(zero)X3008(or)X3112(not.)X576 3071(In)N682(addition)X1024(to)X1125(the)X1269(above-mentioned)X1964(components)X2455(of)X2561(the)X2705(CPU,)X2941(the)X3085(memory)X3432(also)X3613(consists)X3943(of)X4050(a)X4120(very)X576 3183(large)N797(number)X1119(of)X1227(components.)X2 f1744(Luckily)X1 f2028(,)X2080(the)X2226(components)X2718(are)X2863(all)X2987(identical)X3347(in)X3449(purpose)X3780(and)X3946(function.)X576 3295(We)N734(say)X886(that)X1055(the)X1197(memory)X1542(consists)X1870(of)X1974(a)X2041(set)X2173(of)X3 f2278(locations)X1 f2641(.)X2690(Each)X2908(such)X3109(location)X3445(has)X3598(a)X3666(unique)X3 f3953(address)X1 f4267(.)X576 3407(The)N766(addresses)X1174(are)X1332(simply)X1634(numbers,)X2028(and)X2206(each)X2422(address)X2749(refers)X3007(to)X3121(an)X3251(8-bit,)X3496(or)X3615(one)X3793(byte,)X4022(unit)X4211(of)X576 3519(storage.)N911(If)X1009(we)X1155(have)X1371(a)X1448(1)X1530(kilobyte)X1880(\(1)X1994(KB\))X2193(memory,)X2572(then)X2772(there)X2999(are)X3151(exactly)X3464(2)X9 s3481(10)Y12 s2 f9 f3616 3519(=)N1 f3693(1024)X3919(locations.)X576 3631(Their)N813(addresses)X1209(range)X1450(from)X1664(0)X1739(through)X2065(1023.)X2332(Be)X2466(sure)X2653(not)X2803(to)X2905(confuse)X3231(registers)X3584(and)X3750(memory)X4098(loca-)X576 3743(tions.)N813(Registers)X1197(are)X1341(a)X1410(very)X1607(small)X1842(amount)X2157(of)X2263(temporary)X2685(storage)X2989(within)X3261(the)X3406(CPU,)X3643(and)X3809(memory)X4157(is)X4248(a)X576 3855(vast)N755(array)X977(of)X1081(storage)X1383(external)X1718(to)X1817(the)X1959(CPU.)X3 f576 4079(3.3.)N768(NEWS)X1074(FLASH!)X1450(Computers)X1932(Don't)X2190(Eat)X2358(Quiche.)X1 f776 4219(I)N838(hate)X1029(to)X1134(break)X1378(it)X1462(to)X1567(you,)X1765(but)X1918(you)X2092(have)X2304(been)X2516(hoaxed)X2824(in)X2930(previous)X3292(courses.)X3635(Computers)X4088(don't)X576 4331(really)N820(execute)X1139(things)X1398(like:)X7 f1728 4491(...)N1728 4603(y)N1844(=)X1960(x)X2076(+)X2192(z;)X1728 4715(...)N1 f576 4875(You)N771(may)X967(well)X1163(recognize)X1568(this)X1737(as)X1847(a)X1920(C)X2015(statement)X2416(that)X2592(sums)X2820(the)X2969(values)X3246(of)X3357(variables)X7 f3770(x)X1 f3859(and)X7 f4063(z)X1 f4152(and)X576 4987(stores)N826(the)X970(result)X1210(in)X1311(the)X1455(variable)X7 f1826(y)X1 f1884(.)X1958(First)X2160(of)X2265(all,)X2411(all)X2533(variables)X2906(are)X3049(stored)X3309(in)X3409(memory)X3755(locations,)X4152(and)X576 5099(as)N693(we)X842(have)X1061(just)X1237(seen,)X1469(memory)X1828(locations)X2214(are)X2370(numbered.)X2817(They)X3053(do)X3187(not)X3348(have)X3568(arbitrary)X3938(symbolic)X576 5211(names)N849(like)X7 f1055(x)X1 f1113(,)X7 f1198(y)X1 f1256(,)X1331(or)X7 f1472(z)X1 f1530(.)X1581(To)X1714(begin)X1954(to)X2055(understand)X2503(the)X2647(way)X2833(a)X2902(computer)X3292(actually)X3624(performs)X3997(compu-)X576 5323(tation,)N844(let)X965(us)X1074(see)X1221(how)X1410(a)X2 f1477(real)X1656(macho)X1936(computer)X1 f2323(would)X2587(execute)X2906(a)X2973(few)X3141(example)X3492(C)X3580(statements.)X21 p%%Page: 21 412 s 0 xH 0 xS 1 f3 f576 400(57:017)N872(CIE)X1 f2329(-)X2385(21)X2505(-)X3 f3717(Lecture)X4062(Notes)X576 803(3.3.1.)N840(Sequential)X1296(Flow;)X1555(A)X1648(Single)X1923(Assignment)X2426(Statement)X1 f776 943(Let)N935(us)X1050(consider)X1407(the)X1556(single)X1817(C)X1912(statement)X2313(shown)X2594(in)X2700(Figure)X2982(3.2.)X3181(This)X3383(statement)X3784(is)X3879(commonly)X576 1055(referred)N906(to)X1006(as)X1111(an)X2 f1227(assignment)X1 f1683(statement)X2077(because)X2406(it)X2 f2484(assigns)X1 f2790(the)X2932(value)X3165(computed)X3569(on)X3689(the)X3831(right)X4037(side)X4216(to)X576 1167(the)N718(variable)X1053(shown)X1327(on)X1447(the)X1589(left)X1742(side)X1921(of)X2025(the)X2167(`)X7 f2199(=)X1 f2257(`.)X7 f2304 1327(y)N2420(=)X2536(x)X2652(+)X2768(z;)X3 f1354 1535(Figure)N1651(3.2.)X1819(A)X1912(C)X2005(Addition)X2391(and)X2569(Assignment)X3072(Statement.)X1 f576 1723(Since)N821(all)X949(data)X1141(must)X1359(be)X1481(stored)X1747(in)X1853(memory,)X2229(we)X2372(must)X2590(\256rst)X2770(decide)X3053(where)X3319(to)X3426(store)X3645(the)X3795(variables)X7 f4209(x)X1 f4267(,)X7 f576 1835(y)N1 f634(,)X682(and)X7 f879(z)X1 f937(.)X985(Let)X1138(us)X1247(assume)X1554(the)X1696(following)X2094(correspondence)X2722(of)X2826(variables)X3198(to)X3297(memory)X3642(locations.)X7 f1728 1995(x)N1844(:)X1960(memory)X2366(location)X2888(1000)X1728 2107(y)N1844(:)X1960(memory)X2366(location)X2888(1001)X1728 2219(z)N1844(:)X1960(memory)X2366(location)X2888(1002)X1 f576 2379(Now,)N827(since)X1066(all)X1204(data)X1406(must)X1634(be)X1766(present)X2085(in)X2201(the)X2360(CPU)X2587(before)X2874(being)X3129(operated)X3502(upon,)X3759(we)X3913(must)X4142(\256rst)X576 2491(``move'')N959(or)X1080(``copy'')X1436(the)X1595(data)X1797(from)X2025(memory)X2387(to)X2503(registers.)X2918(This)X3129(is)X3233(done)X3460(with)X3671(the)X3829(following)X4243(2)X576 2603(instructions,)N7 f1728 2763(MOVE)N2304(1000,D0)X1728 2875(MOVE)N2304(1002,D1)X1 f576 3035(which)N7 f884(MOVE)X1 f1155(the)X1312(data)X1512(from)X1738(their)X1954(respective)X2384(memory)X2744(locations)X3132(to)X3247(data)X3448(registers)X3814(D0)X3971(and)X4150(D1.)X576 3147(Note,)N826(the)X983(word)X1219(``move'')X1600(does)X3 f1815(not)X1 f1987(imply)X2251(that)X2435(the)X2592(source)X2882(of)X3001(the)X3158(move)X3411(is)X3514(altered)X3816(in)X3930(any)X4107(way.)X576 3259(``Copy'')N940(is)X1032(probably)X1402(a)X1474(better)X1723(word)X1949(to)X2053(use,)X2234(but)X2386(as)X2495(you)X2668(will)X2847(soon)X3057(see,)X3233(the)X3380(term)X3586(``move'')X3957(will)X4136(pre-)X576 3371(vail.)N7 f866(MOVE)X1 f1127(is)X1220(referred)X1554(to)X1658(as)X1767(an)X3 f1887(instruction)X1 f(.)S2412(For)X2574(now,)X2792(assume)X3104(that)X3278(all)X3404(instructions)X3882(operate)X4195(on)X576 3483(byte-sized)N1013(units)X1241(of)X1362(data.)X1588(Later)X1833(we)X1987(will)X2179(see)X2344(that)X2531(there)X2766(is)X2872(actually)X3220(a)X3305(choice)X3599(of)X3721(sizes)X3950(for)X4104(most)X576 3595(instructions.)N1103(The)X1283(objects)X1586(on)X1712(the)X1860(right)X2072(side)X2257(are)X2405(called)X3 f2666(operands)X1 f3044(.)X3122(We)X3286(call)X3456(the)X3604(left-hand)X3981(operand)X576 3707(the)N3 f727(source)X1 f1027(operand,)X1394(and)X1566(the)X1717(right-hand)X2152(operand)X2496(is)X2594(called)X2859(the)X3 f3011(destination)X1 f3464(.)X3522(We)X3690(also)X3879(sometimes)X576 3819(refer)N798(to)X913(the)X1071(operand)X1421(on)X1557(the)X1715(left)X1884(as)X2004(the)X2 f2161(\256rst)X1 f2349(operand,)X2722(and)X2900(the)X3057(one)X3235(on)X3370(the)X3527(right)X3748(as)X3867(the)X2 f4024(second)X1 f576 3931(operand.)N965(The)X1146(\256rst)X1326(of)X1437(these)X1666(two)X1842(instructions)X2323(moves)X2606(the)X2756(contents)X3109(of)X3221(memory)X3574(location)X3917(1000)X4141(into)X576 4043(CPU)N793(data)X985(register)X1304(D0.)X1475(The)X1655(second)X1952(one)X2121(moves)X2402(the)X2550(contents)X2901(of)X3011(memory)X3362(location)X3703(1002)X3925(into)X4105(CPU)X576 4155(data)N767(register)X1086(D1.)X1281(Now)X1497(that)X1672(the)X1820(data)X2011(are)X2159(present)X2467(in)X2572(the)X2720(CPU,)X2960(we)X3102(can)X3266(operate)X3580(on)X3706(these)X2 f3934(copies)X1 f4211(of)X7 f576 4267(x)N1 f658(and)X7 f855(z)X1 f913(.)X961(The)X1135(following)X1533(instruction)X1969(will)X2143(perform)X2477(the)X2619(required)X2964(addition.)X7 f1728 4427(ADD)N2304(D0,D1)X1 f576 4587(This)N772(instruction)X1209(sums)X1431(the)X1574(contents)X1920(of)X2025(registers)X2376(D0)X2518(and)X2682(D1,)X2848(and)X3012(leaves)X3278(the)X3422(resulting)X3785(sum)X3971(in)X4072(regis-)X576 4699(ter)N709(D1.)X904(In)X1014(this)X1183(case,)X1403(both)X1604(the)X1752(\256rst)X1931(operand)X2271(and)X2440(the)X2588(second)X2885(operand)X3225(are)X3373(called)X2 f3634(source)X1 f3920(operands,)X576 4811(but)N724(the)X867(second)X1159(operand)X1494(is)X1584(also)X1765(called)X2022(the)X2 f2166(destination)X1 f2594(.)X2668(Now,)X2904(although)X3267(the)X3411(desired)X3715(result)X3955(has)X4109(been)X576 4923(computed,)N1006(we)X1144(are)X1287(not)X1435(\256nished)X1764(with)X1960(the)X2103(C)X2192(statement)X2587(until)X2789(the)X2932(result)X3171(is)X3260(stored)X3520(back)X3727(to)X3827(the)X3970(memory)X576 5035(location)N911(reserved)X1261(for)X7 f1431(y)X1 f1489(.)X1537(This)X1732(is)X1820(accomplished)X2374(with)X2569(the)X2711(following)X3109(instruction.)X7 f1728 5195(MOVE)N2304(D1,1001)X1 f576 5355(As)N710(should)X994(be)X1113(obvious)X1445(at)X1543(this)X1710(point,)X1960(this)X2127(instruction)X2567(moves)X2846(the)X2992(value)X3229(stored)X3493(in)X3597(CPU)X3812(data)X4002(register)X576 5467(D1)N718(out)X866(to)X966(memory)X1312(location)X1648(1001.)X1889(Recall)X2161(that)X2330(we)X2466(assumed)X7 f2855(y)X1 f2937(was)X3110(allocated)X3483(the)X3625(byte)X3815(of)X3919(storage)X4221(at)X576 5579(address)N911(1001.)X1198(The)X1395(program)X1768(segment)X2136(illustrating)X2601(the)X2766(entire)X3033(statement)X3451(shown)X3749(in)X3872(Figure)X4171(3.2)X576 5691(appears)N894(in)X993(Figure)X1268(3.3.)X22 p%%Page: 22 512 s 0 xH 0 xS 1 f3 f576 400(57:017)N872(CIE)X1 f2329(-)X2385(22)X2505(-)X3 f3717(Lecture)X4062(Notes)X7 f1728 851(MOVE)N2304(1000,D0)X1728 963(MOVE)N2304(1002,D1)X1728 1075(ADD)N2304(D0,D1)X1728 1187(MOVE)N2304(D1,1001)X3 f1311 1347(Figure)N1608(3.3.)X1776(M68000)X2131(Code)X2368(Corresponding)X3010(to)X3114(Figure)X3411(3.2.)X1 f776 1459(In)N882(addition)X1224(to)X1325(being)X1565(an)X1682(example)X2035(of)X2141(how)X2332(a)X2401(single)X2657(C)X2747(assignment)X3206(statement)X3602(would)X3868(actually)X4200(be)X576 1571(executed)N958(on)X1093(a)X1175(computer,)X1602(this)X1779(example)X2144(also)X2337(illustrates)X2750(what)X2975(is)X3077(known)X3376(as)X3494(the)X3650(``Von)X3917(Neumann)X576 1683(Bottleneck''.)N1112(This)X1313(bottleneck)X1745(refers)X1994(to)X2099(the)X2247(fact)X2422(that)X2597(data)X2788(has)X2946(to)X3051(constantly)X3477(be)X3599(shuf\257ed)X3939(back)X4152(and)X576 1795(forth)N791(along)X1033(the)X1179(Bus)X1356(shown)X1634(in)X1737(Figure)X2016(3.1.)X2188(This)X2387(bottleneck)X2817(is)X2908(the)X3053(source)X3331(of)X3438(the)X3583(primary)X3915(limitation)X576 1907(to)N678(performance)X1192(achievable)X1632(on)X1755(99%)X1958(of)X2065(computers)X2493(today.)X2758(Advanced)X3175(research)X3524(in)X3627(Computer)X4040(Archi-)X576 2019(tecture)N867(has)X1023(been)X1233(hard)X1432(at)X1530(work)X1754(trying)X2011(to)X
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -