PDA

View Full Version : which method is more efficient?



lambs4
12-25-2001, 01:40 PM
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! */

sean
12-26-2001, 06:10 PM
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.

Yoshi
12-26-2001, 07:46 PM
I tried the first one, but it said "unable to locate 'tasm32.exe'" and my computer does not have it.

lambs4
12-26-2001, 08:18 PM
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.

Nick
12-26-2001, 09:47 PM
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.

VirtualAce
12-28-2001, 12:32 AM
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.