11 June 2016, 10:08 | #61 | |
Registered User
Join Date: Mar 2016
Location: Australia
Posts: 881
|
Quote:
|
|
05 December 2018, 11:35 | #62 |
Defendit numerus
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 53
Posts: 4,468
|
Time has passed since the last post about the topic.
I've read everything but I still not convinced on what is the best solution and that works on most hardware and KSs. Using 'calculates time difference passed through the TOD and update' seems the best but has a problem: not always the TOD is tied to the same source, can be power supply frequency or video v-frequency, so machine type dependent. To complicate things it may happen that it's granted to the user to change in real time the vertical screen frequency... battclock.resource works only on KS2.0+. HW bang the RTC seems unaffordable. A full WHDl slave a bit excessive (anyway require 2.0). What is left? A system call for "setclock load"? Who has tried something like that, what did you opt for? (it is absolutely acceptable and understandable to not care about it and not restore the date/time ) |
05 December 2018, 16:41 | #63 |
son of 68k
Join Date: Nov 2007
Location: Lyon / France
Age: 51
Posts: 5,323
|
Don't kill the OS and this problem will magically go away
|
05 December 2018, 16:55 | #64 | |
Registered User
Join Date: Jan 2008
Location: Warsaw/Poland
Age: 55
Posts: 1,959
|
Quote:
|
|
05 December 2018, 17:58 | #65 | |
Defendit numerus
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 53
Posts: 4,468
|
If I could do it I would do it but sometimes it's impossible when you have to apply patch to old and badly written stuff ..
Quote:
I was looking for a more general solution to be applied quietly at the system reanimation Last edited by ross; 05 December 2018 at 18:15. |
|
05 December 2018, 18:36 | #66 |
son of 68k
Join Date: Nov 2007
Location: Lyon / France
Age: 51
Posts: 5,323
|
|
05 December 2018, 19:08 | #67 |
Defendit numerus
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 53
Posts: 4,468
|
|
05 December 2018, 19:34 | #68 |
Registered User
Join Date: Mar 2016
Location: Australia
Posts: 881
|
I ended up leaving the OS running. I had a pretty decent clock restore routine that worked most of the time, but I could never crack the nut of things like network stacks.
And when the OS is running, surprising as it sounds, it provides all these really useful features |
05 December 2018, 19:46 | #69 | |||
Defendit numerus
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 53
Posts: 4,468
|
Well, code is your for your game, so you could do it
Quote:
Quote:
Quote:
|
|||
05 December 2018, 20:04 | #70 |
Registered User
Join Date: Mar 2016
Location: Australia
Posts: 881
|
|
05 December 2018, 20:07 | #71 | |
Defendit numerus
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 53
Posts: 4,468
|
Quote:
Thanks |
|
05 December 2018, 20:55 | #72 |
son of 68k
Join Date: Nov 2007
Location: Lyon / France
Age: 51
Posts: 5,323
|
|
05 December 2018, 21:49 | #73 | |
Defendit numerus
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 53
Posts: 4,468
|
Quote:
(like with only 512kb ram) AND the same code in a 'modern' machine. But anyway is only a curiosity of mine to find a valid solution for time/clock stuck if you stop system IRQ2 from happening. And maybe TOD is the best choice available. I know you are a big sustainer of a proper request of resources before hw banging (and you are right!) but sometime is too hard or time consuming to avoid a dirty patch, or simply not as fun as get your hands dirty and find new solutions |
|
11 December 2018, 13:23 | #74 | |
Registered User
Join Date: Sep 2015
Location: Germany
Posts: 256
|
Quote:
maybe this solution I found out some time ago makes things easier restoring the system time independent from a kickstart version: Code:
MOVE.L $4.W,A6 ;Execbase LEA timer_request_struc(PC),A1 ;Timer-request-structure MOVEQ #0,D0 ;Unit 0 (UNIT_MICROHZ) & Null for struc MOVE.B D0,8(A1) ;LN_Type: Entry type = Null MOVE.B D0,9(A1) ;LN_Pri: Priority of the struc. = NULL MOVEQ #0,D1 ;No Flags for device MOVE.L D0,$A(A1) ;LN_Name: No name for the structure LEA timer_device_name(PC),A0 ;Pointer to name of Timer-Device MOVE.L D0,$E(A1) ;MN_ReplyPort: No Reply-Port JSR -444(A6) ;OpenDevice() TST.L D0 BNE.S open_timer_device_error LEA timer_request_struc(PC),A1 MOVE.W #$A,$1C(A1) ;IO_Command = TR_GETSYSTIME JSR -456(A6) ;DoIO() JSR -120(A6) ;Disable() ;Here we take over the machine... MOVE.L #$BFE001,A4 ;CIA-A base address MOVEQ #0,D0 MOVE.B $A00(A4),D0 ;TOD-clock bits 23-16 SWAP D0 ;Shift bits to the right position MOVE.B $900(A4),D0 ;TOD-clock bits 15-8 LSL.W #8,D0 ;Shift bits to the right position MOVE.B $800(A4),D0 ;TOD-clock bits 7-0 MOVE.L D0,TOD_time_save ;Save time before demo/intro starts MOVEM.L D0-D7/A0-A6,-(A7) BSR demo ;start intro/demo MOVEM.L (A7)+,D0-D7/A0-A6 MOVE.L TOD_time_save(PC),D0 ;Time before starting demo/intro MOVEQ #0,D1 MOVE.B $A00(A4),D1 ;TOD-clock Bits 23-16 SWAP D1 MOVE.B $900(A4),D1 ;TOD-clock Bits 15-8 LSL.W #8,D1 MOVE.B $800(A4),D1 ;TOD-clock Bits 7-0 CMP.L D0,D1 ;TOD overflow? BEQ.S no_TOD_overflow ;No -> skip MOVE.L #$FFFFFF,D2 ;Max TOD value SUB.L D0,D2 ;Difference until overflow ADD.L D2,D1 ;+ value after overflow BRA.S TOD_okay CNOP 0,4 ;Longword alignment for 68020+ no_TOD_overflow SUB.L D0,D1 ;Get normal difference without overflow TOD_okay MOVE.L D1,TOD_time_save ;Save period of demo/intro ;Restoring system... MOVE.L $4.W,A6 ;Execbase JSR -126(A6) ;Enable() MOVE.L TOD_time_save(PC),D0 ;Period of demo/intro MOVEQ #0,D1 MOVE.B 212(A6),D1 ;Get VBlankFrequency LEA timer_request_struc(PC),A1 DIVU.W D1,D0 ;Calculate seconds MOVE.W #$B,$1C(A1) ;IO_command = TR_SETSYSTIME MOVE.L D0,D1 ;Save seconds in d1 EXT.L D0 ;Word to longword ADD.L D0,$20(A1) ;TV_SECS: Set Unix-Time seconds SWAP D1 ;Remainder of division MULU.W #10000,D1 ;*10000 = µs ADD.L D1,$24(A1) ;TV_MICRO: Set Unix-Time microseconds JMP -456(A6) ;DoIO() CNOP 0,4 open_timer_device_error RTS CNOP 0,4 TOD_time_save DC.L 0 timer_request_struc DS.B 40 timer_device_name DC.B "timer.device",0 EVEN |
|
11 December 2018, 15:26 | #75 | |
Defendit numerus
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 53
Posts: 4,468
|
Quote:
I've only a remarks about it: since the TOD tick source can vary, how obtain it (with system destroyed*)? Maybe the easiest thing to do is count how many video lines there are in one tick and select a time count for 50 or 60Hz. I already do it to know if I'm in PAL or NTSC, but TOD source can be also power line frequency, so I need to expand my existing routine. Or is there an even simpler way? EDIT:* well, you can get it before, but sometime KS1.x system is wrong about PAL/NTSC check Last edited by ross; 11 December 2018 at 15:35. Reason: * |
|
11 December 2018, 17:26 | #76 | ||
Natteravn
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,496
|
Quote:
Quote:
I should also improve my code in this aspect. Currently I'm only reading ExecBase.PowerSupplyFrequency and assume this is the CIA clock tick. |
||
11 December 2018, 21:28 | #77 | |
Registered User
Join Date: Sep 2015
Location: Germany
Posts: 256
|
Quote:
|
|
11 December 2018, 21:37 | #78 | |
Registered User
Join Date: Sep 2015
Location: Germany
Posts: 256
|
Quote:
|
|
11 December 2018, 21:47 | #79 |
Natteravn
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,496
|
Is ExecBase.PowerSupplyFrequency always correct?
Ross mentioned that Kick 1.x sometimes reports a wrong frequency, and I remember that too. But I do not remember if it was wrong video or power supply frequency, or both, and which ExecBase(?) entries were wrong. |
11 December 2018, 22:19 | #80 | |
Defendit numerus
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 53
Posts: 4,468
|
Quote:
Yes, I absolutely don't remember what was wrong.. too much time ago, but i'm sure that my PAL KS1.2(3?) machine seldom reported (line frequency, video frequency? ) wrong value(s). |
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
startup/system takeover | sidewinder | Coders. General | 15 | 28 February 2016 16:33 |
time clock prob a2000 | source | Hardware mods | 11 | 07 August 2011 13:16 |
A1200 Real Time Clock | Eclipse | support.Hardware | 4 | 22 March 2011 02:18 |
App to update Amiga System time from web time?? | DDNI | request.Apps | 2 | 31 December 2007 07:21 |
Reading the Real Time Clock | girv | Coders. General | 5 | 04 September 2007 18:30 |
|
|