Module:Program
Description: internal and external EEPROM reprogrammer
Source: program.asm
Wrapper: program.c
  program.h

Description:

The Program module allows the internal HC11 eeprom and the on-board CokeOS eeprom to be reprogrammed in the comfort of your own home. Unless you screw it up so badly that you can no longer enter commands or upload modules, in which case you get to walk down to Moore (or write an HC11 bootloader routine). The code to be programmed should be uploaded as a resource.

This should not be a core module, but should be uploaded as needed.

Commands:

cokerr Program_QueryVersion (char* versionstring)
returns the version string.

cokerr Program_EnableWrite (byte flag)
enables the write commands. flag must be exactly 1 to allow reprogramming.

cokerr Program_WriteChip (byte rezID)
writes a resource into the HC11's internal EEPROM. The resource must be exactly 512 bytes long. If the command succeeds, the board is reset.
Errors: ERROR_Coke_BadResourceID
  ERROR_Program_WriteNotEnabled
  ERROR_Program_BadDataLength

cokerr Program_WriteExternal (byte rezID)
writes a resource into the on-board EEPROM. If the resource is exactly 512 bytes long the command fails, to prevent confusion with files intended for the internal EEPROM. If the command succeeds, the board is reset.
Errors: ERROR_Coke_BadResourceID
  ERROR_Program_WriteNotEnabled
  ERROR_Program_BadDataLength

cokerr Program_WriteBoth (byte chipRezID, byte externalRezID)
writes resources into both EEPROMs at once. If the resources are not appropriate lengths as described above, the command fails. If the command succeeds, the board is reset.
Errors: ERROR_Coke_BadResourceID
  ERROR_Program_WriteNotEnabled
  ERROR_Program_BadDataLength