Thread: ASM

  1. #1
    Is Trying to Learn
    Join Date
    Mar 2006
    Location
    Hutton, Preston
    Posts
    215

    ASM

    does anyone know how to write a getkey command for ASM programming for the 80x86 processor?

  2. #2
    Reverse Engineer maxorator's Avatar
    Join Date
    Aug 2005
    Location
    Estonia
    Posts
    2,318
    It's easy if you've learned some assembly first.
    "The Internet treats censorship as damage and routes around it." - John Gilmore

  3. #3
    Is Trying to Learn
    Join Date
    Mar 2006
    Location
    Hutton, Preston
    Posts
    215
    this is what i have soo far, plese let me know if im wrong.

    Code:
    mov ah, 11
    int 16h
    now im stuck with the next bit of the code.

    also do you know how to do clearscreen without using dos and bios functions?

    Thanks
    Last edited by peckitt99; 11-19-2006 at 01:35 PM.

  4. #4
    MFC killed my cat! manutd's Avatar
    Join Date
    Sep 2006
    Location
    Boston, Massachusetts
    Posts
    870
    Why don't you use asm to call C functions? That is much easier.
    Silence is better than unmeaning words.
    - Pythagoras
    My blog

  5. #5
    Is Trying to Learn
    Join Date
    Mar 2006
    Location
    Hutton, Preston
    Posts
    215
    well our assignment is written in c code but we have to fill in the rest of the functions using ASM

  6. #6
    MFC killed my cat! manutd's Avatar
    Join Date
    Sep 2006
    Location
    Boston, Massachusetts
    Posts
    870
    Show us your assignment. Also, you might want to consider a book like Assembly Step-by-step.
    Silence is better than unmeaning words.
    - Pythagoras
    My blog

  7. #7
    Is Trying to Learn
    Join Date
    Mar 2006
    Location
    Hutton, Preston
    Posts
    215
    my assignment is too big to put up on here, i do have a few books but its not really that good, lol. but like i said in the other post i just have to fill out functions with the asm code rather than all in c. (The Program is "MineSweeper")

  8. #8
    MFC killed my cat! manutd's Avatar
    Join Date
    Sep 2006
    Location
    Boston, Massachusetts
    Posts
    870
    Try giving us, say, one function that you need.
    Silence is better than unmeaning words.
    - Pythagoras
    My blog

  9. #9
    Is Trying to Learn
    Join Date
    Mar 2006
    Location
    Hutton, Preston
    Posts
    215
    here is a clip with a few functions that is needed

    Code:
        // Clear screen and output the title and points text
        ClearWindow(0,0,SCREEN_WIDTH-1,SCREEN_HEIGHT-1,BLOCK_CHAR, BLUE_ON_BLUE);
        WriteAt(TitleStr.X, TitleStr.Y, TitleStr.Text, YELLOW_ON_BLUE);
        WriteAt(NumGoesStr.X, NumGoesStr.Y, NumGoesStr.Text, NumGoesStr.Colour);
    
        // Draw the sea
        ClearWindow(GridLeft,GridTop,GridLeft+GridWidth-1,GridTop+GridHeight-1,SEA_CHAR, WHITE_ON_BLUE);
    
        // Enable the dos mouse cursor and enter the game-on loop until killed or quit using escape
        MouseCursorOn();
    
        do
        {
          // Get mouse position and test whether left button is down. If it is then wait for it to be
          // released.  If the mouse is in the grid area, check if it is on a mine. If it is then
          // game over and exit this loop. If not, write the risk value on the grid and update
          // the points string
          ReadMouse(&Mouse);
          GotoXY(Mouse.Col,Mouse.Row);
          if (Mouse.Buttons.Button.Left == PRESSED)
          {
            while (Mouse.Buttons.Button.Left == PRESSED) ReadMouse(&Mouse); // Wait for release
    
            if (Mouse.Col >= GridLeft && Mouse.Col < GridLeft+GridWidth &&
                Mouse.Row >= GridTop &&  Mouse.Row < GridTop+GridHeight)
            {
               if (Grid[Mouse.Row-GridTop][Mouse.Col-GridLeft] == A_MINE)
               {
                 GameOver();

  10. #10
    Reverse Engineer maxorator's Avatar
    Join Date
    Aug 2005
    Location
    Estonia
    Posts
    2,318
    Code:
    mov ah, 11
    int 16h
    You're not in DOS any more (probably). Windows works a bit differently.
    "The Internet treats censorship as damage and routes around it." - John Gilmore

  11. #11
    Is Trying to Learn
    Join Date
    Mar 2006
    Location
    Hutton, Preston
    Posts
    215
    ah right im using turbo debugger if that help and the other functions that i need to complete are

    Code:
    ClearWindow
    WriteAt 
    StrLen
    IntToStr
    GetKey
    StrCpy 
    MouseCursorOff and Off
    ReadMouse
    MemSet
    anyone know of any good websites that can help me learn this?

  12. #12
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,057
    Code:
    MouseCursorOff and Off
    ->
    Code:
    MouseCursorOff and On
    ?

    You could try google . . . http://www.google.ca/search?hl=en&q=...tutorial&meta=
    dwk

    Seek and ye shall find. quaere et invenies.

    "Simplicity does not precede complexity, but follows it." -- Alan Perlis
    "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
    "The only real mistake is the one from which we learn nothing." -- John Powell


    Other boards: DaniWeb, TPS
    Unofficial Wiki FAQ: cpwiki.sf.net

    My website: http://dwks.theprogrammingsite.com/
    Projects: codeform, xuni, atlantis, nort, etc.

  13. #13
    Registered User VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,607
    Code:
    Mouse cursor on
    
    DOS
    _asm {
      mov ax,0001h
      int 33h
    }
    
    Windows
    ShowCursorPos(TRUE);
    
    
    Mouse cursor off
    
    DOS
    asm  {
      mov ax,0002h
      int 33h
    }
    
    Windows
    ShowCursorPos(FALSE);

    For keyboard you want to hook interrupt 09h, not the BIOS key handler at 16H.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. gcc asm code syntax
    By Uberapa in forum C Programming
    Replies: 4
    Last Post: 06-15-2007, 01:16 AM
  2. Asm + C++
    By JaWiB in forum C++ Programming
    Replies: 17
    Last Post: 06-26-2003, 03:13 PM
  3. Understanding ASM
    By kuphryn in forum A Brief History of Cprogramming.com
    Replies: 26
    Last Post: 07-12-2002, 07:39 PM
  4. asm mov
    By manu in forum C++ Programming
    Replies: 1
    Last Post: 12-15-2001, 12:59 PM
  5. My graphics library
    By stupid_mutt in forum C Programming
    Replies: 3
    Last Post: 11-26-2001, 06:05 PM