Recent

Author Topic: building i8086_msdos target  (Read 6925 times)

Azarien

  • New member
  • *
  • Posts: 9
building i8086_msdos target
« on: September 24, 2015, 03:34:29 pm »
I'm trying to build a cross-compiler from win32 to dos.
I'm using the latest SVN sources.

Code: [Select]
c:\svn\fpc>make OS_TARGET=msdos CPU_TARGET=i8086 all
but it ends with:

Code: [Select]
sstrings.inc(2124,10) Fatal: Code segment too large
Fatal: Compilation aborted

What should I do? Is this target not buildable at the moment?

Jonas Maebe

  • Hero Member
  • *****
  • Posts: 659
Re: building i8086_msdos target
« Reply #1 on: September 24, 2015, 03:38:39 pm »
Try following the instructions at http://wiki.freepascal.org/DOS#Building_a_snapshot_manually

My guess is that your problem is related to not enabling the generation of dead stripable ("smart linkable") code.

Handoko

  • Hero Member
  • *****
  • Posts: 3158
  • My goal: build my own game engine using Lazarus
Re: building i8086_msdos target
« Reply #2 on: September 24, 2015, 04:39:58 pm »
Intel 8086 processor has very limited of accessible memory address. It is 16-bit wide data bus, which means it can only access address up to 2^16 = 64 KB. But by using the help of segment registers, it can access up to 2^20 = 1 MB.

I knew it for sure, because I ever created program using Assembly language on 8088 (variant of 8086). I had to limit the maximum program and data size in the 64 KB boundary.  %)

Source:
https://en.wikipedia.org/wiki/Intel_8086

What should I do? Is this target not buildable at the moment?

I'm afraid you have to reduce the size down to at < 1 MB, which I think is (almost) not possible.

I wonder why you want to target 8086 processors. It is 25 years old technology. Better try the 32-bit processor (i386), which has more accessible memory (up to 2 GB).
« Last Edit: September 24, 2015, 04:49:47 pm by Handoko »

molly

  • Hero Member
  • *****
  • Posts: 2345
Re: building i8086_msdos target
« Reply #3 on: September 24, 2015, 05:10:10 pm »
Quote
I'm afraid you have to reduce the size down to at < 1 MB, which I think is (almost) not possible.
I might have understood OT wrong, but isn't that why OT tries to create a cross-compiler ?

Handoko

  • Hero Member
  • *****
  • Posts: 3158
  • My goal: build my own game engine using Lazarus
Re: building i8086_msdos target
« Reply #4 on: September 24, 2015, 05:16:06 pm »
Not very sure, but I think better chances of success if you use i386 in the parameter:

CPU_TARGET=i386

Even MS DOS 6.22 (1994) can't run on 8086. The minimum requirement of MS DOS 6.22 is Intel 80286 (accessible memory up to 16 MB).
Source:
http://www.vogons.org/viewtopic.php?t=34315
« Last Edit: September 24, 2015, 05:21:35 pm by Handoko »

molly

  • Hero Member
  • *****
  • Posts: 2345
Re: building i8086_msdos target
« Reply #5 on: September 24, 2015, 05:28:59 pm »
Not very sure, but I think better chances of success if you use i386 in the parameter:

Quote
topic: building i8086_msdos target
Quote
I'm trying to build a cross-compiler from win32 to dos
If OT is really sure about the topic then his/her only option is to create cross-compiler, as indeed the memory is to low to run fpc from that.

Your suggestion will not provide him with a 8086 cross-compiler, but a 'normal' 32-bit dos compiler.

Perhaps it has escaped your attention, but 8086 is a valid target from trunk nowadays, see also link provided by Jonas Maebe

marcov

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 7446
Re: building i8086_msdos target
« Reply #6 on: September 24, 2015, 06:34:24 pm »
Jonas' remarks about smartlinking are probably the problem. Smartlinking is nearly mandatory for i8086.

Azarien

  • New member
  • *
  • Posts: 9
Re: building i8086_msdos target
« Reply #7 on: September 24, 2015, 07:07:22 pm »
Yes, with smartlinking flags everything works.
Thank you.

It seems that even standard units are too big when compiled without smartlinking.

marcov

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 7446
Re: building i8086_msdos target
« Reply #8 on: September 24, 2015, 09:21:18 pm »
Either that or your memory model is picked too small :-)

Azarien

  • New member
  • *
  • Posts: 9
Re: building i8086_msdos target
« Reply #9 on: September 24, 2015, 10:29:51 pm »
All memory models are now working (well, at least on a "hello, world" level).

I've also compiled a go32v2->msdos cross-compiler. Compilation crashed on Windows 7 with "out of memory", but succeeded on XP virtual machine (it took a looong time but worked).

Jonas Maebe

  • Hero Member
  • *****
  • Posts: 659
Re: building i8086_msdos target
« Reply #10 on: September 24, 2015, 10:32:20 pm »
go32v2 binaries are only supported under real Dos or under Win9x.

Coldfire

  • New Member
  • *
  • Posts: 13
Re: building i8086_msdos target
« Reply #11 on: December 07, 2015, 07:41:30 pm »
All memory models are now working (well, at least on a "hello, world" level).

I've also compiled a go32v2->msdos cross-compiler. Compilation crashed on Windows 7 with "out of memory", but succeeded on XP virtual machine (it took a looong time but worked).

how you compiled Go32v2->MSDOS? i can't fin that target in the IDE

marcov

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 7446
Re: building i8086_msdos target
« Reply #12 on: December 07, 2015, 07:46:09 pm »
how you compiled Go32v2->MSDOS? i can't fin that target in the IDE

What Jonas meant is that *any* go32v2 binary is only supported for win9x and real dos.

If you use a NT based Windows (NT,2000,XP,2k3,Vista and up) use the win32 compiler.

Coldfire

  • New Member
  • *
  • Posts: 13
Re: building i8086_msdos target
« Reply #13 on: December 07, 2015, 08:17:39 pm »
how you compiled Go32v2->MSDOS? i can't fin that target in the IDE

What Jonas meant is that *any* go32v2 binary is only supported for win9x and real dos.

If you use a NT based Windows (NT,2000,XP,2k3,Vista and up) use the win32 compiler.

ahhhhm ok.
are there plans to add a i8086 target for the Go32v2 version?

Azarien

  • New member
  • *
  • Posts: 9
Re: building i8086_msdos target
« Reply #14 on: December 22, 2015, 10:28:51 pm »
What Jonas meant is that *any* go32v2 binary is only supported for win9x and real dos.
I don't have any problems with go32v2 on XP.

how you compiled Go32v2->MSDOS? i can't fin that target in the IDE
In the console, using ppcross8086.exe (both Win32 and go32v2 versions work)