Sheddy Posted May 4, 2018 Share Posted May 4, 2018 Not just Mads, but I'm kinda new to Mads and maybe there's an easy way in Mads: I've some compressed data/code where it allocates memory to the uncompressed size, but to save memory the compressed data should be aligned to the end of uncompressed area, not the start. Obviously I don't want data the full size of the uncompressed data to be assembled. EG /0000000000000000/ (uncompressed) /0000000000xxxxxx/ X being the compressed data. Anyone have experience of doing this without it being run through an external packer utility? Thanks! Quote Link to comment Share on other sites More sharing options...
tebe Posted May 4, 2018 Share Posted May 4, 2018 ? .align $100,$ff align and fill by value $ff Quote Link to comment Share on other sites More sharing options...
Xuel Posted May 4, 2018 Share Posted May 4, 2018 You need some way to get the length of the compressed data so that you can compute the starting address by subtracting the length from the ending address that you want to align it to. I couldn't find a way to do that in one pass in MADS. You can use .get to read a file into memory within MADS but I don't see a way to get the length of the array. You could do it in two passes. Create one file like this: org $0 ins 'compressed.dat' .put [0] = <* .put [1] = >* .sav 'compressed.len',2 This will create a two byte file named compressed.len which will contain the length of the file compressed.dat. Now you have what you need to align the data as follows: .get 'compressed.len' ?length equ .wget[0] .get 'compressed.dat' org $C000-?length .sav ?length You can then set up your build process to assemble these files in the correct order. Example Makefile: endalign.obx: endalign.asm compressed.len compressed.dat mads $< compressed.len: getlength.asm compressed.dat mads $< Code: endalign.zip 2 Quote Link to comment Share on other sites More sharing options...
Sheddy Posted May 4, 2018 Author Share Posted May 4, 2018 Thanks guys, "get" looks very promising for what I'm doing. (The compressed and uncompressed size will vary depending on the data when the self extractor is assembled). I'll check it out later. Quote Link to comment Share on other sites More sharing options...
flashjazzcat Posted May 4, 2018 Share Posted May 4, 2018 (edited) Deleted. Edited May 4, 2018 by flashjazzcat Quote Link to comment Share on other sites More sharing options...
+JAC! Posted May 5, 2018 Share Posted May 5, 2018 >I couldn't find a way to do that in one pass in MADS. ?length =.filesize 'compressed.dat' org $c000-?length should work. 4 Quote Link to comment Share on other sites More sharing options...
Xuel Posted May 5, 2018 Share Posted May 5, 2018 >I couldn't find a way to do that in one pass in MADS. ?length =.filesize 'compressed.dat' org $c000-?length should work. Thanks JAC! That's what I was looking for. Looks like the English version of the documentation needs to be updated. It also doesn't have .WGET and a few other commands I noticed. Quote Link to comment Share on other sites More sharing options...
+JAC! Posted May 5, 2018 Share Posted May 5, 2018 Yes, update of the English doc (which still is 1.9.4) is on the todo list. 5 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.