[轉貼] 神人project用6502 CPU行pre-emptive scheduler

A Graphical OS for the Atari 8-bit

Atari 8-bit fans have long hankered after a GUI similar to GEOS on the Commodore 64. Diamond GOS went some way to addressing this deficiency, and since then there have been several creditable attempts at implementing a GUI OS on the A8. Now there’s another one in the pipeline: an as yet unnamed project which aims to bring a pre-emptive multi-tasking graphical operating system to the 8-bit Atari.

The most recent demo version of the GUI OS can be downloaded below:

Atari 8-bit Graphical OS

The ZIP file contains ROMs and ATR flashers for a variety of popular programmable cartridges, and separate versions are provided for use with Atari ST and Commodore Amiga mice.

The GUI/OS project grew out of a simple mouse demo, based on the interrupt driven mouse handler by John Maris. However, thanks to ideas and help from AtariAge members analmux, andym00, and popmilo, a simulated hi-res hardware sprite pointer was developed, of which the underlying application is completely unaware.

Meanwhile, Paul Fisher took on full responsibility for font design and production (creating a tool-chain for converting BDF fonts for use with our GUI), and has designed several hundred icons and dozens of other resources. He is also chief beta-tester, and without Paul’s assistance, this project would have been an impossible undertaking. Paul has also created several developmental screen mock-ups which depict how the finished product is likely to look. The mock-ups are realistic representations of screen elements currently being implemented. The completed graphical OS will include:

    A pre-emptively multitasking kernel supporting up to 16 processes
    Inter-process messaging system, supporting up to 64 open messages
    Completely replaces the Atari OS and DOS
    File system drivers supporting FAT12, FAT16 and FAT32
    Overlapping, movable, sizeable windows
    Cascading pull-down and pop-up menus
    Movable desktop icons and shortcuts
    Per-process and overall CPU load profiling
    Dialogue boxes with a rich control set (list boxes, spinners, sliders)
    256 character fonts from 6 to 32 points
    Italic, boldface, and underline, outline, and shadow styles for all fonts
    Smooth, quick and responsive mouse control
    Desktop file manager with drag-and-drop support
    Comprehensive API and technical documentation for developers

While it is hoped that the OS will support unexpanded 64KB XL/XE machines in some minimal way, the realistic base hardware requirement will be an 8-bit Atari XL/XE with at least 128KB, a flash cartridge (or Ultimate 1MB/Incognito), and an ST or Amiga compatible mouse or trackball.

In late 2012, Jörn Mika (aka Prodatron), author of the remarkable SymbOS Graphical Operating System for the CP/M, MSX and other Z80 platforms, approached me with some suggestions regarding rendering, window management and multi-tasking. Because of those pivotal conversations and the insight Jörn provided, the decision was made to abandon the A8 GUI’s right-threaded binary tree internal object structures (initially modelled after TOS on the ST), and adopt instead flat window records almost identical to those used by the SymbOS API. This change immediately yielded considerable reductions in code complexity and size, and an increase in efficiency. But yet there was still room for improvement in other areas.

After a further six months of nagging doubts about the proprietary “window mask” technology I had designed, I decided to take the plunge and do what Jörn had suggested might lead to a considerable increase in rendering speed: namely, to abandon the window masks (which, it turned out, might as well have been called “regions”), and use a traditional dirty-rectangle window management system, as used in SymbOS. In summer/autumn 2013 I set about writing a full implementation of the rectangle-based window manager. Impressed with the result, I committed to the change and optimised the whole system to use the rectangles, and this massive rewrite resulted in a roughly 100 per cent efficiency improvement when rendering the content of overlapping windows. After further optimisation of the font renderer, we finally began to see performance which appeared to approach that of the seemingly magical SymbOS.

In addition to this, Jörn convinced me that pre-emptive multitasking was possible on the 6502, so in May 2014, I began the arduous task of converting the existing code to run from a bank-switched cartridge, while simultaneously designing the pre-emptively multitasking kernel. As of August 2014, the cartridge build is working well and the kernel is fully functional, and we can finally witness multiple tasks sharing CPU time on the 8-bit Atari, and using a messaging queue for communication. Thanks to Jörn and many members of the AtariAge forum, some really inventive techniques of stack and page zero management have been implemented.

What is especially heartening at this stage is that the 8-bit Atari can actually run a pre-emptive scheduler, and run it well – in spite of the 6502’s fixed stack. And the Atari’s custom hardware has made some other really nice things possible, such as the calculation of processor usage on a process-by-process basis, as well as the monitoring of CPU idle time.

To help potential developers, documentation of the API will continue throughout 2015/2016, and – perhaps unsurprisingly – this task becomes easier as the architecture of the system becomes more clearly defined while it’s being coded up. There’s still a lot of work to do (UI controls, file system, SIO driver, etc), but now that we have a rudimentary multi-tasking graphical OS – and one which is efficient and usable – there seems to be no limit to what is achievable.

source: http://atari8.co.uk/gui/


本帖最後由 dsscss 於 2015-9-22 02:26 編輯