lunoka
Gun-headed
Diving into retrodev
Posts: 55
Homebrew skills: art, music
Fave PCE Shooter: Burning angels
Fave PCE Platformer: Ninja Spirit
Fave PCE Game Overall: Valis 3
Fave PCE RPG: Neutopia
|
Post by lunoka on Feb 27, 2022 8:40:30 GMT
Hello o/
I'm facing an issue when using #inc directive for loading resources increment the Bank 2 reserved for constant, for example :
#inctile(title_tile_gfx, "./res/bgtitle.pcx", 1, 7)
and getting :
BANK 2 Constants 1147/7045
whereas it should be around 250 ( size of the char map for placing tiles )
Is it a normal situation? #incspr/#inctile etc. is hard to understand since I don't know what it does underneath.
|
|
lunoka
Gun-headed
Diving into retrodev
Posts: 55
Homebrew skills: art, music
Fave PCE Shooter: Burning angels
Fave PCE Platformer: Ninja Spirit
Fave PCE Game Overall: Valis 3
Fave PCE RPG: Neutopia
|
Post by lunoka on Feb 27, 2022 10:24:46 GMT
I would like to add that it seems to vary in function of the number of C files I have included in my project & in the HuC.exe parameters. I'm quite lost ^^;
|
|
|
Post by elmer on Feb 27, 2022 16:19:10 GMT
I'm facing an issue when using #inc directive for loading resources increment the Bank 2 reserved for constant, for example : Ah, the first problem here is that you really shouldn't normally be using HuC's "Constant" bank, which IIRC can be either bank 2 or bank 3 depending upon the library options that you use. That bank is dedicated to constants (i.e. things like strings) that the HuC compiler finds in your C source. I know that it looks mostly-empty, but it's a bad idea to mess with the compiler! If you use recent versions of PCEAS, the assembler will automatically use any otherwise "wasted" space in that bank for HuC's compiled-C-code procedures. Most data, such as sprites, tiles and maps usually goes into data banks, and is referred to in library functions by far-pointers, which are 24-bit pointers that include bank information so that the data can be mapped into memory only when it is needed. #inctile(title_tile_gfx, "./res/bgtitle.pcx", 1, 7) and getting : BANK 2 Constants 1147/7045 whereas it should be around 250 ( size of the char map for placing tiles ) Is it a normal situation? #incspr/#inctile etc. is hard to understand since I don't know what it does underneath. Yes, it's perfectly normal, because #inctile is for including the graphics data itself, and not the map data. Each "tile" is 16x16 pixels, and so 128-bytes of data. You're including 7 tiles, so 7x128 = 896 bytes. IIRC, and my memory for this isn't good because I don't *use* HuC ... you need to do a #incbin to include the map data that actually uses those 16x16 tiles. The "examples/promotion/promotion.c" gives a simplistic example of this. Someone else may be able to point you to a better HuC example program that actually shows how to use the tilemap functions in that way that they were designed to be used. <EDIT> If you're just getting started and trying to display a non-scrolling screen of graphics, then #incchr and #incbat are easier to use, although horribly wasteful!
|
|
lunoka
Gun-headed
Diving into retrodev
Posts: 55
Homebrew skills: art, music
Fave PCE Shooter: Burning angels
Fave PCE Platformer: Ninja Spirit
Fave PCE Game Overall: Valis 3
Fave PCE RPG: Neutopia
|
Post by lunoka on Feb 27, 2022 21:11:49 GMT
Thank you elmer for your answer. I'm using HuC 3.99 & PCEAS 3.23 from your pinned thread. So far, I don't have any clue about the library options, here is my batch command : D:\[DEV]\NEC\huc-2018-07-07\huc\bin\huc main.c MyInput.c title.c logo.c -v -msmall -fno-recursive D:\[DEV]\NEC\huc-2018-07-07\huc\bin\pceas -pad -s main.s Is there a way to decide the bank affectation? If I build the scroll.c example, the PCX goes to User Program Bank 3, and the bank 2 just contains the const char for map. Everything seems ok with 1 solo C file. For a reason I don't get, on my project, using the same way of loading tile & sprites, it goes to bank 2. With 2 screens & a title sprite, this bank is full already, screen is trashed, having 4 C files in my project. (Warning. Opcode crossing page boundary $6000, bank $03) BANK 2 Constants 8192/ 0 The behaviour is unclear to me, the bank affectation seems to change if I move the #inctile directive from one C file to another in my project. I'm using currently Visual Code to edit my files, don't know if it can bring some strange behaviour. The #inctile etc. are detected as errors since it's pseudo code and IntelliSense doesn't know how to deal with it.
|
|
|
Post by elmer on Feb 28, 2022 1:50:38 GMT
D:\[DEV]\NEC\huc-2018-07-07\huc\bin\huc main.c MyInput.c title.c logo.c -v -msmall -fno-recursive D:\[DEV]\NEC\huc-2018-07-07\huc\bin\pceas -pad -s main.s I don't understand what you're doing here, and why HuC isn't giving you an error! This is the first time that I have ever seen someone put 4 C files on the same HuC command line, and I suspect that you're confusing the heck out of compiler. Since you've not used the "-s" option to compile-but-not-assemble, then if HuC was happy with that command line, it would have automatically assembled the main.s file for you. Furthermore, the compile options are supposed to come *before* the filename, and not after it. Please try a command line ... D:\[DEV]\NEC\huc-2018-07-07\huc\bin\huc -v -v -msmall -fno-recursive main.c... without running the assembler seperately. Then put ... #include "MyInput.c" #include "title.c" #include "logo.c"... at the top (or end) of your main.c file. AFAIK, that's how HuC is supposed to be invoked and used when compiling multiple C source files. Can you please give that a try and let us know what happens?
|
|
lunoka
Gun-headed
Diving into retrodev
Posts: 55
Homebrew skills: art, music
Fave PCE Shooter: Burning angels
Fave PCE Platformer: Ninja Spirit
Fave PCE Game Overall: Valis 3
Fave PCE RPG: Neutopia
|
Post by lunoka on Feb 28, 2022 7:33:56 GMT
the PCE_INCLUDE was missing, after fixing that point, no need to call PCEAS manually anymore, sorry for that. I've removed my logo.h/title.h/MyInput.h and replaced with logo.c/title.c/MyInput.c and then the rom is built : D:\[DEV]\NEC\Projects\TetraBlocks>D:\[DEV]\NEC\huc-2018-07-07\huc\bin\huc -v -v -msmall -fno-recursive main.c HuC (v3.99-c266d57, 2018-07-07) defenum ButtonType enum base type 9 defenum GAME_STATE enum base type 9 No errors D:\[DEV]\NEC\Projects\TetraBlocks>PC Engine Assembler (v 3.23-c266d57, 2018-07-07) pass 1 pass 2 segment usage: USED/FREE ZP $2000-$2015 [ 22] 22/ 234 BSS $2200-$2A6B [2156] 2156/6036 BANK 0 Base Library 1 6781/1411 CODE $E010-$FA82 [6771] CODE $FFF6-$FFFF [ 10] BANK 1 Base Library 2/Font 5815/2377 DATA $6000-$65FF [1536] CODE $A600-$B6B6 [4279] BANK 2 Constants 509/7683 DATA $4000-$41FC [ 509] BANK 3 User Program 8192/ 0 DATA $6000-$7FFF [8192] BANK 4 4360/3832 DATA $6000-$7107 [4360] BANK 5 4073/4119 CODE $A000-$AFE8 [4073] ---- ---- 30K 18K TOTAL SIZE = 48K And every thing is working perfectly! Thanks for your help, although I don't understand why including the *.h files instead is not working. EDIT : ok, I think I'm starting to understand, I thought it was based on the same standards than gcc, but that's not the case. Attachments:
|
|
|
Post by elmer on Feb 28, 2022 18:40:10 GMT
And every thing is working perfectly! Thanks for your help, although I don't understand why including the *.h files instead is not working. EDIT : ok, I think I'm starting to understand, I thought it was based on the same standards than gcc, but that's not the case. No, it's definitely not like GCC! HuC, PCEAS and KickC are all one-input-file builds directly to one-hucard-output, there is no linker involved. So you have to include all of your source code within that single C file, even if you do it with #include just so that you can keep some logical separation. I'm glad that you've got a working build now, and can continue on with your project. You may wish to try the HuC build that I uploaded a few days ago, since it includes the latest changes to PCEAS, which will optimize your ROM output a bit and make use of that empty space in Bank 1 and Bank 4.
|
|
lunoka
Gun-headed
Diving into retrodev
Posts: 55
Homebrew skills: art, music
Fave PCE Shooter: Burning angels
Fave PCE Platformer: Ninja Spirit
Fave PCE Game Overall: Valis 3
Fave PCE RPG: Neutopia
|
Post by lunoka on Feb 28, 2022 20:42:16 GMT
thank you for the update, done o/
By the way, what is the strategy when you want to clear all your current sprites? Using spr_hide() & reset_satb()?
|
|
lunoka
Gun-headed
Diving into retrodev
Posts: 55
Homebrew skills: art, music
Fave PCE Shooter: Burning angels
Fave PCE Platformer: Ninja Spirit
Fave PCE Game Overall: Valis 3
Fave PCE RPG: Neutopia
|
Post by lunoka on Feb 28, 2022 20:58:17 GMT
Oops, I have an issue now with the new version, my title screen is not loading anymore. Here is my PCEAS 3.23 Log that works :
D:\[DEV]\NEC\Projects\TetraBlocks>PC Engine Assembler (v 3.23-c266d57, 2018-07-07)
pass 1 pass 2 segment usage:
USED/FREE ZP $2000-$2015 [ 22] 22/ 234 BSS $2200-$2AEB [2284] 2284/5908
BANK 0 Base Library 1 6781/1411 CODE $E010-$FA82 [6771] CODE $FFF6-$FFFF [ 10] BANK 1 Base Library 2/Font 5815/2377 DATA $6000-$65FF [1536] CODE $A600-$B6B6 [4279] BANK 2 Constants 11/8181 DATA $4000-$400A [ 11] BANK 3 User Program 8192/ 0 DATA $6000-$7FFF [8192] BANK 4 8192/ 0 DATA $6000-$7FFF [8192] BANK 5 8192/ 0 DATA $6000-$7FFF [8192] BANK 6 8192/ 0 DATA $6000-$7FFF [8192] BANK 7 8192/ 0 DATA $6000-$7FFF [8192] BANK 8 4150/4042 DATA $6000-$7035 [4150] BANK 9 4666/3526 CODE $A000-$B239 [4666] ---- ---- 61K 19K
TOTAL SIZE = 80K
And here is the new PCEAS 3.25 log that freezes on title screen :
PC Engine Assembler (v 3.25-978acaa, 2022-02-22)
pass 1 pass 2 segment usage:
USED/FREE ZP $2000-$2015 [ 22] 22/ 234 BSS $2200-$2B1D [2334] 2334/5858
BANK 0 Base Library 1 6820/1372 CODE $E010-$FAA9 [6810] CODE $FFF6-$FFFF [ 10] BANK 1 Base Library 2/Font 8192/ 0 DATA $6000-$65FF [1536] CODE $A600-$BFFF [6656] BANK 2 Constants 11/8181 DATA $4000-$400A [ 11] BANK 3 User Program 8192/ 0 DATA $6000-$7FFF [8192] BANK 4 8192/ 0 DATA $6000-$7FFF [8192] BANK 5 8192/ 0 DATA $6000-$7FFF [8192] BANK 6 8192/ 0 DATA $6000-$7FFF [8192] BANK 7 8192/ 0 DATA $6000-$7FFF [8192] BANK 8 6509/1683 DATA $6000-$7035 [4150] CODE $B036-$B96C [2359] BANK 9 108/8084 PROC $8000-$806B [ 108] ---- ---- 62K 18K
TOTAL SIZE = 80K
|
|
|
Post by elmer on Feb 28, 2022 22:10:15 GMT
Oops, I have an issue now with the new version, my title screen is not loading anymore. Oh, dear! Well, you can try the new assembler with the old HuC, and see if that works. Apart from that, there's not a lot that I can do to help you without seeing your C source and building it myself to find out what's going wrong. Sorry, but I'm not magic! FWIW, all of the HuC example projects are building and running fine, so whatever has changed that is breaking things for you is probably not going to be that easy for you to find yourself, but you're absolutely welcome to try!
|
|
lunoka
Gun-headed
Diving into retrodev
Posts: 55
Homebrew skills: art, music
Fave PCE Shooter: Burning angels
Fave PCE Platformer: Ninja Spirit
Fave PCE Game Overall: Valis 3
Fave PCE RPG: Neutopia
|
Post by lunoka on Mar 1, 2022 8:03:03 GMT
Alright, no problem, if I can't find the issue I will roll back to the former package since it's not a critical update, thanks. Concerning my last question, may I have your opinion on this ? By the way, what is the strategy when you want to clear all your current sprites? Using spr_hide() & reset_satb()?
|
|
|
Post by elmer on Mar 2, 2022 4:52:28 GMT
By the way, what is the strategy when you want to clear all your current sprites? Using spr_hide() & reset_satb()? AFAIK, you only need reset_satb(), which has no effect on the sprites on the screen until you actually upload the new satb contents to VRAM.
|
|
|
Post by elmer on Mar 2, 2022 15:45:01 GMT
AFAIK, you only need reset_satb(), which has no effect on the sprites on the screen until you actually upload the new satb contents to VRAM. But, there is a bug that was introduced in the 2018 release of HuC that stops this working as it was designed, but it was only reported and fixed recently. If you're going to roll-back to the 2018 version, then you need one of the libraries from the latest version.
|
|
lunoka
Gun-headed
Diving into retrodev
Posts: 55
Homebrew skills: art, music
Fave PCE Shooter: Burning angels
Fave PCE Platformer: Ninja Spirit
Fave PCE Game Overall: Valis 3
Fave PCE RPG: Neutopia
|
Post by lunoka on Mar 6, 2022 15:49:23 GMT
No problem, I was stuck with the put_tile function not working correctly on the 2018 version so I made a second attempt with your 2022 fix, cleaned all my project and finally fixed everything \o/ Sorry for the disturbance, still new to these tools & console architecture. You can check the result here : pcengine.proboards.com/thread/1264/tetris-clone-first-project-hucCheerz.
|
|
|
Post by elmer on Mar 7, 2022 18:28:28 GMT
Thanks for letting me know that it wasn't a bug in the current HuC!
|
|