The Retro Dev Forums

Full Version: Porting OpenWatcom Conio to BorlandC Conio Tutorial
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
This tutorial is relatively simple! We will port from the FreeDOS C programming book on the Conio library. We will port from OpenWatcom Conio to BorlandC Conio.

The compiler we will use in this tutorial will be the BorlandC++ 2.0. It is the last version that supports compiling 8086.
The machine we will be building on is a Tandy 1000 SL/2.

YouTube

FreeDOS C Programming book


Code for Cards.C
Code:
#include <conio.h>

/* Set our screens background color */
void clear_tableau(void)
{
    window(1,1,80,25);
    textbackground(2);
    clrscr();
}

/* Clear our message */
void clear_message(void)
{
    window(1,25,80,25);
    textbackground(3);
    clrscr();
}
/* Print a message */
void print_message(char *message)
{
    clear_message();
    textcolor(15);
    cputs(message);
}
/* Draw message box */
void print_message_box(char *message)
{
    /* Shadow */
    window(21,7,61,11);
    textbackground(0);
    clrscr();

    /* Message Box */
    window(20,6,60,10);
    textbackground(4);
    clrscr();

    /* Message! */
    textcolor(14);
    gotoxy(2,2);
    cputs(message);
}

/* Draw our card */
void draw_card(void)
{
    window(10,5,16,9);
    textbackground(7);
    clrscr();

    textcolor(0);
    gotoxy(1,1);
    cputs("4");

    textcolor(4);
    cputs("\003");

    gotoxy(4,3);
    cputs("\003");
}

int main()
{
    textmode(C80);
    _setcursortype(_NOCURSOR);
    clear_tableau();
    draw_card();

    print_message("Press any key to show a message!");
    getch();

    print_message_box("Press any key to exit!");
    clear_message();

    getch();
    textmode(LASTMODE);
    return 0;
}