11 December 2016, 04:20 | #21 |
Registered User
Join Date: Dec 2016
Location: USA
Posts: 101
|
Oh! I'd have never thought of that. The Copper should be made to update the bitplane pointers just before we hit the visible area, shouldn't it?
Programming the Atari 800's ANTIC is starting to come back to me, hah. |
11 December 2016, 19:48 | #22 |
Registered User
Join Date: Dec 2016
Location: USA
Posts: 101
|
I found the problem and we both missed it. The frame loop does this every coarse scroll:
Code:
for(int i=0;i<NUM_BITPLANES; i++){ B_BlitTileRow(BPScreen1, levelTileMap, bgTileGraphics, screenPointerRowOffset); } Code:
for(int i=0;i<4;i++){ for(int column=0;column<20;column++){ int tileIndex = tileIndices[rowTilemapOffset + column]; B_BlitTile_ASM(bitplanes[i], column*16, rowBitplaneOffset, bgTileGraphics[i], tileIndex); } } |
12 December 2016, 11:45 | #23 |
Natteravn
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,545
|
Great you finally found it!
You might want to consider switching to interleaved bitplanes nevertheless. And do some optimizations to the inner core assembler routines, like blit.s. For example replace the mulu #20 with lsl #2 and lsl #4, or better, use a table for all y line offsets on the screeen. |
12 December 2016, 14:35 | #24 | |
Registered User
Join Date: Jul 2015
Location: The Netherlands
Posts: 3,437
|
Quote:
Great that it works now! That said, I would like to echo PHX's comments about interleaved bitmaps. They do speed up blitting by a sizable margin (especially on slower machines) and are usually worth the small extra memory use. |
|
12 December 2016, 18:54 | #25 |
Lemon. / Core Design
Join Date: Mar 2016
Location: Tier 5
Posts: 1,213
|
Also, with interleaved, you can always blit plane by plane for masked bobs, if you don't want to store the interleaved mask (especially for large objects)
|
12 December 2016, 19:36 | #26 |
Total Chaos forever!
Join Date: Aug 2007
Location: Waterville, MN, USA
Age: 49
Posts: 2,200
|
Personally, I wouldn't use bitplane interleave for transparent blits. For opaque blits like tiles it is great!
|
12 December 2016, 23:59 | #27 |
Registered User
Join Date: Dec 2016
Location: USA
Posts: 101
|
It took me a while but I've got it all set up for interleaved bitplanes now and can draw my tilemaps much faster It's not much to look at yet but it's really cool to me!
|
13 December 2016, 00:13 | #28 | |
Lemon. / Core Design
Join Date: Mar 2016
Location: Tier 5
Posts: 1,213
|
Quote:
And if you're plotting tiles... then by reason, you are probably going to want to plot masked bobs over the top.. and then also to save and restore the background... for 4 a bitplane screen that's 3 blits (interleaved) compared to 12 (non-interleaved) for each object plotted |
|
15 December 2016, 05:36 | #29 |
Registered User
Join Date: Dec 2016
Location: USA
Posts: 101
|
I haven't tried interleaved masked bobs yet but I did figure out how to import maps from Tiled using my tile set and can draw backgrounds of any length! Now I just need to fix my blit routine to use a source tilemap (256x256 4 bitplanes interleaved) of more than 16 tiles...
|
15 December 2016, 22:58 | #30 |
Lemon. / Core Design
Join Date: Mar 2016
Location: Tier 5
Posts: 1,213
|
Don't forget, you can pre-calculate your tile offsets and store those in the map (rather than a tile index)... there's some other easy and quick optimisations I can see in that ASM tile plotter too
|
15 December 2016, 23:17 | #31 |
Registered User
Join Date: Dec 2016
Location: USA
Posts: 101
|
That's just because I haven't updated the remote repository in a while.
I'm proud of myself for even getting this far considering I've never programmed an Amiga (or owned a real one!) since I bought my A2000 last month or so. I've done some ST stuff, wrote a dinky disk operating system for Easy68K (okay, a console with three or four commands that can run binaries off a floppy disk) a while back - that's all buried somewhere in my Github. |
20 December 2016, 04:03 | #32 |
Registered User
Join Date: Dec 2016
Location: USA
Posts: 101
|
And here's where we're at now!
I think I'm going to make a cheap River Raid knockoff. No interleaved bobs yet but I've got a 1-color text area now as a status bar. It's magic compared to VGA - just wait for the right scanline and change the bitplane pointers, no mucking with scroll registers or anything. I'm sure 99% of NTSC systems these days can do 320x224... |
01 January 2017, 21:28 | #33 |
Registered User
Join Date: Dec 2016
Location: USA
Posts: 101
|
So now I'm trying to do cookie-cutter shifted blits onto my interleaved screen and having some trouble getting it working.
Here's the routine I've got that's not working. It draws a squished bob with garbage below it so we're reading past the end of the bitmap data. The modulos are wrong maybe? destination is a pointer to the start of the visible screen. source for this example is a 32x32 4-bitplane bitmap (so 32x128 here). Code:
void B_Blit(PLANEPTR destination, int destX, int destY, APTR source, int srcX, int srcY, int sizeW, int sizeH, PLANEPTR oldBackground) { destY = destY*2; //? UWORD shift = (destX % 16) << 12; UWORD firstwordmask = 0xFFFF >> shift; UWORD lastwordmask = 0xFFFF << (16-shift); int bltW_words = sizeW/16; int bltW_bytes = sizeW/8; APTR srcPointer = (APTR)((UBYTE *)source + (srcY * (sizeH/16)) + srcX/8); APTR destPointer= (APTR)((destination + (destY * SCREEN_WIDTH_WORDS) + destX/8)); //Increase blit size by 1 word to account for shifts. I think these numbers are wrong //UWORD sourceSkip = bltW_bytes - 2; UWORD destinationSkip = SCREEN_WIDTH_BYTES - bltW_bytes; UWORD blitsize = (sizeH << 6) + bltW_words + 1; BlitWait(); //wait for the blitter to become available Hardware->dmacon = 0x8040; //make sure blit DMA is enabled Hardware->bltcon0 = 0x0FCA | shift; //AB + /AC Hardware->bltcon1 = 0x0000 | shift; //shifting the B source Hardware->bltadat = 0x0000; //preload with 0xFFFF for cookie cutting; Hardware->bltafwm = firstwordmask; Hardware->bltalwm = lastwordmask; Hardware->bltapt = srcPointer; Hardware->bltbpt = srcPointer; if(oldBackground == NULL) Hardware->bltcpt= destPointer; //if we don't have a background, use the destination else Hardware->bltcpt= oldBackground; //if we do have a background, use it Hardware->bltdpt = destPointer; Hardware->bltamod = sourceSkip; Hardware->bltbmod = sourceSkip; if(oldBackground == NULL) Hardware->bltcmod = destinationSkip; //screen size else Hardware->bltcmod = 0; //we have a background, so don't skip any bytes Hardware->bltdmod = destinationSkip; Hardware->bltsize = blitsize; //execute } Code:
void B_BlitOverwrite(PLANEPTR destination, int destX, int destY, APTR source, int srcX, int srcY, int sizeW, int sizeH) { destY = destY*2; //? int bltW = sizeW/16; APTR srcPointer = (APTR)((UBYTE *)source + (srcY * (sizeH/16)) + srcX/8); APTR destPointer= (APTR)((destination + (destY * SCREEN_WIDTH_WORDS) + destX/8)); //Increase blit size by 1 word to account for shifts UWORD sourceSkip = 0; UWORD destinationSkip = SCREEN_WIDTH_BYTES - bltW*2; UWORD blitsize = (sizeH << 6) + bltW; BlitWait(); //wait for the blitter to become available Hardware->dmacon = (UWORD)0x8040; //make sure blit DMA is enabled Hardware->bltcon0 = (UWORD)0x09F0; //D = A Hardware->bltcon1 = (UWORD)0x0000; Hardware->bltadat = (UWORD)0x0000; Hardware->bltafwm = (UWORD)0xFFFF; Hardware->bltalwm = (UWORD)0xFFFF; Hardware->bltapt = srcPointer; Hardware->bltdpt = destPointer; Hardware->bltamod = sourceSkip; Hardware->bltdmod = destinationSkip; Hardware->bltsize = blitsize; //execute } |
01 January 2017, 22:12 | #34 |
Registered User
Join Date: Mar 2016
Location: Australia
Posts: 882
|
You need to blit an extra word per line for shifting, and your modulo doesn't reflex this.
If you put the extra word in your bltW_* and fix everything from there it should work. Also, the last word mask should be 0x0000. Last edited by alpine9000; 01 January 2017 at 22:17. |
01 January 2017, 22:16 | #35 | |
Banned
Join Date: Dec 2016
Location: Nottingham, UK
Posts: 481
|
Eh, LuigiThirty, if you do want to start "hitting the metal" with machine code, there was a series run in Ace magazine, or maybe Amiga Format called "Davy Jones Locker". From the guy that did Menace, I think.
Quote:
None of 'em used C, as I recall. Not my kind of game though. Some did use AMOS Basic, that's for sure. But, if you are having success and fun using C, good luck with your endeavour. What flavour of C are you using? Last edited by Pat the Cat; 01 January 2017 at 22:38. |
|
01 January 2017, 22:29 | #36 | |
Registered User
Join Date: Dec 2016
Location: USA
Posts: 101
|
Quote:
|
|
03 January 2017, 06:22 | #37 |
Registered User
Join Date: Dec 2016
Location: USA
Posts: 101
|
Cool, I got it working! Now if I could figure out how to get Grafx2 to spit out a mask layer in the ILBM file I'll be set. I could generate the mask layers on the fly when the image is loaded but I'm sure someone's ran into this before.
|
04 January 2017, 15:09 | #38 | |
Natteravn
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,545
|
What was the problem? These lines definitely look wrong:
Code:
UWORD shift = (destX % 16) << 12; UWORD firstwordmask = 0xFFFF >> shift; UWORD lastwordmask = 0xFFFF << (16-shift); Quote:
In my last games we were using Gimp to draw the animation phases into a BMP picture and I wrote a portable C program to convert the picture into raw graphics data and masks. bmptoraw.c in Solid Gold (source on Aminet). |
|
04 January 2017, 23:25 | #39 |
Registered User
Join Date: Dec 2016
Location: USA
Posts: 101
|
I meant it works where it doesn't have to do any shifting. The problem with blitting to (0,0) seemed to be the incorrect modulo.
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Smooth vertical scrolling in AMOS | idrougge | Coders. AMOS | 43 | 21 February 2021 12:58 |
Horizontal vs vertical scrolling | Amiga1992 | Coders. General | 20 | 26 October 2015 11:15 |
infinite money in ishar 2 | Jacobson | support.Games | 7 | 19 April 2012 12:42 |
[Found: Insanity Fight] Vertical Scrolling Shootemup | capehorn | Looking for a game name ? | 5 | 13 March 2009 08:18 |
Vertical scrolling motorcycle game.. Anyone? | Thrash75 | Looking for a game name ? | 11 | 18 May 2005 19:44 |
|
|