This itself is hardly possible on modern hardware. It might be, for example in Linux by accessing /dev/fb or /dev/fb0 framebuffer devices. However, this requires a framebuffer support built on the kernel and root privileges.
In Windows I believe it becomes even more problematic.
However, because your question seems to be about low-level implementation, I can point you to take a look at how BIOS manages the video mode for real-mode x86 code. The basic idea is that you first specify BIOS interrupt dealing with video modes. This is done by the following code:
mov ax, 13h
int 10h
You move the desired video mode(in this case mode 13h, which is 320x200x256 mode) to the lower bits of ax register and then call the appropriate BIOS interrupt which deals with video modes, which in this case happens to be 10h.
After that point, the video mode is being set for you. To actually access the framebuffer contents, you need to read/write from address 0xA000 onwards, which is the base address for the framebuffer. Basically your best way to do this is to set the di register to point to 0xA000 and your si register to hold the value you want to write to the buffer next. Then just use stosb instruction to copy contents from si to di and increment both.