-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
M68K compatible #1
Comments
The details of this code have faded from my mind since four years ago. Since this is just vanilla 68K code, I'd suggest running your modified version in an emulator like Easy68K, and stepping through it while it performs the decompression to find the point where the output is wrong. From a quick glance, I think you need to modify the code at _copy17orMore to use move.b instead of move.l, because the address might be unaligned and I don't think the 68000 supports unaligned memory access. There may also be some unaligned memory access happening in _doRLE and _rleLoop. For best performance on the 68000, you probably need to check if the source and destination addresses are aligned, copy a few bytes individually with move.b if necessary, and then copy the rest with aligned move.w or move.l copies. |
The lea _FC8_LENGTH_DECODE_LUT(pc),a5 is intended to set a5 to point to the beginning of _FC8_LENGTH_DECODE_LUT table, in a position-independent way relative to the PC. I seem to recall I had some difficulty getting this to work right, so I inspected the assembled code or ran it in an emulator, and then manually set the -110 offset to make it work. If you've modified any code that's before that lea statement, then you'll probably need to change that -110 to another number. |
Thanks for the feedback! If I don't get it working, I'll probably just re-implement the whole thing in TRSE (kinda slow!) and then convert each part to assembly. I'm guessing that the crashes is due to the alignment, so I'll start there. |
As a starting point to get it working, I think you could use _nearLoop for all the copying, and delete _copyLoop and its related code as well as deleting _copyRLE, _doRLE, and _rleLoop. nearLoop is the most basic form of copying, and everything else is just intended to optimize specific cases. But I'm now noticing there might also be unaligned access in a few other places, like move.w (a0)+,d5 in BR2. |
hehe I almost got it working, but not quite yet... check out this video: https://www.irio.co.uk/div/almost.mp4 , but the image still has artifacts. Yeah I don't really care about speed right now (usually, decompressing a single resource - like an image - won't have that much penalty in terms of speed) |
ok I'll try to remove those other copying mechanisms |
got it! Works like a charm! Check out https://www.irio.co.uk/div/almost.mp4 (when the first effect transitions, it reverts to the raw uncompressed data and scrambles) - but - thanks a bunch! Slow as %(#/%, but who cares. I've added support in TRSE for an automatic "compression" flag, so the user will be able to include any resource as such: and within each M68K system, I've added a "compression" library so you can simply do "Compression::Decompress(myData, uncompressed_storage);" Since I'm using (a modified version) of both your C++ compression / m68K decompression code, I'll add you to the list of credits of TRSE (again, www.turborascal.com). Also, I'll retain the header you have in the .h file. Let me know if I should add anything else regards Nicolaas |
Great, glad to hear it works. Have you read this: https://www.bigmessowires.com/2016/05/06/fc8-faster-68k-decompression/ FC8 is a balance between compression density and decompression speed. If decompression speed isn't very important for your purposes, then tighter compression is definitely possible. See the "tradeoffs" section of the linked blog post. |
Could you also submit your 68000 changes as a patch or a separate file? I'm sure others would benefit. |
yup well I'll have to rewrite the library first, add some comments and make it more accessible. Also, since it is written as a library within TRSE, there will be some hybrid stuff - Pascal mixed with assembler. For for the most part, it should be simple to copy-paste. And yes, most of the decompression will be of images and demo effect data - stuff that can be done while the music is playing + the raster irq can do some simple effects, so no problem if the load time is 2s instead of 1 for an image. Would therefore love to have higher compression rates, especially since I'd like to keep things in RAM (as opposed to loading resources from disk). |
The M68K decompression library (for the Atari ST) in TRSE can be found here : https://github.com/leuat/TRSE/blob/master/Publish/tutorials/ATARI520ST/tru/compression.tru |
Hi there! I'm the creator of TRSE (www.turborascal.com), and I'm currently in the process of adding automatic packing + extraction of M68K resources (for the Amiga + Atari ST 520). I'm trying to get your decompression code to work on the M68K, but I'm having some problems, and was wondering if you would be able to help me
if we mange to get this work, this will be the de-facto way of compressing resources in TRSE, and you'll naturally be credited in the TRSE credits
I've compared the (compressed) files to the compressed output from fc8, and since the files are identical - the problem must reside with the decompression method. I've tried changing it to M68000 compatibility, but can't make it work. I'm suspecting that by (slow) byte copying method is incorrect, or perhaps the " lea _FC8_LENGTH_DECODE_LUT(pc),a5" that I'm not really getting. Any help would be very .. helpful!
Btw the only major things that I've changed are marked with "CHANGES HERE"
Nicolaas
Here's what I've tried to modify :
The text was updated successfully, but these errors were encountered: