0 Members and 1 Guest are viewing this topic.
Due to multiple requests, I wrote an axe clock library, LIBCLOCK. See CLOCKTST for example code.Axe Code Function on calculators with a clock (function on calculators without a clock).Main functions:ClkOf() Turns the clock off (does nothing).ClkOn() Turns the clock on (does nothing).IsClk() Returns 1 if the clock is on, 0 if off (returns 0).°A:GetDT() Gets the current date and time. Sets 6 consecutive variables, or 6 consecutive words, starting at the passed in address. In this example, A = year, B = month, C = day, D = hour, E = minute, F = second (returns midnight of January 1, 1997). Do not pass in °r₁.SetDT(year,month,day,hour,minute,second) Sets the current date and time (does nothing relatively slowly).DOfWk(year,month,day) Returns the day of the week of the specified date, 1 = Sunday, ..., 7 = Saturday.Low level functions:°A:GetRT() Gets the current raw time. Sets 2 consecutive variables, or 2 consecutive words, starting at the passed in address. In this example, AB = seconds since January 1, 1997 (AB = 0).°A:SetRT() Sets the current raw time. Uses 2 consecutive variables, or 2 consecutive words, starting at the passed in address (does nothing).Bonus functions:Mul21(r₁,r₂,r₃) Multiplies r₁r₂ by r₃ and stores the result in r₁r₂.Div21(r₁,r₂,r₃) Divides r₁r₂ by r₃ and stores the result in r₁r₂, and the remainder in r₄. Edit: I think r₃ must be < 256.
If Y<64
!If Y.π1111111111000000
:Lbl DEC :L2→r1 :L2+100→r2 : conj(,R1,3) : 0→{R2}r : Fill(1+R2,8) : R2→{10+R1}r : 0+R1→r1 : 4+R1→r2 : 0+R1→r3 : ([806967]) : sub(DE0) : ([C0BDF0]) : sub(DE0) : ([6079FE]) : sub(DE0) : ([F0D8FF]) : sub(DE0) : ([18FCFF]) : sub(DE0) : ([9CFFFF]) : sub(DE0) : ([F6FFFF]) : sub(DE0) : ([FFFFFF]) : sub(DE0) : R2 : Return : Lbl DE0 : conj(,4+R1,3) : '0'-1→{8+R1}r : Lbl DE1 : {8+R1}r+1→{8+R1}r : If {2+R1}≥{sub(ADD)} : Goto DE1 : End : sub(SUB) : Return!If {4+R1}+1/256+{8+R1}r-'0'+{R2}r : {8+R1}r→{{10+R1}r}+1→{10+R1}r :Return