Recent

Author Topic: programming for dos on windows?  (Read 14704 times)

slenkar

  • New Member
  • *
  • Posts: 13
programming for dos on windows?
« on: July 06, 2012, 07:38:47 pm »
I have used Lazarus for  Nintendo DS programming before on windows.
How would I setup lazarus for Dos programming on windows?
(Also setup a dos emulator that launches on compilation)

User137

  • Hero Member
  • *****
  • Posts: 1791
    • Nxpascal home
Re: programming for dos on windows?
« Reply #1 on: July 06, 2012, 08:09:27 pm »
I haven't done this myself yet, but if it's possible, here is something.

You can test compiled apps with Dosbox http://www.dosbox.com/
This i use for old dos-games all the time.

Project options -> Code generation and Linking pages give quite a few options to choose from.

slenkar

  • New Member
  • *
  • Posts: 13
Re: programming for dos on windows?
« Reply #2 on: July 09, 2012, 04:27:07 am »
I pointed lazarus to the fpc.cfg file in the freepascal dos directory and set lazarus target to i386 and go32v2

when I compile it complains about an unknown compilation flag

Leledumbo

  • Hero Member
  • *****
  • Posts: 8835
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: programming for dos on windows?
« Reply #3 on: July 09, 2012, 08:23:35 am »
Quote
when I compile it complains about an unknown compilation flag
Which is?

slenkar

  • New Member
  • *
  • Posts: 13
Re: programming for dos on windows?
« Reply #4 on: July 09, 2012, 07:18:47 pm »
Error: Illegal parameter: -Op386

ok I put the target processor as default, and tried to run a gd demo for dos,
it says
gdtestcgi.pp(89) Error: Creation of Dynamic\Shared Libraries not supported
« Last Edit: July 09, 2012, 07:32:53 pm by slenkar »

Leledumbo

  • Hero Member
  • *****
  • Posts: 8835
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: programming for dos on windows?
« Reply #5 on: July 09, 2012, 08:29:20 pm »
Quote
Creation of Dynamic\Shared Libraries not supported
That's clear enough, I guess. DOS target doesn't support creation of dll.

slenkar

  • New Member
  • *
  • Posts: 13
Re: programming for dos on windows?
« Reply #6 on: July 09, 2012, 09:34:09 pm »
i tried some other demos and they worked, how do you draw images to the screen in dos?

I only see wiki pages for other platforms

User137

  • Hero Member
  • *****
  • Posts: 1791
    • Nxpascal home
Re: programming for dos on windows?
« Reply #7 on: July 09, 2012, 09:40:59 pm »
What is your purpose? If you can give a full description of what you are aiming to do, someone can give much better answers.

Google will likely find alot of information on how to draw in DOS. With old QBasic i used to rely on ASM based library. But i don't know what you need to draw, just simple rectangular BMP or shaded polygons... Maybe just ascii art.

slenkar

  • New Member
  • *
  • Posts: 13
Re: programming for dos on windows?
« Reply #8 on: July 09, 2012, 10:19:34 pm »
I would like to draw images for a game
I tried the old graphix library but it doesnt compile:

it doesnt like this line:

FUNCTION DDSetMouseCallback(cb:pointer); 

because the return type of the function isnt specified

so I put boolean as the return type but then:

  wc.lpfnWndProc:=@WindowProc;   

it doesnt like this line

C:\Users\admin\Downloads\gxfp400\gxdd.pp(359,19) Error: Incompatible types: got "<address of function(LongWord,LongWord,LongWord,LongInt):LongInt;StdCall>" expected "<procedure variable type of function(LongWord,LongWord,LongInt,LongInt):LongInt;StdCall>"
« Last Edit: July 09, 2012, 10:27:25 pm by slenkar »

User137

  • Hero Member
  • *****
  • Posts: 1791
    • Nxpascal home
Re: programming for dos on windows?
« Reply #9 on: July 09, 2012, 10:52:53 pm »
Quick google search indicates that it's made for some Delphi version.

What is the type of wc.lpfnWndProc ? You have to match your WindowProc() with same parameters and return value.

edit: Your 3rd parameter is LongWord, when it should be LongInt.
« Last Edit: July 09, 2012, 10:55:14 pm by User137 »

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 12645
  • FPC developer.
Re: programming for dos on windows?
« Reply #10 on: July 10, 2012, 11:27:50 am »
I would like to draw images for a game
I tried the old graphix library but it doesnt compile:

The stuff you quote is windows specific code. That won't work on Dos. Have a look at unit graph.

But IMHO you should rethink targeting Dos in the first place.

slenkar

  • New Member
  • *
  • Posts: 13
Re: programming for dos on windows?
« Reply #11 on: July 10, 2012, 11:19:46 pm »
Quote
But IMHO you should rethink targeting Dos in the first place.

Dos is emulated on nearly every platform, that was the attraction

but yes it is quite a bother to get it working and do stuff that is simpler on other platforms.

User137

  • Hero Member
  • *****
  • Posts: 1791
    • Nxpascal home
Re: programming for dos on windows?
« Reply #12 on: July 12, 2012, 02:54:59 am »
All you need to do is use OpenGL graphics. About all platforms support that. FPC can be compiled directly to those systems, but at least Linux based systems have Wine which your Windows apps can be run on.

 

TinyPortal © 2005-2018