2019-06-14 14:15:30 -04:00
|
|
|
# Writing to a AT28 from Collapse OS
|
|
|
|
|
|
|
|
## Goal
|
|
|
|
|
|
|
|
Write in an AT28 EEPROM from within Collapse OS so that you can have it update
|
|
|
|
itself.
|
|
|
|
|
|
|
|
## Gathering parts
|
|
|
|
|
2020-04-13 14:41:02 -04:00
|
|
|
* A RC2014 Classic
|
2019-06-14 14:15:30 -04:00
|
|
|
* An extra AT28C64B
|
|
|
|
* 1x 40106 inverter gates
|
|
|
|
* Proto board, RC2014 header pins, wires, IC sockets, etc.
|
|
|
|
|
|
|
|
## Building the EEPROM holder
|
|
|
|
|
|
|
|
The AT28 is SRAM compatible so you could use a RAM module for it. However,
|
|
|
|
there is only one RAM module with the Classic version of the RC2014 and we
|
|
|
|
need it to run Collapse OS.
|
|
|
|
|
|
|
|
You could probably use the 64K RAM module for this purpose, but I don't have one
|
|
|
|
and I haven't tried it. For this recipe, I built my own module which is the same
|
|
|
|
as the regular ROM module but with `WR` wired and geared for address range
|
|
|
|
`0x2000-0x3fff`.
|
|
|
|
|
|
|
|
If you're tempted by the idea of hacking your existing RC2014 ROM module by
|
|
|
|
wiring `WR` and write directly to the range `0x0000-0x1fff` while running it,
|
|
|
|
be aware that it's not that easy. I was also tempted by this idea, tried it,
|
|
|
|
but on bootup, it seems that some random `WR` triggers happen and it corrupts
|
2019-11-04 14:45:10 -05:00
|
|
|
the EEPROM contents. Theoretically, we could go around that by putting the AT28
|
2019-06-14 14:15:30 -04:00
|
|
|
in write protection mode, but I preferred building my own module.
|
|
|
|
|
|
|
|
I don't think you need a schematic. It's really simple.
|
|
|
|
|
2020-05-14 11:32:51 -04:00
|
|
|
### Building the binary
|
2019-06-14 14:15:30 -04:00
|
|
|
|
2020-05-14 11:32:51 -04:00
|
|
|
You build the binary by modifying the base recipe's `xcomp` unit. This binary
|
|
|
|
is missing 2 things: Addressed devices and the AT28 Driver.
|
2020-04-26 14:52:55 -04:00
|
|
|
|
2020-05-14 11:32:51 -04:00
|
|
|
Addressed devices are at B140. If you read that block, you'll see that it tells
|
|
|
|
you to load block 142. Open the `xcomp` unit and locate the ACIA driver loading
|
|
|
|
line. Insert your new load line after that one.
|
2020-04-26 14:52:55 -04:00
|
|
|
|
2020-05-13 14:56:38 -04:00
|
|
|
Do the same thing with the AT28 driver (B590)
|
2020-04-26 14:52:55 -04:00
|
|
|
|
2020-05-14 11:32:51 -04:00
|
|
|
You also have to modify the initialization sequence at the end of the `xcomp`
|
|
|
|
unit to include `ADEV$`.
|
2020-04-26 14:52:55 -04:00
|
|
|
|
2020-05-14 11:32:51 -04:00
|
|
|
Build again, write `os.com` to EEPROM.
|
2019-06-14 14:15:30 -04:00
|
|
|
|
|
|
|
## Writing contents to the AT28
|
|
|
|
|
2020-04-13 14:41:02 -04:00
|
|
|
The driver provides `AT28!` which can be plugged in adev's `A!*`.
|
2019-06-14 14:15:30 -04:00
|
|
|
|
2020-04-19 16:56:37 -04:00
|
|
|
First, upload your binary to some place in memory, for example `a000`. To do so,
|
2020-04-13 14:41:02 -04:00
|
|
|
run this from your modern computer:
|
2019-06-14 14:15:30 -04:00
|
|
|
|
2020-04-13 14:41:02 -04:00
|
|
|
./upload <tty device> a000 <filename>
|
2019-06-14 14:15:30 -04:00
|
|
|
|
2020-04-13 14:41:02 -04:00
|
|
|
Then, activate `AT28!` with `' AT28! A!* !` and then run
|
|
|
|
`0xa000 0x2000 <size-of-bin> AMOVE`. `AT28!` checks every myte for integrity,
|
|
|
|
so it there's no error, you should be fine. Your content is now on the EEPROM!
|
2019-06-14 14:15:30 -04:00
|
|
|
|
2020-04-13 14:41:02 -04:00
|
|
|
Why not upload content directly to `0x2000` after having activated `AT28!`?
|
|
|
|
Technically, you could. It was my first idea too. However, at the time of this
|
|
|
|
writing, I always get weird mismatch errors about halfway through. Maybe that
|
|
|
|
the ACIA interrupt does something wrong...
|