linkingtovc内容摘要:

and fill with 32bit // unsigned random integers. unsigned long * rArray = new unsigned long[ARRAY_SIZE]。 for(unsigned i = 0。 i ARRAY_SIZE。 i++) { rArray[i] = LongRandom()。 //call the external (assembly) function cout rArray[i] 39。 ,39。 } cout endl。 return 0。 } asm proc longrandom。 LongRandom procedure module () .model large .386 Public _LongRandom .data seed dd 12345678h//seed should be odd, not even。 Return an unsigned pseudorandom 32bit integer。 in DX:AX,in the range 0 FFFFFFFFh. .code _LongRandom proc far, C mov eax, 214013 mul seed xor edx,edx add eax, 2531011 mov seed, eax。 save the seed for the next call shld edx,eax,16。 copy upper 16 bits of EAX to DX ret _LongRandom endp end • text examples e with (some) piled cpp and assembled asm examples. • you would need to find a borland c piler to undertake this work. • there is a free c piler (mandline only – no ide) available from inprise (borland) • you would link the two obj files to create an exe Free piler from borland • Link for piler: IDEs available for Borland piler IDE continuedamp。 SoftwareDave site • You can “easily” integrate borland C piler with textpad, also. (some of the) output C:\MASM615\EXAMPLES\CH12\BORLAN~1\LONGRANDlongrand 3018423131,1530878130,3423460525,3768712380,1536596111,3080048918,405865345,3338 983488,2101941763,875374778,3701378197,761367812,142804919,3419349918,218704873, 3429891848,1470939563,563267010,3913012605,2845790796,1275647967,4244656934,4140 39377,341437136,1709710931,3514126282,2757121893,143223956,2904402183,3569909678 ,1119967161,2589637528,2108869627,1764615890,2858594893,1329724380,2363169583,37 30491702,3727334177,2285801824,3123210915,3454642906,2824439349,1633624100,21641 82615,2533248958,3079939977,2860878888,508074571,3173628898,305623837,3714775404 ,3194643071,781071174,3555499249,887344112,1198979827,3041081834,1769806085,1231 267764,2476963751,402232270,3202784089,3603001528,804990107,2917090546,330242029 ,2403027708,4082347471,1774424406,1769521857,532322944,25218883,2692414714,32352 54229,3377988420,248030455,243485662,2556277545,874473800,4153901803,3773268482, 1644077245,1595142284,7601439,3311657830,3801353361,3514039568,1379067795,117086 3114,2948164261,1899836116,2255181383,4070864878,1071542020,2733667800,147918777 1,555447058,1083903373,2526407196,3437777007,1075325302,658733665,3858822048,177 3814755,145301274,800860533,3897833060,1221102487,228988926,1032703689,159000740 0,587299723,1855199266,1396268637,1587689388,2718803903,2982765446,2479623217,26 26846256,2391008307,164724266,45304901,2099121652,2925348071,2316381198,19766196 73,2389691128,1739136475,246051122,1842254637,1331288380,2072052495,3684733334,3 367158273,1738120384,1832700035,926683450,2192823061,3042687364,1776714295,22092 64670,4182538857,3556774792,3287188523,2616688194,1687137277,1953484,1461674591, 2020705126,2059181009,2093436752,1758589139,1545721930,1913830885,3725474068,363 0252935,394768430,3571828281,3704057880,3017715323,374619986,3690047693,25427375 00,2231748015,1252313526,1122933153,1695323616,3933232419,821810010,3412397237,2 608237732,1359644887,1944395838,3787568649,4049002664,3787889867,4074353762,4137 63997,1536079340,4153486591,811848646,1854782321,2358931568,2978286963,180374794 6,2441068421,2031465524,1969181223,3897558094,2504346073,2239718712,1983074075,7 36157042,3484175981,1094559612,2472450127,795660758,3474915649,3538018048,599589 315,3467666810,2675430997,2041360324,2166136695,4119944286,3507847593,3360816584 ,1743897963,1359133314,4130273085,2096950540,2135623583,2267595750,2322033425,44 5899152,2634365459,985463946,2023903525,2805759828,2587848903,1571956846,3004652 6360559,2991106806,932705761,2555478304,1625202007,3506051226,1167015157,4069063 652,2132818711,3283945854,133102153,1370493928,202900235,1171161506,2383421917,7 6279084, C:\MASM615\EXAMPLES\CH12\BORLAN~1\LONGRAND what should c do, what should asm do? • C should do things like i/o and real putations • asm should handle low level operations including graphics activities which might involve rombios or dos function calls cpp for read sector example // Calls ReadSector Procedure include include include const int SECTOR_SIZE = 512。 extern C ReadSector( char * buffer, long startSector, int driveNum, int numSectors )。 void DisplayBuffer( const char * buffer, long startSector, int numSectors ) { int n = 0。 long last = startSector + numSectors。 for(long sNum = startSector。 sNum last。 sNum++) { cout \nSector sNum \n。 for(int i = 0。 i SECTOR_SIZE。 i++) { char ch = buffer[n++]。 if( unsigned(ch) 32 || unsigned(ch) 126) cout 39。 .39。 else cout ch。 } cout endl。 getch()。 } } int main() { char * buffer。 long startSector。 int driveNum。 int numSectors。 system(CLS)。 cout Sector display program.\n\n Enter drive number [1=A, 2=B, 3=C, 4=D, 5=E,...]:。 cin driveNum。 cout Starting sector number to read:。 cin startSector。 cout Number of sectors to read:。 cin numSectors。 buffer = new char[numSectors * SECTOR_SIZE]。 cout \n\nReading sectors startSector (startSector + numSectors) from Drive。
阅读剩余 0%
本站所有文章资讯、展示的图片素材等内容均为注册用户上传(部分报媒/平媒内容转载自网络合作媒体),仅供学习参考。 用户通过本站上传、发布的任何内容的知识产权归属用户或原始著作权人所有。如有侵犯您的版权,请联系我们反馈本站将在三个工作日内改正。