Thread: which method is more efficient?

  1. #1
    Registered User
    Join Date
    Aug 2001
    Posts
    380

    which method is more efficient?

    I'm was wondering if anyone could tell me if one of these methods of accessing mode 13h was more efficient than the other. If there's such a thing.

    asm
    {
    MOV AX,0x13
    INT 0x10
    }

    or

    union REGS regs;

    regs.h.ah = 0x00; /* function 00h = mode set */
    regs.h.al = 0x13; /* 256-color mode 13h */
    int86(0x10,&regs,&regs); /* do it! */

  2. #2
    Registered User
    Join Date
    Sep 2001
    Posts
    4,912
    I'm not 100% sure, but my bet would be in the first one because it contains less macroes. It may equalize out when it get's down to machine code, but for now the, the lesser one requires less processing. On second thoughts, higher levels tend to take less space, so it could be either one. But there's some thought to help you mkae your own decision.

  3. #3
    A Banana Yoshi's Avatar
    Join Date
    Oct 2001
    Posts
    859
    I tried the first one, but it said "unable to locate 'tasm32.exe'" and my computer does not have it.
    Yoshi

  4. #4
    Registered User
    Join Date
    Aug 2001
    Posts
    380
    I got the first snippet of code from the www.brackeen.com site.
    Also, I was able to get it to compile under borland c++ 4.5.

  5. #5
    Blank
    Join Date
    Aug 2001
    Posts
    1,034
    The first one uses one less mov instruction and should be faster. Though the interrupt for setting the video mode is so much slower than the mov statements that it doesn't matter too much.

  6. #6
    Registered User VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,607
    The first method is faster. But since this is only setting the video mode which is an operation usually performed during loading or init in a program, it really does not matter. It is not speed critical so either way is sufficient.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. on method pointers and inheritance
    By BrownB in forum C++ Programming
    Replies: 2
    Last Post: 03-02-2009, 07:50 PM
  2. stuck on display method
    By shintaro in forum C++ Programming
    Replies: 2
    Last Post: 02-01-2009, 05:17 PM
  3. Best communication method to thousand childs?
    By Ironic in forum C Programming
    Replies: 8
    Last Post: 11-08-2008, 12:30 AM
  4. Replies: 2
    Last Post: 01-22-2008, 04:22 PM
  5. most efficient method?
    By reRanger in forum C++ Programming
    Replies: 2
    Last Post: 11-23-2004, 12:39 AM