Python program to pad ROMs to exactly 48 K (e.g. for sQLux)

Anything QL Software or Programming Related.
Post Reply
User avatar
ql_freak
Gold Card
Posts: 479
Joined: Sun Jan 18, 2015 1:29 am

Python program to pad ROMs to exactly 48 K (e.g. for sQLux)

Post by ql_freak »

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 :-)
User avatar
tofro
Font of All Knowledge
Posts: 3071
Joined: Sun Feb 13, 2011 10:53 pm
Location: SW Germany

Re: Python program to pad ROMs to exactly 48 K (e.g. for sQLux)

Post by tofro »

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
User avatar
ql_freak
Gold Card
Posts: 479
Joined: Sun Jan 18, 2015 1:29 am

Re: Python program to pad ROMs to exactly 48 K (e.g. for sQLux)

Post by ql_freak »

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 :-)
User avatar
XorA
Site Admin
Posts: 1614
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)

Post by XorA »

truncate -s 48k test.rom

Much easier than python


User avatar
tofro
Font of All Knowledge
Posts: 3071
Joined: Sun Feb 13, 2011 10:53 pm
Location: SW Germany

Re: Python program to pad ROMs to exactly 48 K (e.g. for sQLux)

Post by tofro »

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.
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.


ʎɐqǝ ɯoɹɟ ǝq oʇ ƃuᴉoƃ ʇou sᴉ pɹɐoqʎǝʞ ʇxǝu ʎɯ 'ɹɐǝp ɥO
User avatar
XorA
Site Admin
Posts: 1614
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)

Post by XorA »

tofro wrote: Mon Mar 10, 2025 12:08 pm
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.
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.
I accepted tofro's reasoning and sQLay3 already did except short roms, so I merged his patch a few minutes ago!


Post Reply