08-01-2017, 02:21 PM
could anyone write a guide on how to pack and unpack a string using something like aplib or megalz?
how to pack and unpack a string?
|
08-01-2017, 02:21 PM
could anyone write a guide on how to pack and unpack a string using something like aplib or megalz?
08-05-2017, 06:35 PM
How big is the string?
08-05-2017, 07:12 PM
here is the string:
Quote:PART 1 There are also going to be others, that is just one.
08-08-2017, 09:01 AM
I used unpacking [search for megaLZ] in the tutorial here: <!-- m --><a class="postlink" href="https://docs.google.com/document/d/1vUneCCC18oXLglzoRcJdrMDUSh7vaO_tGDjzjOc8IhU/edit">https://docs.google.com/document/d/1vUn ... c8IhU/edit</a><!-- m -->
Though it's not strings specifically. To pack: Write the text into a file, and use the windows based packer to make a compressed data lump. You can then #include that data lump in your code in asm context. I don't think you can unpack text to a string space and use it like a string, so you're going to have to have a spot of memory to unpack these to. You can either use the malloc function to make one, or DIM a space, and use @variable to access the memory address. Make sure it's a big enough buffer to allow the largest piece of text into, so you don't overwrite anything after it. (Buffer overrun problems are notorious). Then you'd need to write a function to print each character at that address. It's basically a for/next loop increasing the address and printing chr$(peek address) to the screen. The easiest way to do it is to have a unique terminator character - such as a 0 or 255 byte, at the end, and detect that so you know to stop printing and exit your loop. Then you don't need to know the unpacked length of each string, which is probably a size saving over the alternative, which would be to put bytes representing the size of the text at the start of each text block. Don't forget to put in labels for each block so you can find them. Maybe you can put those labels into an array?
08-16-2017, 10:00 PM
thanks thats a good step-by-step tutorial
|
« Next Oldest | Next Newest »
|