Thread: PDOS for Amiga
View Single Post
Old 03 March 2021, 04:24   #9
kerravon
Registered User
 
Join Date: Mar 2021
Location: Ligao, Free World North
Posts: 228
Quote:
Originally Posted by Docent View Post
First option is to take over the hardware and have full control of it. This means that, in order to run some of Amiga programs, you'll need to recreate a number of Amiga libraries, device drivers and generally AmigaOS structures.
Yes, I want to do this - but it will be a minimal implementation. Just enough to run C90 programs - and specifically C90 programs that have been built using PDPCLIB.

Quote:
dos.library
Ok, thanks for the pointer.

I found this:

https://wiki.amigaos.net/wiki/Basic_...ut_Programming

BPTR myfilehandle = IDOS->Open(UBYTE* filename, LONG accessMode);

That looks doable to me.

PDPCLIB implements PDOS/386 (a 32-bit version of MSDOS, basically) with the use of Pos*() function calls, which you can see here (with some edits to avoid confusion):

C:\devel\pdos\pdpclib>grep Pos *.c
pdossupc.c: if (PosOpenFile(filename, 0, &handle)) *errind = 1;
pdossupc.c: if (PosCreatFile(filename, 0, &handle)) *errind = 1;
pdossupc.c: if (PosReadFile(handle, buf, len, &readbytes)) *errind = 1;
pdossupc.c: if (PosWriteFile(handle, buf, len, &writtenbytes)) *errind = 1;
pdossupc.c: return (PosMoveFilePointer(handle, offset, whence, &dummy));
pdossupc.c: PosCloseFile(handle);
pdossupc.c: PosDeleteFile(filename);
pdossupc.c: PosRenameFile(old, new);
pdossupc.c: *ptr = PosAllocMem(size, POS_LOC20);
pdossupc.c: PosFreeMem(ptr);
pdossupc.c: PosExec(cmd, env);
pdossupc.c: PosGetSystemDate(&year, &month, &day, &dow);
pdossupc.c: PosGetSystemTime(&hour, &minute, &second, &hundredths);
pdossupc.c: PosGetSystemDate(&year, &month, &day, &dow);
pdossupc.c: PosTerminate(retcode);
start.c: p = PosGetCommandLine();
start.c: __envptr = PosGetEnvBlock();

As you can see, there are only a small number of OS calls needed.

So basically for AmigaOS I need to replace PosOpenFile() with Open().

If I use the Open() from dos.library that comes with a recent version of AmigaOS, will the resulting executable actually work on the very first version of AmigaOS on the Amiga 1000?

I would like PDPCLIB to be able to be used with the standard dos.library, but I would also like to build my own mini dos.library with just Open() etc that PDPCLIB actually needs.

Regardless, when I have my executable that calls Open(), what does that executable actually look like? Is there some code linked in that does an INT like MSDOS, or is there a DLL reference like Windows uses, and the AmigaOS (or AmigaPDOS) loader will modify the executable to provide a pointer to the code that needs to be executed?

Thanks. Paul.
kerravon is offline  
 
Page generated in 0.04145 seconds with 11 queries