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. Variable types in ASM

Variable types in ASM

Scheduled Pinned Locked Moved C / C++ / MFC
c++question
9 Posts 5 Posters 37 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.
  • C Offline
    C Offline
    Calin Negru
    wrote on last edited by
    #1

    In C++ you have ints, variables for floating point numbers, bools. Does Assembly have the same variable differentiation? Can you move any type of variable into a register?

    M L C 3 Replies Last reply
    0
    • C Calin Negru

      In C++ you have ints, variables for floating point numbers, bools. Does Assembly have the same variable differentiation? Can you move any type of variable into a register?

      M Offline
      M Offline
      Maximilien
      wrote on last edited by
      #2

      yes and no. There's no types in assembly. You just move data to a register; the data can be anything (int, float, address to a string, ...)

      CI/CD = Continuous Impediment/Continuous Despair

      Mircea NeacsuM L 2 Replies Last reply
      0
      • M Maximilien

        yes and no. There's no types in assembly. You just move data to a register; the data can be anything (int, float, address to a string, ...)

        CI/CD = Continuous Impediment/Continuous Despair

        Mircea NeacsuM Offline
        Mircea NeacsuM Offline
        Mircea Neacsu
        wrote on last edited by
        #3

        Not entirely true: floating point registers are still separate AFAIK. The rest are all the same.

        Mircea

        1 Reply Last reply
        0
        • C Calin Negru

          In C++ you have ints, variables for floating point numbers, bools. Does Assembly have the same variable differentiation? Can you move any type of variable into a register?

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #4

          Assembler does have (sort of) data types, in the way that you declare variables. But at the instruction level it is up to the programmer to ensure that the items are handled correctly. Take a look at NASM - The Netwide Assembler[^] for specific details.

          J C 2 Replies Last reply
          0
          • M Maximilien

            yes and no. There's no types in assembly. You just move data to a register; the data can be anything (int, float, address to a string, ...)

            CI/CD = Continuous Impediment/Continuous Despair

            L Offline
            L Offline
            Lost User
            wrote on last edited by
            #5

            What about db, dw, dd, dq ... ?

            1 Reply Last reply
            0
            • L Lost User

              Assembler does have (sort of) data types, in the way that you declare variables. But at the instruction level it is up to the programmer to ensure that the items are handled correctly. Take a look at NASM - The Netwide Assembler[^] for specific details.

              J Offline
              J Offline
              jeron1
              wrote on last edited by
              #6

              Richard MacCutchan wrote:

              it is up to the programmer to ensure that the items are handled correctly

              Truth!

              "the debugger doesn't tell me anything because this code compiles just fine" - random QA comment "Facebook is where you tell lies to your friends. Twitter is where you tell the truth to strangers." - chriselst "I don't drink any more... then again, I don't drink any less." - Mike Mullikins uncle

              1 Reply Last reply
              0
              • L Lost User

                Assembler does have (sort of) data types, in the way that you declare variables. But at the instruction level it is up to the programmer to ensure that the items are handled correctly. Take a look at NASM - The Netwide Assembler[^] for specific details.

                C Offline
                C Offline
                Calin Negru
                wrote on last edited by
                #7

                Richard thanks for your reference.

                L 1 Reply Last reply
                0
                • C Calin Negru

                  In C++ you have ints, variables for floating point numbers, bools. Does Assembly have the same variable differentiation? Can you move any type of variable into a register?

                  C Offline
                  C Offline
                  Calin Negru
                  wrote on last edited by
                  #8

                  Thanks for your feedback guys

                  1 Reply Last reply
                  0
                  • C Calin Negru

                    Richard thanks for your reference.

                    L Offline
                    L Offline
                    Lost User
                    wrote on last edited by
                    #9

                    You are welcome. And NASM is a good introduction to Assembler, and machine code.

                    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