Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. help! inline assemble

help! inline assemble

Scheduled Pinned Locked Moved C / C++ / MFC
c++helptutorialquestion
9 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    jfk_lili
    wrote on last edited by
    #1

    hi guys, is there any tutorials relate to how to pass variables from normal c++ program to inline assemble? and how to change it from character form or integer form to binary form? thank u very much in advance! =)

    P 1 Reply Last reply
    0
    • J jfk_lili

      hi guys, is there any tutorials relate to how to pass variables from normal c++ program to inline assemble? and how to change it from character form or integer form to binary form? thank u very much in advance! =)

      P Offline
      P Offline
      Prakash Nadar
      wrote on last edited by
      #2

      humm

      main()
      {
      int x=6;
      asm
      {
      mov ax,x;
      mov x,69;
      }
      }

      This doesnt work??


      P.R.A.K.A.S.H

      J 1 Reply Last reply
      0
      • P Prakash Nadar

        humm

        main()
        {
        int x=6;
        asm
        {
        mov ax,x;
        mov x,69;
        }
        }

        This doesnt work??


        P.R.A.K.A.S.H

        J Offline
        J Offline
        jfk_lili
        wrote on last edited by
        #3

        but when i use main() { int x=6; asm{ mov dx,37Ah mov al,x out dx, al } } i always get a error message "operand size conflict".. i really dont know wat's going wrong in here, since it's my first time to use inline assemble thank u =)

        P 1 Reply Last reply
        0
        • J jfk_lili

          but when i use main() { int x=6; asm{ mov dx,37Ah mov al,x out dx, al } } i always get a error message "operand size conflict".. i really dont know wat's going wrong in here, since it's my first time to use inline assemble thank u =)

          P Offline
          P Offline
          Prakash Nadar
          wrote on last edited by
          #4

          jfk_lili wrote: mov al,x its wrong, al is 8 bit, int is 16 bit, you should do mov ax,x out dx,al


          P.R.A.K.A.S.H

          J 1 Reply Last reply
          0
          • P Prakash Nadar

            jfk_lili wrote: mov al,x its wrong, al is 8 bit, int is 16 bit, you should do mov ax,x out dx,al


            P.R.A.K.A.S.H

            J Offline
            J Offline
            jfk_lili
            wrote on last edited by
            #5

            but after i hv changed the code to wat u suggest, it still got such a error message. relate to "out dx,al". it's still a "operand size error"

            P 1 Reply Last reply
            0
            • J jfk_lili

              but after i hv changed the code to wat u suggest, it still got such a error message. relate to "out dx,al". it's still a "operand size error"

              P Offline
              P Offline
              Prakash Nadar
              wrote on last edited by
              #6

              Gees I dont know why its not compiling :confused: i know the instructino is valid. sorry i cant help you more, i am out of ideas:-O


              P.R.A.K.A.S.H

              J 2 Replies Last reply
              0
              • P Prakash Nadar

                Gees I dont know why its not compiling :confused: i know the instructino is valid. sorry i cant help you more, i am out of ideas:-O


                P.R.A.K.A.S.H

                J Offline
                J Offline
                jfk_lili
                wrote on last edited by
                #7

                en, never mind. Thank U very much for ur help =) really appriciate ur help :-D

                1 Reply Last reply
                0
                • P Prakash Nadar

                  Gees I dont know why its not compiling :confused: i know the instructino is valid. sorry i cant help you more, i am out of ideas:-O


                  P.R.A.K.A.S.H

                  J Offline
                  J Offline
                  jfk_lili
                  wrote on last edited by
                  #8

                  now i hv found the reason for the error, the machine is 32 bit, so the int is actually 32 bit long, to get 16 bits, we need to declare it as "short int" :-D thank U Prakash

                  P 1 Reply Last reply
                  0
                  • J jfk_lili

                    now i hv found the reason for the error, the machine is 32 bit, so the int is actually 32 bit long, to get 16 bits, we need to declare it as "short int" :-D thank U Prakash

                    P Offline
                    P Offline
                    Prakash Nadar
                    wrote on last edited by
                    #9

                    Good!!! I learned something new today :-)


                    P.R.A.K.A.S.H

                    1 Reply Last reply
                    0
                    Reply
                    • Reply as topic
                    Log in to reply
                    • Oldest to Newest
                    • Newest to Oldest
                    • Most Votes


                    • Login

                    • Don't have an account? Register

                    • Login or register to search.
                    • First post
                      Last post
                    0
                    • Categories
                    • Recent
                    • Tags
                    • Popular
                    • World
                    • Users
                    • Groups