plc.myforum.ro Forum Index plc.myforum.ro
PLCs users www.plc.myforum.ro!
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

37 Basic Practices in Assembly Language Programming

 
Post new topic   Reply to topic    plc.myforum.ro Forum Index -> Programming
View previous topic :: View next topic  
Author Message
kosta
Member
Member


Joined: 09 Aug 2015
Posts: 161
Location: Salonic

PostPosted: 23/01/2017 20:43    Post subject: 37 Basic Practices in Assembly Language Programming Reply with quote

37 Basic Practices in Assembly Language Programming
Zuoliu Ding

Contents
Code:

    Introduction
    About instruction
        1. Using less instructions
        2. Using an instruction with less bytes
    About register and memory
        3. Implementing with memory variables
        4. If you can use registers, don’t use memory
    In concurrent programming
        5. Using atomic instructions
    Little-endian
        6. Memory representations
        7. A code error hidden by little-endian
    About runtime stack
        8. Assignment with PUSH and POP is not efficient
        9. Using INC to avoid PUSHFD and POPFD
        10. Another good reason to avoid PUSH and POP
    Assembling time vs. runtime
        11. Implementing with plus (+) instead of ADD
        12. If you can use an operator, don’t use an instruction
        13. If you can use a symbolic constant, don’t use a variable
        14. Generating the memory block in macro
    About loop design
        15. Encapsulating all loop logic in the loop body
        16. Loop entrance and exit
        17. Don’t change ECX in the loop body
        18. When jump backward…
        19. Implementing C/C++ FOR loop and WHILE loop
        20. Making your loop more efficient with a jump
    About procedure
        21. Making a clear calling interface
        22. INVOKE vs. CALL
        23. Call-by-Value vs. Call-by-Reference
        24. Avoid numeroase RET
    Object data members
        25. Indirect operand and LEA
    About system I/O
        26. Reducing system I/O API calls
    About PTR operator
        27. Defining a pointer, cast and dereference
        28. Using PTR in a procedure
    Unsigned and signed with CF and OF flags
        29. Comparison with conditional jumps
        30. When CBW, CWD, or CDQ mistakenly meets DIV...
        31. Why 255-1 and 255+(-1) affect CF differently?
        32. How to determine OF?
    Ambiguous "LOCAL" directive
        33. When LOCAL used in a procedure
        34. When LOCAL used in a macro
    Calling an assembly procedure in C/C++ and vice versa
        35. Using C calling convention in two ways
        36. Using STD calling convention in two ways
        37. Calling cin/cout in an assembly procedure
    Summary
    References



https://www.codeproject.com/Articles/1116188/Basic-Practices-in-Assembly-Language-Programming

https://www.codeproject.com/script/Articles/Download.aspx?file=/KB/miscctrl/1116188/LoopTestCode.zip&rp=https://www.codeproject.com/Articles/1116188/Basic-Practices-in-Assembly-Language-Programming
https://www.codeproject.com/script/Articles/Download.aspx?file=/KB/miscctrl/1116188/CallingAsmProcInC.zip&rp=https://www.codeproject.com/Articles/1116188/Basic-Practices-in-Assembly-Language-Programming


[URL=https://userscloud.com/zdqy1xvhvkje]CallingAsmProcInC.zip - 3 KB[/URL]
[URL=https://userscloud.com/k1h72dy9xzqh]LoopTestCode.zip - 35 KB[/URL]
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    plc.myforum.ro Forum Index -> Programming All times are GMT + 2 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Fa-ti si tu propriul forum GRATUIT, pe www.myforum.ro