Update 15 August (
download):
Qcmp, Ocmp.data
; for testing
qSmall qWORD 7700000000000001h
qBig qWORD 7700000000000003h
oSmall OWORD 77000000000000000000000000000001h
oBig OWORD 77000000000000000000000000000003h ; OWORD for JWasm and higher ML.exe versions
; oBig qWORD 00000000000000003h, 7700000000000000h ; 2 QWORDS for ML 6.15
.code
Qcmp qBig, qSmall
; compare two global variables mov ecx, offset oBig
; use a pointer ... Ocmp ecx, oSmall
; ... for one (or both) of them movups xmm0, OWORD PTR oSmall
; even ML 6.15 understands that oqDeb=1 ; if this flag is set, Qcmp or Ocmp print e.g. "ecx greater xmm0" to console Ocmp ecx, xmm0
; a pointer and an XMM reg (xmm0...xmm2 will be trashed) deb 4, "Result", flags
; CzSo
, i.e. Carry? and Sign? setRem - returns flags as in a cmp eax, edx comparison (control for overflow!)
- trashes eax and edx, xmm0 and xmm1; do not use edx as input
- you cannot use both ecx and ebx as input pointers (an error will be thrown)
## for comparing floats (REAL4, REAL8, REAL10): ##
Fcmp
MyPI_hi REAL4 3.14160
...
Fcmp MyPI_hi,
PI, medium
; PI is what you think it is .if
FcmpLesser Print Str$("MyPI_hi at %f is lower than the real PI\n", MyPI_hi)
.elseif Zero?
Print Str$("MyPI_hi at %f is exact\n", MyPI_hi)
.else
Print Str$("MyPI_hi at %f is higher than the real PI\n", MyPI_hi)
.endif
Rem - returns Zero? and Sign? flags (and only these are valid): Sign? means "first arg below second arg"
- you may use
FcmpGreater and
FcmpLess (aka
!Sign? and Sign?)
- single arg, e.g.
Fcmp xmm1, tests for zero
- see also QCmp and Ocmp for comparing QWORDs and OWORDs
- almost any number formats can be compared, including xmm registers etc