> JLI` 0tbjbj 1$t,g68LLLLL{!{!{!////G/25$7h:6{!Y!"{!{!{!6LL
!6!!!{!
LL/!{!/!!-#/L@)k!
./760g6.`:!::0#/:#/\{!{!!{!{!{!{!{!66!
{!{!{!g6{!{!{!{!d
COE 205, Term 052
Computer Organization & Assembly ProgrammingProgramming Assignment# 3
Due date: Saturday, May 6, 2006
You are required to write an 8086 assembly program to implement a pseudo random generator using Liner Feedback Shift Register (LFSR). An example of an 8-bit LFSR is shown below:
Two important characteristics of an LFSR are the Feedback Polynomial, which determines the FFs that are XORed to compute the shifted bit, and the seed which determines the initial content of the FFs. Depending on the Feedback polynomial, the LFSR can generate a maximal-length sequence without repetition, or it may not. The seed can be any number other than 0.
The 8-bit LFSR shown above is a maximal-length i.e. it is guaranteed to generate a random sequence in the range from 1 to 255 before it repeats again.
The Feedback polynomial for the above LFSR can be represented as 10001101. Note that 1 indicates that there is feedback connection, while 0 indicates that there is no feedback connection.
Write a macro, RAND8, that implements an 8-bit pseudo random generator. The macro should be given the Feedback polynomial, and the seed, and it should generate the next random number. Assume that the Feedback polynomial, the seed and returned random number should be passes as macro parameters.
Write a procedure that gets as parameters the address of an Array and the size of the Array and scans the array content and determines after how many elements the first number stored in the Array is repeated. For example, suppose that the Array content is 1, 5, 6, 1, 4, 2, then the procedure should return 3. You can store the returned number as you like.
Using the macro and procedure in (i) and (ii), generate the first 256 random numbers that will be obtained from the feedabck polynomial 10001101 and an initial seed of 00000001. Determine after how many numbers the first number is repeated.
Using the macro and procedure in (i) and (ii), generate the first 256 random numbers that will be obtained from the feedabck polynomial 10001101 and an initial seed of 1010101. Determine after how many numbers the first number is repeated.
Using the procedure and macro in (i) and (ii), generate the first 256 random numbers that will be obtained from the feedabck polynomial 10000001 and an initial seed of 00000001. Determine after how many numbers the first number is repeated.
Ask the user to enter a feedback ploynomial and a seed. Then, ask the user to enter a string of characters. Then, encrypt the string using RAND8 as follows. Each character is encrypted by XORing the least significant 4-bits of the ASCII code of the character with the lest significant 4 bits and the most significant 4 bits of the generated random number. For example, assume the character to be encrypted is A=41H and the random number is A1H. Then, the encrypted character will be obtained by keeping the most significant digit as is and computing the least significant digit as A XOR1 XOR 1= A. Thus, the encrypted charactaer will have the ASCII code 4AH = J. To decrypt the character, the decrypted character 4AH=character J, will be XORed with the same corresponding random number used for encryption i.e. A1 and this will generate the original character 41H= character A, as A XOR 1 XOR A=1. As an example show the encryption of the string This is the last Assignment!!. Then, rerun your program giving it the encrypted string and it should correctly decrypt it to This is the last Assignment!!. Try this with the feedback polynomial 10001101 and a seed of 10101010.
The solution should be well organized and your program should be well documented. Submit a soft copy of your solution in a zip file. The soft copy should include a Readme file indicating the file names containing the solution and whether it works or not. The Readme file should also contain your name and ID. Submit both source code file (i.e. .asm) and the executable file (i.e. .exe).
@VXY[emnopstuz{|} 2 3 7 E
L
g
h
68de·¬·ͤ~h'NhHUh|jhq/CJUhkhq/h^=h]}wh]}wCJaJh3N5CJ\aJh|e5CJ\aJhPfC5CJ\aJh]}w5CJ\aJh]^CJaJhHUCJaJhPfCCJaJh]}wCJaJhOICJaJ1[|}/ 0 1 2 4 5 6 7
9
wg$
&F
a$gd
q$
&F
a$gd|$
&F
a$gdQ\z$a$gd'N$a$gd|gdq/gd]^gdPfCgdkt%/CH
Bvw(fV!"|8KN0f&(h56CJ\]aJh]}w56CJ\]aJh
qhHU5\h
q5\h
qh
q5\h
qhh|hhQ\zhHUh]}whk?gXstgd$^a$gd]^$
&F
a$gd
qBu$rsthh|CJaJhh]^5CJ\aJh]^56CJ\]aJ hP'h]^56CJ\]aJ/ 0&P/ =!"#$%@@@Normal_HmHnHsH tH u\@\Heading 1,Question$$@&a$CJKHaJR@R Heading 2$$x@&^a$CJaJuR@R Heading 3$
&F<@&5CJ\aJX@X Heading 4$
&F<@&56CJ\]aJP@P Heading 5
&F<@&CJOJQJaJV@V Heading 6
&F<@&6CJOJQJ]aJH@H Heading 7
&F<@&OJQJN@N Heading 8
&F<@&6]OJQJV @V Heading 9
&F<@&6CJOJQJ]aJDADDefault Paragraph FontVi@VTable Normal :V44
la(k(No List6O6 Dspace-NI
`LOLDspace$dhx*$`a$CJaJ6O6Author$a$CJaJO"Figuren$
&Fh>T0Figurea$F>@2FTitle$<a$5CJ KH\aJ&P$@BPEnvelope Address
$^CJaJOR
References$
&F
hhdhx>Th[]^h`a$CJaJHC@bHBody Text Indent
`CJOr
Definitionh
&F>T
0Definition`DOD Sspace.NI$
a$CJaJOQ Questionso@d>T8@Q..^@`OListai>T8h()^`O Question1c
&F@& >T2B@2 Body TextCJ:P@:Body Text 2CJaJt$[|}/01245679 wgX
sv00000000000000000
0
0
0
0
0
00000tgt
t8ae@-dV(
T nd
d#"Z ld
cldZ l
blB` h|
#l
4
hH
4
|ZB
SDH
`
#
B
B
@ `B
c$D@ZB
SDZ |
a|B
B
W|`B
c$DW`B
c$Dkt
##"4
4
@ ZB
SD@ZB
SD`B
+
c$DdTB
1
CD<[PTB
4
CD^xn PD
8#"nbB2
9
PDTB
:
CDPDTB
;B
CD@@xn PD
G#"(nbB2
H
PDTB
I
CDPDTB
JB
CD@@ZB
K
SD;ZB
M
SD;ZB
NB
SD^<^TB
QB
CD^^ZB
WB
SDZ<ZZB
[
SDlxn PD
\#"nbB2
]
PDTB
^
CDPDTB
_B
CD@@ZB
`
SDOB
S ?2td$d4vv[}7Vvv pflI`KhH]:()!"}8b-z2?/=b2d#\b
dS..@0^`056CJOJQJo(Q..@P^`P56CJOJQJo(()@P0^P`0.@
0^
`0)@0^`0()@0^`0()@0^`0()@`0^``0()@00^0`0()^`5o(.hh^h`56.808^8`0o(()^`.pLp^p`L.@@^@`.^`.L^`L.^`.^`.PLP^P`L.0 0^`0o(()^`.0 L ^ `L.^`.xx^x`.0HLH^H`L.^`.^`.0L^`L.0^`05o(()^`o(.@P^`P56CJOJQJo(()@P0^P`0.@
0^
`0)@0^`0()@0^`0()@0^`0()@`0^``0()@00^0`0() 88^8`5o(()`P^`P56CJOJQJo(()`P0^P`0.`
0^
`0)`0^`0()`0^`0()0`0^`0()``0^``0()0`00^0`0()@h^`56CJOJQJo(()
Id#\-d#\`y?/=pf
dS)!] hX > q/PfCOI'N
q]}wQ\z^=|eHU|]^3Nk&@HP LaserJet 1200 Series PCLNe01:winspoolHP LaserJet 1200 Series PCLHP LaserJet 1200 Series PCL4C 4dXXA4DINU"4J4HP LaserJet 1200 Series PCL4C 4dXXA4DINU"4J4w
7wwt@@UnknownGz Times New Roman5Symbol3&z ArialM`@Traditional Arabic3z Times"h*f,gC <N&
N&
!r4dmm 2QHX(?q/2,KING FAHD UNIVERSITY OF PETROLEUM & MINERALSHassan R. Baradaaimane0 Oh+'0( 8D
dp|
0KING FAHD UNIVERSITY OF PETROLEUM & MINERALSHassan R. BaradaNormalaimane9Microsoft Office Word@ha@>3}@xy2@PTkN&
՜.+,0$
px
4m-KING FAHD UNIVERSITY OF PETROLEUM & MINERALSTitle
!"#$%&'()*+,-./012345678:;<=>?@BCDEFGHKRoot Entry F`)kMData
1Table:WordDocument1$SummaryInformation(9DocumentSummaryInformation8ACompObjq
FMicrosoft Office Word Document
MSWordDocWord.Document.89q