Results 1 to 2 of 2

Thread: Inline ASM, and questions please help

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2000
    Location
    Texas
    Posts
    313

    Inline ASM, and questions please help

    Can someone help me out with inline asm in c++

    1.) How do u work with paramiters?

    void asmfunc(int x, int y)
    {
    asm
    {
    mov ax, x
    mov dx,y
    }
    }

    is that how you work with paramiters?

    2.) How do you do return functions?

    3.) if i were to just use if statments, and for loops, and write my own display functions ect...would it not use dos?

    4.) how do I make a com file?

    5.) how do i boot to the program i make, in other words how do i make a boot disk?

    Thank you so much

  2. #2
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    C++ requires too much overhead to realistically be used as a bootable image. You actually need to code directly in ASM for this.
    The compiler will still bring in DOS-related things so there's very little you can do But, here's a few answers for you:

    1) Are you 32-bit or 16-bit? If 16, then that's right, if 32-bit, then you need to use the E registers (EAX, EDX).

    2) Before you exit the function, place the return value into EAX.

    3) Technically no, but it's compiler dependent what it does.

    4) Use a 16-bit compiler and the TINY memory model, then use EXE2BIN on it. Otherwise just use an assembler.

    5) I have no idea -- check the Linux documentation
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width