tom-seddon / acorn_mos_disassembly

WIP disassembly of Acorn MOS, operating system for Acorn's 8-bit Master series
8 stars 0 forks source link

More Compact EEPROM stuff #24

Closed tom-seddon closed 8 months ago

tom-seddon commented 9 months ago

Copy-pasted notes from discussion elsewhere, that needs some comments adding to the disassembly...


This bit of code here: https://github.com/tom-seddon/acorn_mos_disassembly/blob/e8e54cb2d5a108e2d79fc1734fceaa8b5f199180/src/terminal.s65#L3182C71-L3182C71 - it can actually detect whether the EEPROM read succeeded (the chip puts out an acknowledge signal that you can read), and, if it didn't, it can return a default value from the table L9DE4.

The Compact MOS can also support either a 128 or 256 byte EEPROM. When resetting the CMOS data, it EORs the value in location 127 and writes that to location 255. So locations 127 and 255 are either different (256 bytes) or the same (128 bytes): https://github.com/tom-seddon/acorn_mos_disassembly/blob/e8e54cb2d5a108e2d79fc1734fceaa8b5f199180/src/reset.s65#L690

You can query the EEPROM size by reading EEPROM address 255: https://github.com/tom-seddon/acorn_mos_disassembly/blob/e8e54cb2d5a108e2d79fc1734fceaa8b5f199180/src/terminal.s65#L3162C31-L3162C31

I can't quickly find any official docs about this, but BeebWiki mentions it: https://beebwiki.mdfs.net/OSBYTE_%26A1

What it doesn't mention is that you can't write to EEPROM addresses 0, 127, 128 or 255: https://github.com/tom-seddon/acorn_mos_disassembly/blob/e8e54cb2d5a108e2d79fc1734fceaa8b5f199180/src/terminal.s65#L3239

Still, the only documented CMOS/EEPROM addresses are 30-49, so not really a big issue.