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.

(M)ASM <-> C/C++

Featured Replies

Posted

Hello,

i wanted to ask if someone knows something like a comparison-list of (m)asm and c/ c++ functions. I understand both languages and can write and read it, but a list which compares functions would be nice.

What i mean for example:

ASM

mov eax, value1
cmp eax, value2
//code
mov eax, 5
//code
mov value3, eax

C

if (value1 == value2)
{
value3 = 5;
}

Maybe the examples don't match very well but it should be something similar i guess (cant test it right now..).

So what i am asking is if there is somewhere a list where i can see how common functions/ instructions look like in asm <-> c?

It would be nice to see quickly when i have some asm instructions how the appopriate c function would look like (if-else, loops, strlen, memcpy, ...)

Edited by unix

Hacker Disassembling Uncovered has a section called "Identifying Key Structures of High-Level Languages", you'll find similar information in other publications as well. Or you could do it on your own, code a small C program and analyze the disassembly.

Sometimes it is harder though, if using VC++ because of MS optimization. What you write in your C/C++ code will differ greatly or only a little, depending on your optimization settings.

HR,

Ghandi

Edited by ghandi

Reminds me of VC++ "optimizing" a "mov dword ptr [00000000], eax" into my code... and no, the C code didn't contain any static zero pointer. ;)

  • Author

Thank you, guess i will look for a copy of Hacker Disassembling Uncovered as i wanted to read it anyway. Thanks :)

Sometimes it is harder though, if using VC++ because of MS optimization. What you write in your C/C++ code will differ greatly or only a little, depending on your optimization settings.

I tried that first but got "stuck" because of this.

this discussion is not about masm like the topic says.

if i would code that in masm it would look like in c

//c

if (value1 == value2)

{

value3 = 5;

}

;---masm---

mov eax,value2

.if value1 == eax

mov value3,5

.endif

c:

if (value1 == value2)

{

value3 = 5;

}

Fasm:(http://flatassembler.net/)

format PE GUI 4.0

entry start

value1 equ 1

value2 equ 1

value3 db ?

start:

mov eax,value1

cmp eax,value2

jne lable

mov eax,5

mov byte [value3],al

lable:

; exit

Edited by by:70

  • Author

Thanks for your replys. :)

@diablo2oo2: Can you recommend a good book or other resource about "real" masm programming?

I tried Art of Assembly Language but it seems to be High Level Assembly..

edit: except iczelions and gobbits from arteam of course.

Edited by unix

Iczelion's-Tutorial's (recommend)

http://tuts4you.com/download.php?view.1200

post-41139-1240894253_thumb.jpg

Edited by Teddy Rogers
You could just link to the tutorial... :)

  • Author

Thanks by:70, i like the two references ;)

Iczelion's-Tutorial's are great too, but i was looking for other ones as i am already working on them ;)

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.