8Fermer10
Mega ShockedLe 20/05/2017 à 19:52
Hi BEY!

I looked at my current makefile and it looks like this...

LDFLAGS = -Wl,-T$(BASEDIR)/src/system/neo$(OUTPUT).x -Xlinker -Map=output.map

Sorry for what follows I am very basic...

The banked demo provided by HPMAN in the post below was the basis for this thread.

topics/186412-datimage

My first steps are get HPMAN's demo working as is....he shows a very valuable technique he calls image catalogs plus he hooks up the banking method!!
From here you can experiment with different methods of calling your sprites.
The thread above where he introduces the demo may have some beginner stuff (questions by yours truly) that may help get the demo running.

The current state of affairs

My goal is to integrate HPMAN's example as the framework of my project.

I started to consider:

1. The syntax of gfx calls (the above posts consider a call style similar to what HPMAN introduced in DATLib)
2. Image catalogs are added to the makefile. If there isn't a need for image catalogs can the makefile be avoided?

At the end of the above post HPMAN helped me realize I need to parse bank0map.s in order to accommodate the syntax to closer match the gfx calls introduced in DATlib.

Heres what I do now....

When I compile gfx my pipe line includes this call....

parseBankToDefineBank0 .\bank0map.s .\Bank0.h


The .vbs script below could be saved as
parseBankToDefineBank0.vbs

Const ForReading = 1 Const ForWriting = 2 filePath = WScript.Arguments(0) outFilePath = WScript.Arguments(1) Set fso = CreateObject("Scripting.FileSystemObject") Set f = fso.OpenTextFile(filePath) Do Until f.AtEndOfStream currentLine = f.ReadLine strText = strText & "#define " & Replace(currentLine, " = ", " ") & vbCrlf Loop f.Close Set objFSO = CreateObject("Scripting.FileSystemObject") If objFSO.FileExists(outFilePath) then objFSO.DeleteFile(outFilePath) Set objFile = objFSO.CreateTextFile(outFilePath) Else Set objFile = objFSO.CreateTextFile(outFilePath) End If objFile.WriteLine "#ifndef __BANK0GFX_H__" objFile.WriteLine "#define __BANK0GFX_H__" objFile.WriteLine "" objFile.WriteLine strText objFile.WriteLine "#endif"
The above parses bank0map.s into defines to be referenced in the gfx calls.

My gfx calls now look like this....similar to DATLib and much different in comparison to the original banked demo. classe

aSpriteInit(&player->player.sprite,(spriteInfo*)Player1,INDEX_PLAYERSPRITEPOOL,PAL_PLAYER1,player->player.x,player->player.y,0,FLIP_NONE); palJobPut(PAL_PLAYER1,1,((paletteInfo*)Player1_Palettes+1));
However I do have a snag that I have been meaning to bug HPMAN about...

I have had a false sense of security for a long while.
My Bank0 was taking a while to build so I figured I would add my gfx to Bank1.
After all I have Bank0, Bank1, Bank2 and Bank3 to play with so why not use another Bank for testing purposes when one bank takes a while to build?

I realize now that a line of code I eliminated was extremely important from the perspective of accessing the other banks!!!! scotch

volMEMWORD(0x2ffff0)=imagePack[frameIndex].bank;

I reviewed the imagePack and saw this....

MAINROM = 0 BANK_0 = 0 BANK_1 = 1 BANK_2 = 2 BANK_3 = 3 ENDMARK = 0xffff

I don't use the imagepack so I thought maybe I could get away with this...

Assuming the player 1 sprite was on Bank1.

volMEMWORD(0x2ffff0)=1; //I assume this is the secret code that references the next bank. I insert 1 hoping that this would be a reference to Bank1...I also tried some casting and stuff but I still can't reference the gfx I am trying to display aSpriteInit(&player->player.sprite,(spriteInfo*)Player1,INDEX_PLAYERSPRITEPOOL,PAL_PLAYER1,player->player.x,player->player.y,0,FLIP_NONE); palJobPut(PAL_PLAYER1,1,((paletteInfo*)Player1_Palettes+1));
Unfortunately the above example does not work and I am currently without access to any of other banks outside of Bank0. Hoping HPMAN can help on this one.