Python program to pad ROMs to exactly 48 K (e.g. for sQLux)
Python program to pad ROMs to exactly 48 K (e.g. for sQLux)
UQLX can use ROMs which are less than 49152 Bytes (48 K), but sQLux complains. So I have written a quick and dirty Python program to make a 48 K ROM from those ROMs. Hint: The program does not allow to overwrite the existing ROM on disk, you must save it with another name.
- Attachments
-
- padRomTo49152.zip
- (827 Bytes) Downloaded 12 times
http://peter-sulzer.bplaced.net
GERMAN! QL-Download page also available in English: GETLINE$() function, UNIX-like "ls" command, improved DIY-Toolkit function EDLINE$ - All with source. AND a good Python 3 Tutorial (German) for Win/UNIX
GERMAN! QL-Download page also available in English: GETLINE$() function, UNIX-like "ls" command, improved DIY-Toolkit function EDLINE$ - All with source. AND a good Python 3 Tutorial (German) for Win/UNIX

Re: Python program to pad ROMs to exactly 48 K (e.g. for sQLux)
The next release of sqlux will likely accept ROMs shorter than 49152 Bytes.
ʎɐqǝ ɯoɹɟ ǝq oʇ ƃuᴉoƃ ʇou sᴉ pɹɐoqʎǝʞ ʇxǝu ʎɯ 'ɹɐǝp ɥO
Re: Python program to pad ROMs to exactly 48 K (e.g. for sQLux)
I'm not sure, if this is a good idea. A ROM should have exactly 49152 bytes. With the current version of sQLux it is much more difficult, to load a file, which is no QL-ROM. It would only make sense, if ROMs >48K can be loaded as system ROM, and even than, it would be nice, if sQLux checks, that it is e.g 64, 128, ... KBytes exactly.
http://peter-sulzer.bplaced.net
GERMAN! QL-Download page also available in English: GETLINE$() function, UNIX-like "ls" command, improved DIY-Toolkit function EDLINE$ - All with source. AND a good Python 3 Tutorial (German) for Win/UNIX
GERMAN! QL-Download page also available in English: GETLINE$() function, UNIX-like "ls" command, improved DIY-Toolkit function EDLINE$ - All with source. AND a good Python 3 Tutorial (German) for Win/UNIX

- XorA
- Site Admin
- Posts: 1616
- Joined: Thu Jun 02, 2011 11:31 am
- Location: Shotts, North Lanarkshire, Scotland, UK
Re: Python program to pad ROMs to exactly 48 K (e.g. for sQLux)
truncate -s 48k test.rom
Much easier than python
Much easier than python
Re: Python program to pad ROMs to exactly 48 K (e.g. for sQLux)
Well, we need to accept what's out there. And there's plenty of ROMs floating about shorter than 49152 bytes. If we supply a warning if a "short ROM" is detected, that should be enough.ql_freak wrote: Mon Mar 10, 2025 12:42 am I'm not sure, if this is a good idea. A ROM should have exactly 49152 bytes. With the current version of sQLux it is much more difficult, to load a file, which is no QL-ROM. It would only make sense, if ROMs >48K can be loaded as system ROM, and even than, it would be nice, if sQLux checks, that it is e.g 64, 128, ... KBytes exactly.
ʎɐqǝ ɯoɹɟ ǝq oʇ ƃuᴉoƃ ʇou sᴉ pɹɐoqʎǝʞ ʇxǝu ʎɯ 'ɹɐǝp ɥO
- XorA
- Site Admin
- Posts: 1616
- Joined: Thu Jun 02, 2011 11:31 am
- Location: Shotts, North Lanarkshire, Scotland, UK
Re: Python program to pad ROMs to exactly 48 K (e.g. for sQLux)
I accepted tofro's reasoning and sQLay3 already did except short roms, so I merged his patch a few minutes ago!tofro wrote: Mon Mar 10, 2025 12:08 pmWell, we need to accept what's out there. And there's plenty of ROMs floating about shorter than 49152 bytes. If we supply a warning if a "short ROM" is detected, that should be enough.ql_freak wrote: Mon Mar 10, 2025 12:42 am I'm not sure, if this is a good idea. A ROM should have exactly 49152 bytes. With the current version of sQLux it is much more difficult, to load a file, which is no QL-ROM. It would only make sense, if ROMs >48K can be loaded as system ROM, and even than, it would be nice, if sQLux checks, that it is e.g 64, 128, ... KBytes exactly.