VOGONS


Reply 40 of 56, by Anonymous Coward

User metadata
Rank l33t++
Rank
l33t++

Okay thanks.
I'll be working strictly with uncompressed ROMs.

There's something strange going on with a couple of Award V4.50 386 BIOSes I downloaded. I cannot open them with modbin as it claims there is a file checksum error.
However, the ROM checksum seems to be correct. Apparently Award BIOSes that have been opened with awdbedit exhibit the same problem. Anyone know what the deal is there?
Is there already a thread about this problem, or should I start a new one?

"Will the highways on the internets become more few?" -Gee Dubya
V'Ger XT|Upgraded AT|Ultimate 386|Super VL/EISA 486|SMP VL/EISA Pentium

Reply 41 of 56, by CkRtech

User metadata
Rank Oldbie
Rank
Oldbie

Have any of you looked at HDD translation/autodetection for the 64k AMI BIOS versions?

I don't know how late the 64k AMI BIOSes were used on a given board. If any of them received an update for larger drive translation or an update to the autodetect function courtesy of AMI and a generous board manufacturer, a byte comparison between an older version to the newer version may help zero-in on the replacement code. From there, you'd have to update any jump addresses for the BIOS you want to update - unless AMI BIOSes followed a standard layout/address structure, I suppose.

I am just spitballing. Not new to hex editors or assembly, but the contents of an AMI BIOS? My knowledge is maybe a couple of days old.

Totally possible that there is a hard cut-off date from moving from 64k uncompressed to LHA'ed 128k (or whatever it is) in order for AMI to even consider updating their drive calculations.

Reply 42 of 56, by jakethompson1

User metadata
Rank Oldbie
Rank
Oldbie
CkRtech wrote on 2025-05-02, 04:16:
Have any of you looked at HDD translation/autodetection for the 64k AMI BIOS versions? […]
Show full quote

Have any of you looked at HDD translation/autodetection for the 64k AMI BIOS versions?

I don't know how late the 64k AMI BIOSes were used on a given board. If any of them received an update for larger drive translation or an update to the autodetect function courtesy of AMI and a generous board manufacturer, a byte comparison between an older version to the newer version may help zero-in on the replacement code. From there, you'd have to update any jump addresses for the BIOS you want to update - unless AMI BIOSes followed a standard layout/address structure, I suppose.

I am just spitballing. Not new to hex editors or assembly, but the contents of an AMI BIOS? My knowledge is maybe a couple of days old.

Totally possible that there is a hard cut-off date from moving from 64k uncompressed to LHA'ed 128k (or whatever it is) in order for AMI to even consider updating their drive calculations.

Yes, I have thought of this 😁
Here, the 10/16/94 one here does not have LBA, and the 01/09/95 one does: https://theretroweb.com/motherboards/s/efa-4dmu-hl3s#bios
But, everything is shifted around, they didn't just simply patch in the LBA support, unfortunately.

Reply 43 of 56, by CkRtech

User metadata
Rank Oldbie
Rank
Oldbie
jakethompson1 wrote on 2025-05-02, 04:20:

Here, the 10/16/94 one here does not have LBA, and the 01/09/95 one does: https://theretroweb.com/motherboards/s/efa-4dmu-hl3s#bios
But, everything is shifted around, they didn't just simply patch in the LBA support, unfortunately.

Yuck. Looks like they reclaimed some space above the $8000 BIOS copyright info and from the big block of $00 @ $DD42-$DFB1 and used it for some serious rewrite/replace under the BootSector Write/Possible Virus warning.

Reply 44 of 56, by feipoa

User metadata
Rank l33t++
Rank
l33t++
Anonymous Coward wrote on 2024-07-19, 02:35:
Okay thanks. I'll be working strictly with uncompressed ROMs. […]
Show full quote

Okay thanks.
I'll be working strictly with uncompressed ROMs.

There's something strange going on with a couple of Award V4.50 386 BIOSes I downloaded. I cannot open them with modbin as it claims there is a file checksum error.
However, the ROM checksum seems to be correct. Apparently Award BIOSes that have been opened with awdbedit exhibit the same problem. Anyone know what the deal is there?
Is there already a thread about this problem, or should I start a new one?

That should read 'open and saved with awdbedit'. This is an issue I've known about for some time. Best to do all modding with Modbin rather than awdbedit, although awdbedit has that convenient PCI routing table open for editing and the ability to swap the Energy Star logo.

On another front, has anyone had success in adding PS/2 mouse support to old Phoenix BIOSes? I have one from 1994, rev. 4.03c which doesn't work with a KBC-PS/2 mouse mod. It's an ALi 1429 board - EXP4349.

Plan your life wisely, you'll be dead before you know it.

Reply 45 of 56, by analog_programmer

User metadata
Rank Oldbie
Rank
Oldbie
Anonymous Coward wrote on 2024-07-16, 14:24:

I'm not much of a software guy, but if you could get the script to actually patch the ROM image automatically, that would be ever better!

feipoa wrote on 2024-07-18, 07:07:

Indeed, this seems cleaner. Thanks!

I also think an option to have the script modify the BIOS would be a nice to have. e.g. "do you want this programme to amend your BIOS with this information: Y or N?"

Finally your wish is fulfilled 😁 I got back here due to some AMI 286 BIOS tinkering.

Here's the new Python code for the AMI "color" BIOS checksum calculator script with auto-patching option for 64 kB BIOS-dump file - just as you suggested. It also have some basic checks if given BIOS-dump file exists and if it is exactly 64 kB in size. And don't worry, the script does not messes with the original BIOS-dump file, but creates a copy with corrected checksum bytes (with ".NEW" file extension):

Obsolete code
#!/usr/bin/env python3
# amichksumcalc v.2
# loads ami color bios dump-file, calculates checksum (16-bit sequential) and values needed to validate (if checksum != 0), and patches file if chosen to

import sys
import os.path
import shutil

if len(sys.argv) != 2:
print(f'Usage: {sys.argv[0]} <64 kB BIOS ROM-dump file>')
sys.exit()

bios_file_name = sys.argv[1]

if not os.path.isfile(bios_file_name):
print(f'Error: "{bios_file_name}" file does not exist!')
sys.exit()

if os.path.getsize(bios_file_name) !=65536:
print(f'Error: "{bios_file_name}" file is not 64 kB in size!')
sys.exit()

try:
with open(bios_file_name, mode='rb') as file:
bios_data = file.read()
file.seek(65360, 0)
first_checksum_byte = file.read(1)
second_checksum_byte = file.read(1)
print(f'Checksum bytes read from "{bios_file_name}" file at address 0xFF50 (hex, LE): "{first_checksum_byte.hex().upper()} {second_checksum_byte.hex().upper()}".')
except:
print(f'Error while reading "{bios_file_name}" file!')
sys.exit()

block_count = int(len(bios_data) / 16)
checksum = 0

for block in range(0, block_count):
bios_block = bios_data[block * 16: block * 16 + 16]
block_checksum = 0

for byte_pair in range(0, 8):
byte_pair_hex = (bios_block[byte_pair * 2 + 1: byte_pair * 2 + 2].hex() + bios_block[byte_pair * 2:byte_pair * 2 + 1].hex())
byte_pair_dec = int(byte_pair_hex, 16)
block_checksum += byte_pair_dec

block_checksum %= 65536
checksum += block_checksum

checksum %= 65536

if checksum == 0:
print(f'Checksum for "{bios_file_name}" file equals zero.')
print('No actions needed.')
else:
print(f'Checksum for "{bios_file_name}" file does not equal zero!')
print(f'Current checksum (dec): {str(checksum)}; (hex, LE): "{int(checksum).to_bytes(2, "little").hex(" ").upper()}".')

two_byte_addition_strhex = int(65536 - checksum).to_bytes(2, "little").hex(" ").upper()
print(f'2 bytes addition to current checsum needed to validate it (hex, LE): "{two_byte_addition_strhex}".')

Show last 37 lines
    new_first_byte_sum_dec = int(bytearray.fromhex(two_byte_addition_strhex)[0] + int.from_bytes(first_checksum_byte, "little"))
correction_sum_strhex = new_first_byte_sum_dec.to_bytes(2, "little").hex(" ").upper()
new_second_byte_sum_dec = int(bytearray.fromhex(two_byte_addition_strhex)[1] + int(bytearray.fromhex(correction_sum_strhex)[1]) + int.from_bytes(second_checksum_byte, "little"))

new_first_byte_strhex = new_first_byte_sum_dec.to_bytes(2, "little").hex(" ").upper().split(" ")[0]
new_second_byte_strhex = new_second_byte_sum_dec.to_bytes(2, "little").hex(" ").upper().split(" ")[0]

choices = ('', 'n','y')

while True:
ch = input(f'Do you want to auto-patch the checksum bytes in "{bios_file_name}" file? Enter [y/N]: ')
if ch.lower() not in choices:
print(f'Error: Invalid choice "{ch}". Try again!')
continue
else:
break

if not ch or ch.lower() == 'n':
print('No actions taken.')
print(f'Manually hex-edit checksum bytes in "{bios_file_name}" file at address 0xFF50 with these values (hex, LE): "{new_first_byte_strhex} {new_second_byte_strhex}".')
else:
new_bios_file_name = bios_file_name.split('.')[0] + '.NEW'
shutil.copy(bios_file_name, new_bios_file_name)
print(f'Original "{bios_file_name}" file was copied to "{new_bios_file_name}".')

try:
with open(new_bios_file_name, mode='rb+') as file:
file.seek(65360, 0)
file.write(bytearray.fromhex(new_first_byte_strhex))
file.write(bytearray.fromhex(new_second_byte_strhex))
print(f'Checksum bytes replaced in "{new_bios_file_name}" file at address 0xFF50 with these values (hex, LE): "{new_first_byte_strhex} {new_second_byte_strhex}".')
except:
print(f'Error while writing "{new_bios_file_name}" file!')
sys.exit()
print(f'Original unmodified "{bios_file_name}" file is still intact.')
print(f'Now you can use freshly created "{new_bios_file_name}" file with corrected checksum bytes.')

The newest final version (added BIOS checksum check skip simple hack revert and other extras) of this script is HERE.

I think I tested everything in this script without problems.

Last edited by analog_programmer on 2025-06-22, 20:18. Edited 3 times in total.

The word Idiot refers to a person with many ideas, especially stupid and harmful ideas.
This world goes south since everything's run by financiers and economists.
This isn't voice chat, yet some people overusing online communications talk and hear voices.

Reply 46 of 56, by feipoa

User metadata
Rank l33t++
Rank
l33t++

Nice.

For dozens of 286 through 386 boards, I have already modified my BIOSes with jake's process to skip the checksum. Does your script check for this condition and not skip the checksum? Or are users of this script needing to manually revert their checksum skip procedure?

Plan your life wisely, you'll be dead before you know it.

Reply 47 of 56, by analog_programmer

User metadata
Rank Oldbie
Rank
Oldbie
feipoa wrote on 2025-06-21, 01:39:

Nice.

For dozens of 286 through 386 boards, I have already modified my BIOSes with jake's process to skip the checksum. Does your script check for this condition and not skip the checksum? Or are users of this script needing to manually revert their checksum skip procedure?

Nope, the script does not check for any BIOS executable code patching. It checks only if the given (path + ) filename exists as file and if there is such file it checks it's size. Then if the size of given file is exactly 64 kB the it proceeds - reads the two checksum bytes starting at address 0xFF50, calculates the checksum for the file and checks if it's equal to 0 - if not: asks to auto-correct the two checksum bytes (at same address 0xFF50) in a copy of the original given file (with file extension ".NEW").

P.S. I found the info needed for this patch in the first post of the thread. So, the byte "FA" that is patched to "EB" can be found by searching for "00 80 33 F6 2E AD 03 D8 E2 FA 74 06 BD 09 00" pattern. I need someone with more machine code reading skills to confirm if this pattern is suitable for searching (i.e. is it constant?) in all AMI "color" BIOSes, so I can try to implement the anti-bypassing-checksum-check-autopatch in the checksum correction script.

The word Idiot refers to a person with many ideas, especially stupid and harmful ideas.
This world goes south since everything's run by financiers and economists.
This isn't voice chat, yet some people overusing online communications talk and hear voices.

Reply 49 of 56, by jakethompson1

User metadata
Rank Oldbie
Rank
Oldbie
analog_programmer wrote on 2025-06-21, 04:40:

P.S. I found the info needed for this patch in the first post of the thread. So, the byte "FA" that is patched to "EB" can be found by searching for "00 80 33 F6 2E AD 03 D8 E2 FA 74 06 BD 09 00" pattern. I need someone with more machine code reading skills to confirm if this pattern is suitable for searching (i.e. is it constant?) in all AMI "color" BIOSes, so I can try to implement the anti-bypassing-checksum-check-autopatch in the checksum correction script.

The byte string 2E AD 03 D8 E2 FA 74 06 does not have any absolute addresses in it, and captures the "essence" of the 16-bit checksum calculation. I suggest you use that in your script to verify that what's being passed in is actually an AMIBIOS that uses this calculation, before doing the checksum change at ff50. And changing 74 to EB is the easiest, but not the only way to patch out the check, but since it's the one most openly discussed here, perhaps it's worth supporting.

Reply 50 of 56, by analog_programmer

User metadata
Rank Oldbie
Rank
Oldbie
jakethompson1 wrote on 2025-06-21, 18:24:

The byte string 2E AD 03 D8 E2 FA 74 06 does not have any absolute addresses in it, and captures the "essence" of the 16-bit checksum calculation. I suggest you use that in your script to verify that what's being passed in is actually an AMIBIOS that uses this calculation, before doing the checksum change at ff50. And changing 74 to EB is the easiest, but not the only way to patch out the check, but since it's the one most openly discussed here, perhaps it's worth supporting.

Thanks for your response, jakethompson1.

Then I'll use "2E AD 03 D8 E2 FA EB 06" bytes pattern to check if the dump-file was patched with the simplest possible checksum checking bypass hack which is described in this thread, and if found - the "EB" byte will be reverted back to "74". Probably there is a possibility for patching the BIOS function checksum calculating to return always 0, but the primary goal of the checksum calculator was not to remove the BIOS executable code patches. This "simple checksum bypass patch" check and depatching when restoring a valid checksum will be a bonus 😉

I didn't bother to think for some complex checking if the processed file is a real AMI "color" BIOS, 'cause I don't believe that someone sane will use it on 64 kB Award dump-file expecting to achieve something usable out of it. And in the end the original processed file remains unchanged. But if you have some clue on what to check for - for example some exact string or some other constant thing that is unique and can be found only in all of this AMI "color" BIOSes, I'm open for suggestions to improve the script reliability.

The word Idiot refers to a person with many ideas, especially stupid and harmful ideas.
This world goes south since everything's run by financiers and economists.
This isn't voice chat, yet some people overusing online communications talk and hear voices.

Reply 51 of 56, by jakethompson1

User metadata
Rank Oldbie
Rank
Oldbie

That's my suggestion, to require that the input file have 2E AD 03 D8 E2 FA 74 06 in it somewhere, and if so, you presume there is a 16-bit checksum stored at FF50. This is better than trying to do it based on the copyright message or BIOS date IMO.

Reply 52 of 56, by analog_programmer

User metadata
Rank Oldbie
Rank
Oldbie
jakethompson1 wrote on 2025-06-21, 19:29:

That's my suggestion, to require that the input file have 2E AD 03 D8 E2 FA 74 06 in it somewhere, and if so, you presume there is a 16-bit checksum stored at FF50. This is better than trying to do it based on the copyright message or BIOS date IMO.

So the check for a real AMI "color" BIOS-dump file will be If the file contains one of these two patterns: "2E AD 03 D8 E2 FA 74 06" (for unpatched) or "2E AD 03 D8 E2 FA EB 06" (for patched). And of course the 64 kb length check. As simple as that. And if the second pattern is found, then the file will be first de-patched (before any checksum calculations).

Tomorrow will be a good day for new script version 😉

The word Idiot refers to a person with many ideas, especially stupid and harmful ideas.
This world goes south since everything's run by financiers and economists.
This isn't voice chat, yet some people overusing online communications talk and hear voices.

Reply 53 of 56, by feipoa

User metadata
Rank l33t++
Rank
l33t++

Thanks for adding code to revert the previous'skip checksum' mod. Looks like I will have a lengthy upgrade project for my 286-386 systems. They all have been retro-fitted with PS/2 headers.

Plan your life wisely, you'll be dead before you know it.

Reply 54 of 56, by analog_programmer

User metadata
Rank Oldbie
Rank
Oldbie
feipoa wrote on 2025-06-22, 07:27:

Thanks for adding code to revert the previous'skip checksum' mod. Looks like I will have a lengthy upgrade project for my 286-386 systems. They all have been retro-fitted with PS/2 headers.

Anonymous Coward wrote on 2025-06-21, 12:19:

Double plus good. Thanks!

As I promised yesterday the final Python script for the amichksumcalc v.3. is ready.

The code is rewritten so it can be more readable and reusable. The script now checks if given file is real AMI "color" BIOS and also reverts the well known simple hack for BIOS checksum check bypass if found - as suggested by jakethompson1 . The script works with a copy of the original given file - a temporary .TMP file and if all the auto-patching process is completed successfully renames the temp file to one with .PCH extension (for the final fully patched file), otherwise the temporary file remains, if process is interrupted by some reason. The original given BIOS-dump file is never altered.

Just read the messages carefully when using the script!

It took me a couple of hours to test and adjust everything, and here is the new code:

#!/usr/bin/env python3
# amichksumcalc v.3 by analog_programmer, based on ahyeadude's AMI "color" BIOS checksum algorithm
# Thanks to ahyeadude, jakethompson1, feipoa and Anonymous Coward from vogons.org

import sys
import os
import shutil

def checksum_calc(bytes_data):
block_count = len(bytes_data) // 16
checksum = 0
for block in range(0, block_count):
bios_block = bytes_data[block * 16:block * 16 + 16]
block_checksum = 0
for byte_pair in range(0, 8):
byte_pair_hex = (bios_block[byte_pair * 2 + 1:byte_pair * 2 + 2].hex()
+ bios_block[byte_pair * 2:byte_pair * 2 + 1].hex())
byte_pair_dec = int(byte_pair_hex, 16)
block_checksum += byte_pair_dec
block_checksum %= 65536
checksum += block_checksum
checksum %= 65536
return checksum

def confirm_choice(question):
choices = ('', 'n','y')
while True:
choice = input(f'{question} Enter [y/N]: ')
if choice.lower() not in choices:
print(f'Error: Invalid choice "{choice}". Try again!')
continue
else:
break
if not choice or choice.lower() == 'n':
return False
return True

def hex_str2byte(hex_str):
return bytearray.fromhex(hex_str)

def hex_str2int(hex_str):
return int.from_bytes(bytearray.fromhex(hex_str), "little")

def int2hex_str(int_num, idx=None):
if idx or idx == 0:
return int_num.to_bytes(2, "little").hex(" ").upper().split(" ")[idx]
return int_num.to_bytes(2, "little").hex(" ").upper()

def byte2int(bytes_data):
return int.from_bytes(bytes_data, "little")

def byte2hex_str(bytes_data):
return bytes_data.hex().upper()

def file_op_error(file_name, action):
print(f'Error while {action} "{file_name}" file!')
sys.exit()

def check_file_exists(file_name):
if os.path.isfile(file_name):
Show last 170 lines
        return True
return False

def print_no_further_actions():
print('No further actions will be taken.')

def file_delete(file_name):
if check_file_exists(file_name):
try:
print(f'Deleting "{file_name}"...')
os.remove(file_name)
print(f'"{file_name}" file was deleted.')
except:
file_op_error(file_name, 'deleting')

def file_copy(file_name1, file_name2):
if check_file_exists(file_name2):
print(f'Warning: "{file_name2}" file already exists!')
if not confirm_choice(f'Do you want to overwrite "{file_name2}" file with "{file_name1}"?'):
print_no_further_actions()
sys.exit()
try:
print(f'Copying "{file_name1}" file to "{file_name2}" file...')
shutil.copy(file_name1, file_name2)
print(f'"{file_name1}" file was copied to "{file_name2}" file.')
return file_name2
except:
file_op_error(file_name2, 'creating')

def file_rename(file_name1, file_name2):
if check_file_exists(file_name2):
file_copy(file_name1, file_name2)
if check_file_exists(file_name1):
file_delete(file_name1)
return file_name2
else:
try:
print(f'Renaming "{file_name1}" file to "{file_name2}"...')
os.rename(file_name1, file_name2)
print(f'Original "{file_name1}" file was renamed to "{file_name2}".')
return file_name2
except:
file_op_error(file_name1, 'renaming')

def write_file_single_byte(file_name, byte_position, byte_data):
try:
with open(file_name, mode='rb+') as file:
file.seek(byte_position, 0)
file.write(byte_data)
except:
file_op_error(file_name, 'writing')

def read_file_single_byte(file_name, byte_position):
try:
with open(file_name, mode='rb') as file:
file.seek(byte_position, 0)
return file.read(1)
except:
file_op_error(file_name, 'reading')

def read_file_binary_contents(file_name):
try:
with open(file_name, mode='rb') as file:
return file.read()
except:
file_op_error(file_name, 'reading')

def check_ami(file_name):
global hacked
file_bytes_data = read_file_binary_contents(file_name)
idx = 0
# search for unpatched string "2E AD 03 D8 E2 FA 74 06"
idx = file_bytes_data.find(b'\x2e\xad\x03\xd8\xe2\xfa\x74\x06', idx)
if idx != -1:
print(f'"{file_name}" file seems like authentic 64 kB AMI "color" BIOS.')
return True
idx = 0
# search for patched string "2E AD 03 D8 E2 FA EB 06"
idx = file_bytes_data.find(b'\x2e\xad\x03\xd8\xe2\xfa\xeb\x06', idx)
if idx != -1:
hacked = True
print(f'"{file_name}" file seems like hacked 64 kB AMI "color" BIOS.')
print(f'Restoring "{file_name}" file to authentic 64 kB AMI "color" BIOS...')
# restoring unpatched string "2E AD 03 D8 E2 FA 74 06"
file_address = idx + 6
byte4patch = read_file_single_byte(file_name, file_address)
write_file_single_byte(file_name, file_address, b'\x74')
print(f'Byte "{byte2hex_str(byte4patch)}" replaced in "{file_name}" file at address 0x'
f'{hex(file_address)[2:].upper()} with this value (hex): "74".')
print(f'"{file_name}" file restored to authentic 64 kB AMI "color" BIOS.')
return True
return False

# main code:
# check CL parameters
if len(sys.argv) != 2:
print(f'Usage: {sys.argv[0]} <64 kB BIOS ROM-dump file>')
sys.exit()

# gets BIOS ROM-dump file name
bios_file_name = sys.argv[1]

# check if BIOS ROM-dump file exists
if not check_file_exists(bios_file_name):
print(f'Error: "{bios_file_name}" file does not exist!')
sys.exit()

# check if BIOS ROM-dump file is 64 kB in size
if os.path.getsize(bios_file_name) !=65536:
print(f'Error: "{bios_file_name}" file is not 64 kB in size!')
sys.exit()
print(f'"{bios_file_name}" file is 64 kB in size!')

# copy BIOS ROM-dump file to BIOS ROM-dump file with ".TMP" extension
new_bios_file_name = bios_file_name.split('.')[0] + '.TMP'
print(f'Original "{bios_file_name}" will be copied to "{new_bios_file_name}" file.')
file_copy(bios_file_name, new_bios_file_name)

# check if BIOS ROM-dump file is genuine AMI "color" BIOS or hacked AMI "color" BIOS
hacked = False
if not check_ami(new_bios_file_name):
print(f'Error: "{new_bios_file_name}" file is not AMI "color" BIOS ROM-dump!')
file_delete(new_bios_file_name)
print_no_further_actions()
sys.exit()

# print two checksum bytes from BIOS ROM-dump file at address 0xFF50
first_checksum_byte = read_file_single_byte(new_bios_file_name, 65360)
second_checksum_byte = read_file_single_byte(new_bios_file_name, 65361)
print(f'Checksum bytes read from "{new_bios_file_name}" file at address 0xFF50 (hex, LE): '
f'"{byte2hex_str(first_checksum_byte)} '
f'{byte2hex_str(second_checksum_byte)}".')

# calculating BIOS ROM-dump file checksum
bios_file_checksum = checksum_calc(read_file_binary_contents(new_bios_file_name))

# validating BIOS ROM-dump file checksum
if bios_file_checksum != 0:
print(f'Checksum for "{new_bios_file_name}" file does not equals zero.')
print(f'Current checksum (dec): {bios_file_checksum}; (hex, LE): "{int2hex_str(bios_file_checksum):}".')
# calculating addition sum for correction
two_byte_addition = 65536 - bios_file_checksum
print(f'2 bytes addition to current checksum needed to validate it (dec) {two_byte_addition}; (hex, LE): '
f'"{int2hex_str(two_byte_addition)}".')
# calculating two new checksum bytes for BIOS ROM-dump file
new_first_checksum_byte = hex_str2int(int2hex_str(two_byte_addition, 0)) + byte2int(first_checksum_byte)
correction = hex_str2int(int2hex_str(new_first_checksum_byte, 1))
new_second_checksum_byte = (hex_str2int(int2hex_str(two_byte_addition, 1)) + byte2int(second_checksum_byte) +
correction)
# ask to proceed with auto-patching of BIOS ROM-dump file
if confirm_choice(f'Do you want to auto-patch the checksum bytes in "{new_bios_file_name}" file?'):
write_file_single_byte(new_bios_file_name, 65360, hex_str2byte(int2hex_str(new_first_checksum_byte, 0)))
write_file_single_byte(new_bios_file_name, 65361, hex_str2byte(int2hex_str(new_second_checksum_byte, 0)))
patched_bios_file_name = file_rename(new_bios_file_name, bios_file_name.split('.')[0] + '.PCH')
print(f'Checksum bytes replaced in "{patched_bios_file_name}" file at address 0xFF50 with these values (hex, LE): '
f'"{int2hex_str(new_first_checksum_byte, 0)} {int2hex_str(new_second_checksum_byte, 0)}".')
print(f'Original unmodified "{bios_file_name}" file is still intact.')
print(f'Now you can use freshly created "{patched_bios_file_name}" file with corrected checksum bytes'
f'{" and removed checksum hack" if hacked else ""}.')
else:
print_no_further_actions()
print(f'Manually hex-edit checksum bytes in "{new_bios_file_name}" '
f'file{" with removed checksum hack" if hacked else ""} at address 0xFF50 with these values (hex, LE): '
f'"{int2hex_str(new_first_checksum_byte, 0)} {int2hex_str(new_second_checksum_byte, 0)}".')
else:
print(f'Checksum for "{new_bios_file_name}" file equals zero.')
file_delete(new_bios_file_name)
print('No actions needed.')
print(f'Original unmodified "{bios_file_name}" file is still intact.')

If the new code is approved, I'll attach the script file in zip-archive later.

I'm waiting for your feedback...

The word Idiot refers to a person with many ideas, especially stupid and harmful ideas.
This world goes south since everything's run by financiers and economists.
This isn't voice chat, yet some people overusing online communications talk and hear voices.

Reply 55 of 56, by feipoa

User metadata
Rank l33t++
Rank
l33t++

If you're waiting for me, I won't have time to do any computer work until the Fall. I'm in summer home repair mode and have lots going on.

Plan your life wisely, you'll be dead before you know it.

Reply 56 of 56, by analog_programmer

User metadata
Rank Oldbie
Rank
Oldbie
feipoa wrote on 2025-06-24, 06:30:

If you're waiting for me, I won't have time to do any computer work until the Fall. I'm in summer home repair mode and have lots going on.

I'm waiting for someone to test the script and give some feedback, 'cause there's always a possibility that I've missed or messed something.

The word Idiot refers to a person with many ideas, especially stupid and harmful ideas.
This world goes south since everything's run by financiers and economists.
This isn't voice chat, yet some people overusing online communications talk and hear voices.