Zac67 wrote:
No offense meant, but you asking these questions (esp. 1) kind of leaves me in doubt that you're really up to the task...
Well I could just poke the vector table (either the reset vector or some interrupt I know is going to happen soon), but I figured it would be wise to ask here the best approach in case there were any gotchas I should worry about. For all I know the vector table could be in ROM and you can't exactly muck about with VBR in user mode. Heck on many operating systems you can't even poke around in the vector table because it's protected with the MMU (though as I understand it that's not the case on the Amiga).
If you don't target the Amiga as primary system, but just use it as a development platform, there's no need for 2) since you leave it to normal Kickstart to setup the hardware (RAM, caches, IDE, video, ...) and then take over the machine much like most games do it or other OSes.
It's difficult to write a proper pre-emptive scheduler that runs in user mode. Besides, part of the reason I'm targetting the Amiga is to better understand how the hardware works.
If you're going to ask 'Then how do I take over the machine?' you're definitely not up to it, sorry.
Okay Mr. Bad Attitude.
Furthermore, writing a modern OS is nothing one single person can do in his lifetime...
AtheOS was written by a single person. It's now maintained by several people as Syllable, but it was a complete modern working operating system as AtheOS. I've already written an implementation for most of the functionality in the Palm OS memory manager (though once I tackle the MMU, I need to tweak the memory allocator so that two processes can't allocate memory in the same page and to deal with fragmentation using the MMU) and that probably took about a days worth of effort, two at the most.
movea.l 4.s,a6 ;Execbase
jsr _LVOForbid(a6) ;Disable multitasking
lea $dff000,a5 ;Custom chip base
move.w #$7FFF,intena(a5) ;Disable interrupts
move.w #$7FFF,dmacon(a5) ;Disable DMA
But that will leave me in user mode won't it? Is code in the bootblock of a floppy started in system or user mode? Is there a guide on the format of the bootblock somewhere?
From hwstartup.asm:
; if full interrupt control is desired, _main must _LVODisable,
; save intenar and disable all interrupts by writing $7fff to
; intena. to restore, write $7fff to intena, or $8000 to saved
; intenar value and write it to intena, and finally _LVOEnable.
So I'm guessing intenar is the read version of intena and that intena is used to control the interrupts generated by the hardware?
Could be a good idea to have a look at the NetBSD for initialization purposies and hw interface.
Reading driver source code to figure out how the hardware works is a bit of a pain. I suppose the bootloader might be useful, but the code Piru posted seems to have set me in the right direction.
BTW, if you do not plan to use the MMU (by far, a complicated task), could be a good idea to target the A500 or A600. A lees complicated processor. Try to use UAE to run your soft, that will save you plenty of time
Well I do plan to use the MMU eventually and unfortunately neither the A500 or UAE have an MMU. One of my goals in this project is to bring memory protection to classic Palm OS and I will need to deal with memory fragmentation and I'd rather not use the hackish mechanism Palm OS 5 and below use to deal with that.