When I was in the 11th grade in high school I was coding using borland C++ 4.5 which did not allow me to use 32 bit instructions. So I figured I could cheat the compiler and do something interesting to get maximum performance on a copy from a buffer copy to svga framebuffer:
unsigned long far *dbtemp= dbdw[0];
asm {
push ds;//save regs
push es;
push bx;
mov bx, 0xA000//get vram seg
mov es, bx//point extra segment to vram
lds si, dbtemp;//get buffer location
mov di, 0//start at offset 0
mov cx, 16384//dwords to copy
cld//set dir to forward
}
__emit__(102,243, 165);//32bit movsd
This was 3 years ago now and I still keep the file that this snippet is in around. How many C coders out there know of the __emit__ function anyway ?
When I was in the 11th grade in high school I was coding using borland C++ 4.5 which did not allow me to use 32 bit instructions. So I figured I could cheat the compiler and do something interesting to get maximum performance on a copy from a buffer copy to svga framebuffer:
//save regs
//get vram seg
//point extra segment to vram
//get buffer location
//start at offset 0
//dwords to copy
//set dir to forward
//32bit movsd
unsigned long far *dbtemp= dbdw[0];
asm {
push ds;
push es;
push bx;
mov bx, 0xA000
mov es, bx
lds si, dbtemp;
mov di, 0
mov cx, 16384
cld
}
__emit__(102,243, 165);
This was 3 years ago now and I still keep the file that this snippet is in around. How many C coders out there know of the __emit__ function anyway ?