(This is for the TI-84 series with its real-time clock).
I need to be able to convert a date and time, where I know the individual numeric components (ie, year, month, day, hour, minute and second) into a number of seconds since 1997/01/01 to set the clock. I also need to be able to go the other way and convert a number of seconds since 1997/01/01 to a date and time.
Does the TI-OS expose such functionality to assembly programmers?
This is for BBC BASIC's TIME$ pseudo-variable. It's a 24-character string in the form Wed,22 Oct 2008.12:46:25. I've written code to convert the string representation to and from the individual components, but the clock chip I'm using makes life easy by storing the date and time components as packed BCD.
[TI ASM] Converting date to number of seconds since epoch
Moderator: MaxCoderz Staff
-
- Calc King
- Posts: 1513
- Joined: Sat 05 Aug, 2006 7:22 am
Re: [TI ASM] Converting date to number of seconds since epoch
I tried to search for something like that on WikiTI
But it is an "attack site"?? wtf?
That can't be true, but it makes it annoying to browse it.. I didn't find any useful BCalls - but that doesn't mean that there are none..
But it is an "attack site"?? wtf?
That can't be true, but it makes it annoying to browse it.. I didn't find any useful BCalls - but that doesn't mean that there are none..
- benryves
- Maxcoderz Staff
- Posts: 3089
- Joined: Thu 16 Dec, 2004 10:06 pm
- Location: Croydon, England
- Contact:
Re: [TI ASM] Converting date to number of seconds since epoch
There's been a problem on Dan's site - something modified the PHP to embed an iframe that linked to a malicious PDF. Andy_J fixed it, but I think he's looking for a new host (current versions of MediaWiki require PHP5, Dan's host only has PHP4).
BrandonW had the answers, though; there are BCALLs to get and set the current date and time via the floating point stack.
BrandonW had the answers, though; there are BCALLs to get and set the current date and time via the floating point stack.
- driesguldolf
- Extreme Poster
- Posts: 395
- Joined: Thu 17 May, 2007 4:49 pm
- Location: $4080
- Contact:
Re: [TI ASM] Converting date to number of seconds since epoch
That's why you browse with firefox + noscript (it blocks those attempts) (get adblock too while you're at it) plugin
- benryves
- Maxcoderz Staff
- Posts: 3089
- Joined: Thu 16 Dec, 2004 10:06 pm
- Location: Croydon, England
- Contact:
Re: [TI ASM] Converting date to number of seconds since epoch
You can disable JavaScript in any browser and as you can clearly see from the screenshot IE blocks said attempts as well. (The restarted tab is because the malicious PDF crashes Foxit).driesguldolf wrote:That's why you browse with firefox + noscript (it blocks those attempts) (get adblock too while you're at it) plugin
- driesguldolf
- Extreme Poster
- Posts: 395
- Joined: Thu 17 May, 2007 4:49 pm
- Location: $4080
- Contact:
Re: [TI ASM] Converting date to number of seconds since epoch
Well yes, but with noscript allows a much finer degree of control.benryves wrote:You can disable JavaScript in any browser and as you can clearly see from the screenshot IE blocks said attempts as well. (The restarted tab is because the malicious PDF crashes Foxit).driesguldolf wrote:That's why you browse with firefox + noscript (it blocks those attempts) (get adblock too while you're at it) plugin
(okok... I don't like ie )
- benryves
- Maxcoderz Staff
- Posts: 3089
- Joined: Thu 16 Dec, 2004 10:06 pm
- Location: Croydon, England
- Contact:
Re: [TI ASM] Converting date to number of seconds since epoch
Or just use Opera where it's built in. Just trying to avoid the browser fanboyism.
Code: Select all
RTC.Write:
ld hl,(Date.Year)
.bcall _SetXXXXOP2
.bcall _OP2ToOP1
.bcall _PushOP1
ld a,(Date.Month)
.bcall _SetXXOP1
.bcall _PushOP1
ld a,(Date.DayOfMonth)
.bcall _SetXXOP1
.bcall $516A ; setDate
ld a,(Time.Hour)
.bcall _SetXXOP1
.bcall _PushOP1
ld a,(Time.Minute)
.bcall _SetXXOP1
.bcall _PushOP1
ld a,(Time.Second)
.bcall _SetXXOP1
.bcall $5170 ; setTime
ret