Just Jeff Posted October 13, 2023 Share Posted October 13, 2023 Good Morning, Does anyone know of a tool that will take two blocks of data and combine them in an interlaced manner? I have some voice samples for a 2600 game I'm writing that will run faster if two samples are stored together- a byte from one, then a byte from the other, and so on like this: 1st byte is from "Hey Taxi", 2nd is from "Thanks", 3rd is from "Hey Taxi", 4th from "Thanks", and so on. Thanks! Quote Link to comment Share on other sites More sharing options...
mzxrules Posted October 14, 2023 Share Posted October 14, 2023 I personally use the Python 3 programming language. This way I can store data in a sane format and write a script that converts it into whatever format is most optimal for my needs. For example, all of my NPC dialogs are stored right here in a very simple, straightforward python structure, very easy to modify unless you want to use the letter J. In my final output, the data for every message is split across 4 rom banks. Each character is converted into offset location of that character's left or right sprite sheets, where each sheet crams in 43 different 5 byte character sprites into 128 bytes using a "superstring" algorithm to pack them in. 1 Quote Link to comment Share on other sites More sharing options...
+Dave C Posted October 14, 2023 Share Posted October 14, 2023 +1 for python for this sort of thing 1 Quote Link to comment Share on other sites More sharing options...
DEBRO Posted October 15, 2023 Share Posted October 15, 2023 Hi there, I’m not sure if this would help. Have a look at the disassembly listings I posted for Boxing and Football. In those I use a macro called INTERLEAVED_GRAPHICS. The idea was to place the graphics data in the listing so it is easier for the reader to see but interleave the data as needed in the ROM. 3 Quote Link to comment Share on other sites More sharing options...
Just Jeff Posted October 15, 2023 Author Share Posted October 15, 2023 Hmm I checked it all out.. I think you guys give me too much credit. Do I need to know Python? I did think of something on the way to work the other day.. Using my graphics spreadsheet formula and just re-arranging it a little bit, I can paste the samples in columns B and C, then concatenate in column A, then copy/paste column A into my code. I would have to break up line 2 manually here to add my labels. Is what your suggesting easier? Thanks! -Jeff 1 Quote Link to comment Share on other sites More sharing options...
+Dave C Posted October 16, 2023 Share Posted October 16, 2023 This is all really a bet on what is going to save you time. Will you only have to do this once and never change the data? one time cut and paste from excel seems like you are already done - time to move on… Do you need to repeat the process over and over? At that point you maybe want to write a script so you can separate the data from the code. But using data to write code and vice versa is what it’s all about - how you do it is up to you… for me I adopted python a while back for this kind of thing because for me it was a pretty easy jump from the languages I already used (basically, a better Perl) but I wouldn’t blink if I saw someone using something else 2 Quote Link to comment Share on other sites More sharing options...
DEBRO Posted October 21, 2023 Share Posted October 21, 2023 Hi there, On 10/16/2023 at 10:10 AM, Dave C said: Do you need to repeat the process over and over? At that point you maybe want to write a script so you can separate the data from the code. But using data to write code and vice versa is what it’s all about - how you do it is up to you… for me I adopted python a while back for this kind of thing because for me it was a pretty easy jump from the languages I already used (basically, a better Perl) but I wouldn’t blink if I saw someone using something else I actually have been sitting on a reverse engineering of Millipede asking myself this question. I could post it as is but the graphics data is interleaved and may make it harder for someone to change the graphics. I’ve been debating having another tool create the include files for the graphics from another easier read and manipulated input that may be more straightforward in changing the graphics. I like your Python approach. Maybe I post the reverse engineered code as-is for now and revisit this. 1 Quote Link to comment Share on other sites More sharing options...
mzxrules Posted October 29, 2023 Share Posted October 29, 2023 it isn't strictly necessary to know python. I just personally find that once you know a bit of python, can be a very powerful tool for mangling data into different forms. The interleaved data problem can be solved in a few lines like so: #!/usr/bin/env python3 sample1 = [ 0b0001, 0b0011, 0b0101, 0b1101, ] sample2 = [ 0b0010, 0b0100, 0b0110, 0b1000, ] interleaved = zip(sample1, sample2) for s1, s2 in interleaved: print(f'.byte %{s1:08b}, %{s2:08b}') with open(f'interleave_samples.asm', 'w') as file: file.write('interleave_samples_label:') for s1, s2 in interleaved: file.write(f'.byte %{s1:08b}, %{s2:08b}') 1 Quote Link to comment Share on other sites More sharing options...
+MarcoJ Posted December 14, 2023 Share Posted December 14, 2023 On 10/16/2023 at 8:53 AM, Just Jeff said: Hmm I checked it all out.. I think you guys give me too much credit. Do I need to know Python? I did think of something on the way to work the other day.. Using my graphics spreadsheet formula and just re-arranging it a little bit, I can paste the samples in columns B and C, then concatenate in column A, then copy/paste column A into my code. I would have to break up line 2 manually here to add my labels. Is what your suggesting easier? Thanks! -Jeff That's how I usually do this kind of thing too. Good old spreadsheets. 1 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.