Monday, November 8, 2010

Use DOSBOX to run Turbo C++ in Ubuntu Linux

                 when I switched to Ubuntu, what I needed to run Turbo C++. But
sadly Turbo C++ cannot be natively run under Linux. I did a quick Google on
Turbo C++ and found nothing worthwhile.
This is how I ran Turbo C++ in Ubuntu:
                           INSTALLATION
           
The installation is easy as much as any other application in Ubuntu
repository.                                        
                                               
Simply, Go to the terminal:
                                                                
sudo aptitude install dosbox
APT will now download and install DOSBOX.


                           
                          CONFIGURATION
I made a directory inside my home of ‘programs’ and inside ‘programs’, I
created another directory ‘dos’. This ‘dos’ folder would be the root C: of the
emulated dos and hence is essential. I also created a ‘bin’ directory inside
the ‘dos’ directory.
 I copied the TC folder from my Windows partition to the ‘dos’directory.
You can also copy the installation files of Turbo C++ in the 'dos'
directory in case you have the installation files.
    Now I created the DOSBOX configuration file. First I ran went to terminal
and ran DOSBOX:
dosbox
Using this command I generated the DOSBOX configuration file which will be
stored as /home/user/dosbox.conf. Under the DOSBOX command prompt I
executed:
config -writeconf /home/yourname/dosbox.conf

I then closed DOSBOX and now double clicked the dosbox.conf file in the

root of my home folder and I configured DOSBOX to mount its C: to

my /home/anurag/programs/dos. I added the following lines at the end of
the configuration file below the
[autoexec]:
mount c /home/username/programs/dos
C:
CD BIN

This enabled the DOSBOX to use my /home/username/programs/dos as
its C: at startup. You add as many DOS command here. All commands here
are treated as DOS command and are same as commands in autoexec.bat
in DOS/Windows.
Another setting I changed in DOSBOX was that I set the value of the key
fullscreen to be true. You can locate this key at the top of the dosbox.conf
as:







                                                                          
                                                                          
[sdl]
# fullscreen -- Start dosbox directly in fullscreen.            
                                                                           
# fulldouble -- Use double buffering in fullscreen.
# fullresolution -- What resolution to use for fullscreen: original 
or fixed size (e.g. 1024x768)
# windowresolution -- Scale the window to this size IF the output
device supports hardware scaling.
                                                                           
# output -- What to use for output: surface,overlay,opengl,openglnb.
# autolock -- Mouse will automatically lock, if you click on the          
screen.
# sensitiviy -- Mouse sensitivity.
# waitonerror -- Wait before closing the console if dosbox has an
                                                                           
error.
# priority -- Priority levels for dosbox:                                  
lowest,lower,normal,higher,highest.
                                                                          
# Second entry behind the comma is for when dosbox is not
focused/minimized.
                                                                         
# mapperfile -- File used to load/save the key/event mappings from.
# usescancodes -- Avoid usage of symkeys                                           
                                                                          
fullscreen=false
                                                                      
and change it to:
                                                                     
fullscreen=true
This will set the startup of DOSBOX to be fullscreen. This is vital for
especially running Turbo C++ since under windowed mode its keyboard
shortcuts Alt+F9 do not work since this key combination is used for
minimizing windows,

You can also increase the processing power by increasing the value of
cyles. DO NOT increase the value sohigh that the system does not handle.
Keep it in range of 3000-20000.
Save the configuration files and close it.
Now when you run DOSBOX, it will automatically run in fullscreen and show
your ‘dos’ directory files inside its C:

The next thing is needed is to solve another keyboard shortcut problem.
Under Turbo C++ Crtl+F9 links and executes programs but this is also a
keyboard shortcut of DOSBOX to immediately terminate itself. You could
map DOSBOX. But as a better approach you can avoid this tedious work
and download my mapper.txt which changes DOSBOX’s primary shortcut
key from Crtl to Shift. Now Shift+F9 will terminate DOSBOX and thus you can
use Crtl + F9 to link your Turbo C++ program.
DOWNLOAD THE MAPPER FILE HERE
Now download this mapper.txt file here and copy it the root of the home
drive,i.e. your home directory itself.

Now you need to create a launcher for Turbo C++ so that you can double-
click and run it.
1) In the desktop, right click and choose ‘Create Launcher’
2) Keeping the type as application, name it as Turbo C++ IDE.
3) In the command type dosbox -c C:\\TC\BIN\\TC.EXE -c EXIT
4) In the Comments type: Thank you, Ren_linx
5) Choose any icon and create your launcher.
6) Now you can double click and run Turbo C++ IDE.
If you face any problems, or have any suggestion or query or comments
you can comment here.
       Note:Dosbox is also available for windows 7
                U can use turbo c under windows 7

1 comment:

Unknown said...

Guyz you also must try this full procedure to install turbo c on ubuntu

http://www.turboc8.com/2013/11/turbo-c-for-ubuntulinux-using-dosbox.html

happy programming...