I'm trying to get around the fact that ICE doesn't allow decimals, so i made this crude sort of thing, but it doesn't work as well as I want. It flashes really bad, but it sort of works. The google drive link is here, and the SourceCoder3 link is here.

My stupid code here: (I don't know if it's the same as the links. The links are the more updated versions if they're different)

Code:
[i]AICETIME
det(0

det(21,0
det(74,1,2
0→M
0→S
0→H

det(18,":",20,80
det(18,":",60,80

Lbl MILLI
Repeat K≠0

det(19,50,80
det(16,H,2
H+1→H
If H≥99
0→H
Goto SECONDS
getKey→K



Lbl SECONDS


det(19,30,80
det(16,S,2
S+1→S
Goto MILLI
If S≥59
0→S
Goto MINUTES



Lbl MINUTES


det(19,10,80
det(16,M,2
M+1→M

Goto SECONDS




If M≥60
det(18,"You're TRASH!",1,1



Repeat K≠0
getKey→K
End
det(1


I need help, desperately. Sad

"You're TRASH" is because this is for cubing, and if you pass 1 hour, you're definitely in need of help. (You shouldn't pass the one min mark for 3x3)
jcgter777 wrote:
I'm trying to get around the fact that ICE doesn't allow decimals, so i made this crude sort of thing, but it doesn't work as well as I want. It flashes really bad, but it sort of works. The google drive link is here, and the SourceCoder3 link is here.

My stupid code here: (I don't know if it's the same as the links. The links are the more updated versions if they're different)

Code:
[i]AICETIME
det(0

det(21,0
det(74,1,2
0→M
0→S
0→H

det(18,":",20,80
det(18,":",60,80

Lbl MILLI
Repeat K≠0

det(19,50,80
det(16,H,2
H+1→H
If H≥99
0→H
Goto SECONDS
getKey→K



Lbl SECONDS


det(19,30,80
det(16,S,2
S+1→S
Goto MILLI
If S≥59
0→S
Goto MINUTES



Lbl MINUTES


det(19,10,80
det(16,M,2
M+1→M

Goto SECONDS




If M≥60
det(18,"You're TRASH!",1,1



Repeat K≠0
getKey→K
End
det(1


I need help, desperately. Sad

"You're TRASH" is because this is for cubing, and if you pass 1 hour, you're definitely in need of help. (You shouldn't pass the one min mark for 3x3)

Try this:

Code:

[i]AICETIME
det(0
det(74,1,2
0→T
det(2,255
Lbl LOOP
det(36,1,1,320,20
det(19,1,1
det(16,T/36000,2
det(17,"h:"
det(16,remainder(T,3600)/600,2
det(17,"m:"
det(16,remainder(remainder(T,36000),600)/10,2
det(17,"s:"
det(16,remainder(remainder(remainder(T,36000),600),10),1
det(17,"ms"
For(X,0,9
getkey→K
Pause 10
End
T+1→T
If K≠9
Goto LOOP
End
Repeat K
getkey→K
End
If K≠15
Goto LOOP
End
det(1

This code will count in milliseconds semi-reliably by getting the 10s (in this case seconds), and 600s (minutes), and 3600s (hours)
you can use any number as multiples, like with 3-byte integers, where the first byte is worth 256 times the second, and that 256 times the third, then just split them up again using remainder and divide, like the shown code.
The "correct" and accurate way to do this would be to do something like this:

(pseudocode)

Code:

ReadMemoryAddress(F20000) -> A
While running:
     ReadMemoryAddress(F20000) - A -> B
     Disp "Seconds Elapsed Since start: ", B*1000/32768
     Disp "Seconds Elapsed Since start: ", B/32768
     Disp "Hours Elapsed Since start: ", B/32768/60

At least this is what http://wikiti.brandonw.net/index.php?title=84PCE:Ports:7000 suggests.
One question: is ReadMemoryAddress(F20000) recognized by ICE or SC3/any other editor?
c4ooo wrote:
The "correct" and accurate way to do this would be to do something like this:

(pseudocode)

Code:

ReadMemoryAddress(F20000) -> A
While running:
     ReadMemoryAddress(F20000) - A -> B
     Disp "Seconds Elapsed Since start: ", B*1000/32768
     Disp "Seconds Elapsed Since start: ", B/32768
     Disp "Hours Elapsed Since start: ", B/32768/60

At least this is what http://wikiti.brandonw.net/index.php?title=84PCE:Ports:7000 suggests.

Oh yeah! I forgot about that!
Insert this instead of Pause:

Code:

{[E]F20000}-INIT→T

where INIT is this:

Code:

{[E]F20000}→INIT

Also: {} reads ANY byte from memory, using the adress inside.
[E] is the small E
Just wait until the next release is out, then you can do this:

Code:
startTmr->TIMER
While 1
checkTmr(TIMER->CURTIME
Disp "MINUTES: ",remainder(CURTIME/32768/60,60)
Disp "SECONDS: ",remainder(CURTIME/32768,60)
Disp "MILLISECONDS: ",remainder(CURTIME*1000/32768,1000)
End
PT_: I figured out how to do it, but it sort of flashes a lot. Can you see if there are problems that can be easily fixed? The code up there isn't updated. I'll post my "good code" up ASAP.
so you going to make a method to wrap a simple memory read? >_>
I forgot to mention that I shaved off like 300 bytes in the second version. The SC3 link is here.

Code:

Code:
[i]AAAAAAA
Begin
0->M->S
0->K
Repeat K!=0
   FillScreen(255
   Lbl START
   getKey->K
   PrintStringXY(":",75,80
   SetTextXY(90,80
   PrintUInt(M,2
   SetTextXY(50,80
   PrintUInt(S,3
   If M<99
      1+M->M
      Pause 2
      If M>=99
         0->M
         1+S->S
         Goto START
         getKey->K
      End
      If K!=0
            det(1
There are severe issues with program flow:
1)

Code:
      If M<99
      1+M->M
      Pause 2
      If M>=99
         0->M

First of all the M<99 is pointless, M is going to always be less then 99, becouse if it is equal to 99 it gets set back to zero. Remove the "If M<99" and change the "M>=99" to a "M=99". Second unless you want it go 97..98..0. You need to compare to 100 not 99, so change it to "M=100"
2)

Code:
      If K!=0
         Repeat K!=0
            getKey->K
            det(1

Assuming ICE's repeat act the same as basic's, this code literally means "if a key is down, execute "getKey->K:det(1" until a key is down. But since a key needs to be down in order for the repeat loop to be ran in the first place, its going to exit without even running the "getKey->K:det(1".
3)
Why do you have a Goto Start? I assume its to skip the "FillScreen(255", when its not necessary to re-fill the background, but dont you *want* to redraw the background when M goes back down to 0? And not redraw the background when M is simply incremented and the new value will draw over the old? Also the "getKey->K" after the goto is useless, since that code will never be ran...
4) There are 1000 milliseconds in a seconds, not 100, if that is relevant.
c4ooo wrote:
so you going to make a method to wrap a simple memory read? >_>

Not at all. You need to setup the timer with the correct bits which might be complicated for most users, so that's why I think that startTmr and checkTmr might be useful.
I got the timer to work for me, but getting it to start when I want is the challenge. How do I let someone hold down a key until the screen says "READY", and start the timer when he lets go?
It's not that hard at all.

Code:
While getKey(X)
   Repeat READY
     ...
   End
End
startTmr->TIME
EDIT:
This works completely fine for me right now, but I've had to fix many bugs over the course of the day. If you have any ways to shorten the code or make it more efficient, please tell me. You can also tell me how to make it look better, or you could do it yourself.





My code:
SourceCoder3 Link


TI-Connect CE Code (on calc):


Code:
[i]AAAAAAA
det(0
det(5,224
det(74,1,1
Lbl HOME
det(5,224
det(74,1,2
det(18,"CubeTimerCE",90,30
det(74,1,1
det(18,"By:Joshua C.",90,60
Lbl CREDITS
det(74,1,2
det(18,"Thanks to:",18,100
det(74,1,1
det(18,"-SM84CE for making the menu",18,130
det(18,"-PT_ for ICE Compiler and help with stuff",18,140
det(18,"-MateoC for the C Libs",18,150
det(18,"-APotato for his timer",18,160



Pause 500
det(18,"Press [enter] to continue.",20,200
Pause

Lbl HOMEMENU
ClrHome
det(74,1,1
det(18,"MENU:",20,70
Pause 100

225→C
1→Q
100→Y
det(21,C
det(18,"> Continue",25,100
det(21,Q
det(18,"> Quit",25,130
0→K
Repeat K=9 or K=54
det(21,C
det(18,"> Continue",25,100
det(21,Q
det(18,"> Quit",25,130
getKey→K
If K=9 or K=54
225→C
0→Q
End
If K=1
130→Y
0→C
225→Q
End
If K=4
100→Y
225→C
0→Q
End
End

If Y=100
Goto TIMER
End
If Y=130
det(1
Return
ClrHome
End

Lbl TIMER
det(5,224
det(74,1,1
det(21,0
det(18,"Hold [enter] and release when READY comes up.",4,10
Lbl KLOOP
Repeat K
getKey→K
If K=9
Lbl PAUSE
End
If K≠9
Goto KLOOP
End
Lbl PAUSE
Lbl CHECK
Repeat K
getKey→K
If K=9
Goto READY
End
If K≠9
Goto CHECK
End
Lbl READY
Pause 700
det(5,135
While getKey(9)
det(74,2,2
det(18,"READY!",100,100
End
det(74,1,1
0→M→S
Repeat K≠0
det(5,224
Lbl START
getKey→K

det(18,":",75,80
det(19,80,80
det(16,M,2
det(19,50,80
det(16,S,3
If M<99
1+M→M
Pause 3
If M≥99
0→M
1+S→S
Goto START
getKey→K
End
If K≠0
det(5,83
det(18,"Your time was:",20,20
det(19,80,40
det(16,S,3
det(18,":",105,40
det(19,110,40
det(16,M,2

det(18,"Press [enter] to go to the homescreen.",20,180
det(18,"Press [mode] to exit.",20,200
det(18,"Press [2nd] to go to timer.",20,220
Lbl KCHECK
Repeat K≠0
getKey→K
If K=55
det(1
Return
End
If K=9
Goto HOME
End

If K=54
Goto TIMER
End

If K≠54 or K≠55 or K≠9
Goto KCHECK
End







ICE Language Code (from SourceCoder3):


Code:
[i]AAAAAAA
Begin
FillScreen(224
SetTextScale(1,1
Lbl HOME
FillScreen(224
SetTextScale(1,2
PrintStringXY("C|u[|b][|e]Time[r]CE",90,30
SetTextScale(1,1
PrintStringXY("By:Jo[s]h|u[|a] C.",90,60
Lbl CREDITS
SetTextScale(1,2
PrintStringXY("Thanks to:",18,100
SetTextScale(1,1
PrintStringXY("-SM84CE for making the menu",18,130
PrintStringXY("-PT_ for ICE Com[p]iler and help with stuff",18,140
PrintStringXY("-MateoC for the C Libs",18,150
PrintStringXY("-APotato for his timer",18,160



Pause 500
PrintStringXY("P[r][|e][s][s] [[|e][n][t][|e][r]] [t]o [|c]o[n][t]i[n]|u[|e].",20,200
Pause

Lbl HOMEMENU
ClrHome
SetTextScale(1,1
PrintStringXY("MENU:",20,70
Pause 100

225->C
1->Q
100->Y
SetTextFGColor(C
PrintStringXY("> Continue",25,100
SetTextFGColor(Q
PrintStringXY("> Quit",25,130
0->K
Repeat K=9 or K=54
   SetTextFGColor(C
   PrintStringXY("> Continue",25,100
   SetTextFGColor(Q
   PrintStringXY("> Quit",25,130
   getKey->K
   If K=9 or K=54
      225->C
      0->Q
   End
   If K=1
      130->Y
      0->C
      225->Q
   End
   If K=4
      100->Y
      225->C
      0->Q
   End
End

If Y=100
   Goto TIMER
End
If Y=130
   det(1
   Return
   ClrHome
End

Lbl TIMER
FillScreen(224
SetTextScale(1,1
SetTextFGColor(0
PrintStringXY("Hol[|d] [[|e][n][t][|e][r]] and [r][|e]l[|e][|a][s][|e] |wh[|e][n] READY [|c]om[|e][s] |u[p].",4,10
Lbl KLOOP
Repeat K
   getKey->K
   If K=9
      Lbl PAUSE
   End
   If K!=9
      Goto KLOOP
   End
   Lbl PAUSE
   Lbl CHECK
   Repeat K
      getKey->K
      If K=9
         Goto READY
      End
      If K!=9
         Goto CHECK
      End
      Lbl READY
      Pause 700
      FillScreen(135
      While getKey(9)
         SetTextScale(2,2
         PrintStringXY("READY!",100,100
      End
      SetTextScale(1,1
      0->M->S
      Repeat K!=0
         FillScreen(224
         Lbl START
         getKey->K
         
         PrintStringXY(":",75,80
         SetTextXY(80,80
         PrintUInt(M,2
         SetTextXY(50,80
         PrintUInt(S,3
         If M<99
            1+M->M
            Pause 3
            If M>=99
               0->M
               1+S->S
               Goto START
               getKey->K
            End
            If K!=0
               FillScreen(83
               PrintStringXY("Yo|u[r] [t]im[|e] |w[|a][s]:",20,20
               SetTextXY(80,40
               PrintUInt(S,3
               PrintStringXY(":",105,40
               SetTextXY(110,40
               PrintUInt(M,2
               
               PrintStringXY("P[r][|e][s][s] [[|e][n][t][|e][r]] [t]o go [t]o [t]h[|e] hom[|e][s][|c][r][|e][|e][n].",20,180
               PrintStringXY("P[r][|e][s][s] [mo[|d][|e]] [t]o [|e]xi[t].",20,200
               PrintStringXY("P[r][|e][s][s] [2[n][|d]] [t]o go [t]o [t]im[|e][r].",20,220
               Lbl KCHECK
               Repeat K!=0
                  getKey->K
                  If K=55
                     det(1
                     Return
                  End
                  If K=9
                     Goto HOME
                  End
                  
                  If K=54
                     Goto TIMER
                  End
                  
                  If K!=54 or K!=55 or K!=9
                     Goto KCHECK
                  End
Right now, the only problem I have is that if I press enter, it waits, but then it jumps to the timer. How do I fix that?
jcgter777 wrote:
Right now, the only problem I have is that if I press enter, it waits, but then it jumps to the timer. How do I fix that?


Code:

1→B→T
Lbl KL
getKey→Q
B and (Q=K→B
Pause 10
T+1→B and (T≤70→B
Q→K
If B
Goto KL
End

EDIT: not related to quote
So I'd have to do something like:

SourceCoder3 Code





Code:
[i]AAAAAAAA
Begin
FillScreen(224
SetTextScale(1,1
Lbl HOME
FillScreen(224
SetTextScale(1,2
PrintStringXY("C|u[|b][|e]Time[r]CE",100,30
SetTextScale(1,1
PrintStringXY("By:Jo[s]h|u[|a] C.",100,60
Lbl CRedITS
SetTextScale(1,2
PrintStringXY("Th[|a][n]k[s] [t]o:",18,100
SetTextScale(1,1
PrintStringXY("-SM84CE fo[r] m[|a]ki[n]g [t]h[|e] m[|e][n]|u",18,130
PrintStringXY("-PT_ fo[r] ICE Com[p]il[|e][r] and h[|e]l[p] |wi[t]h [s][t]|uff",18,140
PrintStringXY("-M[|a][t][|e]oC fo[r] [t]h[|e] C Li[|b][s]",18,150
PrintStringXY("-APo[t][|a][t]o fo[r] hi[s] [t]im[|e][r]",18,160

Pause 300
PrintStringXY("P[r][|e][s][s] [[|e][n][t][|e][r]] [t]o [|c]o[n][t]i[n]|u[|e].",20,200
Pause

Lbl HOMEMENU
FillScreen(224
SetTextScale(1,2
PrintStringXY("C|u[|b][|e]Time[r]CE",100,30
SetTextScale(1,1
ClrHome
PrintStringXY("MENU:",20,70
Pause 100

225->C
1->Q
100->Y
SetTextFGColor(C
PrintStringXY("> Co[n][t]i[n]|u[|e]",25,100
SetTextFGColor(Q
PrintStringXY("> Q|ui[t]",25,130
0->K
Repeat K=9 or K=54
   SetTextFGColor(C
   PrintStringXY("> Co[n][t]i[n]|u[|e]",25,100
   SetTextFGColor(Q
   PrintStringXY("> Q|ui[t]",25,130
   getKey->K
   If K=9 or K=54
      225->C
      0->Q
   End
   If K=1
      130->Y
      0->C
      225->Q
   End
   If K=4
      100->Y
      225->C
      0->Q
   End
End

If Y=100
   Goto TIMER
End
If Y=130
   det(1
   Return
   ClrHome
End

Lbl TIMER
FillScreen(225
SetTextScale(1,1
SetTextFGColor(0
PrintStringXY("Hol[|d] [[|e][n][t][|e][r]] and [r][|e]l[|e][|a][s][|e] |wh[|e][n] READY [|c]om[|e][s] |u[p].",4,30

Lbl PAUSE
0->Q
Repeat K
   getKey->K
End
If K=9
   1->Q
End
If K!=9
   2->Q
End
If Q=2
   Goto TIMER
End
If Q=1
   Goto WHILE
End
Lbl WHILE
Pause 700
While getKey(9)
   FillScreen(135
   SetTextScale(2,2
   PrintStringXY("READY!!",100,100
End
SetTextScale(1,1
0->M->S
Repeat K!=0
   FillScreen(224
   Lbl START
   getKey->K
   
   PrintStringXY(":",75,80
   SetTextXY(80,80
   PrintUInt(M,2
   SetTextXY(50,80
   PrintUInt(S,3
   If M<99
      1+M->M
      Pause 3
      If M>=99
         0->M
         1+S->S
         Goto START
         getKey->K
      End
      If K!=0
         FillScreen(63
         PrintStringXY("Yo|u[r] [t]im[|e] |w[|a][s]:",20,20
         SetTextXY(80,40
         PrintUInt(S,3
         PrintStringXY(":",105,40
         SetTextXY(110,40
         PrintUInt(M,2
         
         PrintStringXY("P[r][|e][s][s] [[|e][n][t][|e][r]] [t]o go [t]o [t]h[|e] hom[|e][s][|c][r][|e][|e][n].",20,180
         PrintStringXY("P[r][|e][s][s] [mo[|d][|e]] [t]o [|e]xi[t].",20,200
         PrintStringXY("P[r][|e][s][s] [2[n][|d]] [t]o go [t]o [t]im[|e][r].",20,220
         Lbl KCHECK
         Repeat K!=0
            getKey->K
            If K=55
               det(1
               Return
            End
            If K=9
               Goto HOME
            End
            
            If K=54
               Goto TIMER
            End
            
            If K!=54 or K!=55 or K!=9
               Goto KCHECK
            End



TI-Connect CE Code


Code:
[i]AAAAAAAA
det(0
det(5,224
det(74,1,1
Lbl HOME
det(5,224
det(74,1,2
det(18,"CubeTimerCE",100,30
det(74,1,1
det(18,"By:Joshua C.",100,60
Lbl CREDITS
det(74,1,2
det(18,"Thanks to:",18,100
det(74,1,1
det(18,"-SM84CE for making the menu",18,130
det(18,"-PT_ for ICE Compiler and help with stuff",18,140
det(18,"-MateoC for the C Libs",18,150
det(18,"-APotato for his timer",18,160

Pause 300
det(18,"Press [enter] to continue.",20,200
Pause

Lbl HOMEMENU
det(5,224
det(74,1,2
det(18,"CubeTimerCE",100,30
det(74,1,1
ClrHome
det(18,"MENU:",20,70
Pause 100

225→C
1→Q
100→Y
det(21,C
det(18,"> Continue",25,100
det(21,Q
det(18,"> Quit",25,130
0→K
Repeat K=9 or K=54
det(21,C
det(18,"> Continue",25,100
det(21,Q
det(18,"> Quit",25,130
getKey→K
If K=9 or K=54
225→C
0→Q
End
If K=1
130→Y
0→C
225→Q
End
If K=4
100→Y
225→C
0→Q
End
End

If Y=100
Goto TIMER
End
If Y=130
det(1
Return
ClrHome
End

Lbl TIMER
det(5,225
det(74,1,1
det(21,0
det(18,"Hold [enter] and release when READY comes up.",4,30

Lbl PAUSE
0→Q
Repeat K
getKey→K
End
If K=9
1→Q
End
If K≠9
2→Q
End
If Q=2
Goto TIMER
End
If Q=1
Goto WHILE
End
Lbl WHILE
Pause 700
While getKey(9)
det(5,135
det(74,2,2
det(18,"READY!!",100,100
End
det(74,1,1
0→M→S
Repeat K≠0
det(5,224
Lbl START
getKey→K

det(18,":",75,80
det(19,80,80
det(16,M,2
det(19,50,80
det(16,S,3
If M<99
1+M→M
Pause 3
If M≥99
0→M
1+S→S
Goto START
getKey→K
End
If K≠0
det(5,63
det(18,"Your time was:",20,20
det(19,80,40
det(16,S,3
det(18,":",105,40
det(19,110,40
det(16,M,2

det(18,"Press [enter] to go to the homescreen.",20,180
det(18,"Press [mode] to exit.",20,200
det(18,"Press [2nd] to go to timer.",20,220
Lbl KCHECK
Repeat K≠0
getKey→K
If K=55
det(1
Return
End
If K=9
Goto HOME
End

If K=54
Goto TIMER
End

If K≠54 or K≠55 or K≠9
Goto KCHECK
End
I made a GitHub repository so you can edit it and I can see what's different.
Does ICE support the Degrees'Minutes'Seconds angle format, becuase if it does, I think that would be an easy was to make a timer/stopwatch.
Legoman413: PLEASE change your avatar picture. It makes me dizzy, in addition to messing up the whole page.

PT_ did make 2 new commands. startTmr and checkTmr.


EDIT: your avatar pic only messes that up for me because I'm on CemetechRetro Razz
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 2
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement