Difference between revisions of "Blitz:Blitz Mode"

From Amiga Coding
Jump to: navigation, search
(Switching Modes)
Line 12: Line 12:
 
BLITZ</code>
 
BLITZ</code>
 
This will pause for 5 seconds (on a PAL machine; 4 seconds on an NTSC Amiga) before entering Blitz mode.
 
This will pause for 5 seconds (on a PAL machine; 4 seconds on an NTSC Amiga) before entering Blitz mode.
 +
 +
==QAmiga Mode==
 +
This is a special mode that is useful when your program mostly runs in Blitz mode. It switches the Amiga back to a limited Amiga mode, keeping the Blitz display and custom chip registers intact. This allows your program to use OS functions for accessing files without reverting to the standard OS display. The Blitz display can't be updated in this mode however, instead will appear frozen until your program returns to Blitz mode.
 +
 +
As with other mode switch commands, simply executing the command QAmiga will enter the QAmiga mode, and executing the Blitz command will return your program to Blitz mode where it left off.
  
 
[[Category:Blitz Basic / AmiBlitz|Blitz]]
 
[[Category:Blitz Basic / AmiBlitz|Blitz]]
 
[[Category:Advancing With Blitz|Advancing With Blitz]]
 
[[Category:Advancing With Blitz|Advancing With Blitz]]

Revision as of 13:07, 28 August 2015

The Amiga OS is a great operating system, but with the limited power available when the Amiga was released first it made sense to bypass the OS and use the hardware directly. This disabled multitasking and took over the machine, but allowed games to run faster and with more colours without worrying about other tasks needing access to resources.

Blitz Basic / AmiBlitz can use a special mode called "Blitz Mode" which suspends the OS like this and allows full, unrestricted access to the Amiga's features by using a special set of commands. Your program can swap in and out of Blitz mode at will, but bear in mind that any OS features that rely on other tasks, e.g. intuition, file access etc. will be unavailable in Blitz mode.

Generally, freezing the OS like this is considered antisocial on a multitasking OS, so please be sure you really need to use it. Also, bear in mind that it will only work on "real" Amigas with the custom chipsets since it uses the chips directly, so using Blitz mode automatically rules your program out of working on a next-gen Amiga system.

Switching Modes

To switch to Blitz mode, the keyword Blitz is simply used. When your program reaches this command, the OS is instantly suspended and the screen will go blank. Everything the system does from this point on must be done by accessing the chips directly.

To switch back to normal mode, use the keyword Amiga. This will restore the OS to normal running mode, and Intuition will redraw the screen as it was before Blitz mode was entered. Please remember however, that even though operation is resumed, if some task was unexpectedly interrupted when Blitz mode was activated, some unexpected behavior could result. For example, writing to a file on disk could result in a corrupted file, or even a corrupted partition. For this reason, always ensure nothing else is happening when using Blitz mode. There isn't a 100% safe way of doing this, so generally it's just an idea to not use Blitz mode at all if you want your software to be used in a multitasking environment, and if you must use Blitz mode, add a small delay before entering Blitz mode to allow any disk caches to be flushed: VWait 250 BLITZ This will pause for 5 seconds (on a PAL machine; 4 seconds on an NTSC Amiga) before entering Blitz mode.

QAmiga Mode

This is a special mode that is useful when your program mostly runs in Blitz mode. It switches the Amiga back to a limited Amiga mode, keeping the Blitz display and custom chip registers intact. This allows your program to use OS functions for accessing files without reverting to the standard OS display. The Blitz display can't be updated in this mode however, instead will appear frozen until your program returns to Blitz mode.

As with other mode switch commands, simply executing the command QAmiga will enter the QAmiga mode, and executing the Blitz command will return your program to Blitz mode where it left off.