The present invention provides a controller that can write an operation
program for a control circuit to a memory and a method for writing data,
while suppressing an increase in circuit area and an increase in
manufacturing cost. An ATA register is connected to a host computer. An
ATAPI register is connected to the ATA register. When a command code A0h
is sent to the ATA register from the host computer, data (a command and
microcomputer control software) sent from the host computer is sent to
the ATAPI register via the ATA register. A decoder decodes the data sent
to the ATAPI register and generates an address and data for writing the
microcomputer control software to the flash ROM.