Space Invaders-style programming demo, 27-Oct-97 ------------------------------------------------ NOTE: This is currently not a working game. It only demos a scrolling method. Recently someone asked me how games that have more than 40 moving objects on screen might be implemented on a GameBoy given the fact that GameBoy only supports a max- imum of 40 sprites simultaneously on screen. The game Space Invaders (SI) by Taito for GameBoy is a good example of such a game. It has 40 "invaders" along with a space ship and missle launcher. All of these have the ability to be moving simultaneously. A quick disassembly of SI seems to suggest that they have separate tiles for each invader. Given the fact that each invader is 8x8 pixels, it appears they move them two pixels at a time using tiles similar to these : +--------+--------+ +--------+--------+ | | XX | | | XX | | | XXXX | | |XXXX | | | XXXXXX | | X|XXXXX | | |XX XX XX| | XX| XX XX | | |XXXXXXXX| | XX|XXXXXX | | | X X | | X| X | | |X X| | X | X | | | X X | | X| X | +--------+--------+ +--------+--------+ +--------+--------+ +--------+--------+ | X|X | | XX | | | XX|XX | | XXXX| | | XXX|XXX | | XXXXX|X | | XX X|X XX | | XX XX |XX | | XXXX|XXXX | | XXXXXX|XX | | X | X | | X |X | | X | X | | X | X | | X | X | | X |X | +--------+--------+ +--------+--------+ Given the fact that separate tiles are required to show smooth movement across the screen, seven times as many tiles are required of the original invader tile. Not only does this consume large amounts of ROM but valuable tiles are used up as well. One method of conserving tiles is to have dynamic tiles. Dynamic tiles are tiles that are modified during a VBlank interrupt to show movement. Still large amounts of ROM are often required to update these dynamic tiles. This demo source & ROM code for GameBoy shows another method for smooth scrolling of a large number of on screen objects. It does the scrolling not by modifying the tile map memory but rather by modifying the BackGround X scroll register on a line by line basis. So how does the code know when a new scan line is present? By setting and using the LYC scan interrupt. It interrupts at every scan line allowing the scroll register to be modified. This demo ROM code will work on the real GameBoy, VGB 1.0 or later, and possibly other emulators. It does NOT work on VGB 0.71 and possibly others. The source code was compiled using RGBDS V1.07. All screen images were created using TILE256. The 'tiles.dat' file is the original TILE256 data file. Jeff