On Saturday, November 19, 2022 at 11:37:49 PM UTC+8, Terje Mathisen wrote:
> > if @DataSize
> > else
> >
> > mov bx,ss
> > mov ax,ds
> > sub bx,ax
> > mov cl,4
> > shl bx,cl
> >
> > mov bp, sp
> > sub bp, bx
This should have been an add, not a subtract. :-)
> > mov ss, dx
> > mov sp, bp
> > ; And that null PSP thing needs to be redone
> > mov ax, 0
> > push ax
> >
> > endif
> >
> >
> > My testing suggests that there is a problem with tiny memory
> > model, but the other memory models seem to work.
> Tiny is the one used by all .COM files, in those the binary has no
> relocation info, it is just block copied into a newly allocated 64KB
> block of memory, at offset 100h, and with those first 256 bytes (the
> PSP) initialized by the OS.
>
> In this model all segment registers are the same, i.e. CS=DS=ES=SS
> because the OS and CPU are pretending to be a Z80 with no support for
> extended/segmented memory addressing.
That's only if you deliberately choose to produce a COM file,
and also you need an org 100h in the startup code.
Otherwise, tiny memory model produces a perfectly fine
normal MSDOS executable, and the entry point can be
anywhere.
My hello world program, linking in the whole C library
in tiny memory model is this size:
Memory size: e110 (57616.)
_TEXT CODE DGROUP 0000:0000 000053c6
CONST DATA DGROUP 053c:0006 000002be
CONST2 DATA DGROUP 0568:0004 00000000
_DATA DATA DGROUP 0569:0000 00000668
_BSS BSS DGROUP 05cf:0008 00006412
STACK STACK DGROUP 0c11:0000 00002000
Entry point address: 0000:02fa
Which is cool.
I have a lot of BSS because of 6144-byte buffers for files which
gave a great speedup on a real XT in the 1990s.
My tiny mode doesn't support malloc though, so you can't
do much. Doesn't support parameters either. :-) Large is
fine though. It was interesting to see.
PDOS/86 now has INT 3 and INT 1 support as a result of
debugging that.
BFN. Paul.