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. using assembly in turbo c++, help

using assembly in turbo c++, help

Scheduled Pinned Locked Moved C / C++ / MFC
helpc++
5 Posts 4 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.
  • A Offline
    A Offline
    asif m hmood
    wrote on last edited by
    #1

    this is code of gotoxy, i have made in c++ using assembly, but it is not working and giving an error of invalid operand. plz help!!!! void _gotoxy(int row,int cols) { asm MOV AH,0x2 asm MOV DH,row// problem is here,if we use asm MOV DL,cols//constant here, it works asm MOV BH,0x0 asm INT 0x10 } void main() { clrscr(); _gotoxy(15,15); printf("x"); getch(); }

    PJ ArendsP 1 Reply Last reply
    0
    • A asif m hmood

      this is code of gotoxy, i have made in c++ using assembly, but it is not working and giving an error of invalid operand. plz help!!!! void _gotoxy(int row,int cols) { asm MOV AH,0x2 asm MOV DH,row// problem is here,if we use asm MOV DL,cols//constant here, it works asm MOV BH,0x0 asm INT 0x10 } void main() { clrscr(); _gotoxy(15,15); printf("x"); getch(); }

      PJ ArendsP Offline
      PJ ArendsP Offline
      PJ Arends
      wrote on last edited by
      #2

      Just a guess (it's been a long time :~ ), but aren't DH and DL only 8 bits? Try this:

      void _gotoxy(int row, int col)
      {
      asm
      {
      mov ah, 2
      mov bh, 0
      mov dh, row & 0xff
      mov dl, col & 0xff
      int 0x10
      }
      }


      CPUA 0x5041 Sonork 100.11743 Chicken Little "So it can now be written in stone as a testament to humanities achievments "PJ did Pi at CP"." Colin Davies Within you lies the power for good - Use it!

      Within you lies the power for good; Use it!

      A 1 Reply Last reply
      0
      • PJ ArendsP PJ Arends

        Just a guess (it's been a long time :~ ), but aren't DH and DL only 8 bits? Try this:

        void _gotoxy(int row, int col)
        {
        asm
        {
        mov ah, 2
        mov bh, 0
        mov dh, row & 0xff
        mov dl, col & 0xff
        int 0x10
        }
        }


        CPUA 0x5041 Sonork 100.11743 Chicken Little "So it can now be written in stone as a testament to humanities achievments "PJ did Pi at CP"." Colin Davies Within you lies the power for good - Use it!

        A Offline
        A Offline
        asifmahmood
        wrote on last edited by
        #3

        i have checked that but it is not working, suggest any thing else, plz help!!!!

        PJ ArendsP 1 Reply Last reply
        0
        • A asifmahmood

          i have checked that but it is not working, suggest any thing else, plz help!!!!

          PJ ArendsP Offline
          PJ ArendsP Offline
          PJ Arends
          wrote on last edited by
          #4

          The only other thing I can think of would be to use char instead of int. void _gotoxy (char x, char y) otherwise I have no idea why it would work with a constant and not a variable. I do not have Turbo C++ to test it myself. What does your manual say about using variables in inline assembly?


          CPUA 0x5041 Sonork 100.11743 Chicken Little "So it can now be written in stone as a testament to humanities achievments "PJ did Pi at CP"." Colin Davies Within you lies the power for good - Use it!

          Within you lies the power for good; Use it!

          R 1 Reply Last reply
          0
          • PJ ArendsP PJ Arends

            The only other thing I can think of would be to use char instead of int. void _gotoxy (char x, char y) otherwise I have no idea why it would work with a constant and not a variable. I do not have Turbo C++ to test it myself. What does your manual say about using variables in inline assembly?


            CPUA 0x5041 Sonork 100.11743 Chicken Little "So it can now be written in stone as a testament to humanities achievments "PJ did Pi at CP"." Colin Davies Within you lies the power for good - Use it!

            R Offline
            R Offline
            RaCeRx
            wrote on last edited by
            #5

            Hey Im not a real advanced programer or anything, but when I use Turbo C++ in class, I can include and freely use gotoxy(int,int); thoughout the program to move the cursor to a certain spot on the screen and print something there. What the hell is up with visual c++. It's telling me that gotoxy(int,int); is an "undeclared identifier". Well Im lost...:omg:

            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