What is the best 64 bit assembly book for beginners on a budget?

In summary, you need the Intel or AMD CPU reference manuals, a C program to produce C function names, and a 64 bit assembler.
  • #1
thankz
265
40
I need a good 64 bit assembly book for beginners, can you recommend one, I'm kinda short on cash so I can only afford one.

I have a few 32 bit books like -Linux assembly, high level assembly, and peter nortons assembly but I got to admit they aren't very good. I want to play around with turning my bios rom into a small operating system and messing with bootloaders and stuff. I only have a windows laptop so I guess i'll be using masm. question is their a 64 bit version? and where can I get it?

also I need to practice on an 8 bit assembler where can I find one that is like masm or runs in an emulator?

sorry to sound so needy lol, but I also am looking for the old intel cheat sheet, I think it was called the blue book or something(had it once) that list all the opcodes, operands and mnemonics
? the 8 bit and if it exists the 64 bit one.

I got the amd 64 bit programming manuals what else do I need, I'm just starting to get back into programming after years away from it.
 
Technology news on Phys.org
  • #2
Frankly, I am not even sure books on assembly are being written and published these days.

EDIT: I see that some books are "in store". The few that I checked out seem to be updates of books first published a decade or two ago. So I would guess Norton's book, which was first written in late 80's, should not be much worse.

If you have 32 bit books, stick with them even if they are not too good, make sure you can write a 32 bit program that actually works. The transition to 64 bits won't be too difficult after that.

The books you must have are Intel's/AMD's references/manuals on their CPUs. I have personally used mostly Intel's. They won't teach you how to write bootloaders and BIOSes, though. I do not think there is any book that will. In fact, writing those has very little to do with knowing how to write assembly code and much to do with how your chosen platform works from ground up. That is a lot of arcane knowledge and your best bet are open source implementations - study them and learn from them.

Masm is included with visual studio. I know that VS 2012 Express for Desktop (free version) had it, both 32 and 64 bit flavors. Not sure about later versions. GCC has an assembler as well.
 
Last edited:
  • #3
I have visual studio 2005 so i'll poke (lol)around and see if I can find it. I don't want to use at&t syntax and I'm only using windows right now so gcc is out. I was surprised to see a bunch of 64 bit asm books on amazon I just need a recommendation on which one to get. I have two books on bios's from the days when I wanted to be a virus writer lol so I'm comfortable exploring my computers internals.

ps please don't tell me to use debug.com to write asm lol, I really would like an 8 bit assembler or emu to practice on, if anyone can find those cheat sheets I really would appreciate it.
 
  • #4
What is an "8 bit assembler"? debug.com is a 16-bit assembler. I have not checked that in a while, but at least some time ago some 32-bit version of masm would produce 16 bit code, that was the question of using the SEGMENT directive correctly and then some linker options. The cheat sheets are the IA32 ref manuals I mentioned above.
 
  • #5
thankz said:
bios
The bios runs in 16 bit real mode, using 32 bit prefixes if needed to access 32 bit operands / registers. You'd need to setup some tables and switch to protected mode in order to run in 32 bit or 64 bit mode.

thankz said:
visual studio 2005 ... 64 bit asm ...
You need to be running on a 64 bit version of windows. VS2005 includes ml64.exe which is the 64 bit assembler. Note the "removal of older features" in this wiki article section:

http://en.wikipedia.org/wiki/X86-64#Architectural_features

For VS2005 64 bit assembler projects, I use a custom build step (instead of letting VS2005 default a build step for .asm source files). Right click on the .asm source file(s) and create a custom build step:

command line - debug:

ml64 /c /Zi /Fo$(OutDir)\example.obj example.asm

command line - release:

ml64 /c /Fo$(OutDir)\example.obj example.asm

outputs:

$(OutDir)\example.obj

To get C function names as used in assembly code, I write a dummy C program using /Fa option to produce assembly code to get the names.

example source for stand alone assembly code (using VS2005 / 64 bit windows):
Code:
_DATA   SEGMENT
_DATA   ENDS

_BSS    SEGMENT
_BSS    ENDS

        PUBLIC  wmain
        EXTRN   __imp_malloc:PROC
        EXTRN   __imp_free:PROC
        EXTRN   __imp_clock:PROC
        EXTRN   __imp_CreateFileW:PROC
        EXTRN   __imp_WriteFile:PROC
        EXTRN   __imp_CloseHandle:PROC

_TEXT   SEGMENT

wmain   PROC
        sub     rsp,64                  ;allocate stack space
;       ...
        add     rsp,64                  ;restore rsp
        xor     rax,rax
        ret     0
wmain   ENDP
_TEXT   ENDS
        END
 
Last edited:
  • #6
thanks for the replys, I have some catching up to do, i'll have some more questions in the future.
 
  • #7
I guess they don't have a 8 bit assembler, I was looking for something like this:
http://nanochess.110mb.com/emulator.html
 
Last edited by a moderator:
  • #8
Why do you need an 8080 assembler? It is very remotely related to IA32.
 
  • #9
I thought i'd start on something simple I'm just starting to remember things like little/big endian byte order you'll have to forgive me :)
 
  • #10
Stick with IA32/x64, forget 8080. Or go with ARM. Do not waste your time on dead platforms. The only reason to study 8080 would be an interest in the history of computing, which I guess is not what you are after.
 
  • #11
thankz said:
I need a good 64 bit assembly book for beginners, can you recommend one, I'm kinda short on cash so I can only afford one.

I have a few 32 bit books like -Linux assembly, high level assembly, and peter nortons assembly but I got to admit they aren't very good. I want to play around with turning my bios rom into a small operating system and messing with bootloaders and stuff. I only have a windows laptop so I guess i'll be using masm. question is their a 64 bit version? and where can I get it?

also I need to practice on an 8 bit assembler where can I find one that is like masm or runs in an emulator?

sorry to sound so needy lol, but I also am looking for the old intel cheat sheet, I think it was called the blue book or something(had it once) that list all the opcodes, operands and mnemonics
? the 8 bit and if it exists the 64 bit one.

I got the amd 64 bit programming manuals what else do I need, I'm just starting to get back into programming after years away from it.

If you want to go that far into bare metal, I would recommend picking up a cheap raspberry pi B and learning arm assembly language. The raspberry pi will set you back like 30 or 40 bucks. And you can buy a cellphone charger to power it (Just make sure it's rated above 750 mil Amp). Oh and get a flash card reader/writer! With absolute barebones, you'll have to get a serial adapter for it: https://www.amazon.com/gp/product/B008AGDTA4/?tag=pfamazon01-20
MASM64 or
http://www.japheth.de/JWasm.html

But I would recommend learning 32 bit first.

The 8 bit, 16 bit, 32 bit, 64 bit architectures just communicate how large the register sizes are going to be for that platform. So it defines the largest and smallest signed integer that can fit in a single addressable location. In addition, it also puts a limit on how much memory a computer can have because of the limit on the size of addressable locations. A 32 bit computer can have up to 2^32 = (2^2)(2^30) = 4 gigs of memory since we can only identify 2^32 locations.

On a 32 bit platform, the x86 architecture will have registers like eax, and it also provides smaller portions of eax:

eax - 32 bit register.
ax - The lower 16 bits of eax.
ah - the upper 8 bits of ax
al - the lower 8 bits of ax.

So if you wanted to play around with 8 bits, just limit yourself to stuff like al, bl, cl, dl, etc

But all of that being said, there should be a good reason for you to limit yourself. For example, suppose you want to write a platform that is going to operate on a battery powered cell phone that's using arm architecture. Even though you can use 32 bits, you might want to write the code in 16 bits and use thumb mode. Why? Under such a situation you're not trying to optimize for performance but power consumption.
 
Last edited:
  • #12
SixNein said:
A 32 bit computer can have up to 2^32 = (2^2)(2^30) = 4 gigs of memory since we can only identify 2^32 locations.
Pentium processors have supported 36 bit addressing for quite a while. The server versions of Windows and some other operating systems support. Each process is limited to a 4gb virtual memory space, and part of that may be reserved for the operating system (I'm not sure how much if any is reserved).

http://en.wikipedia.org/wiki/PSE-36

http://en.wikipedia.org/wiki/Physical_Address_Extension

SixNein said:
Even though you can use 32 bits, you might want to write the code in 16 bits and use thumb mode. Under such a situation you're not trying to optimize for performance but power consumption.
ARM thumb mode is mostly used to reduce code size. Power consumption is about the same and the resgisters are still 32 bits.
 
  • #13
rcgldr said:
Pentium processors have supported 36 bit addressing for quite a while. The server versions of Windows and some other operating systems support. Each process is limited to a 4gb virtual memory space, and part of that may be reserved for the operating system (I'm not sure how much if any is reserved).

http://en.wikipedia.org/wiki/PSE-36

http://en.wikipedia.org/wiki/Physical_Address_Extension

ARM thumb mode is mostly used to reduce code size. Power consumption is about the same and the resgisters are still 32 bits.

Yes, the limitation can be partially overcome with virtual memory; however, a pointer is always going to be limited to the register size and thus provide a limitation on addressable locations. In virtual memory, pointers point to tables instead of physical memory addresses. So there is an extra layer added there to get around this issue. How much will the OS reserve? The OS shouldn't require anything since its virtual and not physical memory. The OS will just swap these tables in and out when it needs to do some things.


Less obvious is the relation between code density and power. Achieving high code density can also help to improve power dissipation in systems where differing memory types have differing power implications. Any off chip data or instruction transaction will tend to dissipate more power than operations that keep everything on chip as generally more gates will be clocked and
more clock cycles will be required, however, on chip memory is limited in quantity.
Writing applications using Thumb instructions will enable more of the most frequently used code to be stored in on chip memory and so it can be said that higher code density can also be compatible with the aim of achieving low power.


http://www.cs.uiuc.edu/class/fa05/cs433ug/PROCESSORS/Thumb2.pdf
 

Related to What is the best 64 bit assembly book for beginners on a budget?

What is assembly language?

Assembly language is a low-level programming language that is used to directly control a computer's hardware. It is considered the closest level of abstraction to the computer's machine code, which is the binary code that the computer actually understands.

Why is learning assembly language important?

Learning assembly language can help you gain a deeper understanding of how computers work at a fundamental level. It also allows you to write programs that are highly optimized and efficient, making it a valuable skill for certain types of programming, such as embedded systems or operating systems development.

What are the advantages of using assembly language?

Assembly language offers a high degree of control over the computer's hardware, allowing for precise and efficient programming. It also has a small instruction set, making it easier to learn and understand compared to higher-level languages. Additionally, assembly language programs can often run faster and use less memory than programs written in higher-level languages.

What are the challenges of learning assembly language?

Assembly language can be difficult to learn and requires a strong understanding of computer architecture and binary operations. It also has a steep learning curve and can be time-consuming to write programs in. Additionally, assembly language is not as portable as higher-level languages, meaning that programs written in assembly may not be compatible with different computer architectures.

What resources are available for learning assembly language?

There are many resources available for learning assembly language, including online tutorials, books, and courses. Some popular assembly language tutorials and resources include "Assembly Language Step-by-Step" by Jeff Duntemann and "Programming from the Ground Up" by Jonathan Bartlett. There are also online communities and forums where you can ask questions and get support from other assembly language programmers.

Similar threads

  • Programming and Computer Science
Replies
16
Views
2K
  • Programming and Computer Science
Replies
5
Views
3K
Replies
6
Views
1K
  • Programming and Computer Science
2
Replies
60
Views
16K
  • Programming and Computer Science
Replies
18
Views
6K
  • Programming and Computer Science
Replies
1
Views
623
  • Engineering and Comp Sci Homework Help
Replies
7
Views
2K
  • Programming and Computer Science
Replies
15
Views
10K
  • Programming and Computer Science
Replies
2
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
2K
Back
Top