Author Topic: use of this code ?  (Read 1491 times)

Offline JohnG

  • Jr. Member
  • *
  • Posts: 33
use of this code ?
« 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
« Last Edit: April 14, 2023, 06:48:38 AM by JohnG »

Offline Frank Kotler

  • NASM Developer
  • Hero Member
  • *****
  • Posts: 2665
  • Country: us
Re: use of this code ?
« Reply #1 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



Offline Deskman243

  • Jr. Member
  • *
  • Posts: 49
Re: use of this code ?
« Reply #2 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.

Offline fredericopissarra

  • Full Member
  • **
  • Posts: 365
  • Country: br
Re: use of this code ?
« Reply #3 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:
« Last Edit: June 30, 2023, 10:32:23 PM by fredericopissarra »

Offline Deskman243

  • Jr. Member
  • *
  • Posts: 49
Re: use of this code ?
« Reply #4 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.
« Last Edit: July 01, 2023, 01:04:40 AM by Deskman243 »