Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Porting OpenWatcom Conio to BorlandC Conio Tutorial
#1
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;
}
Creator of The Retro Dev.. Living inside of FreeDOS and Linux.

System Specs:
OS: FreeDOS 1.3
CPU: AMD AM5x86-P75+ @150mhz
Memory: 64MB
Sound: Sound Blaster AWE32, Roland SC-55 Sound Canvas
Keyboard: Model-M
HD: 32 GB MicroSD
GPU: S3 Trio 64
Reply


Messages In This Thread
Porting OpenWatcom Conio to BorlandC Conio Tutorial - by TheRetroDev - 05-09-2022, 05:56 PM



Users browsing this thread: 1 Guest(s)