The blitter is the most amazing thing that can be found in a STE and the Mega St's why, coz it's so fast! Here will I have now a go through of this amazing chip be published along with some illustrations and no source examples. The sources will be found in the comming issues of the Inc, since I have planes of starting up a special blitter section for a few issues where I'll confrontate some problems with the blitter and the solution to them. Now let's start with the pin design and after that look at the block diagram over it and the different registers it have and what to put into them. This one don't require Gdb any comments just look at it since it's how it looks (it aint scale 1:1 it's magnifyed a bit). Now let's look at the schematic flow diagram over the blitters function. Gbf The source is exactly what it sounds like it's the source and it's read twice and shifted (if you want's shift and final source read) the Halftone, that is a 16 bit mask that the shifted source then is masked along with that's the HOP (halftone operating) and then is the destination read and a logical operation between the source and the destination is then done eg. XOR,OR,AND,Source replacement and then masked with a end mask and placed back on the destination address. The blitter iis just like the DMA, ACIA's, Floppy controllers and Sound DMA (only STE) capable of generating a interrupt. The interrupt is cleared when the operation is ready the bit that is set it the third MFP bit (GPIP) but it's not usually used by the TOS. Halftone: --------- This is 16 16 bit mask's that are masked onto the source data, the halftone is located at $FF8A00-$FF8A1E. And each one is one word big in size. $FF8A00 R/W x x x x x x x x x x x x x x x x Half tone 0 $FF8A02 R/W x x x x x x x x x x x x x x x x Half tone 0 $FF8A04 R/W x x x x x x x x x x x x x x x x Half tone 1 $FF8A06 R/W x x x x x x x x x x x x x x x x Half tone 2 $FF8A08 R/W x x x x x x x x x x x x x x x x Half tone 3 $FF8A0A R/W x x x x x x x x x x x x x x x x Half tone 4 $FF8A0C R/W x x x x x x x x x x x x x x x x Half tone 5 $FF8A0E R/W x x x x x x x x x x x x x x x x Half tone 6 $FF8A10 R/W x x x x x x x x x x x x x x x x Half tone 7 $FF8A12 R/W x x x x x x x x x x x x x x x x Half tone 8 $FF8A14 R/W x x x x x x x x x x x x x x x x Half tone 9 $FF8A16 R/W x x x x x x x x x x x x x x x x Half tone A $FF8A18 R/W x x x x x x x x x x x x x x x x Half tone B $FF8A1A R/W x x x x x x x x x x x x x x x x Half tone C $FF8A1C R/W x x x x x x x x x x x x x x x x Half tone D $FF8A1E R/W x x x x x x x x x x x x x x x x Half tone E Source X and Y increment. ------------------------- In those two addresses must you put the X and Y incremant values, those values decides how you will cut from the source. The X incremant can't be a odd value since that bit isn't supported. normally is it 2 since then will every bit be read, if a value of 8 is placed in low res then will only bit plane 0 be read. The Y increment determinds how many bytes must be added to the current source address to reach the end of the line and the start of the line. In monochrome is it 80 bytes on each line, and if I'd copy 40 bytes (see later on) then would the value of 40 be placed in the source Y increment. Or if I'd copy 10 bytes would the value of 70 be placed here. $FF8A20 R/W x x x x x x x x x x x x x x x 0 Source X increment $FF8A22 R/W x x x x x x x x x x x x x x x 0 Source Y increment | -- Even values only! Source address: --------------- As the name says are it in this one that the source address must be placed. It is one 16 bit register and one 8 bit register giving a 24 bit address register on location $FF8A24 in where the source address start should be placed. $FF8A24 R/W 0 0 0 0 0 0 0 0 x x x x x x x 0 High address $FF8A26 R/W x x x x x x x x x x x x x x x 0 Low address | -- Even values only! End mask: --------- Those three addresses may contain a value that can (if the programmer wants to) be msked onto the end values of the whole operation, it can along with the Half tone created complex full patterns of nice effects. $FF8A28 R/W x x x x x x x x x x x x x x x x End mask 1 $FF8A2A R/W x x x x x x x x x x x x x x x x End mask 2 $FF8A2C R/W x x x x x x x x x x x x x x x x End mask 3 Destination X and Y increment ----------------------------- Those two are bult up exactly like the source X and Y increments. To understand those go back and read about the X and Y source increments. $FF8A2E R/W x x x x x x x x x x x x x x x 0 Dest. X increment $FF8A30 R/W x x x x x x x x x x x x x x x 0 Dest. Y increment | -- Even values only! Destination address: -------------------- Just look at the Source address and you'll understand how it works except to that this one is for the destination and not for the source. $FF8A32 R/W 0 0 0 0 0 0 0 0 x x x x x x x 0 High address $FF8A34 R/W x x x x x x x x x x x x x x x 0 Low address | -- Even values only! X and Y count: -------------- In those two are the size of the block to be blitted putted. If I'd like to copy a 32 pixels width and 15 lines high object then I would place 4 in the X count since 32 pixels is 4 words from left to right and in Y i'd place the value 15. $FF8A36 R/W x x x x x x x x x x x x x x x x X $FF8A38 R/W x x x x x x x x x x x x x x x x Y HOP: ---- This is the Halftone operation mode. Depending on what value that is placed here is different things done with the halftone and the source. Most used is mode 2 source only. HOP What: 0 Everything is set to 1 bit's 1 Half tone only 2 Source only 3 Source and Half tone. And the value for the decided operation is placed in here: $FF8A3A R/W - - - - - - x x Half tone operation Logical operation: ------------------ Now this is a fun one, with this one can you perform different logical operations berween the source and the destination, let's look at the operation overview. OP Does what: 0 All bits are set to zeros ,good when deleteing areas 1 S and D 2 S and not D 3 S only 4 not S and D 5 D only 6 S xor D 7 S or D 8 not S and not D 9 not S xor D 10 not D 11 S or not D 12 not S 13 not S or D 14 not S or not D 15 All bits are set to ones. (S=Source, D=Destination) The most intresting ones are 3 (source replaces background) and 7/1 source OR and source AND with destinations, with those can sprites be generated. $FF8A3B R/W - - - - x x x x logical operation Skew and extra read: -------------------- With this can one have the source to be shifted before anyother operations is preformed with it, can be useful from tile to time. But this register allso incoperates two more functions the FXSR and NFSR and the first one stands for Force eXtra Source Read and when that bit is set will the begining of the next line be read as a extra word. When the No Final Source Read is set when the last word of each line can not be read and the use of those three registers allso requires usage of source X and Y increment and source address. $FF8A3D R/W x x - - x x x x | | | | | | | | -------- Skew | -------------- NFSR ---------------- FXSR Various extra functions: ------------------------ Finaly we have reached the last register, this one is allso the one that starts the operation when it's written to. Let's look at it: $FF8A3C R/W x x x - x x x x | | | | | | | | | | -------- Line number | | ------------ SMUDGE | -------------- HOG ---------------- Busy The first one "Line number" indicates witch one of the 16 half tone registers that is about to be used. When the SMUDGE bit is set is the selected line activated, if it's a zero it will be ignored. The next bit called "HOG" indicates what working mode that should be used if it's a zero (0) than will the processor and the blitter share the bus and after 64 bus cycles will the processor work for 64 cycles and after that will the blitter work for 64 cycles etc.. When it's a one will the processor stop until the blitter have finished it's operation. The last bit called "Busy" is the one that startes the blitter, put a one here and it will start. That was all for now folks, hope you did get something out of my article and I'll follow it up with a article about "how to use the blitter in real life". Until then, let's wrap.. Kent Johansson +46(0)90139994