Skip to content

Tutorial 1: Hello World!

Make sure you've followed the instructions in Getting Started

Once you have the IDE and library set up, create a new file named MAIN.C. All programming using Draw13 is done using C89, which has a few major differences from modern C.

Here is a simple Hello World file. Don't worry, I'll explain everything afterwards:

#include "d13lib.h"

int main() {
    set_vga_mode();
    printf("Hello World!");
    getch();
    set_text_mode();
    return 0;
}
#include "d13lib.h"

includes the library. This is assuming that the D13LIB.LIB file is in the same folder as your MAIN.C.

set_vga_mode()1

sets the display into Mode 13h.

getch()2

waits for any key input. Part of

set_text_mode()3

sets the display back to text mode (the default in DOS).

Note

See functions reference for more in-depth information.

Compile ~~and run in the IDE (if it actually works. See USAGE WARNING) by using (Alt+R->Enter) or~~ in the command line by running

tcc -IC:\TC\INCLUDE -LC:\TC\LIB -ml MAIN.C D13LIB.lib

You should see the text "Hello World!" in the top-left of the screen. Press any key to exit.

By default, printf() puts text on the screen as if it were in the command line. I use this primarily for debugging, but it could also be used to show ASCII art.

Congratulations! You've made a program! Check out Tutorial 2 - Drawing for drawing pixels and shapes.