[SOLVED] CS代考程序代写 assembly ;; SIEVE.ASM–Program to compute number of primes <= 520000

30 $

File Name: CS代考程序代写_assembly_;;_SIEVE.ASM–Program_to_compute_number_of_primes_<=_520000.zip
File Size: 847.8 KB

SKU: 6644903927 Category: Tags: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,

Or Upload Your Assignment Here:


;; SIEVE.ASM–Program to compute number of primes <= 520000;;using the sieve of Eratosthenes and 80386+ bit;;instructions;;;;Program text from “Assembly Language for the IBM PC Family” by;; William B. Jones, (c) Copyright 1992, 1997, 2001, Scott/Jones Inc.;;INCLUDE PCMAC.INC.MODELSMALL .586.STACK100h.DATAMsg1DB’The number of primes less than $’Msg2DB’ is $’Msg3DB13, 10, ‘$’N EQU 520000 ;PrimesDD0AAAAAAA8h, (N/32 – 1) DUP (0AAAAAAAAh); 0, 1 and multiples of 2 already crossed outCURPRIME EQUedxMULTIPLES EQU ebxPrimeCount EQUedi.CODESieve PROCEXTRN PutDDec : NEAR_Beginsub esi, esimov cx, N/32 ;Number of DWORDs to processmov PrimeCount, 1 ; prime ‘2’ already countedProcessDWords:; We don’t really need two labelsFindNextPrime:bsf eax, [Primes + 4 * esi]jzNextDWord ; No more primes hereinc PrimeCount ;Count Prime; cross out multiplesmov CURPRIME, esi ; Compute CURPRIMEshl CURPRIME, 5 ;= esi * 32add CURPRIME, eax ; + eaxmov MULTIPLES, CURPRIME ; first cross out current primeshl CURPRIME, 1 ; Need only cross out odd multiplesCrossOffMultiples:btr Primes, MULTIPLES ; zero a multipleadd MULTIPLES, CURPRIMEcmp MULTIPLES, NjlCrossOffMultiplesjmp FindNextPrimeNextDWord:inc esidec cxjnz ProcessDWords_PutStr Msg1mov eax, NcallPutDDec_PutStr Msg2mov eax, PrimeCountcallPutDDec_PutStr Msg3_Exit 0Sieve ENDPEND Sieve

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[SOLVED] CS代考程序代写 assembly ;; SIEVE.ASM–Program to compute number of primes <= 520000
30 $