Sign in with
Sign up | Sign in
Your question

Intel and AMD 64-bit processors and their instruction sets

Last response: in CPUs
Share
November 9, 2012 2:00:11 PM

:hello: 
Hello everyone, I am doing a paper for college for my ASM x86 class, that should describe Intel and AMD 64 bit processors and their instruction sets. I am not asking anyone to do my homework for me. I am just asking for a little direction here. I have goggled a few links but I can not use sources like wiki or any other link that does not contain valid citations. Up until now I have never really had a whole lot of experiences with hardware, except for maybe just replacing parts. So what I am asking for here are the good sites that I can get information from. Sites that have a good reputation, or any article that you may have come across that maybe a good source of learning.

I am a Game dev/Application dev/ Web dev, and I am learning ASM for optimization as far as I know so far.
Some of the languages I have studied so far include
HTML, C++, C#, VB6.0, VB.net, Delphi 7, ASP.net including some CSS, MS SQL, SQL express, SQL Server and as I have said I am currently in week 5 of ASM. :love: 

Some the Libraries and layers I have used include
Irvine32, Boost, OpenMp, DirectX, and SDL(Currently learning this as well)

The reason I am listing these things is so that maybe I could tie all of these things into my paper and how they all relate. For example game porting(SDL), Boost and OpenMP(Optimization and Multi threaded processing)

• Technical aspects of the new technology
• Role of the new technology in computer organization and structure
• Ways technology improves performance
• Specific applications to game industry
• Separate glossary for the technical terms used in this paper including detailed definition of each term and associated principle

Here are my sources so far....

http://en.wikipedia.org/wiki/X86-64
Although I can not use this link in my bibliography I can still learn from it to break things down a little more for understanding things in other articles that may go over my head.

http://www.extremetech.com/extreme/56018-analyst-intel-...
I realize that AMD and Intel kind of leap frog each other every other year, but I found it interesting in this article that it has been reported that Intel reverse engineered AMD's Instruction set. What I am curious about is if this a common thing? Is it illegal to do this? I also realize that as a programmer just about anything can be reverse engineered.

http://www.dailytech.com/AMD+to+Make+64Bit+ARM+Processo...
This link describes ARM AMD processor but what I am unsure of is if it relates my subject or if it is a completely different type of processor. It also talks about trashing the old x86 processor. Which from my understand x86 work on both 32bit and 64 bit systems.

I appreciate any guidance I may receive and thank everyone for taking the time to look over my post.

So far the hardest thing I have done in ASM x86 is decrypted a file and plot points on an axis and then color code the points according to the quadrant they are in.
Here is my project and since this is a hardware site I believe someone may understand the code.
I had a few bugs in my project while trying to plot the points, maybe someone can figure this out. By the way this assignment is already handed in so I won't be receiving any extra point for it now.

Here is the link to the encrypted file.
https://dl.dropbox.com/u/64787986/inputfile.txt

  1. TITLE Week # 4 Assignment
  2.  
  3. INCLUDE Irvine32.inc
  4.  
  5. .data
  6. encrypedFile BYTE "inputfile.txt",0
  7. decrypedFile BYTE "outputfile.txt",0
  8. BUFFER_SIZE = 5000
  9. buffer BYTE BUFFER_SIZE DUP(?)
  10. bytesRead DWORD ?
  11. intX DWORD ?
  12. intY DWORD ?
  13. intAxisX SDWORD -15
  14. intAxisY SDWORD -15
  15. .code
  16. main PROC
  17. call question1Proc
  18. call question2Proc
  19. exit
  20. main ENDP
  21. ;-------------------------------------------------------------------------------------
  22. question1Proc PROC
  23.  
  24.  
  25. ;Question 1###################################################
  26.  
  27. ;a.-------------------------------------------------------
  28. mov edx, OFFSET encrypedFile ;Open the file
  29. call OpenInputFile
  30. push eax ;Push the register on the stack
  31. mov edx, OFFSET buffer ;points to the buffer
  32. mov ecx, BUFFER_SIZE ;max bytes to read
  33. call ReadFromFile ;read the file
  34. mov bytesRead, eax ;count of bytes read
  35. pop eax ;Pop the register off the stack
  36. call CloseFile ;Close the file
  37.  
  38. ;b.-------------------------------------------------------
  39. mov esi, offset buffer ;Point to the buffer
  40. mov ecx, bytesRead ;Loop counter
  41. Decrypt:
  42. mov al, byte ptr [esi] ;get byte at current pointer
  43. xor al,0ffh ;Translate a byte
  44. mov byte ptr [esi], al ;move that decrypted byte back to our buffer at current pointer
  45. inc esi ;point to the next byte
  46. loop Decrypt ;loop
  47.  
  48. ;c.-------------------------------------------------------
  49. call WriteString ;Print the message to the screen
  50. mov edx, OFFSET buffer ;Display the buffer
  51. call WriteString
  52.  
  53. ;d.-------------------------------------------------------
  54. ;Create the output file
  55. mov edx,OFFSET decrypedFile
  56. call CreateOutputFile
  57. ;Write to file
  58. push eax ;get the decrypted file
  59. mov edx, OFFSET buffer ;points to the buffer
  60. mov ecx, BUFFER_SIZE ;max bytes to read
  61. call WriteToFile ;Write to file
  62. pop eax ;Pop the register off the stack
  63. call CloseFile ;Close the file
  64. call Crlf ;Go to the next line
  65. call waitMsg ;Wait
  66. call Clrscr ;Clear the screen
  67.  
  68. ;e.-------------------------------------------------------
  69. COMMENT &
  70. Bonus Question:
  71. Hi Joe,
  72. Here's at question I have pondered. What is the hibernation period of the antartic polar bear?
  73. Thanks
  74. Andrew
  75.  
  76. Anwser = Polar do not hibernate or live in the antartic
  77. polar bears instead enter a state of walking hibernation
  78. where their metabolism slows.
  79. Only pregnant polar bears enter a den, give birth, and emerge three months later.
  80. http://www.polarbearsinternational.org/about-polar-bears/faqs#q15
  81. &
  82. ret
  83.  
  84. question1Proc ENDP
  85. ;-------------------------------------------------------------------------------------
  86. ;a.-------------------------------------------------------
  87. ;Question 2 procedure
  88. question2Proc PROC
  89.  
  90. mov ecx, 32 ;Moving 32 into ecx to use to control the point loop
  91. point: ;Start the loop
  92. call randomY ;Call the randomY Procedure
  93. call randomX ;Call the randomX procedure
  94. call checkPoint ;Check what quadrate the point belongs
  95. mov dh,BYTE PTR intX ;Moving intX into dh to use with GotoXY, had to use PTR because of size difference.
  96. mov dl,BYTE PTR intY ;Moving intY into dl to use with GotoXY, had to use PTR because of size difference.
  97. add dl,15 ;Adding 15 back into dl because negitives do not work.
  98. add dh,15 ;Adding 15 back into dh because negitives do not work.
  99. call Gotoxy ;Calling Procedure Gotoxy
  100. mov eax,intX ;Moving intX into eax to display with WriteInt
  101. call WriteInt ;Write the integer
  102. mov eax,intY ;Moving inty into eax to display with WriteInt
  103. call WriteInt ;Moving inty into eax to display with WriteInt
  104. loop point ;End of loop point
  105. call Crlf ;Move the cursor to the next line
  106. call drawAxis
  107. call waitMsg
  108. ret ;Return control back to main
  109. question2Proc ENDP
  110.  
  111. ;-------------------------------------------------------------------------------------
  112.  
  113. ;randomize Y procedure===================================
  114. randomY PROC
  115. call random
  116. mov intY,eax
  117. ret
  118. randomY ENDP
  119. ;-------------------------------------------------------------------------------------
  120.  
  121. ;randomize X procedure===================================
  122. randomX PROC
  123. call random
  124. mov intX,eax
  125. ret
  126. randomX ENDP
  127. ;-------------------------------------------------------------------------------------
  128.  
  129. ;random procedure===================================
  130. random PROC
  131. mov eax,29 ;values 0- 29
  132. call RandomRange ;Generate a random int
  133. sub eax,15 ;value from -15 - +14
  134. ret ;return
  135. random ENDP ;end random procedure
  136. ;-------------------------------------------------------------------------------------
  137.  
  138. ;check point procedure
  139. checkPoint PROC ;Begin check point procdure
  140. mov edx,intX ;Moving intX into edx for compare
  141. cmp edx,0 ;Comparing edx to zero
  142. JG Xgreater ;If edx greater then zero jump to Xgreater
  143. JL Xlesser ;If edx less then zero jump to Xlesser
  144. Xgreater: ;Xgreater knows that X is greater then zero, now compares y
  145. mov edx,intY ;Moving intY into edx for compare
  146. cmp edx,0 ;Comparing edx to zero
  147. JG YandXGreat ;If edx greater than zero jump to YandXGreat
  148. JL XgreatYless ;If edx less than zero jump to XgreatYless
  149. YandXGreat: ;YandXgreat is the Quadrant 1, sets text color to yellow
  150. mov eax,yellow + (black * 16) ;Assign the color yellow
  151. Call SetTextColor ;Call the color function
  152. JMP Complete ;Jump to complete
  153. XgreatYless: ;XgreatYless is Quadrant 4, sets text color to green
  154. mov eax,green + (black * 16) ;Assign color green
  155. Call SetTextColor ;Call the color function
  156. JMP Complete ;Jump to complete
  157. Xlesser: ;Xlesser knows that X is less then zero, now compares y
  158. mov edx,intY ;Moving intY into edx for compare
  159. cmp edx,0 ;Comparing edx to zero
  160. JG XlessYgreat ;If edx greater then zero goto XlessYgreat
  161. JL XlessYless ;If edx less then zero goto XlessYless
  162. XlessYgreat: ;XlessYgreat is Quadrant 2, sets text color to cyan
  163. mov eax,cyan + (black * 16) ;Assign color cyan
  164. Call SetTextColor ;Call the color function
  165. JMP Complete ;Jump to complete
  166. XlessYless: ;XlessYesll is Quadrant 3, sets text colot to red
  167. mov eax,red + (black * 16) ;Assign color red
  168. Call SetTextColor ;Call the color function
  169. JMP Complete ;Jump to complete
  170. Complete: ;Complete jump
  171. ret
  172. checkPoint ENDP
  173. ;-------------------------------------------------------------------------------------
  174.  
  175. drawAxis PROC
  176. call drawXAxis
  177. call drawYAxis
  178. ret
  179. drawAxis ENDP
  180.  
  181. drawXAxis PROC
  182. mov ecx,36
  183. loopXAxis:
  184. mov dl,BYTE PTR intAxisX
  185. mov dh,BYTE PTR intAxisY
  186. add dh, 16
  187. sub dl, 36
  188. call Gotoxy
  189. mov eax,0
  190. call WriteInt
  191. INC intAxisX
  192. DEC ecx
  193. loop loopXAxis
  194. ret
  195. drawXAxis ENDP
  196.  
  197. drawYAxis PROC
  198. mov ecx, 36
  199. loopYAxis:
  200. mov dl,BYTE PTR intAxisX
  201. mov dh,BYTE PTR intAxisY
  202. add dl, 10
  203. sub dh, 236
  204. call Gotoxy
  205. mov eax,0
  206. call WriteInt
  207. INC intAxisY
  208. DEC ecx
  209. loop loopYAxis
  210. ret
  211. drawYAxis ENDP
  212.  
  213. END main


Thanks for any help! :wahoo: 
a b à CPUs
November 9, 2012 2:19:16 PM

Oh wow, been a while since I've looked at X86 assembly code...

Anyways, a few technical points:

X86 generally refers to the 32-bit instruction set in both AMD and Intel processors.
X64 typically refers to the AMD-64 instruction set, which is the 64-bit instruction set that runs when the processor is set to long mode.
Intel-64 or X86-64 typically refers to Intels failed 64-bit implementation.

Anyway, give me a bit to look at the code; I'm a bit rusty with X86 code, but I'll post again if I find anything obviously wrong.
m
0
l
a b à CPUs
November 9, 2012 2:29:38 PM

Don't see anything obviously wrong, except:

;b.-------------------------------------------------------
mov esi, offset buffer ;Point to the buffer

I forget if X86 assembly is case sensitive or not; in either case, capitalizing OFFSET would be good practice. Don't see anything else obviously wrong at first glance; may play a bit at home over the weekend...

ASM actually isn't that hard to code, provided you understand basic program flow and think through the steps that need to be taken. I've used four or five different forms of ASM over my career, and I don't find it particularly challenging (slow and tedious, but not hard).
m
0
l
Related resources
November 9, 2012 2:31:26 PM

gamerk316 said:
Oh wow, been a while since I've looked at X86 assembly code...

Anyways, a few technical points:

X86 generally refers to the 32-bit instruction set in both AMD and Intel processors.
X64 typically refers to the AMD-64 instruction set, which is the 64-bit instruction set that runs when the processor is set to long mode.
Intel-64 or X86-64 typically refers to Intels failed 64-bit implementation.

Anyway, give me a bit to look at the code; I'm a bit rusty with X86 code, but I'll post again if I find anything obviously wrong.


It is not case sensitive, the only errors I have had were in the PROC question 2, and it seems to display the correct color for the quadrants but the numbers are off by one quadrant in a clockwise direction. Not sure what is causing it. :pt1cable: 

Thanks gamerk316 :) 
m
0
l
a c 117 à CPUs
November 9, 2012 2:42:20 PM

gamerk316 said:
Intel-64 or X86-64 typically refers to Intels failed 64-bit implementation.

The x86 in x86-64 stands for x86-64 being an extension to the x86 instruction set and that would be AMD's 64bits stuff.

IA64 is Intel's Itanium Architecture instruction set. There is no "x86" in Intel's Itanium instruction set names since they are completely unrelated to the legacy x86 instruction set..
m
0
l
a b à CPUs
November 9, 2012 4:31:24 PM

Duh, I should know that. *facepalm*
m
0
l
!