Re: [hatari-devel] Problem with Hatari 1.6.2 and EmuTOS 192K ROMs |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/hatari-devel Archives
]
- To: hatari-devel@xxxxxxxxxxxxxxxxxxx
- Subject: Re: [hatari-devel] Problem with Hatari 1.6.2 and EmuTOS 192K ROMs
- From: Vincent Rivière <vincent.riviere@xxxxxxxxxxx>
- Date: Fri, 12 Oct 2012 23:38:32 +0200
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:message-id:date:from:user-agent:mime-version:to:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=J5xy0qtEEwP/UQN8X1/6aklWLaRFO7AtkEifogR6gqI=; b=qITejury2TCgPWmML32pdZcz81eXnmtvEVHXuoza4L6fiY6+2ojhk35A/atR2VbUVL iUv98k8+ufzvpl7FTBO/+haTjF+EvPL0/XAH9HIs6QeynjR6ghrxLIaerW/Bh/43y+nT bE9Sm/1TfUx64YgyWGReYbl8pSOfTQkkYdVLwjLjAyWlFymJBlfVSix/PNE4JHs+PhFL QbwYysWBCp6BV0aGoNNytQ80KYyX9Tbi1emysthvmfajL+WjlPP0y837+DfYYqwEIdHX /VazdBLtd1FhaTswUrODyFkMnguV/cH/6xHamMIhDkH9ca0PC11LeMUxCUDghx5q2zch /qig==
On 12/10/2012 22:48, Eero Tamminen wrote:
Does EmuTOS call IKBD_Cmd_SetClock() before IKBD_Cmd_ReadClock()
with some wierd value?
BTW, the following Hatari code looks like a Y2K bug:
src/ikbd.c, function IKBD_Cmd_SetClock()
NewTime.tm_year = IKBD_FromBCD(Keyboard.InputBuffer[1]);
As I said, EmuTOS sets year 12 at startup.
tm_year is an offset from 1900, so Hatari understands 1912. This will shock
MinGW mktime() which will probably return -1.
When EmuTOS (or whatever) says year 12, it means 2012.
The classic way to solve this issue is to use 80 as pivot year:
- if 2 digit year < 80 then add 2000
- otherwise add 1900
Anyway, the upper limit of time_t is 2038, so 2 digit years from 39 to 79
(understand: 2039 to 2079) will still not be representable with MinGW time_t.
Hatari should use another way to represent nTimeOffset, at least on Windows.
--
Vincent Rivière