KanedaFr Posted February 21 Share Posted February 21 (edited) On a classic fighting game like SF2 or others, you have 2 players on screen. You choose them on a select menu then you load stage assets and each player assets. I don't understand how to do it on Lynx... 😥 Perhaps it's related to my previous post because it's a memory related misunderstanding I think. Basically, I see it like this with Game code common to any character P1 memory area to store player 1's selected character assets P2 memory area to store player 2's selected character assets (yes, I forgot about stage asset but you get the idea!) So, on the CFG file, I defined Game code with GAME: file = %O, define = yes, start = $0200, size = __GAME_SIZE__; and GAME_CODE: load = GAME, type = ro, define = yes; GAME_RODATA:load = GAME, type = ro, define = yes; GAME_DATA: load = GAME, type = rw, define = yes; GAME_BSS: load = GAME, type = bss, optional = yes; defined DIR_GAME on directory.s _DIR_GAME=4 block4 = offGame / __BANK0BLOCKSIZE__ .byte <block4 .word offGame & (__BANK0BLOCKSIZE__ - 1) .byte $88 .word $200 .word __GAME_SIZE__ (probably wrong but you see I load every GAME_xx segment to $200) to load it with lynx_load(4) but how should I define the character assets and how to load it on P1 or P2 address ? my first idea was to define one file per asset with a size not strictly __BANK0BLOCKSIZE__ like _ASSET_CHUNLI=5 .byte asset_chunLi/__BANK0BLOCKSIZE__. ; page .word asset_chunLi & (__BANK0BLOCKSIZE__ - 1) ;offset .byte $00 ;not executable .word P1 .word __ASSET_SIZE__ but it mean I shoud create the same one for P2 ? will lynx_load(5) do the stuff and won't break GAME CODE execution ? I can't test it because, similiar to my question P1 vs P2, I don't know how to define the ASSET segments I htough about, on the CFG file ASSET: file = %O, define = yes, start = P1_ADDR, size = __ASSET_SIZE__; and ASSET_RODATA:load = ASSET, type = ro, define = yes; but then, I'm already defining ASSET to be loadable on P1_ADDR only, and not P2_ADDR I don't see how to handle this unless defining the assets twice (one per player) I also looked at lynx_lseek + lynx_read but, on that case too, I don't know where the assets should be defined (ie on which linking segment) Any help is welcome ! Edited February 21 by KanedaFr Quote Link to comment Share on other sites More sharing options...
obschan Posted February 21 Share Posted February 21 There isn't a definitive answer but you could for example: Define an ASSETS segment starting a $0000. ASSETS: file = %O, define = yes, start = $0000, size = __ASSETS_SIZE__; ASSETS_RODATA:load = ASSETS, type = ro, define = yes; Then include your binary assets in an asm source file, export their location in the segment: .setcpu "65C02" .smart on .case on .debuginfo off .export _ryu_wait .export _ryu_hit .export _blanka_wait .export _blanka_hit .SEGMENT "ASSETS_RODATA" _ryu_wait: .incbin "ryu_wait.bin" _ryu_hit: .incbin "ryu_hit.bin" _blanka_wait: .incbin "blanka_wait.bin" _blanka_hit: .incbin "blanka_hit.bin" Then use cc65 openn function to open the ASSETS segment, then lseek_cur to the asset address, and finally read, to copy the data from the cart to wherever you want in memory. Quote Link to comment Share on other sites More sharing options...
Nop90 Posted February 21 Share Posted February 21 In Starblader all the sprites are assigned to the same memory segment (P1), but I made a copy of the lynx_load() function that ignores the segment address in the directory slots and loads the sprites data in another memory segment (P2). The sprites on the cart are block aligned for a faster loading. Quote Link to comment Share on other sites More sharing options...
KanedaFr Posted February 21 Author Share Posted February 21 (edited) 4 hours ago, obschan said: Then use cc65 openn function to open the ASSETS segment, then lseek_cur to the asset address, and finally read, to copy the data from the cart to wherever you want in memory. Thanks! the openn function was the missing part in the lseek/read way 2 hours ago, Nop90 said: In Starblader all the sprites are assigned to the same memory segment (P1), but I made a copy of the lynx_load() function that ignores the segment address in the directory slots and loads the sprites data in another memory segment (P2). The sprites on the cart are block aligned for a faster loading. Good idea! a lynx_load_ex(dest_address) is on the way Edited February 21 by KanedaFr Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.