X16Community / x16-emulator

Emulator for the Commander X16 8-bit computer
BSD 2-Clause "Simplified" License
205 stars 43 forks source link

Multiple bin files not counted and processed in makecart utility #302

Open tomxp411 opened 1 month ago

tomxp411 commented 1 month ago

From the forums: https://cx16forum.com/forum/viewtopic.php?t=7949

The nature of the problem (ie: "the emulator crashes when I try to OPEN 8,8,8,"DIR.DIR,S,W")

The -rom_files parameter in the makecart utility doesn't process more than one file. This is no wonder, as the parameter processor walks through additional files, but doesn't increment the numfiles value.

Specific reproduction steps:

Create a rom cartridge and try to pack multiple bin files into one rom bank.

If it's not obvious, what do you expect to happen? (The file should open for writing, without crashing the emulator.)

The documentation explicitly states, that multiple bin files would be packed tightly into the given rom bank and follow ups. This is not´the case, every file after the first is ignored.

Include details about your computer (Windows? Linux? Mac? What graphics card are you using?), the version of the emulator and ROM (if known), and your X16's serial number if you are on hardware.

This happens on every platform, as this bug can be spotted in the source code. See lines 446 until 453 for reference. Line 447 sets num_files to 1, the loop from 448-451 iterated over further files, but doesn't touch num_files, which is given to cartridge_import_files unaltered as 1 in line 453. The same error occurs further below with the -nvram_file switch.