Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  nodelist  faq  login

The reason computer chips are so small is computers don't eat much.


programming / comp.lang.asm.x86 / Re: Disassembly of old Turbo Pascal (V3) code - how to create data

SubjectAuthor
* Disassembly of old Turbo Pascal (V3) code - how to create dataRobert Prins
+- Re: Disassembly of old Turbo Pascal (V3) code - how to create dataSjouke Burry
`* Re: Disassembly of old Turbo Pascal (V3) code - how to create datawolfgang kern
 `* Re: Disassembly of old Turbo Pascal (V3) code - how to create dataRobert Prins
  `* Re: Disassembly of old Turbo Pascal (V3) code - how to create dataFrank Kotler
   `* Re: Disassembly of old Turbo Pascal (V3) code - how to create dataRobert Prins
    +* Re: Disassembly of old Turbo Pascal (V3) code - how to create datawolfgang kern
    |`- Re: Disassembly of old Turbo Pascal (V3) code - how to create dataRobert Prins
    `- Re: Disassembly of old Turbo Pascal (V3) code - how to create dataTerje Mathisen

1
Subject: Disassembly of old Turbo Pascal (V3) code - how to create data
From: Robert Prins
Newsgroups: comp.lang.asm.x86
Organization: A noiseless patient Spider
Date: Sat, 17 Apr 2021 13:48 UTC
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: rob...@nospicedham.prino.org (Robert Prins)
Newsgroups: comp.lang.asm.x86
Subject: Disassembly of old Turbo Pascal (V3) code - how to create data
Date: Sat, 17 Apr 2021 13:48:02 +0000
Organization: A noiseless patient Spider
Lines: 51
Approved: fbkotler@myfairpoint.net - comp.lang.asm.x86 moderation team.
Message-ID: <s5ehts$1no$1@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Info: reader02.eternal-september.org; posting-host="b0950cef0f32972b8c4a305d29b98026";
logging-data="4288"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/dFImINmlKvxDWZ+jZRj7TMyuteXtQmxE="
User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:78.0) Gecko/20100101
Thunderbird/78.9.1
Cancel-Lock: sha1:3XqaL0ZaszoTct0wcw9s76HAcbE=
View all headers
Hi all,

I would like to disassemble the final version of a self-written Turbo Pascal V3 program, i.e. a simple .COM file, and to that effect I've dug out my old (AD 2004) registered copy of IDA Pro (V4.7.0.831). Not having used it for more than 10 years, and no longer having access to their forum, I'm now stuck. The .COM file loads, IDA happily disassembles it, but it just creates one single segment, and I have no (longer) a clue on how to create the data segment. There's a bit of info in the TP3 Manual, and using David Lindauer's GRDB in DOXBox-X allows me to single-step through the RTL initialisation code and that shows me it sets up up DS and SS, but it doesn't help me in setting up these segments in IDA.

I've tried the "Create Segment" option, but I'm lost entering the required values for start address, end address and base, "class" is probably "DATA", the once for the single "seg000" that IDA creates are CODE, start @ 0x0100, end @ 0xD623, which leads me to assume that a to-be-created "seg001" should start at 0x0000, end at 0xffff, and have a base of 0xd63 (paragraphs), but that results in a "Bad segment base: segment would have bytes with a negative offset" pop-up.

Trying start @ 0xd630, end @ 0x1d630, with a base 0x0000 creates a segment, but it looks like

seg000:D622
seg001:C8C00 ; ---------------------------------------------------------------------------
seg001:C8C00
seg001:C8C00 ; Segment type: Regular
seg001:C8C00 seg001          segment byte public '' use16
seg001:C8C00                 assume cs:seg001
seg001:C8C00                 ;org 0C8C00h
seg001:C8C00                 assume es:nothing, ss:nothing, ds:nothing, fs:nothing, gs:nothing

Which may be correct, but the "org 0c8c00" makes absolutely no sense to me.

If you can help me I would be grateful, and to help you, I've uploaded a RAR archive with the full sources, the resulting "lift.com" executable and the input file to my Google drive @ https://drive.google.com/drive/folders/0B0oygbfs7DsVVWNBZWpqaHRHX3c?usp=sharing look for lift16bit.rar Please note that the code will not compile with anything more advanced than Turbo Pascal 3, and in my case it was compiled with TP 3.01a.

Thanks,

Robert
--
Robert AH Prins
robert(a)prino(d)org
The hitchhiking grandfather - https://prino.neocities.org/indez.html
Some REXX code for use on z/OS - https://prino.neocities.org/zOS/zOS-Tools.html



Subject: Re: Disassembly of old Turbo Pascal (V3) code - how to create data
From: Sjouke Burry
Newsgroups: comp.lang.asm.x86
Organization: A noiseless patient Spider
Date: Sat, 17 Apr 2021 18:32 UTC
References: 1
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: burrynul...@nospicedham.ppllaanneett.nnll (Sjouke Burry)
Newsgroups: comp.lang.asm.x86
Subject: Re: Disassembly of old Turbo Pascal (V3) code - how to create data
Date: Sat, 17 Apr 2021 20:32:10 +0200
Organization: A noiseless patient Spider
Lines: 51
Approved: fbkotler@myfairpoint.net - comp.lang.asm.x86 moderation team.
Message-ID: <607b29aa$0$3789$e4fe514c@textnews.kpn.nl>
References: <s5ehts$1no$1@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Info: reader02.eternal-september.org; posting-host="b0950cef0f32972b8c4a305d29b98026";
logging-data="12734"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18vxQ1ms2BWB51oRH/PNcXzFQ3NPMJ1Y4s="
User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:17.0) Gecko/20131118 Thunderbird/17.0.11
Cancel-Lock: sha1:kd7Ne5CEKJNk0mOf3Kw1KA+gJS8=
View all headers
On 17.04.21 15:48, Robert Prins wrote:
Hi all,

I would like to disassemble the final version of a self-written Turbo Pascal V3
program, i.e. a simple .COM file, and to that effect I've dug out my old (AD
2004) registered copy of IDA Pro (V4.7.0.831). Not having used it for more than
10 years, and no longer having access to their forum, I'm now stuck. The .COM
file loads, IDA happily disassembles it, but it just creates one single segment,
and I have no (longer) a clue on how to create the data segment. There's a bit
of info in the TP3 Manual, and using David Lindauer's GRDB in DOXBox-X allows me
to single-step through the RTL initialisation code and that shows me it sets up
up DS and SS, but it doesn't help me in setting up these segments in IDA.

I've tried the "Create Segment" option, but I'm lost entering the required
values for start address, end address and base, "class" is probably "DATA", the
once for the single "seg000" that IDA creates are CODE, start @ 0x0100, end @
0xD623, which leads me to assume that a to-be-created "seg001" should start at
0x0000, end at 0xffff, and have a base of 0xd63 (paragraphs), but that results
in a "Bad segment base: segment would have bytes with a negative offset" pop-up.

Trying start @ 0xd630, end @ 0x1d630, with a base 0x0000 creates a segment, but
it looks like

seg000:D622
seg001:C8C00 ;
---------------------------------------------------------------------------
seg001:C8C00
seg001:C8C00 ; Segment type: Regular
seg001:C8C00 seg001          segment byte public '' use16
seg001:C8C00                 assume cs:seg001
seg001:C8C00                 ;org 0C8C00h
seg001:C8C00                 assume es:nothing, ss:nothing, ds:nothing,
fs:nothing, gs:nothing

Which may be correct, but the "org 0c8c00" makes absolutely no sense to me.

If you can help me I would be grateful, and to help you, I've uploaded a RAR
archive with the full sources, the resulting "lift.com" executable and the input
file to my Google drive @
https://drive.google.com/drive/folders/0B0oygbfs7DsVVWNBZWpqaHRHX3c?usp=sharing
look for lift16bit.rar Please note that the code will not compile with anything
more advanced than Turbo Pascal 3, and in my case it was compiled with TP 3.01a.

Thanks,

Robert

A com file is a simplyfied exe, without a lot of exe things.
Just a solid block of code and data.
And not to much of that either.



Subject: Re: Disassembly of old Turbo Pascal (V3) code - how to create data
From: wolfgang kern
Newsgroups: comp.lang.asm.x86
Organization: Aioe.org NNTP Server
Date: Sat, 17 Apr 2021 19:30 UTC
References: 1
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: nowh...@nospicedham.never.at (wolfgang kern)
Newsgroups: comp.lang.asm.x86
Subject: Re: Disassembly of old Turbo Pascal (V3) code - how to create data
Date: Sat, 17 Apr 2021 21:30:24 +0200
Organization: Aioe.org NNTP Server
Lines: 15
Approved: fbkotler@myfairpoint.net - comp.lang.asm.x86 moderation team.
Message-ID: <s5fd2o$1qgu$1@gioia.aioe.org>
References: <s5ehts$1no$1@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Info: reader02.eternal-september.org; posting-host="6f10c6db12fd65a62e680b6260b17350";
logging-data="5438"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+P+Ec/tYBmMDBAFgYCPd9xxLKONmMhj4g="
User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:88.0) Gecko/20100101
Thunderbird/88.0
Cancel-Lock: sha1:z6BC4bnOR3w0Op34CqRulr9F+zk=
View all headers
On 17.04.2021 15:48, Robert Prins wrote:
Hi all,
Hello,
I would like to disassemble the final version of a self-written Turbo Pascal V3 program, i.e. a simple .COM file,
....

..com files haven't any segment-info.
you can try DOS-debug (if you have one) or the NASM disassembler.

DOS.COM-files are usually organized to start at cs:0x0100.
If you post a hex-dump of your code I could disassemble it.
__
wolfgang



Subject: Re: Disassembly of old Turbo Pascal (V3) code - how to create data
From: Robert Prins
Newsgroups: comp.lang.asm.x86
Organization: A noiseless patient Spider
Date: Sat, 17 Apr 2021 22:07 UTC
References: 1 2
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: rob...@nospicedham.prino.org (Robert Prins)
Newsgroups: comp.lang.asm.x86
Subject: Re: Disassembly of old Turbo Pascal (V3) code - how to create data
Date: Sat, 17 Apr 2021 22:07:15 +0000
Organization: A noiseless patient Spider
Lines: 42
Approved: fbkotler@myfairpoint.net - comp.lang.asm.x86 moderation team.
Message-ID: <s5ff5t$gbj$1@dont-email.me>
References: <s5ehts$1no$1@dont-email.me> <s5fd2o$1qgu$1@gioia.aioe.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Info: reader02.eternal-september.org; posting-host="6f10c6db12fd65a62e680b6260b17350";
logging-data="17520"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX180YC520zo1eQ4EFxEZVB8T4KzCRXG48B0="
User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:78.0) Gecko/20100101
Thunderbird/78.9.1
Cancel-Lock: sha1:u3diMoCqNyaViF1c9tiSjyBdpfk=
View all headers
On 2021-04-17 19:30, wolfgang kern wrote:
On 17.04.2021 15:48, Robert Prins wrote:
Hi all,
Hello,
I would like to disassemble the final version of a self-written Turbo Pascal V3 program, i.e. a simple .COM file,
...

.com files haven't any segment-info.
you can try DOS-debug (if you have one) or the NASM disassembler.

DOS.COM-files are usually organized to start at cs:0x0100.
If you post a hex-dump of your code I could disassemble it.

To you, Wolfgang, and Sjouke Berry,

Turbo Pascal V3 (and probably versions 1 & 2 too) created .COM files are not run-of-the-mill .COM files. The startup-code actually sets up DS to point to a separate data segment, and SS to a separate stack. For what it's worth, I've put 'LIFT.COM' temporarily on my website https://prino.neocities.com/temp/lift.com so feel free to have a go at it. The code that sets up the environment starts at 0x2d7c (assuming the program is loaded at 0x100)

And as I wrote, IDA Pro happily disassembles it, but my problem is, not having ever disassembled a TP3 generated .COM file, how to create a second (= data) segment. I see it being created running the program in GRDB, but GRDB <> IDA Pro.

Getting a new version of IDA Pro (to again get access to their forum) is a no-no, the Pro version costs USD 1879 (or more than 10% of my annual income), the Home version costs USD 365, but no longer has a perpetual license and can only disassemble selected instruction sets...

Robert

PS: Maybe I should give this NSA thing, Ghidra, a try?
--
Robert AH Prins
robert(a)prino(d)org
The hitchhiking grandfather - https://prino.neocities.org/indez.html
Some REXX code for use on z/OS - https://prino.neocities.org/zOS/zOS-Tools.html



Subject: Re: Disassembly of old Turbo Pascal (V3) code - how to create data
From: Frank Kotler
Newsgroups: comp.lang.asm.x86
Organization: Aioe.org NNTP Server
Date: Sat, 17 Apr 2021 21:50 UTC
References: 1 2 3
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: fbkot...@nospicedham.myfairpoint.net (Frank Kotler)
Newsgroups: comp.lang.asm.x86
Subject: Re: Disassembly of old Turbo Pascal (V3) code - how to create data
Date: Sat, 17 Apr 2021 17:50:15 -0400
Organization: Aioe.org NNTP Server
Lines: 13
Approved: fbkotler@myfairpoint.net - comp.lang.asm.x86 moderation team.
Message-ID: <s5fllu$1eki$1@gioia.aioe.org>
References: <s5ehts$1no$1@dont-email.me> <s5fd2o$1qgu$1@gioia.aioe.org>
<s5ff5t$gbj$1@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Info: reader02.eternal-september.org; posting-host="0bff4bba722937584aa9fc461b7d8c52";
logging-data="31797"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/d6o4VlsU1THXfk1fsekaieSr9cINIP/k="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101
Thunderbird/52.5.2
Cancel-Lock: sha1:B4JeeWw+Lhp1Wtp9SpnoiP2cHew=
View all headers
On 04/17/2021 06:07 PM, Robert Prins wrote:

....
Turbo Pascal V3 (and probably versions 1 & 2 too) created .COM files are not run-of-the-mill .COM files.

As I recall, DOS doesn't care what the file is named. If the first two bytes are "MZ", it's an exe. Perhaps we should not call it .COM?

Best,
Frank




Subject: Re: Disassembly of old Turbo Pascal (V3) code - how to create data
From: Robert Prins
Newsgroups: comp.lang.asm.x86
Organization: A noiseless patient Spider
Date: Sun, 18 Apr 2021 09:09 UTC
References: 1 2 3 4
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: rob...@nospicedham.prino.org (Robert Prins)
Newsgroups: comp.lang.asm.x86
Subject: Re: Disassembly of old Turbo Pascal (V3) code - how to create data
Date: Sun, 18 Apr 2021 09:09:25 +0000
Organization: A noiseless patient Spider
Lines: 25
Approved: fbkotler@myfairpoint.net - comp.lang.asm.x86 moderation team.
Message-ID: <s5glvd$v3g$1@dont-email.me>
References: <s5ehts$1no$1@dont-email.me> <s5fd2o$1qgu$1@gioia.aioe.org>
<s5ff5t$gbj$1@dont-email.me> <s5fllu$1eki$1@gioia.aioe.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Info: reader02.eternal-september.org; posting-host="0bff4bba722937584aa9fc461b7d8c52";
logging-data="2523"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19aCiGqRjXsM0WsZiRlmRtOJz2VH4ZFe9o="
User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:78.0) Gecko/20100101
Thunderbird/78.9.1
Cancel-Lock: sha1:Hq4ySDLnvy4l/4zFVxR50ZNAvWA=
View all headers
On 2021-04-17 21:50, Frank Kotler wrote:
On 04/17/2021 06:07 PM, Robert Prins wrote:

...
Turbo Pascal V3 (and probably versions 1 & 2 too) created .COM files are not run-of-the-mill .COM files.

As I recall, DOS doesn't care what the file is named. If the first two bytes are "MZ", it's an exe. Perhaps we should not call it .COM?

They are not MZ files, they are real COM files, be it that they do strange things once loaded.

Not that strange, given that "turbo.com", the original "IDE" did also handle multiple segments (itself, and the image of the compiled program, when set to run from memory) Anders Hejlsberg, who originally wrote it, was (and still is) pretty brilliant guy.

Robert
--
Robert AH Prins
robert(a)prino(d)org
The hitchhiking grandfather - https://prino.neocities.org/indez.html
Some REXX code for use on z/OS - https://prino.neocities.org/zOS/zOS-Tools.html



Subject: Re: Disassembly of old Turbo Pascal (V3) code - how to create data
From: wolfgang kern
Newsgroups: comp.lang.asm.x86
Organization: Aioe.org NNTP Server
Date: Sun, 18 Apr 2021 09:29 UTC
References: 1 2 3 4 5
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: nowh...@nospicedham.never.at (wolfgang kern)
Newsgroups: comp.lang.asm.x86
Subject: Re: Disassembly of old Turbo Pascal (V3) code - how to create data
Date: Sun, 18 Apr 2021 11:29:37 +0200
Organization: Aioe.org NNTP Server
Lines: 35
Approved: fbkotler@myfairpoint.net - comp.lang.asm.x86 moderation team.
Message-ID: <s5gu8b$mg2$1@gioia.aioe.org>
References: <s5ehts$1no$1@dont-email.me> <s5fd2o$1qgu$1@gioia.aioe.org>
<s5ff5t$gbj$1@dont-email.me> <s5fllu$1eki$1@gioia.aioe.org>
<s5glvd$v3g$1@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Info: reader02.eternal-september.org; posting-host="0bff4bba722937584aa9fc461b7d8c52";
logging-data="17389"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18W16dpxGCwKRF++X9TVrtWnSkSY8whIPg="
User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:88.0) Gecko/20100101
Thunderbird/88.0
Cancel-Lock: sha1:qVQDNzTqxw5IpB0ASffnhXBaAGs=
View all headers
On 18.04.2021 11:09, Robert Prins wrote:
On 2021-04-17 21:50, Frank Kotler wrote:
On 04/17/2021 06:07 PM, Robert Prins wrote:

...
Turbo Pascal V3 (and probably versions 1 & 2 too) created .COM files are not run-of-the-mill .COM files.

As I recall, DOS doesn't care what the file is named. If the first two bytes are "MZ", it's an exe. Perhaps we should not call it .COM?

They are not MZ files, they are real COM files, be it that they do strange things once loaded.

Not that strange, given that "turbo.com", the original "IDE" did also handle multiple segments (itself, and the image of the compiled program, when set to run from memory) Anders Hejlsberg, who originally wrote it, was (and still is) pretty brilliant guy.

if they are real COM files then the segment info is found in the code.

often seen start in com-files:

org 0100h       ;to override DOS default segment setting
  push CS        ;the COM-loader grant a few bytes stack
  pop  SS
  mov  SP.xxxx   ;wherever it's wanted to be
  push CS
  pop  DS
  push  0
  pop  ES
.....
__
wolfgang



Subject: Re: Disassembly of old Turbo Pascal (V3) code - how to create data
From: Terje Mathisen
Newsgroups: comp.lang.asm.x86
Organization: Aioe.org NNTP Server
Date: Sun, 18 Apr 2021 12:39 UTC
References: 1 2 3 4 5
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: terje.ma...@nospicedham.tmsw.no (Terje Mathisen)
Newsgroups: comp.lang.asm.x86
Subject: Re: Disassembly of old Turbo Pascal (V3) code - how to create data
Date: Sun, 18 Apr 2021 14:39:10 +0200
Organization: Aioe.org NNTP Server
Lines: 32
Approved: fbkotler@myfairpoint.net - comp.lang.asm.x86 moderation team.
Message-ID: <s5h99b$1gc9$1@gioia.aioe.org>
References: <s5ehts$1no$1@dont-email.me> <s5fd2o$1qgu$1@gioia.aioe.org>
<s5ff5t$gbj$1@dont-email.me> <s5fllu$1eki$1@gioia.aioe.org>
<s5glvd$v3g$1@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Info: reader02.eternal-september.org; posting-host="0bff4bba722937584aa9fc461b7d8c52";
logging-data="29295"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX196VVBTe8JR00n1T1Vja5mTe2XXWlMK9LE="
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:60.0) Gecko/20100101
Firefox/60.0 SeaMonkey/2.53.7
Cancel-Lock: sha1:8TcA/XwlF3Om5Kd1ieWSEBe0dtg=
View all headers
Robert Prins wrote:
On 2021-04-17 21:50, Frank Kotler wrote:
On 04/17/2021 06:07 PM, Robert Prins wrote:

...
Turbo Pascal V3 (and probably versions 1 & 2 too) created .COM files are not run-of-the-mill .COM files.

As I recall, DOS doesn't care what the file is named. If the first two bytes are "MZ", it's an exe. Perhaps we should not call it .COM?

They are not MZ files, they are real COM files, be it that they do strange things once loaded.

Not that strange, given that "turbo.com", the original "IDE" did also handle multiple segments (itself, and the image of the compiled program, when set to run from memory) Anders Hejlsberg, who originally wrote it, was (and still is) pretty brilliant guy.

I agree 100%.

The 35-37 kB needed for Turbo.com is one of the all-time great hacks:

A compiler (non-optimizing but still), editor, debugger and RTL in that space?

Terje

--
- <Terje.Mathisen at tmsw.no>
"almost all programming can be viewed as an exercise in caching"



Subject: Re: Disassembly of old Turbo Pascal (V3) code - how to create data
From: Robert Prins
Newsgroups: comp.lang.asm.x86
Organization: A noiseless patient Spider
Date: Mon, 19 Apr 2021 01:26 UTC
References: 1 2 3 4 5 6
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: rob...@nospicedham.prino.org (Robert Prins)
Newsgroups: comp.lang.asm.x86
Subject: Re: Disassembly of old Turbo Pascal (V3) code - how to create data
Date: Mon, 19 Apr 2021 01:26:54 +0000
Organization: A noiseless patient Spider
Lines: 57
Approved: fbkotler@myfairpoint.net - comp.lang.asm.x86 moderation team.
Message-ID: <s5if84$2gb$1@dont-email.me>
References: <s5ehts$1no$1@dont-email.me> <s5fd2o$1qgu$1@gioia.aioe.org>
<s5ff5t$gbj$1@dont-email.me> <s5fllu$1eki$1@gioia.aioe.org>
<s5glvd$v3g$1@dont-email.me> <s5gu8b$mg2$1@gioia.aioe.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Info: reader02.eternal-september.org; posting-host="0e8ace9d0cb450e25e7da0cf5aed8539";
logging-data="6992"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19UIy2FBQoNp3GULXeYzsPpgxPmjO+KRWI="
User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:78.0) Gecko/20100101
Thunderbird/78.9.1
Cancel-Lock: sha1:JoEiZXII7vT+tM8p4sVRl4afwEk=
View all headers
On 2021-04-18 09:29, wolfgang kern wrote:
On 18.04.2021 11:09, Robert Prins wrote:
On 2021-04-17 21:50, Frank Kotler wrote:
On 04/17/2021 06:07 PM, Robert Prins wrote:

...
Turbo Pascal V3 (and probably versions 1 & 2 too) created .COM files are not run-of-the-mill .COM files.

As I recall, DOS doesn't care what the file is named. If the first two bytes are "MZ", it's an exe. Perhaps we should not call it .COM?

They are not MZ files, they are real COM files, be it that they do strange things once loaded.

Not that strange, given that "turbo.com", the original "IDE" did also handle multiple segments (itself, and the image of the compiled program, when set to run from memory) Anders Hejlsberg, who originally wrote it, was (and still is) pretty brilliant guy.

if they are real COM files then the segment info is found in the code.

often seen start in com-files:

org 0100h       ;to override DOS default segment setting
push CS        ;the COM-loader grant a few bytes stack
pop  SS
mov  SP.xxxx   ;wherever it's wanted to be
push CS
pop  DS
push  0
pop  ES
....

The info is there, but it's not as trivial as what you show. I'm sure that I will be able to get at it at some stage to automagically create an skeleton IDC file to generate the segments, after all I also got this bit of REXX,

=== CUT ===
data  = charin(file, 1, chars(file))

data  = overlay(reverse(x2c(d2x(date('T', now, 'I') + 12 * 3600, 8))), data, pos('PE' || x2c(00 00), data) + 8)

call charout file, data, 1
=== CUT ===

that sets the timestamp in the PE files coming out of Virtual Pascal to 12:00 with "now" being the date of the newest source file.

Robert
--
Robert AH Prins
robert(a)prino(d)org
The hitchhiking grandfather - https://prino.neocities.org/indez.html
Some REXX code for use on z/OS - https://prino.neocities.org/zOS/zOS-Tools.html



1
rocksolid light 0.7.2
clearneti2ptor