====== Code Snippets ====== ===== Arcade Examples ===== This section uses code snippets from existing Bally Arcade games and demos to demonstrate important and/or commonly-used functions. Snippets are typically followed by a short discussion of how and why the listing works as it does. * The [[bunker|Space Invaders bunker]] snippet demonstrates how to write a pattern to the screen with [[system routines:screen handler#writp|WRITP]]. * The [[base|Space Invaders base]] snippet demonstrates how to write a pattern to the screen with [[system routines:screen handler#writ|WRIT]]. * The [[invader music|Space Invaders sound effect]] snippet demonstrates how to play sound using [[system routines:interrupt scheduler#bmusic|BMUSIC]]. * The [[star expander|Star Battle expanded pattern]] snippet demonstrates how to use the Magic System's Expander option to write patterns. ===== Z80 Examples ===== This section includes code snippets for useful Z80 routines. * [[Packed BCD subtraction]] demonstrates subtracting BCD numbers of varying length. * [[Packed BCD addition]] demonstrates adding BCD numbers of varying length.