Jump to content
View in the app

A better way to browse. Learn more.

Tuts 4 You

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Help On The Fx Of This Code

Featured Replies

Posted

i saw below code in one tutorial, but i dont understand what it means

==============

01 MOV ECX, FFFFFFFF

02 SUB EAX, EAX

03 REPNZ SCASB

04 NOT ECX

05 DEC ECX <== length

==============

the tut said it's used to calculate the length of the string/char

and ECX mean say the length

line 01: mov -1 to ECX

line 02: EAX-EAX=> ZF=1

line 03: ???????

line 04: NOT ECX

line 05: ECX=ECX-1

can anyone help...

:worthy:

You will find a help file in the MASM32 package which explains the intel opcodes

For example

REPNE/REPNZ - Repeat Not Equal / Repeat Not Zero

Usage: REPNE

REPNZ

Modifies flags: None

Repeats execution of string instructions while CX != 0 and the Zero

Flag is clear. CX is decremented and the Zero Flag tested after

each string operation. The combination of a repeat prefix and a

segment override on processors other than the 386 may result in

errors if an interrupt occurs before CX=0.

Clocks Size

Operands 808x 286 386 486 Bytes

none 2 2 2 1

F2 A6 REPNE CMPS m8,m8 Find matching bytes in ES:[(E)DI] and DS:[(E)SI]

F2 A7 REPNE CMPS m16,m16 Find matching words in ES:[(E)DI] and DS:[(E)SI]

F2 A7 REPNE CMPS m32,m32 Find matching doublewords in ES:[(E)DI] and DS:[(E)SI]

F2 AE REPNE SCAS m8 Find AL, starting at ES:[(E)DI]

F2 AF REPNE SCAS m16 Find AX, starting at ES:[(E)DI]

F2 AF REPNE SCAS m32 Find EAX, starting at ES:[(E)DI]

It's worthwhile to install the MASM package and extract the opcode helpfile. Helps answer questions like this.

EDIT : I've attached the full set of MASM help files.

In this case the REPNZ will keep searching the bytes in the string referenced by EDI (and decrementing ECX) until it finds a zero value. Not of ECX then has the string length +1.

Ziggy

MASM_HelpFiles.zip

A nice website to check out if you come across instructions you are unsure about:

http://faydoc.tripod.com/cpu/index_r.htm

Hope it helps you... :)

Ted.

thanks both of you anyway :thumbsup:

and your suggestions are very useful

i 've found out it's becase of the tutorial,

there is something missed in the code,

and here is the full code i found finally

MOV EDX,EAX

MOV ECX,-1

SUB EAX,EAX

REPNE SCAS BYTE PTR ES:[EDI]

NOT ECX

DEC ECX

:hug:

Create an account or sign in to comment

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.