Thread: ASM w/ C++ issues

  1. #16
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Quote Originally Posted by Dino View Post
    I get the following error when running the above:
    Code:
    [Session started at 2008-09-19 17:16:13 -0500.]
    
    c_asm_misc has exited due to signal 4 (SIGILL).
    Intel Dual Core Xeon Mac.
    With what compiler and OS configuration? If it's 64-bit, then it won't be right, since push ECX will actually push a sign-extended 64-bit version of ECX.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  2. #17
    Jack of many languages Dino's Avatar
    Join Date
    Nov 2007
    Location
    Chappell Hill, Texas
    Posts
    2,332
    Ah. Mac OS X (Tiger) 10.4.11 with Intel Dual Core Xeon processors.
    Mainframe assembler programmer by trade. C coder when I can.

  3. #18
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    Quote Originally Posted by matsp View Post
    movzx - Move with Zero Extension: It loads the 16-bit value into a 32-bit register, and fills the remaining 16 bits with zero. It's counterpart for signed numbers is movsx, which fills the upper 16 bits with the content of bit 15 of the low 16 bits.
    Hmmm. But doesn't it just usually work to move a number directly into a register without 0-ing? I don't know if I've tried...

    jae - Jump Above or Equal. It's the same as JGE but for unsigned numbers.
    Aha!
    But then again, I've never encountered JGE before...

    And I can't continue to use ECX after the call, since it's one of the registers that can be used in the callee without preservation, so it would require another load before inc can be used on it. Of course, I could have picked another register...
    Another register is what I was thinking ;)

    And I never knew inc could work with other things than registers... that's cool.
    Thanks for the information. One step closer to an assembly expert
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. gcc asm code syntax
    By Uberapa in forum C Programming
    Replies: 4
    Last Post: 06-15-2007, 01:16 AM
  2. Understanding ASM
    By kuphryn in forum A Brief History of Cprogramming.com
    Replies: 26
    Last Post: 07-12-2002, 07:39 PM
  3. Inline asm
    By wavering in forum C Programming
    Replies: 2
    Last Post: 01-29-2002, 02:42 AM
  4. asm mov
    By manu in forum C++ Programming
    Replies: 1
    Last Post: 12-15-2001, 12:59 PM
  5. My graphics library
    By stupid_mutt in forum C Programming
    Replies: 3
    Last Post: 11-26-2001, 06:05 PM