Log inRegister an accountBrowse CSDbHelp & documentationFacts & StatisticsThe forumsAvailable RSS-feeds on CSDbSupport CSDb Commodore 64 Scene Database
  You are not logged in - nap
Sun Position Calculator   [2020]

Sun Position Calculator Released by :
Hokuto Force [web]

Release Date :
28 April 2020

Type :
C64 Tool

Sun Calculator - create a graphical sun diagram like on your Apple Watch

User rating:awaiting 8 votes (5 left)   See votestatistics

Credits :
Code .... Bytebreaker of Hokuto Force
Design .... Bytebreaker of Hokuto Force
Idea .... Bytebreaker of Hokuto Force

Download :

Look for downloads on external sites:

User Comment
Submitted by polluks on 3 May 2020
FYI the new vbcc6502 also supports FP.
User Comment
Submitted by Bytebreaker on 29 April 2020
Thanks all for your kind feedback. :-)

@ wil
I just saw that Basic Boss supports a data type called REAL. For the future I will take this into account. Somehow I was convinced that BASIC V2 floats cannot be compiled, that‘s why I worked with integers only when using Austro Speed back in the day.
User Comment
Submitted by wil on 29 April 2020
Awesome! I like it when such "serious" applications for science and business are done with BASIC. I think this is like what Commodore had it mind when they designed computers such as the Plus4 or C128. The speed of your program is fine for me, but since you mention it: there are BASIC compilers that handle floating point well, for example Austro-Speed or Basic Boss.
User Comment
Submitted by Pushead on 28 April 2020
Very impressive! Nice work! Tested with values for northern Norway in summertime - when the sun doesn't set:-)!
User Comment
Submitted by Didi on 28 April 2020
Nice work. Had fun trying it.
User Comment
Submitted by TheRyk on 28 April 2020
wonderful and just in time, was just going to buy me a smart watch, now I'll definetely never need one!
User Comment
Submitted by Bytebreaker on 28 April 2020
Hello there,

on my apple watch there is a display showing a sun diagram as a curve with a bright spot moving along the curve, showing the sun height at the given time and also sunrise, true noon and sunset. I liked this so much that I decided to code a C64 version of this.

The height of the sun and also the direction (=azimuth) is given in degrees, i.e. the sun is at noon at ca. 60 degrees height and heading south at ca 180 degrees.

How to use:
- Autostart the .d64 (i.e. via drag 'n drop into VICE) or typee load"$",8,1 (press Enter) and run (press Enter)
- Find out the geo coordinates (latitude and longitude) of the place for which you want to calculate a sun diagram (in the application, the coordinates for Pforzheim/Germany are pre-set as an example)
- Find out your UTC timezone (pre-set in the application is +2 (=+1 for Germany +1 for summertime = +2)
- Enter the date, coordinates and UTC zone for which you want the diagram to be calculated
- If you do not want a graphical diagram and only to know the sun key data (sunrise, true noon, sunset), you can choose so and the program quits after displaying this information
- If you choose to see the diagram, you can control the sun position hour-wise with your joystick, key markers are placed as little sun symbols on the curve

Additional remarks:
- Please do not expect this to run extremely fast, it is a BASIC program with some machine language support for the graphics. I need BASIC because of the floating point math and since there is no BASIC compiler that handles floats, we have to cope with the speed there is (use Alt-W in VICE to speed up)
- The calculation for sunrise, true noon and sunset is less precise than the calculation of the sun curve, since I use a simplified algorithm for the sun key data - that's why sunrise and sunset can be at heights slightly below 0 degrees - all in all, the results are very close to comparisons with sun calculators in mobile apps and on websites - the C64 calculates the same results as in my corresponding open office calc sheet (you find it attached in the package), so i am quite satisfied how precise our old C64 works.

Sources used:
For sun position calculation: https://de.wikipedia.org/wiki/Sonnenstand
For weekday calculation: https://de.wikipedia.org/wiki/Wochentagsberechnung
For sunrise and sunset calculation: https://lexikon.astronomie.info/zeitgleichung/
Search CSDb
Prev - Random - Next
Detailed Info
· Summaries
· User Comments (7)
· Production Notes
Fun Stuff
· Goofs
· Hidden Parts
· Trivia
· Discuss this release
Support CSDb
Help keep CSDb running:

Funding status:

About this site:
CSDb (Commodore 64 Scene Database) is a website which goal is to gather as much information and material about the scene around the commodore 64 computer - the worlds most popular home computer throughout time. Here you can find almost anything which was ever made for the commodore 64, and more is being added every day. As this website is scene related, you can mostly find demos, music and graphics made by the people who made the scene (the sceners), but you can also find a lot of the old classic games here. Try out the search box in the top right corner, or check out the CSDb main page for the latest additions.
Home - Disclaimer
Copyright © No Name 2001-2023
Page generated in: 0.096 sec.