Thread: PDOS for Amiga
View Single Post
Old 04 March 2021, 12:17   #42
kerravon
Registered User
 
Join Date: Mar 2021
Location: Ligao, Free World North
Posts: 228
Quote:
Originally Posted by Thomas Richter View Post
SysBase = *((struct ExecBase **)(4L));
Great! I think that's everything I need. I think I'm looking at under 200 lines of C code to be added to PDPCLIB. Plus under 100 lines of assembler to implement setjmp/longjmp.

Then I need maybe 100 lines of header files to contain structures like ExecBase. I only need to populate the fields I'm actually interested in, and will have "filler" for the rest. These structures would be provided by the OS (AmigaPDOS) rather than PDPCLIB.

AmigaPDOS also needs to provide amiga.lib containing Read() etc. I think that is the only library I need to actually provide. That's probably 200 lines of code.

Does the DOSBase global variable belong in PDPCLIB or amiga.lib? ie do existing C compilers put the variable in their C library or does Commodore provide it in some *.library (for the first Amiga 1000)?

The first step would be to get the above running under some existing C compiler such as SAS/C, assuming SAS/C allows you to bypass their own header files and libraries. Then a "hello, world" will start working. It is this "hello, world" that I want to run on AmigaPDOS in the medium term, but not the short term.

That would be the end of my involvement with AmigaOS and SAS/C.

Then I would want GCC 3.2.3 for 68000 to be compiled as a cross-compiler on my Windows machine.

Then GCC will start producing 68000 assembler, which looks like this:

cmp%.w %0,%1
fpmove%.l %x1,%x0

I don't know if that is the same format that SAS/C accepts, but it's not that important, as the next step is to build binutils, possibly version 2.14a, as that is what I am currently using to produce executables for PDOS/386. It looks to me like it can produce a.out format executables for 68000. a.out is a format PDOS can already handle. I don't see support for Amiga "hunk" format.

I can modify PDOS to start putting a structure pointer into memory location 4, to make it AmigaOS-like. Accepting OS calls via location 4 instead of INT 21H shouldn't be a big deal. I will not have a switch between application mode and OS mode, everything will run in OS mode, in a single memory space. If a suitable BIOS is available, I'm hopefully looking at 500 lines of C code to be added. I'll keep interrupts disabled so that I don't need much/any 68000 assembler.

Assuming a IBM-PC-style BIOS is available (instead of Kickstart), it will need to have the ability to load the first (boot) sector from a FAT-formatted floppy, which will need to be written in 68000 assembler. Or an MBR plus boot sector from a hard disk.

This will then load the loader (IO.SYS), which needs to be located in consecutive sectors. It is 18k in size.

This then loads the kernel (MSDOS.SYS), which can be located anywhere in the root directory and is about 100k in size.

Then I will be running Amiga programs, just not in Amiga hunk format.

Then in the medium term I can add Amiga hunk format to what PDOS supports. Currently it supports ELF and a.out and Windows executable formats. So then the "hello, world" I described above will immediately start working.

In the longer term, hopefully someone will update binutils to make it produce Amiga hunk format. Or provide an independent assembler and linker. These may even already exist. They need to be restricted to just use Read etc that AmigaPDOS actually supports.

Also in the longer term, support for the Amiga file system can be added to AmigaPDOS, including Amiga-style hard disks which presumably require a different MBR too. Or maybe this bit won't be technically possible?

Anything I've missed?

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