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. Other Discussions
  3. Work Issues
  4. assembly and c code problem please help

assembly and c code problem please help

Scheduled Pinned Locked Moved Work Issues
helpc++question
4 Posts 3 Posters 4 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.
  • D Offline
    D Offline
    dj_felix
    wrote on last edited by
    #1

    the problem in this code is that it can't compile it when "A" is defined as "int" "C:\Documents and Settings\simon\Desktop\the program.cpp(34) : error C2443: operand size conflict" in my program A is in the range of 1-512 in decimal so thier is no problem with the size. so how i force it to compile? or how i change the program to compile it? void light_port_b(int A) { _asm { mov Dx,PORTB Mov Al,A Out Dx,Al } }

    R 1 Reply Last reply
    0
    • D dj_felix

      the problem in this code is that it can't compile it when "A" is defined as "int" "C:\Documents and Settings\simon\Desktop\the program.cpp(34) : error C2443: operand size conflict" in my program A is in the range of 1-512 in decimal so thier is no problem with the size. so how i force it to compile? or how i change the program to compile it? void light_port_b(int A) { _asm { mov Dx,PORTB Mov Al,A Out Dx,Al } }

      R Offline
      R Offline
      Ryan Roberts
      wrote on last edited by
      #2

      Ints are 32 bits nowadays, and AL is a 16 bit reg. Change it to unsigned short. Odd forum for a programming question by the way :) Ryan

      P 1 Reply Last reply
      0
      • R Ryan Roberts

        Ints are 32 bits nowadays, and AL is a 16 bit reg. Change it to unsigned short. Odd forum for a programming question by the way :) Ryan

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

        Ryan Roberts wrote: and AL is a 16 bit reg. its 8 bits ;P


        MSN Messenger. prakashnadar@msn.com

        R 1 Reply Last reply
        0
        • P Prakash Nadar

          Ryan Roberts wrote: and AL is a 16 bit reg. its 8 bits ;P


          MSN Messenger. prakashnadar@msn.com

          R Offline
          R Offline
          Ryan Roberts
          wrote on last edited by
          #4

          Oops. Teach me to answer questions when drunk. I'll leave my stupidity for prosperity :O Ryan

          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