My rendition based on the screenshot:

Code:
FnOff
ClrDraw
GridOff
AxesOff
PlotsOff
0→Xmin:14‾¹→ΔX
0→Ymin:8‾¹→ΔY
For(X,‾Ans,7
Horizontal X
Line(X,0,X,6.7
End
getDate→L1
Ans(2→T
Text(0,0,sub("January░░February░March░░░░April░░░░May░░░░░░June░░░░░...
...July░░░░░August░░░SeptemberOctober░░November░December░",9Ans-8,9
Text(0,79,max(L1
For(X,0,6
Text(8,14X+(X=5),sub("SunMonTueWedThuFriSat",3X+1,3
End
6+dayOfWk(L1(1),Ans,1→U
For(X,1,30+not(T≠2 or fPart(L1(1)/4))-2((T=2)-fPart(.5(T+(T>7
8+8int(Ans/7→V
4+round(98fPart(U/7
Text(V,Ans-2(X>9),X
If X=L1(3
Then
For(A,V,V+6
For(B,max(0,Ans-5),min(94,Ans+7
Pxl-Change(A,B
End
End
End
U+1→U
End

From leap years to knuckle measurements – it's all in there.
I think just for Weregoose (and others) I need to make the DCS BASIC library hook convert IS>( and DS<( to increment/decrement. Smile Also, I love your delightful For() loop bounds.
Wow, amazing speed improvement! I just got rid of about half of the code from the calendar program and added a nice formula for my text display resulting in an increased speed of calculating/displaying by 75%, which is about 10 seconds to 2.5 seconds according to my time trials. As I stated before, the emulator slows it down, and it is slightly faster on a real calculator.

Anyways, here is the new speed improvement with the old program next to the screenie in comparison.

Old program


New faster program
Here is the source code that I used for my calendar. If you find any mistakes or have any ideas on how I can make it better, please post your code. Thanks!


Code:
:DelVar ZDelVar ODelVar P
:Lbl 1
:ClrHome
:Input "Month:",B
:iPart(B)→B
:If B>12 or B<0
:Goto 1
:If B=0
:Goto 2
:Lbl 4
:Input "Year:",A
:iPart(A)→A
:If A<1
:Goto 4
:Lbl 3
:{31,28,31,30,31,30,31,31,30,31,30,31}→{L1}
:If fPart(A/4)=0
:29→{L1}(2)
:If fPart(A/100)=0
:28→{L1}(2)
:If fPart(A/400)=0
:29→{L1}(2)
:AxesOff
:ClrDraw
:RecallPic 4
:If B=1
:Then
:"January"→Str1
:{L1}(1)→F
:End
:If B=2
:Then
:"February"→Str1
:{L1}(2)→F
:End
:If B=3
:Then
:"March"→Str1
:{L1}(3)→F
:End
:If B=4
:Then
:"April"→Str1
:{L1}(4)→F
:End
:If B=5
:Then
:"May"→Str1
:{L1}(5)→F
:End
:If B=6
:Then
:"June"→Str1
:{L1}(6)→F
:End
:If B=7
:Then
:"July"→Str1
:{L1}(7)→F
:End
:If B=8
:Then
:"August"→Str1
:{L1}(8)→F
:End
:If B=9
:Then
:"September"→Str1
:{L1}(9)→F
:End
:If B=10
:Then
:"October"→Str1
:{L1}(10)→F
:End
:If B=11
:Then
:"November"→Str1
:{L1}(11)→F
:End
:If B=12
:Then
:"December"→Str1
:{L1}(12)→F
:End
:Text(0,15,Str1)
:Text(0,56,A)
:For(E,1,F,1)
:dayOfWk(A,B,E)→D
:If D=7
:1+O→O
:If D=1 and O>0
:1+P→P
:P→Y
:D→X
:16+(8*Y)→K
:6+(13*X-13)→L
:Text(K,L,E)
:End
:Pause
:ClrHome
:Return
:Lbl 2
:getDate→{L2}
:{L2}(1)→A
:{L2}(2)→B
:Goto 3
An optimization:


Code:
:If B=1
:Then
:"January"→Str1
:{L1}(1)→F
:End
:If B=2
:Then
:"February"→Str1
:{L1}(2)→F
:End
:If B=3
:Then
:"March"→Str1
:{L1}(3)→F
:End
:If B=4
:Then
:"April"→Str1
:{L1}(4)→F
:End
:If B=5
:Then
:"May"→Str1
:{L1}(5)→F
:End
:If B=6
:Then
:"June"→Str1
:{L1}(6)→F
:End
:If B=7
:Then
:"July"→Str1
:{L1}(7)→F
:End
:If B=8
:Then
:"August"→Str1
:{L1}(8)→F
:End
:If B=9
:Then
:"September"→Str1
:{L1}(9)→F
:End
:If B=10
:Then
:"October"→Str1
:{L1}(10)→F
:End
:If B=11
:Then
:"November"→Str1
:{L1}(11)→F
:End
:If B=12
:Then
:"December"→Str1
:{L1}(12)→F
:End
to
Code:
:sub("January  February March    April    May      June     July     August   SeptemberOctober  November December ",9B-8,9→Str1
:{L1}(B→F
(make sure you get the spaces correct_
Wow, thanks Kerm. That was a really great memory saving solution. Now the total size of my program is 548 bytes excluding the pic. Now that I have the speed optimized to a satisfactory rate, I need to implement the inverting pixels for the current date...
kpa4941 wrote:
Wow, thanks Kerm. That was a really great memory saving solution. Now the total size of my program is 548 bytes excluding the pic. Now that I have the speed optimized to a satisfactory rate, I need to implement the inverting pixels for the current date...
Thanks; that technique can be applied to a lot of situations where you need to turn a number into one of several corresponding strings. Hopefully the inversion process makes sense to you now.
Well, the inversion process makes sense, but I still don't know how to put it to use. I think that I have an idea, but I have never done something with inverted pixels before and it will most likely be very messy coding with a lot of if conditional statements.

Sorry for being so slow with the current date inversions, but I am still stuck at the drawing board of how to actually do it. I understand the concept, but I don't really know where to start with the coding. It would be nice to have a foundation or something to look off of for ideas. If anyone has any code that they would like to share, it would be very helpful.
Well, as we were saying earlier, you need to invert a rectangular area, which means iterating between two X values and two Y values in a nested loop, as I showed you. All you have to do is pick the X and Y values (as I said, similar to the Text() coordinates except with a few pixels' offset), and add a conditional to only invert the day that is equal to today. Should be exactly seven lines of code if done correctly.
Wow, I never updated my status with the Calendar program.

Well better late then never, I have now implemented a current date indicator.

The program now boxes the current date instead of the inverted pixels. I know what all of y'all were trying to say but I didn't really know how to do it. The program still indicates the current date nevertheless.

Here is a youtube video of the calendar now.
  
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 2 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