Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.os.msdos.programmer > #4006

Re: PSP

From Marc 'BlackJack' Rintsch <marc@rintsch.de>
Newsgroups comp.os.msdos.programmer
Subject Re: PSP
Date 2021-05-03 11:46 +0000
Organization Aioe.org NNTP Server
Message-ID <s6onrc$1a5p$1@gioia.aioe.org> (permalink)
References (2 earlier) <aca67831-44fe-4271-876b-cbd5e23b3705n@googlegroups.com> <1amil4yros312.48wfgyi4tdux.dlg@40tude.net> <66abb53c-1309-46fe-9739-59078ced6277n@googlegroups.com> <a7fce4b2-9897-4a0a-a96a-b3d4d49d0215n@googlegroups.com> <e2b5a625-204c-446a-a501-16d5c1481a6dn@googlegroups.com>

Show all headers | View raw


On Tue, 30 Mar 2021 12:57:40 -0700, muta...@gmail.com wrote:

> On Wednesday, March 31, 2021 at 6:47:54 AM UTC+11, muta...@gmail.com wrote:
> 
>> > What I want to know is how MSDOS managed to 
>> > make @05, @08 and @09 a far call to 00C0. If 
>> > we can see a PSP from MSDOS for a .com file 
>> > it should have the answer. If we can disassemble 
>> > that, anyway.
> 
>> 05h BYTE CP/M CALL 5 service request (FAR CALL to absolute 000C0h) 
>> 06h WORD CP/M compatibility--size of first segment for .COM files 
>> 08h 2 BYTEs remainder of FAR JMP at 05h
> 
>> 000000 CD20C09F 009AF0FE 1DF0DC01 F70E4B01 . ............K. 
> 
> So:
> 
> 05h = 9A
> 06/07 = FEF0
> 08h = 1D
> 09h = F0
> 
> So the 06/07 "segment size" of nearly 64k is basically
> just maxing out the memory available to the .com
> program.
> 
> But how does 9A + 1D + F0 translate into a call to 00C0?

Let's fire up debug.exe and see what those bytes look like disassembled:

```
C:\>debug                                                         
-e 1000 9a f0 fe 1d f0                                            
-u 1000 1004
07D7:1000 9AF0FE1DF0        CALL    F01D:FEF0                     
```

So it is not a distributed instruction but all bytes together are the (far)
CALL.  Does it lead to address 000c0h?  Yes it does:

```
>>> hex((0xf01d << 4) + 0xfef0)
'0x1000c0'

>>> hex((0xf01d << 4) + 0xfef0 & 0xfffff)
'0xc0'
```

Apparently DOS puts the size at 06h/07h and calculates a segment for 08h/09h
that gives an effective address of 000c0h, taking into account that the number
”wraps” at 20 bits back to zero.

Ciao,
	Marc 'BlackJack' Rintsch
-- 
“It is well known that a vital ingredient of success is
 not knowing that what you're attempting can't be done.”
                         -- Terry Pratchett, Equal Rites

Back to comp.os.msdos.programmer | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

PSP "muta...@gmail.com" <mutazilah@gmail.com> - 2021-03-28 03:57 -0700
  Re: PSP JJ <jj4public@gmail.com> - 2021-03-28 19:03 +0700
    Re: PSP "muta...@gmail.com" <mutazilah@gmail.com> - 2021-03-28 19:10 -0700
      Re: PSP JJ <jj4public@gmail.com> - 2021-03-30 00:26 +0700
        Re: PSP "muta...@gmail.com" <mutazilah@gmail.com> - 2021-03-30 02:20 -0700
          Re: PSP "muta...@gmail.com" <mutazilah@gmail.com> - 2021-03-30 12:47 -0700
            Re: PSP "muta...@gmail.com" <mutazilah@gmail.com> - 2021-03-30 12:50 -0700
            Re: PSP "muta...@gmail.com" <mutazilah@gmail.com> - 2021-03-30 12:57 -0700
              Re: PSP "muta...@gmail.com" <mutazilah@gmail.com> - 2021-03-30 13:14 -0700
                Re: PSP "muta...@gmail.com" <mutazilah@gmail.com> - 2021-04-01 22:06 -0700
              Re: PSP Marc 'BlackJack' Rintsch <marc@rintsch.de> - 2021-05-03 11:46 +0000
                Re: PSP "muta...@gmail.com" <mutazilah@gmail.com> - 2021-05-03 05:38 -0700
                Re: PSP "muta...@gmail.com" <mutazilah@gmail.com> - 2021-05-04 18:49 -0700
                Re: PSP "muta...@gmail.com" <mutazilah@gmail.com> - 2021-05-07 18:11 -0700

csiph-web