TIP: Click on subject to list as thread! ANSI
echo: locuser
to: Paul Edwards
from: Matthew Parker
date: 1997-05-11 03:57:08
subject: pdos + pdpclib

On May 18 14:34, 1997, Paul Edwards of 3:711/934.9 wrote:

PE> Hi, I've just released PDPC051.ZIP and PDOS010.ZIP.  I am sending them both 
PE> to John.  Can you make both of these available for FREQ please?

PE> PDPC051 is a public domain c library

PE> PDOS010 is a public domain operating system (incomplete)

* Crossposted in 80XXX
* Crossposted in MSDOS.028
All,

As you might be aware, Caldera released the sourcecode to their OpenDOS
MS-DOS compatible operating system (version 7.01) on the fifth of may.
(http://www.caldera.com or http://www.caldera.co.uk)

[..deleted..]

 This is the source to what used to be Novell DOS. I assume it still
has restrictions on its use though. I haven't actually seen it yet.

PE> Matthew, I'm after some technical advice.  I needed to make my stuff handle 
PE> the tiny memory model in order to create io.sys.  This meant that I had to 
PE> change some procedures, which were expecting a far return address.  I have 
PE> found that other people use % model and use the "proc"
statement to handle 
PE> parameters.  Also they use the {at}datasize.

PE> However, I don't know what is "standard".  What I think
should be standard 
PE> is masm with Watcom's pitfalls, ie a common subset amongst the 
PE> "almost-masm-compatible" assemblers.  So how should I
write my stuff?

%.model MEMORY_MODEL 

is the normal way it is done with the use of {at}CodeSize and {at}DataSize to
work out the size of pointers. You then use "tasm -DMEMORY_MODEL=small".
This works with my copy of wasm ver 10.6. Try the method below instead 
I don't know if this will work though. Also if you don't mind changing the
source code for the memory model required you can use ".model small" etc.

ifdef WATCOM
    .model MODL
else
    %.model MODL
endif

PE> Also, I've done a lousy job on the myint86x stuff, I wasn't really sure how 
PE> to load ALL of the registers.

 I was working on an int86 function if your interested. Its not complete
though, it only works with Borland in large data memory models and needs
tasm available. Also I've only tested it with the file test.asm. I'll post
it all anyway. Also int 25h & 26h need special handling.

   ----- dos.h begins -----
#ifndef __DOS_H
#define __DOS_H

struct BYTEREGS
{
    unsigned char al, ah;
    unsigned char bl, bh;
    unsigned char cl, ch;
    unsigned char dl, dh;
};

struct WORDREGS
{
    unsigned short ax;
    unsigned short bx;
    unsigned short cx;
    unsigned short dx;
    unsigned short si;
    unsigned short di;
    unsigned short cflag;
};

union REGS
{
    struct WORDREGS x;
    struct WORDREGS w;
    struct BYTEREGS h;
};

int int86(int int_num, const union REGS *in_regs, union REGS *out_regs);
#endif
   ----- dos.h ends -----
   ----- dos.c begins -----
/* Works In large data memory model only */
#include 

#ifndef __WATCOMC__
int int86(int int_num, const union REGS *in_regs, union REGS *out_regs)
{
asm
{
    push ds
    mov al,byte ptr [int_num]
    mov byte ptr cs:[intoffset+1],al
    jmp short $+2
    les si,[in_regs]
    mov ax,es:[si]
    mov bx,es:[si+2]
    mov cx,es:[si+4]
    mov dx,es:[si+6]
    mov di,es:[si+10]
    mov si,es:[si+8]
    push bp

intoffset db 0cdh, 20h

    pop bp
    push si
    lds si,[out_regs]
    mov [si],ax
    mov [si+2],bx
    mov [si+4],cx
    mov [si+6],dx
    mov [si+10],di
    pushf
    pop ax
    and ax,1
    mov [si+12],ax
    mov di,si
    pop si
    mov [di+8],si

    pop ds
}
    return out_regs->x.ax;
}
#else
void __int86(int int_num, const union REGS *in_regs, union REGS *out_regs);
#pragma aux __int86="mov cs:[intoffset+1], al" \
                    "intoffset db 0cdh, 20h  " \
                    "" \
                    parm [ax] [ds si] [es di]
                    modify [ax bx cx dx es ds si di]
int int86(int int_num, const union REGS *in_regs, union REGS *out_regs)
{
    return out_regs->x.ax;
}
#endif
   ----- dos.c ends -----
   ----- test.asm begins -----

_TEXT segment byte public 'CODE'
extrn _int86: far
assume cs:_TEXT, ds:_TEXT
start:
    push cs
    pop ds
    push cs
    mov ax,offset regs
    push ax
    push cs
    push ax
    mov ax,21h
    push ax
    call _int86
    add sp,10

    mov ah,4ch
    int 21h

regs dw 900h ;AX
     dw ?    ;BX
     dw ?    ;CX
     dw offset message ;DX
     dw ?    ;SI
     dw ?    ;DI
     dw ?    ;cflag
message db 'Hello this worked$'
_TEXT ends

stack segment stack
db 200h dup (?)
stack ends
end start
   ----- test.asm ends -----
Matthew

--- Msged 4.20 beta 1
* Origin: Blueee Lilly Snowy (3:712/610.31)
SEEN-BY: 711/934 712/610
@PATH: 712/610 711/934

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.