FirstBlockCheck: ld hl, $0000 ld bc, $0201 ld de, ROM_FirstBlockCopy ; copy in RAM the first 513 bytes of the potential ROM location ldir ld a, (ROM_FirstBlockCopy) ; and we are going to compare the 1st byte with the next 512 ld hl, ROM_FirstBlockCopy+1 ; we will consider it a valid ROM if the 513 bytes don't all ld bc, $0200 ; contain the exact same value (so this BIOS can boot Japanese ROMs!) BlockCheckLoop: cpi jr nz, BlockCheckSuccess ; at least one byte of the block doesn't match the first! jp po, BlockCheckLoop ; if we haven't checked all the bytes yet, loop ret ; check failed