Author Topic: 84+/SE System Clock?  (Read 6940 times)

0 Members and 1 Guest are viewing this topic.

Offline FloppusMaximus

  • LV5 Advanced (Next: 300)
  • *****
  • Posts: 290
  • Rating: +57/-5
    • View Profile
Re: 84+/SE System Clock?
« Reply #15 on: January 29, 2011, 12:08:22 am »
Well, if you're only interested in the time of day (not the date), that's relatively easy.  Doing it in pure Axe, using only 16-bit math, would be interesting and difficult, but the boot code provides an undocumented routine that you can use to divide a 32-bit number by a 16-bit number.  Something like this (untested):
Code: [Select]
Asm(
217884  ; ld hl, OP1
014904  ; ld bc, $0449
0D      ; dec c
EDA2    ; ini
20FB    ; jr nz, $ - 5
113C00  ; ld de, 60
EFB180  ; B_CALL Div32ByDE
)
{e8486}→S ; number of seconds
Asm(
113C00  ; ld de, 60
EFB180  ; B_CALL Div32ByDE
)
{e8486}→M ; number of minutes
Asm(
111800  ; ld de, 24
EFB180  ; B_CALL Div32ByDE
)
{e8486}→H ; number of hours
would obtain the hours, minutes, and seconds since midnight; I'll let somebody else figure out how to turn that into a string.

Offline ferox

  • LV3 Member (Next: 100)
  • ***
  • Posts: 94
  • Rating: +3/-0
    • View Profile
Re: 84+/SE System Clock?
« Reply #16 on: January 31, 2011, 12:31:18 am »
Im trying to do something like the Basic GetTimeStr(12)

i do know a BASIC syntax for this:

Code: [Select]
getTime->L1

this stores the hours into L1(1) mins into L1(2) and secs into L1(3)
btw, it only knows 24 hours, no AM or PM display
« Last Edit: January 31, 2011, 12:32:23 am by ferox »
on hold:

Offline calcdude84se

  • Needs Motivation
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2272
  • Rating: +78/-13
  • Wondering where their free time went...
    • View Profile
Re: 84+/SE System Clock?
« Reply #17 on: February 01, 2011, 08:40:33 pm »
Sadly, he's looking for Axe code. That'd work for BASIC, though ;)
Floppus, nice! Didn't know about that bcall :D
"People think computers will keep them from making mistakes. They're wrong. With computers you make mistakes faster."
-Adam Osborne
Spoiler For "PartesOS links":
I'll put it online when it does something.

Offline thepenguin77

  • z80 Assembly Master
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1594
  • Rating: +823/-5
  • The game in my avatar is bit.ly/p0zPWu
    • View Profile
Re: 84+/SE System Clock?
« Reply #18 on: February 01, 2011, 08:54:07 pm »
i do know a BASIC syntax for this:

Code: [Select]
getTime->L1

And just like almost every basic command, it has a bcall counter part. bcall(_getTime) puts seconds, minutes, and hours all on the floating point stack. The method of retrieval can vary, but there are two distinct strategies. Pop and grab each one through op1, or pop them consecutively into op1 2 and 3.

So, method 1:
Code: [Select]
EF5B51 EF9043 grab OP1 seconds EF9043 grab OP1 minutes EF9043 grab OP1 hours
And method 2:
Code: [Select]
EF5B51 EF9043 EF8D43 EF8A43 OP1 = secs OP2 = minutes OP3 = hours


Just remember that those answers are TI floating point. So you'll have to convert them.

zStart v1.3.013 9-20-2013 
All of my utilities
TI-Connect Help
You can build a statue out of either 1'x1' blocks or 12'x12' blocks. The 1'x1' blocks will take a lot longer, but the final product is worth it.
       -Runer112

Offline calcdude84se

  • Needs Motivation
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2272
  • Rating: +78/-13
  • Wondering where their free time went...
    • View Profile
Re: 84+/SE System Clock?
« Reply #19 on: February 01, 2011, 09:00:09 pm »
Axe has float{ for that (converting from TI FP), so your method will work too :)
"People think computers will keep them from making mistakes. They're wrong. With computers you make mistakes faster."
-Adam Osborne
Spoiler For "PartesOS links":
I'll put it online when it does something.