Ok guys, i'll go for 3.0 compatibility, as that should be enough for most people.
May you plese check if this logic makes sense?
1) Set up Layer2:
LD A, 2 ; Activate Layer 2
LD BC, LAYER2_ACCESS_PORT
OUT (C),A
NEXTREG REG_SPRITE_LAYERS, 0 ; Make sure it's S-L-U
NEXTREG REG_LAYER2_RAM_PAGE, 12 ; Use page 12, 13 and 14 for Layer2
LD A, 116 ; My test image is 116 pixels high
NEXTREG REG_CLIP_WINDOW_CTRL, $20
NEXTREG REG_CLIP_LAYER2, A
NEXTREG REG_CLIP_WINDOW_CTRL, $30
NEXTREG REG_CLIP_LAYER2, A
2) Load the palette:
First I set the index (just once)
NEXTREG REG_PALETTE_INDEX,0
Then call this 256 times (with A changing values of course, one per each palette color):
NEXTREG REG_PALETTE_VALUE, A
3) Load pixel data:
I change MM7 to 24 (as I put Layer2 at 16K bank 12), and read 8K from file at 0xE000, if there are more, then I change MMU7 to 25, and readk 8K more. I do that as much times as needed until the file is loaded (MMU7=24,25,26,27 etc.)
I change the MMU using the MMU regiters:
NEXTREG REG_MMU7, 1
Finally I restore the original MMU7 page, that according documentation is OK page 1:
NEXTREG REG_MMU7, 1
That's all, but it doesn't work, The game doesn't freeze or reset, and I know the ULA layer is there somewhere although i cannot see it, cause I can use the compass directions to move around the game, and when I enter valid direcitions I see my code is fired (to paint the new location picture) and when I enter invalid directions it is not fired.
I can only see a dark green layer that covers the whole screen, and ocassilnaly I see an single column of random pixels.
Oh, that's is my definition of ports:
Code: Select all
define LAYER2_ACCESS_PORT $123B
define REG_LAYER2_RAM_PAGE $12
define REG_TRANSPARENCY $14
define REG_SPRITE_LAYERS $15
define REG_CLIP_LAYER2 $18
define REG_CLIP_WINDOW_CTRL $1C
define REG_PALETTE_INDEX $40
define REG_PALETTE_VALUE $41
define REG_MMU7 $57