Hello!
I am just testing and trying to learn how assembler works with C. So i was browsing around some tutorials and i found this:
__asm
{
mov ax,0B800h //startaddress for the screen memory (in textmode)
mov es,ax //add the startaddress to es
xor di,di //reset di (start at the beginning of the screen)
mov al, 65 //65 = ascii for the 'A' character to al
mov ah, 16*4+1 //Attribute = blue text on a red background to ah.
mov cx,2000 //25*80 = 2000 characters on the screen
rep stosw //write ax to the screen memory and count di up 2000 times
}
The problem i have is that i can't run it, i can compile it inside my main method in Microsoft Visual Studio 2008 but when i run it, it produces this error:
Unhandled exception at 0x00da3660 in Test.exe: 0xC0000005: Access violation reading location 0xffffffff.
on the second line, mov es,ax //lägg startadressen i es
Could it be that the program is 16-bit and that VS 2008 compiles it into a 32-bit program? If so, can you force VS 2008 to compile it differently?
Does anyone know of a good inside assembler tutorial ?