⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 as.9

📁 Unix操作系统minix 2.0源码
💻 9
📖 第 1 页 / 共 3 页
字号:
936(be)S1091(used.)S1413(Anything)S1910(can)S2119(in)S2254(principle)S2725(be)S2879(assembled)S3423(into)S3651(any)S3865(segment,)S4338(but)S4532(the)S10 R4715(MINIX)S3522 V12 R936(bss)S1121(segment)S1555(may)S1794(only)S2039(contain)S(uninitialized)606 2427 A3065(data.)S3359(Note)S3627(that)S3841(the)S4021(`)S4052(`.')S4154(')S4227(symbol)S4614(refers)S4924(to)S3660 V936(the)S1114(location)S1534(in)S1658(the)S1836(current)S2210(segment.)S3936 V12 B936(Labels)S4248 V12 R1116(There)S1445(are)S1640(two)S1868(types:)S2203(name)S2511(and)S2731(numeric.)S3234(Name)S3571(labels)S3901(consist)S4284(of)S4432(a)S4533(name)S4842(fol-)S4386 V936(lowed)S1262(by)S1412(a)S1496(colon)S1794(\(:\).)S4560 V1116(The)S1340(numeric)S1773(labels)S2092(are)S2277(single)S2602(digits.)S2967(The)S3191(nearest)S3571(0:)S3701(label)S3973(may)S4217(be)S4367(referenced)S4917(as)S4698 V936(0f)S1067(in)S1191(the)S1369(forward)S1784(direction,)S2275(or)S2406(0b)S2556(backwards.)S4974 V12 B936(Statement)S1492(Syntax)S5286 V12 R1116(Each)S1388(line)S1600(consists)S2013(of)S2144(a)S2228(single)S2547(statement.)S3102(Blank)S3420(or)S3551(comment)S4031(lines)S4290(are)S4469(allowed.)S5562 V12 B936(Instruction)S1545(Statements)S5874 V12 R1116(The)S1334(most)S1599(general)S1986(form)S2252(of)S2383(an)S2527(instruction)S3075(is)S6081 V1026(label:)S1326(opcode)S(operand1,)479 1704 A(operand2)449 2213 A2782(!)S2853(comment)S6426 V12 B936(Expression)S1536(Semantics)S6738 V12 R1116(The)S1350(following)S1867(operators)S2364(can)S2578(be)S2738(used:)S3039(+)S12 Y3153(-)S12 R3265(*)S3371(/)S3452(&)S3593(|)S3664(\303)S3752(\304)S3840(<<)S4023(\(shift)S4327(left\))S4578(>>)S4761(\(shift)S6876 V936(right\))S12 Y1243(-)S12 R1346(\(unary)S1699(minus\).)S2132(32-bit)S2458(integer)S2832(arithmetic)S3362(is)S3480(used.)S3767(Division)S(produces)436 4220 A4692(a)S4782(trun-)S7014 V936(cated)S(quotient.)426 1222 A8427 VEP%%Page: 7 7BP/slant 0 def/height 0 def1130 V10 R936(SEC.)S1196(.1)S2424(AS\320ASSEMBLER)S3272([IBM])S12 B4958(7)S1380 V936(Addressing)S1551(Modes)S1692 V12 R1116(Below)S1469(is)S1587(a)S1678(list)S1864(of)S2002(the)S2187(addressing)S2741(modes)S(supported.)506 3093 A3666(Each)S3946(one)S4158(is)S4277(followed)S4746(by)S4904(an)S1830 V936(example.)S2037 V1116(constant)S3096(mov)S3340(eax,)S(123456)360 3568 A2175 V1116(direct)S(access)310 1423 A3096(mov)S3340(eax,)S(\(counter\))445 3568 A2313 V1116(register)S3096(mov)S3340(eax,)S3568(esi)S2451 V1116(indirect)S3096(mov)S3340(eax,)S3568(\(esi\))S2589 V1116(base)S1361(+)S1459(disp.)S3096(mov)S3340(eax,)S3568(6\(ebp\))S2727 V1116(scaled)S1449(index)S3096(mov)S3340(eax,)S3568(\(4*esi\))S2865 V1116(base)S1361(+)S1459(index)S3096(mov)S3340(eax,)S3568(\(ebp\)\(2*esi\))S3003 V1116(base)S1361(+)S1459(index)S1757(+)S1855(disp.)S3096(mov)S3340(eax,)S3568(10\(edi\)\(1*esi\))S3210 V936(Any)S1174(of)S1305(the)S1483(constants)S1963(or)S2095(symbols)S2528(may)S2767(be)S(replacement)593 2912 A3536(by)S3687(expressions.)S4342(Direct)S(access,)340 4678 A3348 V936(constants)S1429(and)S(displacements)686 1646 A2375(may)S2626(be)S2783(any)S3000(type)S3251(of)S3395(expression.)S4015(A)S4146(scaled)S4492(index)S4802(with)S3486 V936(scale)S1209(1)S1299(may)S1537(be)S(written)345 1681 A(without)370 2056 A2456(the)S2634(`)S2665(`1*')S2857('.)S3762 V12 B936(Call)S1182(and)S1406(Jmp)S4074 V12 R1116(The)S1338(`)S1369(`call')S1617(')S1692(and)S1900(`)S1931(`jmp')S2191(')S2266(instructions)S2865(can)S3067(be)S3215(interpreted)S3775(as)S3910(a)S3998(load)S4241(into)S4464(the)S4647(instruc-)S4212 V936(tion)S1154(pointer.)S4419 V1116(call)S12 Y11322(3)S12 R1382(routine)S3096(!)S3167(Direct,)S3532(intrasegment)S4557 V1116(call)S1322(\(subloc\))S3096(!)S3167(Indirect,)S3605(intrasegment)S4695 V1116(call)S1322(6\(ebp\))S3096(!)S3167(Indirect,)S3605(intrasegment)S4833 V1116(call)S1322(ebx)S3096(!)S3167(Direct,)S3532(intrasegment)S4971 V1116(call)S1322(\(ebx\))S3096(!)S3167(Indirect,)S3605(intrasegment)S5109 V1116(callf)S1363(\(subloc\))S3096(!)S3167(Indirect,)S3605(intersegment)S5247 V1116(callf)S1363(seg:offs)S3096(!)S3167(Direct,)S3532(intersegment)S5730 V12 B936(Symbol)S1355(Assigment)S6180 V12 R1116(Symbols)S1572(can)S1774(acquire)S2165(values)S2508(in)S2636(one)S2844(of)S2979(two)S3195(ways.)S3538(Using)S3861(a)S3950(symbol)S4340(as)S4476(a)S4565(label)S4836(sets)S6318 V936(it)S1045(to)S1180(`)S1211(`.')S1313(')S1395(for)S1578(the)S1767(current)S2152(segment)S2596(with)S2853(type)S3101(relocatable.)S3704(Alternative,)S4321(a)S4415(symbol)S4810(may)S6456 V936(be)S1080(given)S1378(a)S1462(name)S1754(via)S1932(an)S2076(assignment)S2650(of)S2781(the)S2959(form)S6663 V1026(symbol)S1411(=)S1509(expression)S6870 V936(in)S1060(which)S1386(the)S1564(symbol)S1949(is)S2060(assigned)S2506(the)S2684(value)S2976(and)S3180(type)S3418(of)S3549(its)S3694(arguments.)S8427 VEP%%Page: 8 8BP/slant 0 def/height 0 def1130 V12 B936(8)S1380 V936(Storage)S1362(Allocation)S1830 V12 R(Space)289 1116 A1439(can)S1641(be)S1789(reserved)S2234(for)S2410(bytes,)S2729(words,)S3089(and)S(longs)261 3297 A3593(using)S(pseudo-ops.)579 3889 A4533(They)S4816(take)S1968 V936(one)S1148(or)S1287(more)S1574(operands,)S2078(and)S2290(for)S(each)222 2470 A2730(generate)S3179(a)S3271(value)S3571(whose)S3918(size)S4145(is)S4264(a)S4356(byte,)S4631(word)S4917(\(2)S2106 V936(bytes\))S1262(or)S(long)214 1393 A1637(\(4)S1768(bytes\).)S2154(For)S2352(example:)S2313 V1116(.data1)S1438(2,)S1558(6)S3096(!)S3167(allocate)S3575(2)S3665(bytes)S(initialized)486 3950 A4466(to)S4590(2)S4680(and)S4884(6)S2451 V1116(.data2)S1451(3,)S(0x10)240 1584 A3122(!)S3206(allocate)S3628(2)S3732(words)S(initialized)486 4072 A4602(to)S4740(3)S4844(and)S2589 V936(16)S2727 V1116(.data4)S(010)180 1438 A3096(!)S3167(allocate)S3575(a)S(longword)463 3659 A(initialized)486 4152 A4668(to)S4792(8)S2865 V(.space)299 1116 A1445(40)S3096(!)S3167(allocates)S3622(40)S3772(bytes)S4057(of)S4188(zeros)S3072 V936(allocates)S1392(50)S1543(\(decimal\))S2040(bytes)S2326(of)S2458(storage,)S(initializing)526 2869 A3426(the)S3605(\256rst)S3825(two)S4038(bytes)S4324(to)S4450(2)S4542(and)S4748(6,)S4870(the)S3210 V936(next)S1189(two)S1416(words)S1757(to)S1896(3)S2001(and)S2220(16,)S2415(then)S2668(one)S(longword)463 2887 A3395(with)S3656(value)S3963(8)S(\(010)221 4068 A4334(octal\),)S4685(last)S4898(40)S3348 V936(bytes)S1221(of)S1352(zeros.)S3624 V12 B936(String)S1289(Allocation)S3936 V12 R1116(The)S(pseudo-ops)549 1360 A12 I1965(.ascii)S12 R2280(and)S12 I2510(.asciz)S12 R2838(take)S3096(one)S3326(string)S3658(argument)S4171(and)S4402(generate)S4870(the)S4074 V936(ASCII)S1307(character)S1807(codes)S2136(for)S2331(the)S2532(letters)S2883(in)S3030(the)S3231(string.)S3590(The)S3831(latter)S4135(automatically)S4848(ter-)S4212 V936(minates)S1343(the)S1521(string)S1827(with)S2073(a)S2157(null)S2375(\(0\))S2547(byte.)S2845(For)S3043(example,)S4419 V1026(.ascii)S1309("hello")S4557 V1026(.asciz)S1329("world\\n")S4902 V12 B936(Alignment)S5214 V12 R1116(Sometimes)S1686(it)S1786(is)S(necessary)471 1899 A2402(to)S2528(force)S2810(the)S2990(next)S3230(item)S3478(to)S3604(begin)S3904(at)S4024(a)S4110(word,)S(longword)463 4421 A4917(or)S5352 V936(even)S1207(a)S1304(16)S1467(byte)S1718(address)S(boundary.)485 2124 A2682(The)S12 I2913(.align)S12 R(pseudo-op)502 3234 A3778(zero)S4029(or)S4172(more)S4463(null)S4693(byte)S4943(if)S5490 V936(the)S1114(current)S1488(location)S1908(is)S2019(a)S(multiple)404 2103 A2537(of)S2668(the)S2846(argument)S3333(of)S3464(.align.)S5766 V12 B936(Segment)S1410(Control)S6078 V12 R1116(Every)S1441(item)S1693(assembled)S2233(goes)S2491(in)S2622(one)S2833(of)S2971(the)S3156(four)S3395(segments:)S3916(text,)S4165(rom,)S4427(data,)S4696(or)S4834(bss.)S6216 V936(By)S1121(using)S1427(the)S12 I1620(.sect)S12 R(pseudo-op)502 1884 A2430(with)S2690(argument)S12 I3191(next)S3437(items)S3738(to)S3876(go)S4040(in)S4178(a)S4282(particular)S4816(seg-)S6354 V936(ment.)S8427 VEP%%Page: 9 9BP/slant 0 def/height 0 def1130 V10 R936(SEC.)S1196(.1)S2424(AS\320ASSEMBLER)S3272([IBM])S12 B4958(9)S1380 V936(External)S1416(Names)S1692 V12 R1116(A)S1257(symbol)S1665(can)S1886(be)S2053(given)S2374(global)S2729(scope)S3057(by)S3230(including)S3739(it)S3860(in)S4007(a)S12 I4114(.de\256ne)S12 R(pseudo-op.)532 4486 A1830 V(Multiple)417 936 A1387(names)S1730(may)S1972(be)S2120(listed,)S2447(separate)S2879(by)S3033(commas.)S3530(It)S3638(must)S3906(be)S4053(used)S4307(to)S(export)309 4434 A4776(sym-)S1968 V936(bols)S1173(de\256ned)S1564(in)S1695(the)S1880(current)S2261(program.)S2768(Names)S3142(not)S3333(de\256ned)S3725(in)S3856(the)S4041(current)S4422(program)S4869(are)S2106 V936(treated)S1303(as)S("unde\256ned)524 1440 A2000(external")S2476(automatically,)S(although)422 3202 A3659(it)S3762(is)S3878(customary)S4417(to)S4546(make)S4843(this)S2244 V936(explicit)S1330(with)S1576(the)S12 I1754(.extern)S12 R(pseudo-op.)532 2117 A2520 V12 B936(Common)S2832 V12 R1116(The)S12 I1348(.comm)S12 R(pseudo-op)502 1712 A2258(declares)S2700(storage)S3094(that)S3320(can)S3532(be)S3691(common)S4158(to)S4297(more)S4591(than)S4844(one)S2970 V(module.)392 936 A1402(There)S1729(are)S1922(two)S2148(arguments:)S2730(a)S2828(name)S3134(and)S3352(an)S3510(absolute)S3957(expression)S4518(giving)S4870(the)S3108 V936(size)S1171(in)S1311(bytes)S1612(of)S1759(the)S1953(area)S2202(named)S2570(by)S2736(the)S2930(symbol.)S3361(The)S3595(type)S3850(of)S3998(the)S4193(symbol)S4595(becomes)S3246 V936(external.)S1419(The)S1639(statement)S2136(can)S2336(appear)S2690(in)S2815(any)S3020(segment.)S3514(If)S(you)180 3627 A3838(think)S4117(this)S4323(has)S4515(something)S3384 V936(to)S1060(do)S1210(with)S1456(FORTRAN,)S(you)180 2081 A2291(are)S2470(right.)S3660 V12 B936(Examples)S3972 V12 R1116(In)S1271(the)S1473(kernel)S1830(directory,)S2352(there)S2649(are)S2852(several)S3250(assembly)S3754(code)S4037(\256les)S4294(that)S4531(are)S4735(worth)S4110 V936(inspecting)S1471(as)S1610(examples.)S2165(However,)S2678(note)S2923(that)S3142(these)S3428(\256les,)S3697(are)S3883(designed)S4349(to)S4480(\256rst)S4706(be)S4857(run)S4248 V(through)375 936 A1355(the)S1547(C)S1671(preprocessor.)S2394(\(The)S2668(very)S2928(\256rst)S3162(character)S3653(is)S3779(a)S3878(#)S3983(to)S4122(signal)S4456(this.\))S4777(Thus)S4386 V936(they)S1187(contain)S1586(numerous)S2104(constructs)S2637(that)S2861(are)S3052(not)S3248(pure)S3505(assembler.)S4092(For)S4302(true)S4533(assembler)S4524 V936(examples,)S1455(compile)S1877(any)S2083(C)S2195(program)S2637(provided)S3098(with)S10 R3341(MINIX)S12 R3676(using)S3969(the)S12 B4149(\261S)S12 R4308(\257ag.)S4581(This)S(will)190 4828 A4662 V936(result)S1238(in)S1364(an)S1509(assembly)S(language)436 1990 A2457(\256le)S2643(with)S2890(a)S2975(suf\256x)S3281(with)S3528(the)S3707(same)S3987(name)S4280(as)S4412(the)S4591(C)S4702(source)S4800 V936(\256le,)S1151(but)S1335(ending)S1693(with)S1939(the)S2117(.s)S2224(suf\256x.)S8427 VEP%%Trailer%%DocumentFonts: Times-Roman Times-Bold Times-Italic Symbol Troff%%Pages: 9

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -