UGH. So the chip enable on the rom sockets is just grounded! So all the rom socket is ALWAYS enabled. They only toggle the output enable for reads. So I have no idea how I can enable writing to this chip from the 128 itself without serious logic mods.
However, I did verify that I could read from the chip fine, I could see the bytes that should hold the time etc. So I just need to write the correct time and date to the chip and it should then be readable by the 128.
For extra kicks I need to write an ML program so the "rom" has an autostart code, this copies the RTC into the correct ToD slot and then continues with a normal boot.
If anybody can help me with that rom code I would appreciate it. It seems that once programmed with the boot code and the correct time it should pretty much be a plug and play RTC for the 128
Got a converter built to connect an Arduino to the chip and spent a lot more time than I would hope working it out. However, I can now read and set the time in the chip. If I place it in the 128 and read the ram in bank 4 I get the time and date It needs 2 pins swapping so I ordered a couple chip sockets which I will mod to do that and then glue them together as an adaptor. Next is writing the code to read the RTC into the ToD and program that into the RTC SRAM.
So, please excuse me pasting his code here but I want help understanding it.
NOP ; that's for NMI handler AFAIR
BOOTSTART here So, I get that it starts at 8000 but why 3 NOPs? then it jumps to the beginning of the code, fair enough. The bytes are for the auto detection of the rom, so required. Fair enough.
LDA $FF00, this gets the state of the bank register yes? Then it turns off the highest 2 bits (which banks are these?) and puts it back into the register.
Next we have a loop that copies 255 bytes of rom into ram and then jumps to that point in the ram?
What was the point of the register change for the banks?
My rom will simply copy the correct time from the RTC into the ToD registers and then carry on a normal boot. I don't want the ROM to be banked in, I want a normal boot from that point on. So I assume the last thing I do is change the bank register to the normal bank system which is what on boot? Also, I guess I then have to jump to an address to continue the boot, so what address do I jump to that continues the boot as if the function rom had not been there?
I think I have the code sort of worked out. Turns out you need to read/write the ToD in a particular order or it stops! wtf. So now I just need to sort the 24 hour to 12hour+am/pm conversion and I am done. I assume I can just end my routine with an rts?
At the zimmers.net ftp area there is a file with drivers and schematics (SmartWatch-128.v2.sfx) that interfaces the smartwatch with control (joystick) port 2. It seems not so complicated. Screenshot of schematic in VICE:
Maybe this can be of use to you as an alternative approach (and use of the chip).
Just to prove I am "on the right track" here is a screen shot. This was take using my real 128 connected to a monitor, running.. Monitor. I simply displayed the contents of the option ROM socket. so the time when I took this screenshot was 18:11:05 Tuesday 28/06/16
Yes, this updates realtime inside the option rom. Repeated reads give the constant current time.