ZXodus Engine Copyright (c) 2011 Andrew Owen All rights reserved. LEGAL You may use or adapt this code in your own program, even if you charge for it, but you must state that it was written with the ZXodus Engine. INSTRUCTIONS Load the routine with CLEAR 39747 : LOAD "" CODE. Initialize the routine with RANDOMIZE USR 40075 (do this only once). Switch on the interrupt driver with RANDOMIZE USR 39748. Switch it off with RANDOMIZE USR 39751. Set the tiles by POKEing the values in the tile map (40075 to 40155). Use a different 768 byte 6x8 pixel font by loading it at 40156. The font should use the middle 6 pixels of the byte. Use a different tile set (up to 256 tiles) by loading it at 40924. CREATING TILE SETS The simplest way to create tile sets is with ColorTILE: http://www.worldofspectrum.org/infoseekid.cgi?id=4000117 However, this will require an accurate TC2048 emulator (such as Fuse or EightyOne). A quick and dirty way of creating tile sets is to use an image conversion tool to create two Timex .SCR files with the tiles in the lower two thirds of the screen and then import those into ColorTILE using the storage (T) option. If you want to use a different tool, or edit them by hand, the tiles are stored as 32 bytes of sequential bitmap data followed by 32 bytes of sequential attribute data. There can be a maximum of 256 tiles. BACKGROUND I wrote this engine as a technical exercise to see if it was possible to do more than 16 columns of 'rainbow processing' real data (as opposed to just changing the attributes every scan line) on a bog standard Speccy. The answer is: not really. POP / PUSH will get you 16 columns without any flicker. You can only get 18 columns using LD / PUSH. And in BASIC it flickers a bit, although it will stop if you do a PAUSE 0. Because the attributes are stored as a series of LD instructions, updating them is not trivial. To simplify the process the engine draws the tile map for you. All you need do is set the tile values in the tile buffer. Because so many cycles have already been used up by the 'rainbow processor' it is only possible to update three tiles every interrupt. This means it takes a total of 27 interrupts to fully update the tile map. The routine itself is 25,788 bytes in length and includes a 6x8 font driver using channel #4, 16K of tile definitions, and a 768 bytes font. The code to initialize channel #4 is used only once so it is stored in what will be the tile buffer.