NASM - The Netwide Assembler

NASM Forum => Other Discussion => Topic started by: JohnG on April 14, 2023, 06:05:11 AM

Title: use of this code ?
Post by: JohnG on April 14, 2023, 06:05:11 AM
Hi all,

Can you tell me if I am missing something with this code. I do not fully understand it, besides its a compare and jmp if below.

cmp  0x7fffffe1, 7
jb  address

John
Title: Re: use of this code ?
Post by: Frank Kotler on April 14, 2023, 10:41:53 PM
What does Nasm say? I don't think:
Code: [Select]
cmp imm, imm
is valid.

Best,
Frank


Title: Re: use of this code ?
Post by: Deskman243 on June 30, 2023, 09:40:43 PM
Quote
cmp  0x7fffffe1, 7
jb  address

On inspection one could state that if the test value is a static variable it could be passed as a regular value where you would have to refer to the original source. Many times programmers use binary values for segmentation. This also counts as pass by reference I believe as a typical computer science concept.  In particular that number in binary is just a sequence of 1's besides e 1. The actual number should look like this 0111 1111 1111 1111 1111 1111 1110 0001. If you would like more of a review you can post the source code as a reference.
Title: Re: use of this code ?
Post by: fredericopissarra on June 30, 2023, 10:22:52 PM
What does Nasm say? I don't think:
Code: [Select]
cmp imm, imm
is valid.
Huh? I believe it is not valid... Here, from Intel's SDM:
(https://i.postimg.cc/nhh85mqy/cmp.png)
Title: Re: use of this code ?
Post by: Deskman243 on July 01, 2023, 12:49:42 AM
Good job guys who else would still get stuck on the basics haha. Like I had to check again because of how long I have been researching the same BIOS that I gotta realize data types are still a thing.