News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests

Main Menu

Brand new loop instruction discovered

Started by jj2007, August 07, 2015, 02:23:33 AM

Previous topic - Next topic

jj2007

Works only with the latest MASM version, or with JWasm:

include \masm32\MasmBasic\MasmBasic.inc      ; download
  Init
  mov ecx, 66666
  @@:
  Print Str$(ecx), " "
  loopnew @B
  Exit
end start

K_F

'Sire, Sire!... the peasants are Revolting !!!'
'Yes, they are.. aren't they....'

dedndave

1) is this a MasmBasic thing ?
2) isn't ECX destroyed in the Print call ?
3) what Van said - lol

sinsi

 :lol: ml 6.15 has no problem with it either (as it shouldn't)

dedndave

but - what opcode is generated ?
it's probably an alias for one of the well-known LOOPxx instructions

jj2007

Quote from: dedndave on August 07, 2015, 08:47:40 PMit's probably an alias for one of the well-known LOOPxx instructions

Congrats, you are very close :t

LOOPNEW is "loop non-equal word sized". It loops as long as the zero flag is not set and cx>0.

;)

P.S.:
> 1) is this a MasmBasic thing ?
No, works with ML 6.14

> 2) isn't ECX destroyed in the Print call ?
Not in MasmBasic

> 3) what Van said - lol
I just discovered it :biggrin:

habran


ins (LOOP,   loop,       OpCls( I8,   NONE,  NONE  ), 0,      0,  no_RM,  0xE2,     0x00,   P_86,    0)
ins (LOOPE,  loope,      OpCls( I8,   NONE,  NONE  ), 0,      0,  no_RM,  0xE1,     0x00,   P_86,    0)
ins (LOOPZ,  loopz,      OpCls( I8,   NONE,  NONE  ), 0,      0,  no_RM,  0xE1,     0x00,   P_86,    0)
ins (LOOPNE, loopne,     OpCls( I8,   NONE,  NONE  ), 0,      0,  no_RM,  0xE0,     0x00,   P_86,    0)
ins (LOOPNZ, loopnz,     OpCls( I8,   NONE,  NONE  ), 0,      0,  no_RM,  0xE0,     0x00,   P_86,    0)
ins (LOOPD,  loopd,      OpCls( I8,   NONE,  NONE  ), F_32A,  0,  no_RM,  0xE2,     0x00,   P_386,   0)
ins (LOOPED, looped,     OpCls( I8,   NONE,  NONE  ), F_32A,  0,  no_RM,  0xE1,     0x00,   P_386,   0)
ins (LOOPZD, loopzd,     OpCls( I8,   NONE,  NONE  ), F_32A,  0,  no_RM,  0xE1,     0x00,   P_386,   0)
ins (LOOPNED,loopned,    OpCls( I8,   NONE,  NONE  ), F_32A,  0,  no_RM,  0xE0,     0x00,   P_386,   0)
ins (LOOPNZD,loopnzd,    OpCls( I8,   NONE,  NONE  ), F_32A,  0,  no_RM,  0xE0,     0x00,   P_386,   0)
insx(LOOPW,  loopw,      OpCls( I8,   NONE,  NONE  ), F_16A,  0,  no_RM,  0xE2,     0x00,   P_86,    0, RWF_IA32)
insx(LOOPEW, loopew,     OpCls( I8,   NONE,  NONE  ), F_16A,  0,  no_RM,  0xE1,     0x00,   P_86,    0, RWF_IA32)
insx(LOOPZW, loopzw,     OpCls( I8,   NONE,  NONE  ), F_16A,  0,  no_RM,  0xE1,     0x00,   P_86,    0, RWF_IA32)
insx(LOOPNEW,loopnew,    OpCls( I8,   NONE,  NONE  ), F_16A,  0,  no_RM,  0xE0,     0x00,   P_86,    0, RWF_IA32)
insx(LOOPNZW,loopnzw,    OpCls( I8,   NONE,  NONE  ), F_16A,  0,  no_RM,  0xE0,     0x00,   P_86,    0, RWF_IA32)
Cod-Father