Mirror of CollapseOS
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

41 lines
1.3KB

  1. # Sega Master System ROM signatures
  2. When loading ROM, the SMS' BIOS checks for a special signature
  3. at the end of that ROM. If that signature is incorrect, the ROM
  4. doesn't load.
  5. Collapse OS has a program to generate that signature at B165.
  6. This document describes what it does.
  7. At boot, the BIOS checks 0x10 bytes before the 0x8000, then
  8. 0x4000, then 0x2000 mark for a signature. This signature has
  9. the following structure.
  10. 0x00-0x07: String constant: "TMR SEGA"
  11. 0x08-0x09: null bytes
  12. 0x0a-0x0b: checksum
  13. 0x0c-0x0e: null bytes
  14. 0x0f : "size" flag
  15. The checksum is a simple 16-bit sum of all bytes up to the
  16. beginning of the signature.
  17. The size flag can have 3 values: 0x4a for an 8K ROM, 0x4b for
  18. 16K and 0x4c for 32K. It can have other values for other kinds
  19. of sizes, but we don't care about them in the context of
  20. Collapse OS.
  21. ## Generating the signature
  22. Before generating the signature, you need to have the contents
  23. of your ROM somewhere in memory. Then, you load B165 and you
  24. call "segasig" which has the signature "addr size". "addr" is
  25. the adress of the beginning of the ROM and "size" is 0, 1 or 2
  26. depending on whether your ROM is 8K, 16K or 32K.
  27. Calling the word will write the 0x10 bytes signature at the
  28. end of the ROM.
  29. Note that all I/O use the "Addressed device" words (see
  30. usage.txt), so I/O indirections will work.