08 March 2021, 14:59 | #121 | ||||
Registered User
Join Date: Mar 2021
Location: Ligao, Free World North
Posts: 224
|
Quote:
Quote:
https://sourceforge.net/p/pdos/gitco...358b6a/#diff-3 I have committed all the work I did today (see other files too). Quote:
Quote:
|
||||
08 March 2021, 15:18 | #122 | |
Registered User
Join Date: Mar 2021
Location: Ligao, Free World North
Posts: 224
|
Quote:
What I would really have liked is to generate 68020 instructions only when the ldivu etc situation occurred, so that simple programs that don't actually exercise floating point or 32-bit divides or whatever, still run on a plain 68000. But until that is available, I'm happy to just require a minimum of a 68020. I guess I could look at adding ldivu etc and drop back to 68000 at a later date as another option. |
|
08 March 2021, 15:59 | #123 | |
Registered User
Join Date: Jan 2019
Location: Germany
Posts: 3,247
|
Quote:
On AmigaOs, it is available in a separate system library, i.e. utility.library which programs needing it would open. |
|
08 March 2021, 16:07 | #124 | |
son of 68k
Join Date: Nov 2007
Location: Lyon / France
Age: 51
Posts: 5,335
|
Quote:
This looks somehow incompatible with your desire to have simple Amiga native programs run on AmigaPDOS. |
|
08 March 2021, 16:09 | #125 | |||
Natteravn
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,510
|
Quote:
Quote:
Quote:
Code:
; 32bit Division/Modulo for 68000/68010 * Functions: * long __divu(register long d0, register long d1) * long __divs(register long d0, register long d1) * long __modu(register long d0, register long d1) * long __mods(register long d0, register long d1) * __ldivs etc. expect parameters on the stack mc68000 code xdef __divu xdef __divs xdef __modu xdef __mods xdef __ldivs xdef __ldivu xdef __lmods xdef __lmodu __lmods movem.l 4(sp),d0/d1 __mods: tst.l d1 bmi 1$ tst.l d0 bmi 2$ bsr __divu move.l d1,d0 rts 1$: neg.l d1 tst.l d0 bmi 3$ bsr __divu move.l d1,d0 rts 2$: neg.l d0 bsr __divu neg.l d1 move.l d1,d0 rts 3$: neg.l d0 bsr __divu neg.l d1 move.l d1,d0 rts __lmodu movem.l 4(sp),d0/d1 __modu: bsr __divu move.l d1,d0 rts __ldivs movem.l 4(sp),d0/d1 __divs: tst.l d0 bpl 2$ neg.l d0 tst.l d1 bpl 1$ neg.l d1 bsr __divu neg.l d1 rts 1$: bsr __divu neg.l d0 neg.l d1 rts 2$: tst.l d1 bpl __divu neg.l d1 bsr __divu neg.l d0 rts __ldivu movem.l 4(sp),d0/d1 __divu: move.l d2,-(sp) swap d1 move.w d1,d2 bne 2$ swap d0 swap d1 swap d2 move.w d0,d2 beq 1$ divu d1,d2 move.w d2,d0 1$: swap d0 move.w d0,d2 divu d1,d2 move.w d2,d0 swap d2 move.w d2,d1 move.l (sp)+,d2 rts 2$: move.l d3,-(sp) moveq #16,d3 cmp.w #$80,d1 bhs 3$ rol.l #8,d1 subq.w #8,d3 3$: cmp.w #$800,d1 bhs 4$ rol.l #4,d1 subq.w #4,d3 4$: cmp.w #$2000,d1 bhs 5$ rol.l #2,d1 subq.w #2,d3 5$: tst.w d1 bmi 6$ rol.l #1,d1 subq.w #1,d3 6$: move.w d0,d2 lsr.l d3,d0 swap d2 clr.w d2 lsr.l d3,d2 swap d3 divu d1,d0 move.w d0,d3 move.w d2,d0 move.w d3,d2 swap d1 mulu d1,d2 sub.l d2,d0 bhs 8$ subq.w #1,d3 add.l d1,d0 7$: bhs.s 7$ 8$: moveq #0,d1 move.w d3,d1 swap d3 rol.l d3,d0 swap d0 exg d0,d1 move.l (sp)+,d3 move.l (sp)+,d2 rts end |
|||
08 March 2021, 16:54 | #126 | ||
Registered User
Join Date: Mar 2021
Location: Ligao, Free World North
Posts: 224
|
Quote:
Quote:
|
||
08 March 2021, 17:18 | #127 | ||
Registered User
Join Date: Mar 2021
Location: Ligao, Free World North
Posts: 224
|
Quote:
I now think it is important for the generated assembler to work on 68000 for something as important as the C runtime library, so I would like the 68000 non-FP code like ldivs to be available. Quote:
Thanks. Paul. |
||
08 March 2021, 17:37 | #128 | ||
son of 68k
Join Date: Nov 2007
Location: Lyon / France
Age: 51
Posts: 5,335
|
Quote:
Quote:
As i understand you want your OS to be universal and it's clearly the wrong candidate for that. |
||
08 March 2021, 18:00 | #129 | ||
Registered User
Join Date: Mar 2021
Location: Ligao, Free World North
Posts: 224
|
Quote:
Quote:
|
||
08 March 2021, 18:44 | #130 | ||
son of 68k
Join Date: Nov 2007
Location: Lyon / France
Age: 51
Posts: 5,335
|
Quote:
Quote:
But ok, one step at a time. |
||
08 March 2021, 20:53 | #131 |
Registered User
Join Date: Mar 2021
Location: Ligao, Free World North
Posts: 224
|
|
08 March 2021, 20:58 | #132 | |
Registered User
Join Date: Mar 2021
Location: Ligao, Free World North
Posts: 224
|
Probably find out what the barrier is to doing the same thing with Pascal. ie an OS and applications completely written in Pascal with no assembler.
Quote:
|
|
08 March 2021, 21:46 | #133 |
Registered User
Join Date: Mar 2021
Location: Ligao, Free World North
Posts: 224
|
Could someone help me with the code required to:
1. Save sp to a static variable in amistart 2. In exita, place return code into d0 3. Restore sp to saved value Thanks. Paul. * section "CODE",code xref ___start xdef ___amistart xdef ___exita ___amistart: movem.l d0/a0/a6,-(sp) jsr ___start rts * This function receives a return code as a parameter. The stack * then needs to be restored and the parameter placed in register d0 * prior to return to the OS. ___exita: rts |
08 March 2021, 22:44 | #134 |
Registered User
Join Date: Mar 2021
Location: Ligao, Free World North
Posts: 224
|
I'm unclear about FreeMem:
http://amigadev.elowar.com/read/ADCD.../node0355.html If I want to free all the memory I allocated, should I set the "desired block size" to 0? Thanks. |
08 March 2021, 23:03 | #135 |
AmigaMan
Join Date: Oct 2012
Location: Castro Urdiales/Spain
Posts: 761
|
It should be the same bytesize you have used in allocmem.
|
09 March 2021, 00:06 | #136 | |
Natteravn
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,510
|
Quote:
Writing it in C is possible, of course. But definitely slower. Er... what? How about BSD or Linux? At least the BSD-license is pretty close to public domain, and it should be hard to find any better OS. |
|
09 March 2021, 00:11 | #137 | |
Natteravn
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,510
|
Quote:
Code:
section CODE,code xref ___start ___amistart: move.l sp,savedSP movem.l d0/a0/a6,-(sp) jmp ___start xdef ___exita ___exita: move.l 4(sp),d0 move.l savedSP,sp rts section BSS,bss savedSP: ds.l 1 Last edited by phx; 09 March 2021 at 00:14. Reason: return |
|
09 March 2021, 02:00 | #138 | |
Registered User
Join Date: Mar 2021
Location: Ligao, Free World North
Posts: 224
|
Quote:
I would like the assembler to be flexible enough to handle __start() returning, so I modified your code slightly. There is still some work to do with getting things like rename() implemented for AmigaOS, but I'd like to see "hello, world" working first. |
|
09 March 2021, 04:37 | #139 | ||||
Registered User
Join Date: Mar 2021
Location: Ligao, Free World North
Posts: 224
|
Quote:
Yikes. Quote:
Quote:
Quote:
|
||||
11 March 2021, 20:15 | #140 |
Registered User
Join Date: Mar 2021
Location: Ligao, Free World North
Posts: 224
|
I currently have this code in my AmigaOS executables:
#ifdef __AMIGA__ if (cmdlen >= 0x80000000UL) { cmdlen -= 0x80000000UL; SysBase = (struct ExecBase *)pdosbase; } else { SysBase = *(struct ExecBase **)4; } So that I am not dependent on Commodore's SysBase, and can add my own features to AmigaPDOS, I was thinking that a6 should point to an AmigaPDOS parameter block, and the first element of that is a traditional SysBase. So SysBase is set and looks normal, but a new set of API calls is opened up, via the second element. I'm thinking the MSDOS API, like this: ret = PosFindFirst(p, 0x10); which will only do something sensible when operating on an AmigaPDOS-controlled disk. And to make things easier for the next person, I'll have a reserved word after that. Any flaw in this concept? Thanks. Paul. |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
|
|