Forums

Sega Master System / Mark III / Game Gear
SG-1000 / SC-3000 / SF-7000 / OMV
Home - Forums - Games - Scans - Maps - Cheats - Credits
Music - Videos - Development - Hacks - Translations - Homebrew

View topic - aPLib and SDCC 4.2

Reply to topic
Author Message
  • Joined: 07 Oct 2015
  • Posts: 114
Reply with quote
aPLib and SDCC 4.2
Post Posted: Thu Feb 02, 2023 12:23 pm
I'm slowly getting in touch with the system after a long while. I've managed to port an old unfinished project to the latest DevKitSMS / SDCC 4.2 and it mostly works, save for aPLib stuff.

I have all pattern data and also level data compressed with appack. I used aPLib_depack_VRAM and aPLib_depack to get my patterns to VRAM and my map data to RAM, but that no longer works.

I've found UNSAFE_SMS_loadaPLibcompressedTiles which works as a replacement to aPLib_depack_VRAM - I can see my graphics now, but there's nothing to replace aPLib_depack so I can load my level data to RAM.

What I did was recompile aPLib with SDCC 4.2 to get an updated aPLib.rel, but no luck. It just doesn't work with 4.2.

Does anybody know why / if there is a replacement? Otherwise I'd have to roll back to SDCC 3.6 and an ancient version of DevKitSMS to finish my game :)

Thanks.
  View user's profile Send private message
  • Joined: 05 Sep 2013
  • Posts: 3763
  • Location: Stockholm, Sweden
Reply with quote
Post Posted: Thu Feb 02, 2023 1:27 pm
I'm starting to suspect that I removed that by mistake.

Let me see what I can do...
  View user's profile Send private message Visit poster's website
  • Joined: 05 Sep 2013
  • Posts: 3763
  • Location: Stockholm, Sweden
Reply with quote
Post Posted: Thu Feb 02, 2023 1:51 pm
na_th_an wrote
I've found UNSAFE_SMS_loadaPLibcompressedTiles which works as a replacement to aPLib_depack_VRAM - I can see my graphics now, but there's nothing to replace aPLib_depack so I can load my level data to RAM.


so there's now

void SMS_decompressaPLib (const void *src, void *dst)


to replace aPLib_depack.

What I suspect is that when I removed the 'separate' aPLib library and moved aPLib_depack_VRAM into SMSlib with the new name UNSAFE_SMS_loadaPLibcompressedTiles I left that other function behind. :facepalm:

Sorry for that!
  View user's profile Send private message Visit poster's website
  • Joined: 07 Oct 2015
  • Posts: 114
Reply with quote
Post Posted: Thu Feb 02, 2023 2:19 pm
Thanks, you are ace :)
  View user's profile Send private message
  • Joined: 07 Oct 2015
  • Posts: 114
Reply with quote
Post Posted: Fri Feb 03, 2023 8:03 am
It seems that you forgot to include some code, as these symbols are missing: ap_getbit, ap_getgamma & ap_getbitbc.

?ASlink-Warning-Undefined Global 'ap_getbit' referenced by module 'SMSlib_aPLib'

?ASlink-Warning-Undefined Global 'ap_getgamma' referenced by module 'SMSlib_aPLib'

?ASlink-Warning-Undefined Global 'ap_getbitbc' referenced by module 'SMSlib_aPLib'
  View user's profile Send private message
  • Joined: 05 Sep 2013
  • Posts: 3763
  • Location: Stockholm, Sweden
Reply with quote
Post Posted: Fri Feb 03, 2023 8:38 am
na_th_an wrote
It seems that you forgot to include some code


and that's exactly what happened - I'm an idiot! ;)

Now it should be fixed. Hopefully.
  View user's profile Send private message Visit poster's website
  • Joined: 07 Oct 2015
  • Posts: 114
Reply with quote
Post Posted: Fri Feb 03, 2023 8:50 am
Thanks!
  View user's profile Send private message
  • Joined: 28 Jan 2017
  • Posts: 546
  • Location: Málaga, Spain
Reply with quote
zx7
Post Posted: Sun Feb 05, 2023 6:32 pm
Ummm...I know, this is out of this topic but.... I think zx7 is the grial here. It's so fast, and the compression pretty decent, the algorithm takes a small portion of ram and is small, too.

... but... smslib lacks this function:

SAFE_ZX7_TO_VRAM

(for tiles mainly, when you compress a bunch of tile data (the tiles for a tilemap, or sprites) can take a big amount of ram, and you need a two pass process, first uncompress the zx7 blob into ram, and then load it into the vram).

With tilemaps is not so helpful as the data involved is much smaller.

Only as a suggestion, I know there are ways to avoid this kind of troubles. This shoud be like a "nice to have".

Note: In z88dk the function is implemented.

Regards.
  View user's profile Send private message
  • Joined: 05 Sep 2013
  • Posts: 3763
  • Location: Stockholm, Sweden
Reply with quote
Post Posted: Mon Feb 06, 2023 8:44 am
Last edited by sverx on Mon Feb 06, 2023 1:32 pm; edited 1 time in total
eruiz00 wrote
smslib lacks this function:

SAFE_ZX7_TO_VRAM


True. It's that I didn't imagine one would need that. I mean, ZX7 is very slow when unpacking to VRAM (because of the operations needed to read back) so one would usually use ZX7 only to load a bunch of tiles into VRAM once before the game starts (or the level) with screen OFF.

But I will look into that and see if I can create a VRAM safe version of the decompressor. It would likely be very VERY slow... but, indeed, you won't have to turn the screen OFF to make sure that it works fine.
  View user's profile Send private message Visit poster's website
  • Joined: 05 Sep 2013
  • Posts: 3763
  • Location: Stockholm, Sweden
Reply with quote
Post Posted: Mon Feb 06, 2023 1:31 pm
SMS_loadZX7compressedTiles(src,tilefrom)


just added. It can be used to decompress to VRAM safely even when screen is on (or outside vBlank...)

If you don't have any speed issues, use this one even where you used the UNSAFE version so that you don't link both into the ROM (which is a waste...)
  View user's profile Send private message Visit poster's website
  • Joined: 05 Sep 2013
  • Posts: 3763
  • Location: Stockholm, Sweden
Reply with quote
Post Posted: Sun Feb 12, 2023 2:31 pm
na_th_an wrote
I've managed to port an old unfinished project to the latest DevKitSMS / SDCC 4.2 and it mostly works, save for aPLib stuff.


Also, I forgot to mention that we will have the SMS Power! 2023 Coding Competition soon, and I hope to see your game there! :)
  View user's profile Send private message Visit poster's website
Reply to topic



Back to the top of this page

Back to SMS Power!