How to Calculate Jump Target Address and Branch Target Address?

(In the diagrams and text below, PC is the address of the branch instruction itself. PC+4 is the end of the branch instruction itself, and the start of the branch delay slot. Except in the absolute jump diagram.) 1. Branch Address Calculation In MIPS branch instruction has only 16 bits offset to determine next instruction. … Read more

ASM: MASM, NASM, FASM?

MASM (Microsoft Assembler) is the popular assembler for Windows. MASM is for 16-bit and 32-bit applications(x86). ML64 is the one for 64 bit sources (AMD64/x86-64) NASM (Netwide Assembler) is the popular assembler for Linux but is available on Windows too. NASM supports 16-bit, 32 bit and 64 bit programs. FASM (Flat Assembler) is available for … Read more

What does cltq do in assembly?

Mnemonic cltq is the gas mnemonic for Intel’s cdqe as documented at: https://sourceware.org/binutils/docs/as/i386_002dMnemonics.html The mnemonics are: Convert Long To Quad (cltq): AT&T-style Convert Double to Quad Extend (cdqe): Intel Terminology: quad (aka quad-word) == 8 bytes long (AT&T) == double-word (Intel) == 4 bytes This is one of the few instructions whose GAS name is … Read more

Difference between: Opcode, byte code, mnemonics, machine code and assembly

OPCODE: It is a number interpreted by your machine(virtual or silicon) that represents the operation to perform BYTECODE: Same as machine code, except, its mostly used by a software based interpreter(like Java or CLR) MNEMONIC: English word MNEMONIC means “A device such as a pattern of letters, ideas, or associations that assists in remembering something.”. … Read more

x86_64 best way to reduce 64 bit register to 32 bit retaining zero or non-zero status

Fewest uops (front-end bandwidth): 1 uop, latency 3c (Intel) or 1c (Zen). Also smallest code-size, 5 bytes. popcnt %rax, %rax # 5 bytes, 1 uop for one port # if using a different dst, note the output dependency on Intel before ICL On most CPUs that have it at all, it’s 3c latency, 1c throughput … Read more

A good NASM/FASM tutorial? [closed]

There is e.g. Writing A Useful Program With NASM and of course the obvious http://www.nasm.us/doc/nasmdoc3.html. There are a couple of sample programs at http://www.csee.umbc.edu/help/nasm/sample.shtml If you are looking for a more general introduction to assembly programming there is The Art of Assembly Programming and the wikipedia page on NASM references Assembly Language Step by Step … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)