06 March 2021, 01:24 | #61 |
Registered User
Join Date: Mar 2021
Location: Ligao, Free World North
Posts: 228
|
Thanks,
fd2pragma -i dos_lib.fd -s 90 generated this: SECTION ".text",CODE XREF _DOSBase XDEF _Read _Read: XDEF Read Read: MOVEM.L D2/D3/A6,-(A7) MOVEA.L _DOSBase ,A6 MOVEM.L 16(A7),D1/D2/D3 JSR -042(A6) MOVEM.L (A7)+,D2/D3/A6 RTS I confirmed that this was functionally the same as what you showed earlier, with A7 = SP. But with or without -gas it is not assembling. But I should be able to manually fix that. There aren't many functions I actually need. C:\devel\fd2pragma>vasmm68k_std -gas -Fhunk Read.s vasm 1.8j (c) in 2002-2020 Volker Barthelmann vasm M68k/CPU32/ColdFire cpu backend 2.3n (c) 2002-2020 Frank Wille vasm std syntax module 5.3 (c) 2002-2020 Volker Barthelmann vasm hunk format output module 2.13 (c) 2002-2020 Frank Wille error 2 in line 2 of "Read.s": unknown mnemonic <SECTION> > SECTION ".text",CODE error 2 in line 3 of "Read.s": unknown mnemonic <XREF> > XREF _DOSBase error 2 in line 5 of "Read.s": unknown mnemonic <XDEF> > XDEF _Read error 2 in line 7 of "Read.s": unknown mnemonic <XDEF> > XDEF Read error 1 in line 10 of "Read.s": illegal operand types > MOVEA.L _DOSBase ***maximum number of errors reached!*** I would like this solution to work with both VBCC and GCC. I assume both of them use the stack the same way, so that this Read() function can be called? I'll put Read/Open/etc (just the ones I need) into a single amiga.asm which I distribute with PDPCLIB, but eventually I think the functions should be individual members of amiga.lib distributed with AmigaPDOS. OS/2 distributes a os2386.lib too. I'm not sure if individual compiler vendors distribute their own version of os2386.lib. I assume that clib/dos_protos.h is distributed by Amiga OS rather than individual compiler vendors too? I was planning on having a separate "amiga" directory under PDOS to store Amiga-specific stuff (I should really create a "windows" one too, and move Windows stuff out of "src"). |
06 March 2021, 01:33 | #62 | ||||
Registered User
Join Date: Mar 2018
Location: Hastings, New Zealand
Posts: 2,849
|
Quote:
Quote:
Quote:
Quote:
The purpose of a BIOS is to virtualize the hardware. When you port an OS from one hardware platform to another, this is the part that needs to be written to handle that specific hardware. On a PC the BIOS is in a ROM on the motherboard, and any hardware differences are incorporated into it by the manufacturer. The Amiga's 'BIOS' is integrated into its multitasking OS and cannot easily be extracted, so to do what you want without any baggage you need a custom BIOS. When porting from x86 to 68k, the compiler must also generate appropriate instructions to suit the CPU. A PC's BIOS is accessed via x86 software 'interrupts'. The 68000 can do something similar with traps. The Atari ST uses trap #13 to call its BIOS functions. |
||||
06 March 2021, 02:30 | #63 | ||
Registered User
Join Date: Mar 2021
Location: Ligao, Free World North
Posts: 228
|
I was thinking of the assembler code I was required to write for PDOS/386. I had to write a set of interrupt handlers. But the main problem there was that because I was running in 32-bit mode, the BIOS couldn't handle the interrupts itself, so I needed to take care of that and return to real mode and then do the BIOS interrupt myself. But I don't think that is required for AmigaPDOS even for applications, since they are invoking the OS via function call.
Quote:
Quote:
|
||
06 March 2021, 06:18 | #64 |
Registered User
Join Date: Mar 2021
Location: Ligao, Free World North
Posts: 228
|
I am a compiler vendor. I will be shipping a custom version of GCC 3.2.3.
In clib/exec_protos.h there is a function called AllocMem() which seems to be the simplest way (ie what I'm after) to allocate memory. Does the stub for this function also appear in amiga.lib? Thanks. |
06 March 2021, 06:46 | #65 | |
Registered User
Join Date: Mar 2021
Location: Ligao, Free World North
Posts: 228
|
Quote:
So perhaps I want a BIOS loaded from floppy (the same way that the Amiga 1000 loads Kickstart) and then the BIOS loads the first sector from the hard disk and transfers control to it. I guess it would be helpful to know whether the Atari BIOS allows booting from a FAT hard disk in this manner. Another possibility would be to have a modified FAT that places the entire BIOS in consecutive sectors and the Amiga 1000 (or some equivalent that can read hard disks) can read that. |
|
06 March 2021, 08:48 | #66 | |
son of 68k
Join Date: Nov 2007
Location: Lyon / France
Age: 51
Posts: 5,378
|
Quote:
Otherwise you're gonna make your life more complex and be limited to single Amiga model. But this has some benefits. The AmigaOS offers a lot more than mere BIOS. Why not just redirecting your API to AmigaOS then ? You could access any file system this way, including FAT. For text output, there is simple stdout. If you're gonna use Amiga thru an emulator, you can use PDOS on the Amiga in pretty much the same way - as a VM. Only thing you need is a .lib redirecting all your calls. If it can't work this way, what did I miss ? |
|
06 March 2021, 09:32 | #67 | ||||||
Registered User
Join Date: Mar 2021
Location: Ligao, Free World North
Posts: 228
|
Quote:
1. Replacing the Kickstart ROM with the new BIOS ROM, which will obviously only allow them to boot PDOS, until other OSes come along that support the Atari (or whatever) BIOS. 2. Creating a version of the BIOS code that can be loaded by Kickstart, with Kickstart being replaced (or ignored) by the BIOS. This would mean that the entire memory wouldn't be available, but that is OK, the BIOS will prevent all the memory from being available too, and the IBM PC BIOS provides a call to retrieve the available memory a bit at a time, in the knowledge that it is not a single block. Quote:
Quote:
Quote:
Quote:
Quote:
However, you have made a good suggestion. Can the Atari OS be run on the Amiga? If so, someone must have provided the Atari BIOS. And actually I don't really care if PDOS runs under AmigaOS, so long as PDOS is only making BIOS calls (trap #13). (Or some replacement BIOS, e.g. IBM PC BIOS if you want). The job of making the Atari BIOS independent of AmigaOS, or independent of just Kickstart, can be an exercise for another day. My main interest is getting PDOS to run on the Amiga and Atari hardware, with minimal changes to PDOS code, and for those minimal changes to be things like using Atari BIOS instead of IBM PC BIOS. I don't like the idea of modifying PDOS to use AmigaOS calls. I guess if the AmigaOS calls are hidden in a function called AtariBIOSReadDiskSector() it's no big deal. Does that open up a new path for quick implementation? |
||||||
06 March 2021, 10:27 | #68 |
Registered User
Join Date: Mar 2021
Location: Ligao, Free World North
Posts: 228
|
I had a brainwave to switch to "mot" and got:
C:\devel\fd2pragma>vasmm68k_mot -gas -Fhunk Read.s vasm 1.8j (c) in 2002-2020 Volker Barthelmann vasm M68k/CPU32/ColdFire cpu backend 2.3n (c) 2002-2020 Frank Wille vasm motorola syntax module 3.14c (c) 2002-2020 Frank Wille vasm hunk format output module 2.13 (c) 2002-2020 Frank Wille error 1 in line 10 of "Read.s": illegal operand types > MOVEA.L _DOSBase error 1011 in line 11 of "Read.s": identifier expected >,A6 I traced that strange error to this rogue x'0d': 000070 53426173 650D2C41 360A094D 4F56454D SBase.,A6..MOVEM It seems that there are a lot of them: C:\devel\fd2pragma>hexdump Read.s 000000 0A095345 4354494F 4E09222E 74657874 ..SECTION.".text 000010 222C434F 44450A09 58524546 095F444F ",CODE..XREF._DO 000020 53426173 650D0A0A 09584445 46095F52 SBase....XDEF._R 000030 6561640A 5F526561 643A0A09 58444546 ead._Read:..XDEF 000040 09526561 640A5265 61643A0A 094D4F56 .Read.Read:..MOV 000050 454D2E4C 0944322F 44332F41 362C2D28 EM.L.D2/D3/A6,-( 000060 4137290A 094D4F56 45412E4C 095F444F A7)..MOVEA.L._DO 000070 53426173 650D2C41 360A094D 4F56454D SBase.,A6..MOVEM 000080 2E4C0931 36284137 292C4431 2F44322F .L.16(A7),D1/D2/ 000090 44330A09 4A535209 2D303432 28413629 D3..JSR.-042(A6) 0000A0 0A094D4F 56454D2E 4C092841 37292B2C ..MOVEM.L.(A7)+, 0000B0 44322F44 332F4136 0A095254 530A D2/D3/A6..RTS. I tried switching from gcc to bcc32, but it didn't compile. I switched to wcl386 and it compiled, and produced the same rogue x'0d'. I tried changing the "wb" in fopen in fd2pragma.c to "w", but that didn't fix the problem. I added -g0 to bcc32 which allowed it to compile (ignoring all the warnings), but got the same result. I changed the "rb" to "r" in fopen, and got: C:\devel\fd2pragma\zzz>..\fd2pragma -i ..\dos_lib.fd -s 90 Error 38 : Could not open file "..\dos_lib.fd". I was horrified that my file had apparently been deleted, but false alarm, it was still there. That error appears to be in an enum block, of value ERR_CLIB_ARG_COUNT, but when I checked that code I gave up. Using micro-emacs to edit (using the output of the original fd2pragma) Read.s and write it back, caused the x'0d' to disappear and I got a clean assembly: C:\devel\fd2pragma>vasmm68k_mot -gas -Fhunk Read.s vasm 1.8j (c) in 2002-2020 Volker Barthelmann vasm M68k/CPU32/ColdFire cpu backend 2.3n (c) 2002-2020 Frank Wille vasm motorola syntax module 3.14c (c) 2002-2020 Frank Wille vasm hunk format output module 2.13 (c) 2002-2020 Frank Wille .text(acrx2): 26 bytes So I'm in business! |
06 March 2021, 10:37 | #69 | ||||||||
son of 68k
Join Date: Nov 2007
Location: Lyon / France
Age: 51
Posts: 5,378
|
Quote:
Quote:
Still, there is a lot to do yourself and you'll end up with more Amiga specific code than if you'd just used AmigaOS. And say good bye to hard drive access. Quote:
But if it's not required then there is no reason to not leave AmigaOS running. Quote:
Look, you mention in first post PDOS works also on mainframes. These don't allow their OS to be switched off to plug another one, do they ? I coded on IBM C370 in the past and didn't even know how much memory there was on it ! Besides, PDPCLIB run on Linux and Windows -- so why not just doing the same on the Amiga ? An abstraction layer. Your calls. Your own APIs. Quote:
Quote:
Actually the situation is pretty much the same as on the Amiga. Quote:
You can't run something that's low level PC software on a machine that's obviously not a PC. Regardless if you use AmigaOS calls or Amiga hardware directly, you *have* to modify PDOS. Quote:
The path for a quick implementation is to list all the functions you need on the Amiga side, then implement them. Whether internally they use some BIOS, AmigaOS calls, or hardware directly, does not matter then. |
||||||||
06 March 2021, 11:19 | #70 | |
Registered User
Join Date: Jan 2019
Location: Germany
Posts: 3,451
|
Quote:
|
|
06 March 2021, 11:26 | #71 | |
Registered User
Join Date: Jan 2019
Location: Germany
Posts: 3,451
|
Quote:
|
|
06 March 2021, 11:29 | #72 |
Registered User
Join Date: Jan 2019
Location: Germany
Posts: 3,451
|
Nope. Not for booting. See above. Read() is a function of the dos.library,and it does not exist once the operating system reaches the floppy boot block. It is rather up to the boot block to create it - but if you create it, the CPU does not come back to you, but continues the regular bootstrap process by executing S:Startup-Sequence.
|
06 March 2021, 11:50 | #73 | ||||||||
Registered User
Join Date: Jan 2019
Location: Germany
Posts: 3,451
|
Quote:
Quote:
Quote:
Quote:
Quote:
Quote:
Quote:
Quote:
|
||||||||
06 March 2021, 11:51 | #74 | |||||||||||
Registered User
Join Date: Mar 2021
Location: Ligao, Free World North
Posts: 228
|
Quote:
Quote:
Quote:
Quote:
Quote:
Quote:
Quote:
Quote:
/* BosDiskSectorRLBA - read using LBA Int 13h Function 42h */ /* Returns 0 if successful, otherwise error code */ int BosDiskSectorRLBA(void *buffer, unsigned int sectors, unsigned int drive, unsigned long sector, unsigned long hisector) Quote:
Quote:
Quote:
|
|||||||||||
06 March 2021, 12:21 | #75 |
Registered User
Join Date: Mar 2021
Location: Ligao, Free World North
Posts: 228
|
I was referring to PDPCLIB there, not PDOS. I believe I have everything I need to implement PDPCLIB for AmigaOS.
|
06 March 2021, 12:32 | #76 | |||||||||
son of 68k
Join Date: Nov 2007
Location: Lyon / France
Age: 51
Posts: 5,378
|
Because you need a working AmigaOS to be able to access the hard drive, for the reasons Thomas mentioned. No AmigaOS, no hard drive.
Quote:
Quote:
Quote:
Quote:
Quote:
Quote:
Code:
C: long Rwabs(int rwflag, long buffer, int number, int recnr, int dev); Asm: move.w dev,-(sp) move.w recnr,-(sp) move.w number,-(sp) move.l buffer,-(sp) move.w rwflag,-(sp) move.w #4,-(sp) trap #13 add.l #14,sp Besides, this requires a dedicated hard drive. A flat file does not. Quote:
Quote:
Quote:
That applications use address 4 is no problem - this information will be hidden in the Amiga specific code. On Windows there is nothing such as SysBase anyway so even if you could have a valid address, what would it point to ? |
|||||||||
06 March 2021, 12:57 | #77 | |||||||
Registered User
Join Date: Mar 2021
Location: Ligao, Free World North
Posts: 228
|
Quote:
[/quote] Quote:
Quote:
Quote:
Quote:
Quote:
Quote:
Once working, this would then allow me to run AmigaOS executables (although a.out format rather than hunk to start with) on the Atari. Not requiring a VM either - directly on the Atari hardware without Atari OS. Right? |
|||||||
06 March 2021, 13:11 | #78 | ||||||
Natteravn
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,570
|
Quote:
There may be differences in the ABI when it comes to floating point, though. Don't know if that affects you. AmigaOS compilers will return a float result in FPU register fp0 (when compiling with FPU code enabled) while many other (Unix-based) compilers always return it as 64-bit double precision in the CPU's register pair d0/d1. Which Amiga compilers only do with soft-float. Quote:
Quote:
Quote:
Quote:
Quote:
Somebody should debug that (probably me, as the original author of fd2pragma disappeared ). Simple solution would be to run fd2pragma with "-s 12". Special 12 directly outputs a hunk-format linker library with individual object files for all functions. |
||||||
06 March 2021, 13:30 | #79 | |||||||||
Registered User
Join Date: Mar 2021
Location: Ligao, Free World North
Posts: 228
|
Quote:
Quote:
Quote:
Quote:
Quote:
Quote:
Quote:
Quote:
Quote:
|
|||||||||
06 March 2021, 14:08 | #80 | |||
Registered User
Join Date: Jan 2019
Location: Germany
Posts: 3,451
|
Quote:
Quote:
Quote:
Well, it would run on emulated Atari hardware, but that might be good enough. I do not quite know why you want to do what you want to do, so I cannot judge whether that is sufficient. My Amiga already has an operating system. |
|||
Currently Active Users Viewing This Thread: 2 (0 members and 2 guests) | |
Thread Tools | |
|
|