🔒 Locked
Trick Question
Advertisement
Original Post
In DOS, sure. Get a pointer to video memory (0x000B8000) and write away to your heart's content. No header files or libraries required.
Under Windows, no. To output to a console window, you need to at least call WriteConsole to show _something_ on the screen. Under GDI, you have to do a lot more work with creating a window and selecting a font. With DirectDraw, you can at least get a pointer to video memory, but you still have to link to some kind of library.
If you're just trying to write text output code, use the console routines to display text to the screen.
Under Windows, no. To output to a console window, you need to at least call WriteConsole to show _something_ on the screen. Under GDI, you have to do a lot more work with creating a window and selecting a font. With DirectDraw, you can at least get a pointer to video memory, but you still have to link to some kind of library.
If you're just trying to write text output code, use the console routines to display text to the screen.
There is nothing wrong with that single line of code. Something else is causing the problem. However, it is usually easier to access video memory in char units rather than "long int".
You _are_ using a DOS compiler, right? Visual Studio cannot generate DOS .EXEs. If you got something compiled and tried to run it, it would crash because the application is not allowed direct memory access.
You _are_ using a DOS compiler, right? Visual Studio cannot generate DOS .EXEs. If you got something compiled and tried to run it, it would crash because the application is not allowed direct memory access.
Try:
The text mode frame buffer is layed out in memory such that two bytes compromise a single character. One byte is the character itself, the next byte is the color attribute. Use google, you should be able to find tons of pages about how it works.
Is this 32-bit protected mode, by the way? If not, 16-bit mode requires a far pointer into B800:0000 instead.
void writeString(char *addr, char *str){ while (*str != 0) { *addr = *str++; addr += 2; }}int main(){ char *addr = (char *)0x000B8000; writeString(addr, "Hello bpoint");}The text mode frame buffer is layed out in memory such that two bytes compromise a single character. One byte is the character itself, the next byte is the color attribute. Use google, you should be able to find tons of pages about how it works.
Is this 32-bit protected mode, by the way? If not, 16-bit mode requires a far pointer into B800:0000 instead.
Topic Locked
This topic has been locked by a moderator. New replies are not allowed.
Sign in to reply to this topic.
Advertisement