Reading & write to RTC 12887 ?

General discussions or ideas about hardware.
stephen_usher
Posts: 352
Joined: Mon Nov 13, 2017 7:19 pm
Location: Oxford, UK.
Contact:

Re: Reading & write to RTC 12887 ?

Post by stephen_usher » Fri Jun 21, 2019 10:59 pm

exxos wrote:
Fri Jun 21, 2019 10:30 pm
6.jpg


So CS going high doesn't clear the selected address I think...

So the 68000 would put the address on the databus, CS = low, DS=low, but can't figure out what RW is supposed to be doing at that point :roll:
From my reading it doesn't look at the 'R/W' line until the read/write part of the cycle and that determines whether it reads the bus or writes onto the bus.
I mean the first bus cycle would select the register, then read or write data to it on the second bus cycle... but its unclear what RW is supposed to be during the register select cycle :stars:

Looking at the intel timings, RW is high in both register select cycles.. so assume thats the way to do it...
Intro retro computers since before they were retro...
ZX81->Spectrum->Memotech MTX->Sinclair QL->520STM->BBC Micro->TT030->PCs & Sun Workstations.
Added code to the MiNT kernel (still there the last time I checked) + put together MiNTOS.
Collection now with added Macs, Amigas, Suns and Acorns.

User avatar
exxos
Site Admin
Site Admin
Posts: 7873
Joined: Wed Aug 16, 2017 11:19 pm
Location: UK
Contact:

Re: Reading & write to RTC 12887 ?

Post by exxos » Fri Jun 21, 2019 11:01 pm

stephen_usher wrote:
Fri Jun 21, 2019 10:59 pm
From my reading it doesn't look at the 'R/W' line until the read/write part of the cycle and that determines whether it reads the bus or writes onto the bus.
That makes sense.. but why didn't they "XXXX" out the RW line in the timing diagram to just indicate "don't care" :shrug:
4MB STFM 1.44 FD- VELOCE+ 020 STE - 4MB STE 32MHz - STFM 16MHz - STM - MEGA ST - Falcon 030 CT60 - Atari 2600 - Atari 7800 - Gigafile - SD Floppy Emulator - PeST - HxC - CosmosEx - Ultrasatan - various clutter

https://www.exxoshost.co.uk/atari/ All my hardware guides - mods - games - STOS
https://www.exxoshost.co.uk/atari/last/storenew/ - All my hardware mods for sale - Please help support by making a purchase.

User avatar
exxos
Site Admin
Site Admin
Posts: 7873
Joined: Wed Aug 16, 2017 11:19 pm
Location: UK
Contact:

Re: Reading & write to RTC 12887 ?

Post by exxos » Sat Jun 22, 2019 10:31 am

I assume as the Falcon has 2 registers for address and data, that it drives the "AS" pin on address, and doesn't for data. So the CPU must do 2 bus accesses to the RTC... and once the RTC has had the address "set" it stores it and can be accessed later in a second bus cycle.

On the memory map http://cd.textfiles.com/ataricompendium ... PPENDB.PDF it has "IO" for both.. but I don't know why it would be "IO" when it looks to only be a "write to register" on the RTC itself :shrug:
4MB STFM 1.44 FD- VELOCE+ 020 STE - 4MB STE 32MHz - STFM 16MHz - STM - MEGA ST - Falcon 030 CT60 - Atari 2600 - Atari 7800 - Gigafile - SD Floppy Emulator - PeST - HxC - CosmosEx - Ultrasatan - various clutter

https://www.exxoshost.co.uk/atari/ All my hardware guides - mods - games - STOS
https://www.exxoshost.co.uk/atari/last/storenew/ - All my hardware mods for sale - Please help support by making a purchase.

User avatar
exxos
Site Admin
Site Admin
Posts: 7873
Joined: Wed Aug 16, 2017 11:19 pm
Location: UK
Contact:

Re: Reading & write to RTC 12887 ?

Post by exxos » Sun Jun 23, 2019 12:00 pm

I guess it's possible the address register could be read or written to, but I don't really see the point in reading the address back.. As I assume operation would be write the address to the RTC, which selects that address, then read or write back from it.

I have emailed Maxim to see if they can clarify some things about it all. The whole datasheet seems to be a little vague :roll:
4MB STFM 1.44 FD- VELOCE+ 020 STE - 4MB STE 32MHz - STFM 16MHz - STM - MEGA ST - Falcon 030 CT60 - Atari 2600 - Atari 7800 - Gigafile - SD Floppy Emulator - PeST - HxC - CosmosEx - Ultrasatan - various clutter

https://www.exxoshost.co.uk/atari/ All my hardware guides - mods - games - STOS
https://www.exxoshost.co.uk/atari/last/storenew/ - All my hardware mods for sale - Please help support by making a purchase.

User avatar
exxos
Site Admin
Site Admin
Posts: 7873
Joined: Wed Aug 16, 2017 11:19 pm
Location: UK
Contact:

Re: Reading & write to RTC 12887 ?

Post by exxos » Sun Jun 23, 2019 11:13 pm

Only just got home, but quickly coded up the firmware and yes I used STOS as it just easier to poke stuff about..

Thankfully I am now seeing a "count" in the values.. Address zero is "seconds" register and its counting..

I think the problem I have now, is when I "peek and poke" it seems to be doing so on the high byte as I just get 255 all the time... but when I deek and doke, I can see it counting up every second, so it does look like I am getting the data.. I just need to mask the high byte on the databus to get a proper figure... will try and do that tomorrow...

IMG_4410.JPG
IMG_4410.JPG (176.25 KiB) Viewed 580 times
IMG_4409.JPG
IMG_4409.JPG (291.14 KiB) Viewed 580 times

EDIT:

Binary output makes more sense.. can see the binary counting up better for the seconds :)

IMG_4411.JPG
IMG_4411.JPG (223.27 KiB) Viewed 580 times
t1.JPG
t1.JPG (41.56 KiB) Viewed 579 times

Changing the address to "2" gives me %00000101 constantly, so as that is 10mins.. I suspect within the next 10mins it will change to %00000110....

EDIT2:
and yes it did!

:cheer: :cheer: :cheer:
4MB STFM 1.44 FD- VELOCE+ 020 STE - 4MB STE 32MHz - STFM 16MHz - STM - MEGA ST - Falcon 030 CT60 - Atari 2600 - Atari 7800 - Gigafile - SD Floppy Emulator - PeST - HxC - CosmosEx - Ultrasatan - various clutter

https://www.exxoshost.co.uk/atari/ All my hardware guides - mods - games - STOS
https://www.exxoshost.co.uk/atari/last/storenew/ - All my hardware mods for sale - Please help support by making a purchase.

User avatar
exxos
Site Admin
Site Admin
Posts: 7873
Joined: Wed Aug 16, 2017 11:19 pm
Location: UK
Contact:

Re: Reading & write to RTC 12887 ?

Post by exxos » Mon Jun 24, 2019 8:41 am

I did a read of the address register and it gives 65535, so doing a read to the register basically isn't being driven, which was assumed to be the case anyway.

I guess poking the address on the bus doesn't matter in terms of the RW signal.. but to keep my sanity, I am basically doing a write to the register anyway.
4MB STFM 1.44 FD- VELOCE+ 020 STE - 4MB STE 32MHz - STFM 16MHz - STM - MEGA ST - Falcon 030 CT60 - Atari 2600 - Atari 7800 - Gigafile - SD Floppy Emulator - PeST - HxC - CosmosEx - Ultrasatan - various clutter

https://www.exxoshost.co.uk/atari/ All my hardware guides - mods - games - STOS
https://www.exxoshost.co.uk/atari/last/storenew/ - All my hardware mods for sale - Please help support by making a purchase.

User avatar
exxos
Site Admin
Site Admin
Posts: 7873
Joined: Wed Aug 16, 2017 11:19 pm
Location: UK
Contact:

Re: Reading & write to RTC 12887 ?

Post by exxos » Mon Jun 24, 2019 1:28 pm

The seconds count is a bit odd.. as basically once it gets to count of 10, it increased the "10 seconds" bits..

So it goes..
00000000 (0)
..
00001001 (9)
00010000 (10 seconds)
00010001 (11 seconds)
..
( 5 ) ( 9 )
0101 1001 (5x10 = 50 seconds + 9 = 59 seconds)

Very odd way of doing things :shrug: Will see if I can port over a proper 60 second dump next...
4MB STFM 1.44 FD- VELOCE+ 020 STE - 4MB STE 32MHz - STFM 16MHz - STM - MEGA ST - Falcon 030 CT60 - Atari 2600 - Atari 7800 - Gigafile - SD Floppy Emulator - PeST - HxC - CosmosEx - Ultrasatan - various clutter

https://www.exxoshost.co.uk/atari/ All my hardware guides - mods - games - STOS
https://www.exxoshost.co.uk/atari/last/storenew/ - All my hardware mods for sale - Please help support by making a purchase.

User avatar
exxos
Site Admin
Site Admin
Posts: 7873
Joined: Wed Aug 16, 2017 11:19 pm
Location: UK
Contact:

Re: Reading & write to RTC 12887 ?

Post by exxos » Mon Jun 24, 2019 2:18 pm

So the annoying thing is, the address has to be set each time the data is accessed :roll: You can't just set address zero and read it multiple times to get the data at that address... The address has to be set each time , which is a bit rubbish..

Below is a full debug of 60 seconds (0-59)

Code: Select all

 %1111111100000000
 %1111111100000001
 %1111111100000010
 %1111111100000011
 %1111111100000100
 %1111111100000101
 %1111111100000110
 %1111111100000111
 %1111111100001000
 %1111111100001001
 %1111111100010000
 %1111111100010001
 %1111111100010010
 %1111111100010011
 %1111111100010100
 %1111111100010101
 %1111111100010110
 %1111111100010111
 %1111111100011000
 %1111111100011001
 %1111111100100000
 %1111111100100001
 %1111111100100010
 %1111111100100011
 %1111111100100100
 %1111111100100101
 %1111111100100110
 %1111111100100111
 %1111111100101000
 %1111111100101001
 %1111111100110000
 %1111111100110001
 %1111111100110010
 %1111111100110011
 %1111111100110100
 %1111111100110101
 %1111111100110110
 %1111111100110111
 %1111111100111000
 %1111111100111001
 %1111111101000000
 %1111111101000001
 %1111111101000010
 %1111111101000011
 %1111111101000100
 %1111111101000101
 %1111111101000110
 %1111111101000111
 %1111111101001000
 %1111111101001001
 %1111111101010000
 %1111111101010001
 %1111111101010010
 %1111111101010011
 %1111111101010100
 %1111111101010101
 %1111111101010110
 %1111111101010111
 %1111111101011000
 %1111111101011001
 %1111111100000000


So next I need to convert the bits over to some sane value which equals a actual seconds count...
4MB STFM 1.44 FD- VELOCE+ 020 STE - 4MB STE 32MHz - STFM 16MHz - STM - MEGA ST - Falcon 030 CT60 - Atari 2600 - Atari 7800 - Gigafile - SD Floppy Emulator - PeST - HxC - CosmosEx - Ultrasatan - various clutter

https://www.exxoshost.co.uk/atari/ All my hardware guides - mods - games - STOS
https://www.exxoshost.co.uk/atari/last/storenew/ - All my hardware mods for sale - Please help support by making a purchase.

User avatar
exxos
Site Admin
Site Admin
Posts: 7873
Joined: Wed Aug 16, 2017 11:19 pm
Location: UK
Contact:

Re: Reading & write to RTC 12887 ?

Post by exxos » Mon Jun 24, 2019 2:42 pm

My STOS conversion for seconds...

What I do is "bit test" bit 0, if its 1 then add one to S. If bit 1 is set, then add 2 to s, if bit 3 is set add 8 to s... and so on.

I've had it debugging to the screen and seems to work. So we are now counting in seconds 0-59 correctly :)

Code: Select all

10 dim A(200)
20 for A=0 to 120
30 doke ($FF8960),0
40 ZZ=deek($FF8962)
50 Z$=str$(ZZ) : AA$=Z$
60 S=0
70 if btst(0,ZZ) then S=S+1
80 if btst(1,ZZ) then S=S+2
90 if btst(2,ZZ) then S=S+4
100 if btst(3,ZZ) then S=S+8
110 if btst(4,ZZ) then S=S+10
120 if btst(5,ZZ) then S=S+20
130 if btst(6,ZZ) then S=S+40
140 print A,bin$(ZZ),S
150 A(A)=ZZ
160 while Z$=AA$
170 doke ($FF8960),0
180 AA$=str$(deek($FF8962))
190 wend 
200 next A
210 open out #1,"output.txt"
220 for A=0 to 120
230 print #1,A,bin$(A(A))
240 next A
250 close #1


EDIT:

Now I just noticed the second table in the datasheet where seconds and minutes can be read as binary :lol: :roll:
4MB STFM 1.44 FD- VELOCE+ 020 STE - 4MB STE 32MHz - STFM 16MHz - STM - MEGA ST - Falcon 030 CT60 - Atari 2600 - Atari 7800 - Gigafile - SD Floppy Emulator - PeST - HxC - CosmosEx - Ultrasatan - various clutter

https://www.exxoshost.co.uk/atari/ All my hardware guides - mods - games - STOS
https://www.exxoshost.co.uk/atari/last/storenew/ - All my hardware mods for sale - Please help support by making a purchase.

stephen_usher
Posts: 352
Joined: Mon Nov 13, 2017 7:19 pm
Location: Oxford, UK.
Contact:

Re: Reading & write to RTC 12887 ?

Post by stephen_usher » Mon Jun 24, 2019 3:29 pm

exxos wrote:
Mon Jun 24, 2019 1:28 pm
The seconds count is a bit odd.. as basically once it gets to count of 10, it increased the "10 seconds" bits..

So it goes..
00000000 (0)
..
00001001 (9)
00010000 (10 seconds)
00010001 (11 seconds)
..
( 5 ) ( 9 )
0101 1001 (5x10 = 50 seconds + 9 = 59 seconds)

Very odd way of doing things :shrug: Will see if I can port over a proper 60 second dump next...
That's because it binary coded decimal.
Intro retro computers since before they were retro...
ZX81->Spectrum->Memotech MTX->Sinclair QL->520STM->BBC Micro->TT030->PCs & Sun Workstations.
Added code to the MiNT kernel (still there the last time I checked) + put together MiNTOS.
Collection now with added Macs, Amigas, Suns and Acorns.

Post Reply

Return to “HARDWARE DISCUSSIONS”