I'm working with C in Visual Studio 2010, and I can get things working if I use a separate NASM file. Eg, to setup the PIC, I use this:
Code: Select all
MOV AL, 0x11
OUT 0x20, AL
OUT 0xA0, AL
MOV AL, 0x20
OUT 0x21, AL
MOV AL, 0x28
OUT 0xA1, AL
MOV AL, 0x4
OUT 0x21, AL
MOV AL, 0x2
OUT 0xA1, AL
MOV AL, 0x1
OUT 0x21, AL
OUT 0xA1, AL
Code: Select all
void outb (unsigned short portid, unsigned char value) {
__asm {
mov al, byte ptr [value]
mov dx, word ptr [portid]
out dx, al
}
}
Code: Select all
outb(0x20, 0x11);
outb(0xa0, 0x11);
outb(0x21, 0x20);
outb(0xa1, 0x28);
outb(0x21, 0x4);
outb(0xa1, 0x2);
outb(0x21, 0x1);
outb(0xa1, 0x1);