Is this code right?

This is a discussion on Is this code right? within the C++ Programming forums, part of the General Programming Boards category; ok im writing a subroutine that reads a single sector from drive A, and the memory buffer is 512bytes read_sector ...

  1. #1
    Tleggo
    Guest

    Is this code right?

    ok im writing a subroutine that reads a single sector from drive A, and the memory buffer is 512bytes

    read_sector proc
    mov al, 0
    mov cl, 1
    mov dx,12
    mov bx,offset buffer
    int 25h
    ret
    read_sector endp

  2. #2
    ....
    Join Date
    Aug 2001
    Location
    Groningen (NL)
    Posts
    2,386
    First, this is the C++ board.

    Seems Intel assembly to me, haven't got a lot of experience with that.

  3. #3
    End Of Line Hammer's Avatar
    Join Date
    Apr 2002
    Posts
    6,231
    Are you related to the nut that posted the java code in another thread?

    Anyway, down to your code.... are you using int main() or void main(), I can't seem to find either !!

    BTW, C++
    When all else fails, read the instructions.
    If you're posting code, use code tags: [code] /* insert code here */ [/code]

  4. #4
    ¡Amo fútbol!
    Join Date
    Dec 2001
    Posts
    2,136
    Hammer, look at this

    Code:
    int main()
    {  
        inline asm
        {read_sector proc 
          mov al, 0 
          mov cl, 1 
          mov dx,12 
          mov bx,offset buffer 
          int 25h 
          ret 
          read_sector endp
         };
    
     return 0;
    }
    Or something like that.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Extended ASCII Characters in an RTF Control
    By JustMax in forum C Programming
    Replies: 18
    Last Post: 04-03-2009, 09:20 PM
  2. Enforcing Machine Code Restrictions?
    By SMurf in forum Tech Board
    Replies: 21
    Last Post: 03-30-2009, 08:34 AM
  3. Obfuscated Code Contest
    By Stack Overflow in forum Contests Board
    Replies: 51
    Last Post: 01-21-2005, 04:17 PM
  4. Interface Question
    By smog890 in forum C Programming
    Replies: 11
    Last Post: 06-03-2002, 06:06 PM
  5. Replies: 0
    Last Post: 02-21-2002, 06:05 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21