home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.sys.amiga.programmer
- Path: comp.vuw.ac.nz!HERMES!maths!peterm
- From: peterm@maths.grace.cri.nz (Peter McGavin)
- Subject: Re: Scrolling only selected bitplanes
- Message-ID: <PETERM.96Mar25143904@tui.maths.irl.cri.nz>
- Date: 25 Mar 1996 02:39:04 GMT
- Distribution: world
- References: <314e1835@beachyhd.demon.co.uk> <2628.6653T1T2571@mbox.vol.it>
- Organization: Industrial Research Ltd
- In-reply-to: bizzetti@mbox.vol.it's message of 19 Mar 1996 23:07:28 GMT
-
- bizzetti@mbox.vol.it (Fabio Bizzetti) writes:
- >>I am currently drawing (using WritePixel()) and scrolling (using
- >>ScrollRaster()). However, I want to be able to draw and scroll completely
- >>*independently* of the final bitplane. So I draw and scroll planes 1 through
- >>7, but plane 8 stays completely undisturbed.
- >
- >Sorry to say it, but this is a good example of reality about OS and direct
- >hardware programming.
-
- The OS provides SetWrMask() that should solve this problem. It should
- even work with gfx cards.
-
- >And also if there's a way to do it with the OS, it'll be damn slower
- >and expecially damn more innatural and complex than it has to be.
-
- ...and more compatible/portable. Maybe slower, but I would argue more
- natural and less complex. Compare: e.g, OpenScreen() with setting up
- all the display and palette registers and copperlists for a simple
- 256-colour display.
-
- Personally I have nothing against games that access hardware directly,
- provided:
-
- o it's really necessary for performance or functionality;
-
- o the game checks for the correct hardware first and doesn't
- crash without warning on different hardware;
-
- o the game exclusively allocates the hardware thru the OS before
- trying to access it;
-
- o the game provides options for different hardware and/or high
- level OS calls where feasible;
-
- o ideally the hardware access should be isolated in low levels
- of the game, e.g, custom device drivers;
-
- o the game obeys all OS rules
-
- The correct hardware can be checked for in places like
- ExecBase->AttnFlags, GfxBase->ChipRevBits0 and the displayinfo
- database.
-
- Most Amiga hardware can be exclusively allocated thru the OS. For
- example, the blitter can be allocated with OwnBlitter() or QBlit().
- There are routines for allocating sprites. Other custom graphics
- hardware can be allocated with LoadView(NULL); WaitTOF(); WaitTOF().
- Then the game can bang away at the copper to its heart's content.
- Restore the original View at the end. Depending on the game, however,
- it might be better to use a plain Intuition Screen and access the
- bitmap directly (after checking that it is a native, planar bitmap)
- and/or maybe open an Intuition Screen with a user copper list.
-
- An input-handler can eliminate 95% of OS overheads (they come from
- Intuition and console.device) and give the illusion of single-tasking
- without disabling multitasking. The game can continue async hard-disk
- caching of texture data, network play, OS calls, maybe even its own
- multiple tasks, etc. At the same time, an input-handler provides
- low-level, portable, efficient keyboard and mouse input that is
- expected to work on all and future Amigas.
-
- Other hardware resources, such as timers, serial and parallel ports,
- audio channels, etc, can be allocated if required (but better to use
- high-level OS calls for compatibility if possible).
-
- About the only Amiga hardware that cannot be directly accessed within
- OS rules (without rebooting afterwards) are the 680x0 interrupt
- vectors. Interrupts must be installed with AddIntServer(),
- SetIntVector(), QBlit(), AddICRVector(), etc. Interrupts may not be
- disabled for more than 250 microseconds. It's not really a problem
- once an input-handler is installed because OS interrupt overheads are
- so small.
-
- Failure to obey these rules can result in lockups, crashes, frozen
- networks and corrupted hard disks on Amigas with third-party
- peripherals such as network cards, disk controllers, etc. Also, the
- game will most likely fail with 680x0 emulation on PPC Amigas.
-
- From my own personal experience, it seems that about half the games
- and demos that install their own interrupt vectors ignore the VBR.
- About half of the rest fail on fast Amigas because they clear the
- interrupt too close before the RTE. On fast Amigas, that doesn't
- allow for propagation time through the slow custom chips and so the
- interrupt occurs again unexpectedly. Of course the OS interrupt
- handling routines know about these things.
-
- Similar problems seem to occur with most keyboard banging routines.
- They either don't wait long enough for certain keyboards (such as the
- A3000 one that needs a longer delay) or they wait so long for all
- keyboards that the extra delay totally eliminates the speed advantage
- of killing the OS.
-
- Well, either that or they spend 10 times as long waiting for the
- vertical blank or waiting for a mouse click or using slow algorithms
- as the speed gain they made by killing the entire OS.
-
- >What are the king of games?: consoles. Have you ever seen a console
- >programmed through an OS such as Amiga's one?
-
- I didn't buy my Amiga just for games.
- --
- Peter McGavin. (p.mcgavin@irl.cri.nz)
-
-