flash · 261530
#-------------------------------------------------------# graphics in tile format#--------------------------------------------------------gt#-------------------------------------------------------# tile reduction#--------------------------------------------------------mR#-------------------------------------------------------# map output#--------------------------------------------------------m#-------------------------------------------------------# graphics bit depth is 4 (16 color)#--------------------------------------------------------gB4
ldr r0, =REG_BG0CNT_SUB @ Set sub screen format to be tilesldr r1, =(BG_COLOR_16 | BG_64x32 | BG_MAP_BASE(29) | BG_TILE_BASE(0))str r1, [r0]
In warhawk some tiles were denoted as destructable and checked against the data for a bullet collision. If I do not have control over what tile numbers are used how can you do this check easily. C64 used a range - ie tiles 250-255 were bases.
Going back to Mappy though (please look at it). This does have the benefit of easy level construction and the ability to output the entire level as a png for use with grip.
Also, I would personally liked to have my own tile set to use on all levels and then have individual levels that used that tileset but alternate palletes. Does that make sense to you, or am I just making work for myself? I mean use the same graphics but modify the pallet as done in the c64 version.I personally wonder if more would be learnt by me if I coded the level display and scroll using my own routines rather that hardware?
With this in mind the DS would have to scroll the screen horizonatally 32 pixels - which would be quite nice to be honest.
I then had a play with the data offsets to see how the tile mode works. So, the level will scroll the whole of the map for you, not smoothly nor correctly!!! This is redrawing the entire map each time a move is needed, but this still helps to see the way the ds works.
It is getting late, but had a play with the scroll registers and got myself confused..I have it scrolling down a few pixel and looping back to start. Ie. scroll down 8 and then return to possition 1... cycle..
ldr r0, =REG_BG0VOFS_SUB @ Load our vertical scroll register for BG0 on the sub screen mov r1, #0 @ Set our scroll counter to 0 ldrh r2, =0x1FF @ This is our mask to ensure the scroll value stays between 0-511loop: strh r1, [r0] @ Write our scroll counter to REG_BG0VOFS_SUB add r1, r1, #1 @ Increment our scroll counter and r1, r2 @ AND our scroll counter with our mask b loop @ Our main loop
What I need to do is work out how to move the entire screen down 8 pixels.. I hope I do not have to do the loop to move the entire screen data down one line - that is a lot of cycles...
Start at bottom line (rightmost)copy line above down one line,move left one block and repeat back all the way to the top left positon... Oh well... Will have another think tomorrow!Actually it can scroll the entire screen using the register (256 positions) but will repeat add nauseum... but there only appears to be one line of blank (8 pixel vert) at the top by which to use for the next map line...
// C Codevoid waitForVBlank(void){ while(!(REG_DISPSTAT & DISP_IN_VBLANK)); while((REG_DISPSTAT & DISP_IN_VBLANK));}@ My (probably wrong) translation to asm ldr r0, =REG_DISPSTATwaitVBlankA: ldr r1, [r0] tst r1, #DISP_IN_VBLANK bne waitVBlankAwaitVBlankB: ldr r1, [r0] tst r1, #DISP_IN_VBLANK beq waitVBlankB