logo
down
shadow

Why is the comparing instruction not working?


Why is the comparing instruction not working?

By : AJL
Date : November 21 2020, 07:01 PM
help you fix your problem So I have a simple assembly code in 8086 that compares the value in the variable value with 100 and if it's greater it prints out: "The value is greater than 100" and if not: "The value is not greater than 100". ,
code :
lea ax, value
cmp ax, 100d
jae StatementWrong
mov al, value
mov al, [value]
cmp al, 100
jng StatementWrong
  mov  al, [value]
  cmp  al, 100
  lea  dx, right    ; "The value is greater than 100$"
  jg   Ending       ; JG means JUMP IF GREATER
  lea  dx, wrong    ; "The value is not greater than 100$"
Ending:
  mov  ah, 09h
  int  21h


Share : facebook icon twitter icon
ARM Assembly: How to set more than one comparing for executing a instruction?

ARM Assembly: How to set more than one comparing for executing a instruction?


By : Jignesh
Date : March 29 2020, 07:55 AM
Hope that helps I try to change this code into ARM without using Jump instructions :
code :
if a == 0 || b == 1 then c:=10  else c:=20;
CMP r0, #0      ; compare a with 0
CMPNE r1, #1    ; compare b with 1 if a!=0
MOVEQ r3, #10   ; a is 0, and/or b is 1 -> set c = 10
MOVNE r3, #20   ; a is not 0, and b is not 1 -> set c = 20
if d == 0 && e == 1 then f:=30  else c:=40;
CMP r0, #0      ; compare d with 0
CMPEQ r1, #1    ; compare e with 1 if d==0
MOVEQ r3, #30   ; d is 0, and e is 1 -> set f = 30
MOVNE r3, #40   ; d isn't 0, and/or e isn't 1 -> set f = 40
What is assembly cmp instruction comparing exactly?

What is assembly cmp instruction comparing exactly?


By : Hooman Badiefar
Date : March 29 2020, 07:55 AM
To fix this issue You seem to have done everything right, except you didn't provide MCVE and didn't show gdb log. You are correct that ZF should NOT be set. Maybe you used gdb wrong.
code :
6           mov dword [rbp-0xc], -24
(gdb) s
7           mov eax, 1000
(gdb)
8           cmp eax, dword [rbp-0xc]
(gdb)
9           jle foo
(gdb) p/d $eax
$1 = 1000
(gdb) x/wd $rbp-0xc
0x7fffffffe254: -24
(gdb) p $eflags
$2 = [ CF PF IF ]
13 error (type doesn't match) when comparing two dates within a conditional instruction (vba)

13 error (type doesn't match) when comparing two dates within a conditional instruction (vba)


By : Kuba Sękowski
Date : March 29 2020, 07:55 AM
like below fixes the issue This will happen if the value isn't a date (eg. February 29th isn't coming this year). You can test this with IsDate before setting the typed variable.
Another way would be using DateDiff, but you'd likely end up with the same problem there.
code :
Sub Test()
    Dim s As String
    Dim d As Date

    s = "12/12/2017"
    d = CDate(s)
End Sub
Assembly comparing instruction

Assembly comparing instruction


By : Paulo Ribeiro
Date : March 29 2020, 07:55 AM
I wish this help you Forget about the assignment for now.
If there were 12345 values and you were asked to find the highest and lowest value, how would you do it? The obvious way is to keep track of the "current highest value" and "current lowest value"; and for each value in the list you'd check to see if it should become the new highest value or the new lowest value.
What am I comparing to? No CMP instruction in assembly code before JNE

What am I comparing to? No CMP instruction in assembly code before JNE


By : Dimetrius Bass
Date : March 29 2020, 07:55 AM
Hope this helps cmp edx, 1 changes the flags exactly like sub edx, 1, only it doesn't update edx. This means that instead of doing a cmp and sub in a loop, you only need to do sub
Related Posts Related Posts :
  • In MIPS Assembly, how do I truncate to two decimal places if I have a floating point value X.YZDEF in a floating point r
  • How to shift a binary number by filling MSB with 1?
  • How many byes is each instruction compiled to in x86 assembly?
  • How to write to the console in fasm?
  • reading a BYTE as a DWORD in Masm
  • Print double-word number to string
  • 8086 assembly right mouse click interrupts
  • how to replace a text in a file in assembly using DOS instruction
  • How to pass argv arguments to execv in asm on 64-bit (linux)
  • What's the difference between the "/FAs command line option" (generate asm output) or the "Goto Disassemb
  • I am not understanding this assemby language program for what(what will be the input or output)
  • Loading the red component of a 24-bit bitmap image into an array
  • How do old CPUs execute the new ENDBR64 and ENDBR32 instructions?
  • Finding GCD of an array of n numbers in assembly without external variables
  • Is it possible to get LLVM-IR from Assembly file?
  • Which value does EDX have after logic NEG and AND instructions?
  • intterrupt that checks if a key was pressed and reads which key it was
  • Objdump swapping fsubrp to fsubp on compiled assembly?
  • Working with percentages using integer division in x86 assembly
  • IDIVQ instruction works odd . . . 16 mod 100 = 0?
  • ASSUME directive using masm
  • shift right and shift left assembly language
  • Is it possible to wake up intel cores with INIT-SIPI-SIPI sequence with all cores in real mode?
  • Bit Difference between 2 binary numbers in MIPS Assembly
  • How to find minimum signed value in array in assembly
  • MIPS: load byte instruction
  • How to deny or invert the memory address
  • Reverse byte order in XMM or YMM register?
  • How to print ASCII array in Assembly?
  • What does it mean by a branch penalty?
  • Copying to arrays in NASM
  • Is there any valid use for a sign-preserving left shift?
  • How does CPU perform operation that manipulate data that's less than a word size
  • Check if user input leads to overflow
  • Get C string length of a 16 or 32-byte fixed-size buffer? (XMM or YMM register width)
  • MIPS little or big endian when encoding as hex
  • How to calculate the sum of a sequence of powers of 2 in x86?
  • How to make timer works? Call int 4ah 5 seconds after start
  • Dword conversion to dec in little endian
  • Is there a way to subtract packed unsigned doublewords, saturated, on x86, using MMX/SSE?
  • What does a program (the assembly) that uses a GPU even look like?
  • Register content after execution
  • Explain how the flags work in conditional jumps in Assembly language
  • segmentation fault while trying to run graphics in yasm
  • How to alloc a segment of memory using BIOS service?
  • Sum of two numbers (each 2 characters) in assembly 8086
  • How does LLVM handle the x86 flag register?
  • How to read hardware input using emu8086
  • Assigning value to the variable present in previous line using $ sign
  • Different Segments may collapse with each other
  • How do we track values of different registers while coding a large program
  • Floating-point addition assembly algorithm
  • How would i make this a decryption instead of an encryption?
  • Do two consecutive labels form two different basic block or are they the same in assembly
  • How to make audio driver for MS-DOS?
  • Where is the time stamp located in a file? Want to change it using assembly
  • 8086 assembly register indirect MOV instruction
  • Which 2 cases aren't solved with this code?
  • Finding first and last capital letter in user input
  • I want to convert x86 Linux shellcode with system calls to ARM Linux system calls
  • shadow
    Privacy Policy - Terms - Contact Us © 35dp-dentalpractice.co.uk