Thread: dancing doll implementation

  1. #1
    Registered User
    Join Date
    Jun 2009
    Location
    US of A
    Posts
    305

    Question dancing doll implementation

    I am trying to implement a dancing doll in c and i found that the code snippet which i have does not run on visual studio.
    It requires a file dos.h and the visual studio is unable to find it. So on which platform should i run it. I tried running the same on cygwin as well but of no use. ANY IDEA ON WHY IT IS UNABLE TO FIND THE INCLUDE FILE DOS.H

    insert
    Code:
    #include <conio.h>
    # include <dos.h>
    # include <stdio.h>
    void interrupt our();
    void interrupt (*prev)();
    char far *scr =(char far *) 0xB800000L;
    void main()
    {
    unsigned long int far *p;
    p=(char far *)36;
    prev=*p;
    *p=our;
    keep(0,500);
    getch();
    }
    void interrupt our()
    {
    int i;
    for(i=0 ;i<=3999;i+=2)
    {
    if(*(scr+i)>='A'&& *(scr+i)<='Z')
      *(scr+i)+=32;
      else
      if(*(scr+i)>='a'&& *(scr+i)<='z')
      *(scr +i)-=32;
    }
    (*prev)();
    }

  2. #2
    Registered User
    Join Date
    Sep 2008
    Posts
    53
    I need some header files from Borland Turbo C++!!! - C and C++ - Forums at ProgrammersHeaven.com

    i think its written for the borland turbo c++ compiler. above is a link to a post with same question and a link for the borland c++ compiler.

  3. #3
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    > ANY IDEA ON WHY IT IS UNABLE TO FIND THE INCLUDE FILE DOS.H
    Because your compiler isn't a DOS compiler.

    Stop living in the past, by scouting for code which is 20 years old and then expecting it to magically still work on your modern compiler and OS.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  4. #4
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    Step 1 - Download DOSbox.
    Step 2 - Go to Borland's Museum and download Turbo C
    Step 3 ???
    Step 4 - Well it probably doesn't involve anything good, and I highly doubt it involves profit. But I bet it would drive some people crazy to see you still using an old ass compiler!


    Quzah.
    Hope is the first step on the road to disappointment.

  5. #5
    Registered User
    Join Date
    Jan 2008
    Posts
    225
    Quote Originally Posted by roaan View Post
    I am trying to implement a dancing doll in c and i found that the code snippet which i have does not run on visual studio.
    It requires a file dos.h and the visual studio is unable to find it. So on which platform should i run it. I tried running the same on cygwin as well but of no use. ANY IDEA ON WHY IT IS UNABLE TO FIND THE INCLUDE FILE DOS.H

    insert
    Code:
    #include <conio.h>
    # include <dos.h>
    # include <stdio.h>
    void interrupt our();
    void interrupt (*prev)();
    char far *scr =(char far *) 0xB800000L;
    void main()
    {
    unsigned long int far *p;
    p=(char far *)36;
    prev=*p;
    *p=our;
    keep(0,500);
    getch();
    }
    void interrupt our()
    {
    int i;
    for(i=0 ;i<=3999;i+=2)
    {
    if(*(scr+i)>='A'&& *(scr+i)<='Z')
      *(scr+i)+=32;
      else
      if(*(scr+i)>='a'&& *(scr+i)<='z')
      *(scr +i)-=32;
    }
    (*prev)();
    }
    far pointers are meant to access VDU memory. But you are treating it some strange way. What exactly you mean by
    Code:
    *(scr+i)+=32;
    In my opinion you should keep some variable increment that . You are treating char far * as though it is contains some alphabet.

  6. #6
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    Quote Originally Posted by chottachatri View Post
    far pointers are meant to access VDU memory.
    Actually 'far' pointers are used to access memory outside the current segment on old crappy compilers and hardware.

    http://en.wikipedia.org/wiki/Far_pointer


    Quzah.
    Hope is the first step on the road to disappointment.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. rand() implementation
    By habert79 in forum C Programming
    Replies: 4
    Last Post: 02-07-2009, 01:18 PM
  2. implementation file
    By bejiz in forum C++ Programming
    Replies: 5
    Last Post: 11-28-2005, 01:59 AM
  3. Binary Search Trees Part III
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 10-02-2004, 03:00 PM
  4. Pure virtual implementation, or not.
    By Eibro in forum C++ Programming
    Replies: 2
    Last Post: 03-19-2003, 08:05 PM
  5. hash table data structure implementation
    By sanju in forum C Programming
    Replies: 1
    Last Post: 09-27-2002, 05:06 AM