mersenneforum.org  

Go Back   mersenneforum.org > Extra Stuff > Programming

Reply
 
Thread Tools
Old 2005-02-17, 21:41   #1
Uncwilly
6809 > 6502
 
Uncwilly's Avatar
 
"""""""""""""""""""
Aug 2003
101×103 Posts

3×19×157 Posts
Default Free C++ package and looking for a bit of help.

Two items:

1) I have and old C package (book, compiler, etc.). I am looking for a free C++ package that has the following:
  • Free
  • includes good documentation (especially for those trying to learn C)
  • can produce programs that will run in old pure DOS (like on a 486)
  • provide reasonable access to Win functions
Any recomendations?

2) Also I have a fairly simple program that I wrote in QBasic that I would like to make into a compiled program, perferablly one with improvements that are unavailable in the old Basic.
Anyone want to give me a hand? I can post the code in reasonable sections along with psuedo code/flow chart. Most of the lines in the prog are DATA and PRINT statements.
Uncwilly is offline   Reply With Quote
Old 2005-02-18, 02:40   #2
Xyzzy
 
Xyzzy's Avatar
 
"Mike"
Aug 2002

172758 Posts
Default

http://bdn.borland.com/article/0,1410,21751,00.html
Xyzzy is offline   Reply With Quote
Old 2005-02-21, 13:32   #3
dsouza123
 
dsouza123's Avatar
 
Sep 2002

2·331 Posts
Default

For 2, what language would the compiled program be in ?
I am willing to help.
dsouza123 is offline   Reply With Quote
Old 2005-02-21, 15:08   #4
ET_
Banned
 
ET_'s Avatar
 
"Luigi"
Aug 2002
Team Italia

477210 Posts
Default

Quote:
Originally Posted by dsouza123
For 2, what language would the compiled program be in ?
I am willing to help.
If you plan to use C (not C++) and/or GMP, I may be available.

Luigi
ET_ is offline   Reply With Quote
Old 2005-02-21, 18:08   #5
Uncwilly
6809 > 6502
 
Uncwilly's Avatar
 
"""""""""""""""""""
Aug 2003
101×103 Posts

22F516 Posts
Default

I was just ignorantly using C++ as what I understood to be "advanced/enhnanced C"

What this is is a countdown timer for use in a TV studio. It starts counting down from some number of seconds and displays the time to go. As time elpases the numbers/screen change color to give the host and guest quick visual clues in addition to the actual time. On the fly (or while paused), the timer operator can add or subtract 1 min, 10 sec, or 1 sec at a time. The counter can be stopped and restarted. Since old QBasic is a interpreted, all the defaults can be changed with an edit (like the screen colors and times), I would presume that an .ini file would be needed for a different imp. This runs a 486 laptop (dos/Win 3.11) that is silent in the studio (no fan). Currently it uses crude block letters printed out (and fed to small TV's via a VGA/TV converter). nu$ are the arrays that hold the block numbers and X is purely a counter; unlike my standard code, I have good variable names. Ideally being able to tap into something to use a better font (like an Impact TTF would be nice).

Here is the code (undocumented of course):
Code:
DIM nu$(9, 11)
ON KEY(1) GOSUB Addsecs
ON KEY(2) GOSUB subsecs
ON KEY(3) GOSUB Addsec
ON KEY(4) GOSUB subsec
ON KEY(5) GOSUB Addmin
ON KEY(6) GOSUB Submin
ON KEY(9) GOSUB Pause
KEY(0) ON
Defaulttime = 1660
guesttime1 = 360
guesttime2 = 180
hosttime1 = 60
hosttime2 = 30
hosttime3 = 15
GOSUB Readnum
actualtime = Defaulttime
ON TIMER(1) GOSUB prnttime
TIMER ON
COLOR 10, 0
CLS
starttime = TIMER
timepast = TIMER - starttime
   WHILE timepast < actualtime
      WHILE actualtime - timepast > guesttime1
         timepast = TIMER - starttime
      WEND
      COLOR 14, 0
      CLS
      TIMER OFF
      GOSUB prnttime
      TIMER ON
      WHILE (actualtime - timepast > guesttime2) AND (actualtime - timepast < guesttime1 + 1)
        timepast = TIMER - starttime
      WEND
      COLOR 4, 0
      CLS
      TIMER OFF
      GOSUB prnttime
      TIMER ON
      WHILE (actualtime - timepast > hosttime1) AND (actualtime - timepast < guesttime2 + 1)
        timepast = TIMER - starttime
      WEND
      COLOR 0, 2
      CLS
      TIMER OFF
      GOSUB prnttime
      TIMER ON
      WHILE (actualtime - timepast > hosttime2) AND (actualtime - timepast < hosttime1 + 1)
        timepast = TIMER - starttime
      WEND
      COLOR 0, 14
      CLS
      TIMER OFF
      GOSUB prnttime
      TIMER ON
      WHILE (actualtime - timepast > hosttime3) AND (actualtime - timepast < hosttime2 + 1)
        timepast = TIMER - starttime
      WEND
      COLOR 0, 4
      CLS
      TIMER OFF
      GOSUB prnttime
      TIMER ON
      WHILE (actualtime - timepast > 0) AND (actualtime - timepast < hosttime3 + 1)
        timepast = TIMER - starttime
      WEND
   WEND
END

prnttime:
togo = actualtime - timepast
firstmin = INT(togo / 600)
secondmin = INT(INT(togo / 60) - firstmin * 10)
firstsec = INT(INT(togo / 10) - INT(togo / 60) * 6)
secondsec = INT(togo - INT(togo / 10) * 10)

IF togo > 600 THEN
  FOR x = 1 TO 11
    LOCATE 6 + x, 9: PRINT nu$(firstmin, x);
  NEXT x
ELSE
  FOR x = 1 TO 11
    LOCATE 6 + x, 9: PRINT "          ";
  NEXT x
END IF
IF togo > 60 THEN
  FOR x = 1 TO 11
    LOCATE 6 + x, 23: PRINT nu$(secondmin, x);
  NEXT x
ELSE
  FOR x = 1 TO 11
    LOCATE 6 + x, 23: PRINT "          ";
  NEXT x
END IF
LOCATE 9, 38: PRINT "ÛÛÛÛ"
LOCATE 10, 38: PRINT "ÛÛÛÛ"
LOCATE 13, 38: PRINT "ÛÛÛÛ"
LOCATE 14, 38: PRINT "ÛÛÛÛ"
FOR x = 1 TO 11
  LOCATE 6 + x, 47: PRINT nu$(firstsec, x);
NEXT x
FOR x = 1 TO 11
  LOCATE 6 + x, 61: PRINT nu$(secondsec, x);
NEXT x
LOCATE 24, 1: PRINT TIME$; " F1=+10sec F2=-10sec F3=+1sec F4=-1sec F5=+1min F6=-1min Esc=Go F9=Stop";
RETURN

Addsecs:
actualtime = actualtime + 10
RETURN
Addsec:
actualtime = actualtime + 1
RETURN
subsecs:
actualtime = actualtime - 10
RETURN
subsec:
actualtime = actualtime - 1
RETURN
Addmin:
actualtime = actualtime + 60
RETURN
Submin:
actualtime = actualtime - 60
RETURN

Pause:
stoptime = TIMER
DO
LOOP UNTIL INKEY$ = CHR$(27)
restarttime = TIMER
starttime = starttime + (restarttime - stoptime)
RETURN


Readnum:
nu$(0, 1) = " ÛÛÛÛÛÛÛÛ "
nu$(0, 2) = "ÛÛÛ    ÛÛÛ"
nu$(0, 3) = "ÛÛ      ÛÛ"
nu$(0, 4) = "ÛÛ      ÛÛ"
nu$(0, 5) = "ÛÛ      ÛÛ"
nu$(0, 6) = "ÛÛ      ÛÛ"
nu$(0, 7) = "ÛÛ      ÛÛ"
nu$(0, 8) = "ÛÛ      ÛÛ"
nu$(0, 9) = "ÛÛ      ÛÛ"
nu$(0, 10) = "ÛÛÛ    ÛÛÛ"
nu$(0, 11) = " ÛÛÛÛÛÛÛÛ "


nu$(1, 1) = "    ÛÛÛ   "
nu$(1, 2) = "   ÛÛÛÛ   "
nu$(1, 3) = "  ÞÛÛÛÛ   "
nu$(1, 4) = "    ÛÛÛ   "
nu$(1, 5) = "    ÛÛÛ   "
nu$(1, 6) = "    ÛÛÛ   "
nu$(1, 7) = "    ÛÛÛ   "
nu$(1, 8) = "    ÛÛÛ   "
nu$(1, 9) = "    ÛÛÛ   "
nu$(1, 10) = "    ÛÛÛ   "
nu$(1, 11) = "  ÞÛÛÛÛÛÝ "

nu$(2, 1) = " ÛÛÛÛÛÛÛÛ "
nu$(2, 2) = "ÛÛ      ÛÛ"
nu$(2, 3) = "        ÛÛ"
nu$(2, 4) = "        ÛÛ"
nu$(2, 5) = "      ÛÛÛ "
nu$(2, 6) = "     ÛÛÝ  "
nu$(2, 7) = "   ÛÛÛ    "
nu$(2, 8) = " ÛÛÛ      "
nu$(2, 9) = "ÛÛ        "
nu$(2, 10) = "ÛÛ        "
nu$(2, 11) = "ÛÛÛÛÛÛÛÛÛÛ"

nu$(3, 1) = " ÛÛÛÛÛÛÛÛ "
nu$(3, 2) = "ÛÛ     ÛÛÛ"
nu$(3, 3) = "        ÛÛ"
nu$(3, 4) = "        ÛÛ"
nu$(3, 5) = "       ÛÛ "
nu$(3, 6) = "    ÞÛÛÛ  "
nu$(3, 7) = "       ÛÛ "
nu$(3, 8) = "        ÛÛ"
nu$(3, 9) = "        ÛÛ"
nu$(3, 10) = "ÛÛ     ÛÛÛ"
nu$(3, 11) = " ÛÛÛÛÛÛÛÛ "

nu$(4, 1) = "ÛÛ      ÛÛ"
nu$(4, 2) = "ÛÛ      ÛÛ"
nu$(4, 3) = "ÛÛ      ÛÛ"
nu$(4, 4) = "ÛÛ      ÛÛ"
nu$(4, 5) = "ÛÛ      ÛÛ"
nu$(4, 6) = "ÛÛÛÛÛÛÛÛÛÛ"
nu$(4, 7) = "        ÛÛ"
nu$(4, 8) = "        ÛÛ"
nu$(4, 9) = "        ÛÛ"
nu$(4, 10) = "        ÛÛ"
nu$(4, 11) = "        ÛÛ"

nu$(5, 1) = "ÛÛÛÛÛÛÛÛÛÛ"
nu$(5, 2) = "ÛÛ        "
nu$(5, 3) = "ÛÛ        "
nu$(5, 4) = "ÛÛ        "
nu$(5, 5) = "ÛÛ        "
nu$(5, 6) = "ÛÛÛÛÛÛÛÛÛ "
nu$(5, 7) = "       ÛÛÛ"
nu$(5, 8) = "        ÛÛ"
nu$(5, 9) = "        ÛÛ"
nu$(5, 10) = "ÛÛ     ÛÛÛ"
nu$(5, 11) = " ÛÛÛÛÛÛÛÛ "

nu$(6, 1) = " ÛÛÛÛÛÛÛÛ "
nu$(6, 2) = "ÛÛÛ       "
nu$(6, 3) = "ÛÛ        "
nu$(6, 4) = "ÛÛ        "
nu$(6, 5) = "ÛÛ        "
nu$(6, 6) = "ÛÛÛÛÛÛÛÛÛ "
nu$(6, 7) = "ÛÛ     ÛÛÛ"
nu$(6, 8) = "ÛÛ      ÛÛ"
nu$(6, 9) = "ÛÛ      ÛÛ"
nu$(6, 10) = "ÛÛÛ    ÛÛÛ"
nu$(6, 11) = " ÛÛÛÛÛÛÛÛ "

nu$(7, 1) = "ÛÛÛÛÛÛÛÛÛÛ"
nu$(7, 2) = "Û       ÛÛ"
nu$(7, 3) = "        ÛÛ"
nu$(7, 4) = "       ÛÛ "
nu$(7, 5) = "     ÞÛÛ  "
nu$(7, 6) = "     ÛÛ   "
nu$(7, 7) = "   ÞÛÛ    "
nu$(7, 8) = "   ÛÛ     "
nu$(7, 9) = "   ÛÛ     "
nu$(7, 10) = "   ÛÛ     "
nu$(7, 11) = "   ÛÛ     "

nu$(8, 1) = " ÛÛÛÛÛÛÛÛ "
nu$(8, 2) = "ÛÛÛ    ÛÛÛ"
nu$(8, 3) = "ÛÛ      ÛÛ"
nu$(8, 4) = "ÛÛ      ÛÛ"
nu$(8, 5) = "ÛÛÛ    ÛÛÛ"
nu$(8, 6) = " ÛÛÛÛÛÛÛÛ "
nu$(8, 7) = "ÛÛÛ    ÛÛÛ"
nu$(8, 8) = "ÛÛ      ÛÛ"
nu$(8, 9) = "ÛÛ      ÛÛ"
nu$(8, 10) = "ÛÛÛ    ÛÛÛ"
nu$(8, 11) = " ÛÛÛÛÛÛÛÛ "

nu$(9, 1) = " ÛÛÛÛÛÛÛÛ "
nu$(9, 2) = "ÛÛÛ    ÛÛÛ"
nu$(9, 3) = "ÛÛ      ÛÛ"
nu$(9, 4) = "ÛÛ      ÛÛ"
nu$(9, 5) = "ÛÛÛ    ÛÛÛ"
nu$(9, 6) = " ÛÛÛÛÛÛÛÛÛ"
nu$(9, 7) = "       ÞÛÛ"
nu$(9, 8) = "        ÛÛ"
nu$(9, 9) = "        ÛÛ"
nu$(9, 10) = "ÛÛ     ÛÛÛ"
nu$(9, 11) = " ÛÛÛÛÛÛÛÛ "
RETURN
Uncwilly is offline   Reply With Quote
Old 2005-02-21, 21:03   #6
dsouza123
 
dsouza123's Avatar
 
Sep 2002

2×331 Posts
Default

The countdown program compiles and runs using QB 4.5.
The compiled code is a DOS based exe file
that needs the BRUN45.EXE in the same directory.

The current way of printing, using block character digits and color changes
can be done with most languages that have DOS compilers.
Reading the keys shouldn't be hard.
The tricky part is the timer code, QBasic's timer is a very usefull feature.

To use ttf fonts requires a Windows 16-bit compiler or interpreter.
The trick is getting one.
Either an early VB ( 3 or 4 ?) or PowerBasic that creates 16-bit Windows executables.
Alternatives are the 16-bit Delphi or C compilers from Borland and Microsoft.
The program will have to be completely rewritten for most of the choices, PowerBasic would be the closest to the basic code in your program.

What extra features do you have in mind ?

Anyone else have ideas about applicable/available compilers ?
dsouza123 is offline   Reply With Quote
Old 2005-02-21, 21:39   #7
ET_
Banned
 
ET_'s Avatar
 
"Luigi"
Aug 2002
Team Italia

477210 Posts
Default

Quote:
Originally Posted by dsouza123

Anyone else have ideas about applicable/available compilers ?
Delphi 1 could create a Win 3.1 executable, while Borland Turbo compilers (both Pascal and C) could make use of BGI (Borland Graphics Interface) under DOS environment.

A Pascal program may use a clock resolution of 2 hundredths of second.

A ANSI C program may use clock() function.

Luigi
ET_ is offline   Reply With Quote
Old 2005-02-22, 01:29   #8
Uncwilly
6809 > 6502
 
Uncwilly's Avatar
 
"""""""""""""""""""
Aug 2003
101×103 Posts

22F516 Posts
Default

oops. I keep on saying QBasic and I mean MS QuickBasic.
Uncwilly is offline   Reply With Quote
Old 2005-02-22, 22:58   #9
dsouza123
 
dsouza123's Avatar
 
Sep 2002

2·331 Posts
Default

The QB I mentioned is Quick Basic 4.5,
which can run the program interpreted or
can compile it to an exe that uses the runtime.

The program runs either way.

QBasic is a reduced function interpreted Quick Basic
that came with DOS 5


A search turned up a possible solution for compilers.
A basic that has both DOS and Windows 3.1 versions is BasicBasic
Do a google search for wbasic14

It even has a sample basic program for windows that displays the time.
SAMPLEW1.BAS

Last fiddled with by dsouza123 on 2005-02-22 at 23:31
dsouza123 is offline   Reply With Quote
Old 2005-03-04, 13:37   #10
Peter Nelson
 
Peter Nelson's Avatar
 
Oct 2004

10000100012 Posts
Default Compiling doesn't need the runtime

Quote:
Originally Posted by dsouza123
The countdown program compiles and runs using QB 4.5.
The compiled code is a DOS based exe file
that needs the BRUN45.EXE in the same directory.
Firstly, there is a checkbox in the Quickbasic make exe which makes the runtime library optional (ie it can compile everything into a single exe).

Secondly, don't be too quick to abandon quickbasic.

If you want the impact TTF why not do these big numbers (0-9) in windows and screencapture the bitmaps in a simple format (maybe BMP, TIFF or anything else you can find docs on, preferrably uncompressed).

What you then need is to use one of the graphics modes in QB.
You can implement a (slow is ok) simple routine to read the pixels from the bitmap onto screen.

Then use GET and PUT functions to grab the screen areas into array memory storage.
These can be blasted back to screen VERY quickly (fast enough for sprite based games so would be ok for your counter).

Use of these functions is well documented in the Quickbasic 4.5 help system.

The only downside I can see is that less colours are available in the hi-res graphics modes. Don't forget abilities to do a little palette changing.
Peter Nelson is offline   Reply With Quote
Reply

Thread Tools


Similar Threads
Thread Thread Starter Forum Replies Last Post
being able to use a latex package wildrabbitt Software 7 2018-01-12 19:46
Python package for sequence analysis Dubslow Aliquot Sequences 0 2015-12-10 18:50
Debian package of mprime Matt Linux 1 2007-02-22 22:36
Improvements for the CWI NFS software package Istari Factoring 30 2005-07-12 20:20
mprime RPM package for linux gbvalor Software 15 2004-01-04 11:51

All times are UTC. The time now is 11:15.

Sat Dec 5 11:15:11 UTC 2020 up 2 days, 7:26, 0 users, load averages: 1.50, 1.57, 1.48

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.

This forum has received and complied with 0 (zero) government requests for information.

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation.
A copy of the license is included in the FAQ.