'Something is wrong with weekday variable, it goes into the negative when 6 "weeks" are needed on the loop.
start:
dd = 0
leap = 0
PRINT " Monthly Calendar Maker" PRINT "This program will make a calendar for the year and month you want." PRINT "It will also name the U.S. Federal Holidays on their days." INPUT "Type the year here: ", y
again2:
INPUT "Type the month here: ", m
IF m
= 1 THEN month$
= " January" IF m
= 2 THEN month$
= "February" IF m
= 3 THEN month$
= " March" IF m
= 4 THEN month$
= " April" IF m
= 6 THEN month$
= " June" IF m
= 7 THEN month$
= " July" IF m
= 8 THEN month$
= " August" IF m
= 9 THEN month$
= "September" IF m
= 10 THEN month$
= " October" IF m
= 11 THEN month$
= "November" IF m
= 12 THEN month$
= "December"
'Calculate to see if it's a Leap Year.
more:
nex:
weekday:
k = 1
mm = m
yy = y
GetDay mm, dd, y, weekday
'This section makes the calendar.
make:
w = (weekday * 13) + 8
dd = dd + 1
k = dd
GetDay mm, dd, y, weekday
w = 7
more2:
LOCATE 29, 1:
INPUT "Press Enter to go back to menu.", a$
'This section saves the calendar to a JPG file.
SaveImage 0, "screenshot" 'saves entire program screen as "screenshot.bmp"
weekdays:
'DO
' PRINT "(don't forget 0's, just enter to quit)"
'INPUT " Enter yyyy-mm-dd date format: "; yymmdd$
'yyyy = VAL(MID$(yymmdd$, 1, 4))
'mm = VAL(MID$(yymmdd$, 6, 2))
'dd = VAL(MID$(yymmdd$, 9, 2))
'PRINT GetDay$(mm, dd, yyyy)
'PRINT
'LOOP UNTIL yymmdd$ = ""
'RETURN
'Steve (SAM) function fix for Ken
SUB GetDay
(mm
, dd
, y
, weekday
) 'use 4 digit year 'From Zeller's congruence: https://en.wikipedia.org/wiki/Zeller%27s_congruence
IF mm
< 3 THEN mm
= mm
+ 12: y
= y
- 1 zerocentury = y \ 100
weekday
= (dd
+ INT(13 * (mm
+ 1) / 5) + century
+ INT(century
/ 4) + INT(zerocentury
/ 4) + 5 * zerocentury
) MOD 7 CASE 0: Day$
= "Saturday" CASE 4: Day$
= "Wednesday" CASE 5: Day$
= "Thursday"
IF bytesperpixel&
= 1 THEN bpp&
= 8 ELSE bpp&
= 24 b$
= "BM????QB64????" + MKL$(40) + MKL$(x&
) + MKL$(y&
) + MKI$(1) + MKI$(bpp&
) + MKL$(0) + "????" + STRING$(16, 0) 'partial BMP header info(???? to be filled later) FOR c&
= 0 TO 255 ' read BGR color settings from JPG image + 1 byte spacer(CHR$(0)) MID$(b$
, 11, 4) = MKL$(LEN(b$
)) ' image pixel data offset(BMP header) FOR py&
= y&
- 1 TO 0 STEP -1 ' read JPG image pixel color data r$ = ""
c&
= POINT(px&
, py&
) 'POINT 32 bit values are large LONG values d$ = d$ + r$ + padder$
MID$(b$
, 35, 4) = MKL$(LEN(d$
)) ' image size(BMP header) b$ = b$ + d$ ' total file data bytes to create file
MID$(b$
, 3, 4) = MKL$(LEN(b$
)) ' size of data file(BMP header)