Register a free account to unlock additional features at BleepingComputer.com
Welcome to BleepingComputer, a free community where people like yourself come together to discuss and learn how to use their computers. Using the site is easy and fun. As a guest, you can browse and view the various discussions in the forums, but can not create a new topic or reply to an existing one unless you are logged in. Other benefits of registering an account are subscribing to topics and forums, creating a blog, and having no ads shown anywhere on the site.


Click here to Register a free account now! or read our Welcome Guide to learn how to use this site.

Generic User Avatar

A book for x64 intel windows ASM with nasm


  • Please log in to reply
7 replies to this topic

#1 zebanovich

zebanovich

  •  Avatar image
  • Members
  • 556 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:EU
  • Local time:07:12 AM

Posted 11 January 2023 - 01:32 PM

I have little experience with assembly language and would like to refresh my skills with a very specific book.

 

I'm looking for a book that teaches x64 asm with nasm assembler on windows for intel processors.

 

So far I have plenty of books but none that will be specific for my interests, if you have some suggestions that would be great.



BC AdBot (Login to Remove)

 


#2 SamHobbs

SamHobbs

  •  Avatar image
  • Members
  • 72 posts
  • OFFLINE
  •  
  • Local time:10:12 PM

Posted 12 January 2023 - 11:56 PM

I studied the IBM 370 Principles of Operation more than half a century ago. I am not suggesting that for you look at that at all since it is for a very different type of processor.

 

I do suggest reading the Intel documentation of their processors. When I first began learning 80286 assembler (an early version of "X64 assembly") the documentation was not free and was relatively costly. You don't realize how good it is for you that there are very many resources available for free. I believe back then there were no assemblers of Intel processor machine language available for free.

 

Note that the only difference between X32 (whatever you want to call it) and X64 is the size of the addresses. The machine language operation codes and the formats are exactly the same and you are not likely to notice any difference in the assembly source code.


Edited by SamHobbs, 13 January 2023 - 12:09 AM.


#3 zebanovich

zebanovich
  • Topic Starter

  •  Avatar image
  • Members
  • 556 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:EU
  • Local time:07:12 AM

Posted 13 January 2023 - 06:46 AM

Thank you for reply, I believe you when you say that in previous times it was hard to get learning resources for asm, a lot of "older" coders say that,

but now all it takes is to search google and there is a lot of choice, agree with that.

 

However books for nasm are still rare, most of them don't touch new registers and instructions so I decided to go with masm because there are good books for MS assembler.

 

 

 

 

I do suggest reading the Intel documentation of their processors.

 

It's very difficult to learn anything out of it for someone who is not skilled like me, I'll read it only once I feel comfortable to write code without a web browser  :)

 

Note that the only difference between X32 (whatever you want to call it) and X64 is the size of the addresses. The machine language operation codes and the formats are exactly the same and you are not likely to notice any difference in the assembly source code.

 

Yes, I noticed the major difference is new registers and instruction sets, however I very dislike MS syntax and how ml works, nasm syntax feels more natural and easier to understand.

For now I guess I'll have to stick with "necessary evil" that is MS syntax and then switching to nasm may be easier.


Edited by zebanovich, 13 January 2023 - 06:46 AM.


#4 SamHobbs

SamHobbs

  •  Avatar image
  • Members
  • 72 posts
  • OFFLINE
  •  
  • Local time:10:12 PM

Posted 13 January 2023 - 03:10 PM

I believe you when you say that in previous times it was hard to get learning resources for asm 
However books for nasm are still rare, most of them don't touch new registers and instructions so I decided to go with masm because there are good books for MS assembler.

I seem to not have been clear. As far as I know, there have always been books about assembler for various types of processors. Perhaps more in the past. What I meant to say is that the documentation of a processor's machine language tends to be more precise and complete than for most other programming documentation. It does however take time to understand.
 

Yes, I noticed the major difference is new registers and instruction sets

I was referring the term X64 asm (implying 64-bit) and compared it to referencing machine instructions for 32-bit. I sure am not aware of any difference in registers and instruction sets between 32-bit and 64-bit except for the size of the addresses. People often compare 32-bit and 64-bit in the manner that implies 64-bit adds features but it does not, at least not for Intel architecture processors.



#5 zebanovich

zebanovich
  • Topic Starter

  •  Avatar image
  • Members
  • 556 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:EU
  • Local time:07:12 AM

Posted 13 January 2023 - 04:41 PM

Are XMM, YMM, RAX-R15 not new registers?

Also don't SSE and AVX bring new instruction sets?

 

I know those registers overlap over 32 bit registers, but XMM and YMM don't and began to exist after 90's

Also segment registers are no longer needed or used for X86_64 asm

 

So I think it's not only about address size, but you know better than me because I wrote not a single line for old CPU's


Edited by zebanovich, 13 January 2023 - 04:43 PM.


#6 SamHobbs

SamHobbs

  •  Avatar image
  • Members
  • 72 posts
  • OFFLINE
  •  
  • Local time:10:12 PM

Posted 13 January 2023 - 05:38 PM

First, I think the problem is that you said X64 when you should have said X86. All this discussion of X64 and X32 would not be relevant if you had said X86. The term X86 refers to the 8086 processors and subsequent processors such as 80286 and Pentium.
 
I have not done any assembly language for more than two decades. When I look at X86-64 Instruction Encoding - OSDev Wiki I think it is saying that the XMM and YMM registers correspond to the AL, AX and corresponding other registers, depending on the address size of the processor. I don't know for sure but I assume that the corresponding opcodes would be the same for all processors.

 
Intel has added features to newer processors and some of the newer features might (probably some but I do not know) be only available for X64 processors. The additional features would likely have new opcodes.
 
Segment registers are used in Real Mode and only Real Mode. The PDF available from Minimum Steps Necessary to Boot an Intel® Architecture Platform says:
 

For supporting legacy Operating Systems, some form of Real Mode code must
be present during system run-time to handle requests from the Operating
System.


Real Mode (segment registers) exist in all X86 processors but certainly is not used for "modern" operating systems.


Edited by SamHobbs, 13 January 2023 - 05:41 PM.


#7 zebanovich

zebanovich
  • Topic Starter

  •  Avatar image
  • Members
  • 556 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:EU
  • Local time:07:12 AM

Posted 13 January 2023 - 07:22 PM

To be honest with you I was confusing "X86" for "32-bit" for a very long time until I started learning assembly and discovered that these 2 terms do not represent the same thing.

I still confuse these things, you know when you get to learn things wrong it's difficult to get rid of wrong knowledge, it's sticks with me like a curse.

 

Anyway I'm starting to like learning assembly no matter how difficult, varied or demanding it is.



#8 SamHobbs

SamHobbs

  •  Avatar image
  • Members
  • 72 posts
  • OFFLINE
  •  
  • Local time:10:12 PM

Posted 14 January 2023 - 09:14 PM

To be honest with you I was confusing "X86" for "32-bit" for a very long time until I started learning assembly and discovered that these 2 terms do not represent the same thing.
I still confuse these things, you know when you get to learn things wrong it's difficult to get rid of wrong knowledge, it's sticks with me like a curse.

I know that people make up terms that can be very confusing. People often do not use their brain and often do not care about being considerate of others.

In this situation it is easier to understand what X86 means if you understand it refers to the processor architecture and related stuff. It is easy for me because I was an adult in the day the IBM PC was initially released using an 8086 processor (actually 8088 but the difference is insignificant) and the 80286, 80386 and 80486 processors.

Sure, go ahead and learn assembler. It can at least help you to understand some of the technicalities of computers. It can be fun and interesting. You can get excited about getting down to the lowest level of the processor. For a carrier the opportunities for employment are likely limited.




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users