[Solved] x86 assembly – masm32: absolute breakdown of multiplication and division [closed]

The answer to this question can be very easily found by looking at the proper page of the Intel 64 and IA-32 Instruction Set Reference. In this case, you’re looking for the MUL and DIV instructions (in case you’re operating on unsigned operands) or IMUL and IDIV instructions, which are used for signed integer multiplication … Read more

[Solved] how does assembler convert from assembly to machine code?

Please try to limit your questions to one question per question. Neverthless, let me try and answer them. Question 1 An “assembly compiler” is called an “assembler.” Assembly is assembled, not compiled. And the assembler is not specific to C++. It is specific to the architecture and can only be used to assemble assembly programs … Read more

[Solved] Positive, negative and zero (assembly)

What’s wrong with my code? I only had a quick look at your program, so my answer may be wrong: LDD 0,Y Obviously you are operating with 16 bit numbers. Otherwise you would use LDA or LDB instead of LDD. CPY #(ARRAY+QUANTITY-1) This would be correct if QUANTITY is the size of the array in … Read more

[Solved] Should all code compiled for 32 bit machines be in 4 byte chunks?

Instruction size does not related to data or address bus size. Some 16-bit x86 CPUs have 3 totally different sizes with 8-bit data bus, 20-bit address bus and variable length instruction size. Modern 32-bit or 64-bit x86 have variable length instruction too for backward compatibility. Just look at the movl $0x542412e6, %eax and pushl 0x08048dd6 … Read more

[Solved] NASM – Variable Basics

‘mystring + 1’ is the address of the second byte of the string. mov al, mystring + 1 stores (the least significant byte of) that address in al. To indicate that you don’t want to store the address but the byte located at that address, write this: mov al, [mystring + 1] To declare a … Read more

[Solved] How to Self checksuming work?

I think there is a problem with trying to put the checksum or hash directly into your executable. Such an approach would mean that the checksum/hash is going to be taken into account when determining the checksum/hash of your executable/binary. You can’t encode the checksum/hash without affecting the resulting hash/checksum of the binary/executable. Without knowing … Read more

[Solved] How to convert for loop in c++ to assembler?

Next is the code for the “for” statement converted into assembler, register EDI is used as the control variable “i”, if EDI is been changed by “encrypt21”, just push it before and pop it after “call encrypt21” to preserve-restore its value. I changed the parameter “length” by “len” because the name gave me problems : … Read more