Blitter Objects (bobs)
Hi,
I am in need of assistance again :D I have managed to get the blitter to blit most of the tiles for my game, but the tiles on an odd byte are causing me problems. The reason being is that they overlap tiles that start on an even byte and I'm failing to merge the 2 :sad A simple example (in ASCII) of what I am trying to do: -XX - represents the start of the tile that starts on an even byte XX represents the tile that starts on an odd byte and overlaps the previous tile (tiles are drawn in the order top-left to bottom-right). Code:
Each tile is 16 pixels (2 bytes) wide by 8 lines. |
I am not sure, I understand you 100%, but you cannot use odd addresses with the blitter.. if you need to blit something to a position that corresponds to an odd address, you need to add 2 to your dest address and then use the A or B source shift to move it 8 pixels left.
|
As hooverphonique already mentioned you will use the Blitter's barrel shifter when you want to write a BOb to an x-position which is not word-aligned.
To make shifting work you have to read and write an extra word. This is the space where the barrel shifter will shift the bits. You will choose a BLTAFWM of $ffff and a BLTALWM of $0000 to ignore the extra word being read and written. The ASH value shifts the mask in BLTAFWM/BLTALWM as well as the source A, which is preloaded with $ffff, to function as a mask for your BOb (A can also be pointed to a variable mask in memory). The minterm used is $CA, for D = (A & B) | (!A & C). You see that you also need the B and the C channel. B is the source which is pointing to the image of your BOB. The A channel defines which pixels are blitted from B onto the screen (D). The C channel is used to read the screen destination, so a pixel from the screen will be preserved in those regions where the mask is 0. BSH must be used to shift the B source by the same amount as A. In your case it would be 0 when the destination pointer is word aligned and 8 when not. Below you find a quick draft of what to do (unfortunately I didn't test it). But it can easily be extended to place masked BOBs at arbitrary coordinates on the screen. Code:
TILE_BLTDMOD equ HARDWARE_WIDTH-(TILE_WIDTH+2) |
Quote:
phx, Thanks for the lengthy explaination, that is exactly what I needed. I did read something along those lines in the Amiga HRM yesterday, but for some reason it didn't sink in properly :nuts I started changing my original code based on what you said, but still couldn't get it to work. Then I started again from scratch with more organised code and direct values for the modulo's and BLTSIZE values. It worked. I carefully replaced the direct values by adjusting the original modulo's (in d4 and d5) and BLTSIZE value (in d6) as necessary and it still works :) The resulting code is below: Code:
.not_even |
All times are GMT +2. The time now is 09:14. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.