home *** CD-ROM | disk | FTP | other *** search
/ ticalc.org / ticalc_org_rev_b.iso / archives / 82 / asm / source / crash / zcal.asm < prev   
Encoding:
Assembly Source File  |  2001-07-01  |  23.6 KB  |  758 lines

  1. ;ZCal 82 1.1
  2. ;By: Ahmed El-Helw
  3. ;Copyright (C) 1998
  4. ;ahmedre@bellsouth.net
  5. ;http://asm8x.home.ml.org
  6.  
  7. #INCLUDE "CRASH82.INC"         
  8. .DB "ZCal 82- By: ARE",0
  9.  
  10. string = TEXT_MEM
  11.  
  12. Init:
  13.     ld a,5                  ;4 into A [Wednesday]
  14.         ld (DayStart),a         ;Starting Day for Month  [The First was Wednesday]
  15.         ld a,2                  ;2 into A
  16.         ld (Leap),a             ;Leap Year = 5 [28 month Feb. this year, 1998]
  17.         ld a,28                 ;28 into A
  18.         ld (FebDays),a          ;A into FebDays
  19.         ld a,1                  ;Loads Month # into A 
  20.  
  21.         ld (Month),a            ;Loads A into Month      [Starting Month December]
  22.         ld hl,1998              ;Loads Year into HL
  23.         ld (Year),hl            ;Loads it into Year #
  24.         jr Start                ;Start!
  25.  
  26. Start:
  27.         ROM_CALL(CLEARLCD)
  28.     ld hl,0
  29.     ld (CURSOR_X),hl
  30.     ld hl,TitleString       ;TitleString into HL
  31.         ROM_CALL(D_ZM_STR)      ;Send to screen! [Large Text]   
  32.         set 3,(iy+$05)          ;Text is now white on black
  33.         ld de,8*256+0           ;Loads Coordinates
  34.         ld hl,BlankDay          ;String into HL
  35.         call PutText             ;Display it!
  36.         ld de,8*256+5           ;Loads Coordinates
  37.         ld hl,Satday            ;String into HL
  38.         call PutText            ;Display it!
  39.         ld de,8*256+15          ;Loads Coordinates
  40.         ld hl,Monday            ;String into HL
  41.         call PutText            ;Display it!
  42.         ld de,8*256+30          ;Loads Coordinates
  43.         ld hl,Thuesday          ;String into HL
  44.         call PutText            ;Display it!
  45.         ld de,8*256+45          ;Loads Coordinates
  46.         ld hl,Wednesday         ;String into HL
  47.         call PutText            ;Display it!
  48.         ld de,8*256+60          ;Loads Coordinates
  49.         ld hl,Thuesday          ;String into HL
  50.         call PutText            ;Display it!
  51.         ld de,8*256+75          ;Loads Coordinates
  52.         ld hl,Friday            ;String into HL
  53.         call PutText            ;Display it!
  54.         ld de,8*256+87          ;Loads Coordinates
  55.         ld hl,Satday            ;String into HL
  56.         call PutText            ;Display it!
  57.         res 3,(iy+$05)          ;Text is now black on white
  58.         jp PutCal
  59.  
  60. PutCal:                         ;Routine to Display Calander
  61.         call PutMonth           ;Routine to Display Month
  62.         ROM_CALL(D_ZM_STR)      ;Put the String on Screen
  63.         call PutYear            ;Display the Year
  64.         ld a,(DayStart)         ;Starting Day into A
  65.         ld (Spot),a             ;A into Spot
  66.         ld a,1                  ;Load 1 into a
  67.         ld (Day),a              ;Make Day  = 1
  68.         ld (Week),a             ;Make Week = 1
  69.         jr Loop                 ;Goto Loop
  70.  
  71. Loop:                           ;Loop to Display the Numbers
  72.         ld a,(Spot)             ;Spot into A
  73.         cp 1                    ;Is it 1?
  74.         jp z,DispSun            ;Goto Display Sunday
  75.         cp 2                    ;Is it 2?
  76.         jp z,DispMon            ;Display Monday
  77.         cp 3                    ;Is it 3?
  78.         jp z,DispTue            ;Display Tuesday
  79.         cp 4                    ;Is it 4?
  80.         jp z,DispWed            ;Display Wednesday
  81.         cp 5                    ;Is it 5?
  82.         jp z,DispThur           ;Display Thursday
  83.         cp 6                    ;Is it 6?
  84.         jp z,DispFri            ;Display Friday
  85.         cp 7                    ;Is it 7?
  86.         jp z,DispSat            ;Display Saturday
  87.         
  88. DispSun:
  89.         call CheckWeek          ;Checks week to set 
  90.         ld a,1                  ;1 into A
  91.         ld (CURSOR_X),a         ;A into Column
  92.         ld a,(Day)              ;Day into A
  93.         call DispA              ;Display A
  94.         jp CheckStatus          ;Checks Status of Days
  95.  
  96. DispMon:
  97.         call CheckWeek          ;Checks week to set 
  98.         ld a,15                 ;15 into A
  99.         ld (CURSOR_X),a         ;A into Column
  100.         ld a,(Day)              ;Day into A
  101.         call DispA              ;Display A
  102.         jp CheckStatus          ;Checks Status of Days
  103.  
  104. DispTue:
  105.         call CheckWeek          ;Checks week to set 
  106.         ld a,30                 ;30 into A
  107.         ld (CURSOR_X),a         ;A into Column
  108.         ld a,(Day)              ;Day into A
  109.         call DispA              ;Display A
  110.         jp CheckStatus          ;Checks Status of Days
  111.  
  112. DispWed:
  113.         call CheckWeek          ;Checks week to set 
  114.         ld a,45                 ;45 into A
  115.         ld (CURSOR_X),a         ;A into Column
  116.         ld a,(Day)              ;Day into A
  117.         call DispA              ;Display A
  118.         jp CheckStatus          ;Checks Status of Days
  119.  
  120. DispThur:
  121.         call CheckWeek          ;Checks week to set 
  122.         ld a,60                 ;60 into A
  123.         ld (CURSOR_X),a          ;A into Column
  124.         ld a,(Day)              ;Day into A
  125.         call DispA              ;Display A
  126.         jp CheckStatus          ;Checks Status of Days
  127.  
  128. DispFri:
  129.         call CheckWeek          ;Checks week to set 
  130.         ld a,75                 ;75 into A
  131.         ld (CURSOR_X),a          ;A into Column
  132.         ld a,(Day)              ;Day into A
  133.         call DispA              ;Display A
  134.         jp CheckStatus          ;Checks Status of Days
  135.  
  136. DispSat:
  137.         call CheckWeek          ;Checks week to set 
  138.         ld a,87                 ;87 into A
  139.         ld (CURSOR_X),a          ;A into Column
  140.         ld a,(Day)              ;Day into A
  141.         call DispA              ;Display A
  142.         jp CheckStatus          ;Checks Status of Days
  143.  
  144. CheckStatus:
  145.         ld a,(TotalDays)        ;Total Days into A
  146.         ld b,a
  147.         ld a,(Day)              ;Days into A
  148.     sub b
  149.     or a
  150.         jp z,GetKeyLoop         ;Goto GetKeyLoop if equal
  151.         jp ContinueLoop         ;Otherwise, Continue Loop
  152.  
  153. ContinueLoop:
  154.         ld a,(Day)              ;Day into A
  155.         inc a                   ;Increase A
  156.         ld (Day),a              ;Back into Day
  157.         ld a,(Spot)             ;Loads Spot into a
  158.         inc a                   ;Increase it
  159.         ld (Spot),a             ;A into Spot
  160.         cp 8                    ;Is it 8
  161.         jp z,NewWeek            ;Do a NewWeek   
  162.         jp Loop                 ;Redo Loop
  163.  
  164. NewWeek:
  165.         ld a,(Week)             ;Week into A
  166.         inc a                   ;Increase it
  167.         ld (Week),a             ;A back into Week
  168.         ld a,1                  ;1 into A [Sunday]
  169.         ld (Spot),a             ;A into Spot
  170.         jp Loop                 ;Return
  171.  
  172. GetKeyLoop:
  173.         halt                    ;Save Energy
  174.         call GET_KEY            ;Wait for a key
  175.         cp G_CLEAR              ;Is it Clear ?
  176.         ret z                    ;Return
  177.         cp G_RIGHT              ;Is it Right?
  178.         jp z,IncreaseMonth      ;Increase the Month!
  179.     cp G_LEFT    
  180.     jp z,DecreaseMonth
  181.         cp G_UP                 ;Is it Up?
  182.         jp z,IncreaseYear       ;Increase the Year
  183.         cp G_DOWN               ;Is it Down?
  184.         jp z,DecreaseYear       ;Decrease the Year
  185.         jp nz,GetKeyLoop        ;No Key?  Reloop!
  186.  
  187. IncreaseYear:
  188.         ld a,(DayStart)         ;Load DayStart into A
  189.         inc a                   ;Increase A
  190.         ld (DayStart),a         ;A into DayStart
  191.         cp 8                    ;Is it 8?
  192.         call z,ResetStart       ;Reset to Sunday!
  193.         ld hl,(Year)            ;Year into HL
  194.         inc hl                  ;Increase it
  195.         ld (Year),hl            ;HL back into Year
  196.         ld a,28                 ;Load 28 into A
  197.         ld (FebDays),a          ;Febuary Days as a
  198.         ld a,(Leap)             ;Leap into A
  199.         dec a                   ;Decrease it
  200.         ld (Leap),a             ;Load A into Leap
  201.         or a                    ;Is it 0 ?
  202.         call z,LeapYear         ;Call LeapYear
  203.     call ResetVars
  204.         jp Start
  205.  
  206. DecreaseYear:
  207.         ld a,(DayStart)         ;Load DayStart into A
  208.         dec a                   ;Decrease A
  209.         ld (DayStart),a         ;A into DayStart
  210.         cp 0                    ;Is it 0?
  211.         call z,ResetSaturday    ;Reset to Saturday!
  212.         ld hl,(Year)            ;Year into HL
  213.         dec hl                  ;Decrease it
  214.         ld (Year),hl            ;HL back into Year
  215.         ld a,28                 ;Load 28 into A
  216.         ld (FebDays),a          ;Febuary Days as a
  217.         ld a,(Leap)             ;Leap into A
  218.         inc a                   ;Increase it
  219.         ld (Leap),a             ;Load A into Leap
  220.         cp 8                    ;Is it 8 ?
  221.         call z,LeapYear         ;Call LeapYear
  222.         cp 4                    ;Is it 4?
  223.         call z,LeapYear         ;Call LeapYear
  224.     call ResetVars        
  225.         jp Start
  226.  
  227. IncreaseMonth:
  228.         ld a,(Spot)             ;Day Spot into A
  229.         inc a                   ;Increase
  230.         ld (DayStart),a         ;A into DayStart
  231.         cp 8                    ;Is it 8?
  232.         call z,ResetStart       ;Reset to Sunday!
  233.         ld a,(Month)            ;Month # into A
  234.         inc a                   ;Increase it
  235.         ld (Month),a            ;A into Month
  236.         cp 13                   ;Is it 13??
  237.         call z,NewYear          ;NewYear!
  238.     call ResetVars
  239.         jp Start                ;Goto Start! [Display it!]
  240.  
  241. ;-------------------------------
  242. ;|Routines to Decrease the Month
  243. ;-------------------------------
  244. DecreaseMonth:
  245.     ld a,(Month)        ;Checks the month.. if it is
  246.     cp 3            ;March, your going to Feb
  247.     jp z,GotoFeb        ;If it is a 31 day month, your going to a 30 day month..
  248.     cp 5
  249.     jp z,Goto30
  250.     cp 7
  251.     jp z,Goto30
  252.     cp 11
  253.     jp z,Goto30
  254.     cp 8            ;August and July are 30 days, so special loop for them..
  255.     jp z,GotoJul
  256.     cp 1            ;If it is January, your going to switch years, so another
  257.     jp z,GotoDec        ;special loop for that...
  258.     cp 2            ;If it is February, we are dealing with a random number of 
  259.     jp z,GotoJan        ;days, so a special loop for that as well...
  260.  
  261.     ld b,29            ;If not,then we are going to a 31 day month.. Loop 29x to get
  262. Dec3031Days:            ;to the beginning of the month...
  263.     ld a,(Spot)
  264.     dec a
  265.     ld (Spot),a
  266.     or a
  267.     call z,ResDecSat
  268.     djnz Dec3031Days
  269.  
  270.     ld b,31            ;Then loop 31x to get to the beginning of the previous month..
  271. Dec31Days:
  272.     ld a,(Spot)
  273.     dec a
  274.     ld (Spot),a
  275.     or a
  276.     call z,ResDecSat
  277.     djnz Dec31Days
  278.     ld a,(Spot)
  279.     ld (DayStart),a
  280.     ld a,(Month)
  281.     dec a
  282.     ld (Month),a
  283.     or a
  284.     call z,OldYear
  285.     call ResetVars
  286.     jp Start
  287.  
  288. ResDecSat:                ;If spot is 0, this means that
  289.     ld a,7                ;we are really on a Saturday..
  290.     ld (Spot),a            ;so we make it Saturday.
  291.     ret
  292.  
  293. Goto30:
  294.     ld b,30
  295. Dec3130Days:
  296.     ld a,(Spot)
  297.     dec a
  298.     ld (Spot),a
  299.     or a
  300.     call z,ResDecSat
  301.     djnz Dec3130Days
  302.  
  303.     ld b,30
  304. Dec30Days:
  305.     ld a,(Spot)
  306.     dec a
  307.     ld (Spot),a
  308.     or a
  309.     call z,ResDecSat
  310.     djnz Dec30Days
  311.  
  312.     ld a,(Spot)
  313.     ld (DayStart),a
  314.     ld a,(Month)
  315.     dec a
  316.     ld (Month),a
  317.     call ResetVars
  318.     jp Start
  319.  
  320. GotoFeb:
  321.     ld b,30
  322. DecMarDays:
  323.     ld a,(Spot)
  324.     dec a
  325.     ld (Spot),a
  326.     or a
  327.     call z,ResDecSat
  328.     djnz DecMarDays
  329.  
  330.     ld a,(FebDays)
  331.     ld b,a
  332.  
  333. DecFebDays:
  334.     ld a,(Spot)
  335.     dec a
  336.     ld (Spot),a
  337.     or a
  338.     call z,ResDecSat
  339.     djnz DecFebDays
  340.     ld a,(Spot)
  341.     ld (DayStart),a
  342.     ld a,(Month)
  343.     dec a
  344.     ld (Month),a
  345.     call ResetVars
  346.     jp Start
  347.  
  348. GotoJul:
  349.     ld b,31
  350. DecJulDays:
  351.     ld a,(Spot)
  352.     dec a
  353.     ld (Spot),a
  354.     or a
  355.     call z,ResDecSat
  356.     djnz DecJulDays
  357.  
  358.     ld a,31
  359.     ld b,a
  360.  
  361. JulDays:
  362.     ld a,(Spot)
  363.     dec a
  364.     ld (Spot),a
  365.     or a
  366.     call z,ResDecSat
  367.     djnz JulDays
  368.     ld a,(Spot)
  369.     inc a
  370.     ld (DayStart),a
  371.     ld a,(Month)
  372.     dec a
  373.     ld (Month),a
  374.     call ResetVars
  375.     jp Start
  376.  
  377. GotoDec:
  378.     ld b,30
  379. DecJanDays:
  380.     ld a,(Spot)
  381.     dec a
  382.     ld (Spot),a
  383.     or a
  384.     call z,ResDecSat
  385.     djnz DecJanDays
  386.  
  387.     ld b,31
  388. DecDecDays:
  389.     ld a,(Spot)
  390.     dec a
  391.     ld (Spot),a
  392.     or a
  393.     call z,ResDecSat
  394.     djnz DecDecDays
  395.     ld a,(Spot)
  396.     ld (DayStart),a
  397.     ld a,12
  398.     ld (Month),a
  399.     call OldYear
  400.     jp Start
  401.  
  402. GotoJan:
  403.     ld a,(FebDays)
  404.     ld b,a
  405. DecFDays:
  406.     ld a,(Spot)
  407.     dec a
  408.     ld (Spot),a
  409.     or a
  410.     call z,ResDecSat
  411.     djnz DecFDays
  412.  
  413.     ld b,31
  414.  
  415. DectoJanDays:
  416.     ld a,(Spot)
  417.     dec a
  418.     ld (Spot),a
  419.     or a
  420.     call z,ResDecSat
  421.     djnz DectoJanDays
  422.     ld a,(Spot)
  423.     inc a
  424.     ld (DayStart),a
  425.     ld a,(Month)
  426.     dec a
  427.     ld (Month),a
  428.     call ResetVars
  429.     jp Start
  430.  
  431. OldYear:
  432.     ld hl,(Year)
  433.     dec hl
  434.     ld (Year),hl
  435.         ld a,(Leap)             ;Leap into A
  436.         inc a                   ;Increase it
  437.         ld (Leap),a             ;Load A into Leap
  438.         cp 8                    ;Is it 8 ?
  439.         call z,LeapYear         ;Call LeapYear
  440.         cp 4                    ;Is it 4?
  441.         call z,LeapYear         ;Call LeapYear
  442.     ret
  443.  
  444. ResetStart:
  445.         ld a,1                  ;Loads 1 into A
  446.         ld (DayStart),a         ;A into DayStart [Sunday]
  447.         ret                     ;Return
  448.  
  449. ResetSaturday:
  450.         ld a,7                  ;Loads 7 into A
  451.         ld (DayStart),a         ;A into DayStart [Saturday]
  452.         ret                     ;Return
  453.  
  454. NewYear:
  455.         ld a,1                  ;Loads 1 into A
  456.         ld (Month),a            ;A into Month [January]
  457.         ld hl,(Year)            ;Year into HL
  458.         inc hl                  ;Increase it
  459.         ld (Year),hl            ;HL into Year
  460.         ld a,(Leap)             ;Leap into A
  461.         dec a                   ;Decrease it
  462.         ld (Leap),a             ;Back into Leap
  463.         cp 0                    ;Is it 0?
  464.         jp z,LeapYear           ;LeapYear it is
  465.         ld a,28                 ;Loads 28 into A
  466.         ld (FebDays),a          ;A into FebDays
  467.         ret                     ;return
  468.  
  469. LeapYear:            ;Loop to find out if the year is 100x
  470.     ld hl,(Year)        ;Loads Year into HL
  471.     ld (TestYear),hl    ;Loads HL into TestYear
  472.     ld b,60            ;Loads 10 into b, starting a loop...
  473.  
  474. LeapLoop:
  475.     ld hl,(TestYear)    ;Load the Test Year into HL
  476.     ld de,0            ;We want to check if it is 0
  477.        call CP_HL_DE        ;So we check...
  478.        jp z,Test400x        ;if it is 0, then it is 100x, so test 400x
  479.     ld hl,(TestYear)    ;if not, then keep going... 
  480.     ld de,-100        ;Load -100 into bc
  481.     add hl,de        ;Add it w/the year [aka TestYear-500]
  482.     ld (TestYear),hl    ;Loads that into Year
  483.     djnz LeapLoop        ;Reloops until b = 0
  484.     ;---------------Real Leap Year!--------------------
  485. RLY:                ;Real Leap Year!
  486.         ld a,29                 ;Loads 29 into A
  487.         ld (FebDays),a          ;Loads A into FebDays
  488.         ld a,4                  ;Loads 4 into A
  489.         ld (Leap),a             ;A into Leap [LeapYear]
  490.         ret                     ;return
  491.  
  492. Test400x:
  493.     ld hl,(Year)        ;Loads Year into HL
  494.     ld (TestYear),hl    ;Loads HL into TestYear
  495.     ld b,60            ;Loads 10 into b, starting a loop...
  496.  
  497. LeapLoop2:
  498.     ld hl,(TestYear)    ;Load the Test Year into HL
  499.     ld de,0            ;We want to check if it is 0
  500.        call CP_HL_DE        ;So we check...
  501.        jp z,RLY        ;if it is 0, then it is 400x, so leap year
  502.     ld hl,(TestYear)    ;if not, then keep going... 
  503.     ld de,-400        ;Load -100 into bc
  504.     add hl,de        ;Add it w/the year [aka TestYear-400]
  505.     ld (TestYear),hl    ;Loads that into Year
  506.     djnz LeapLoop2        ;Reloops until b = 0
  507.  
  508. NotReal:            ;Not REALLY a Leap Year...
  509.     ld a,4            ;Loads 4 into A
  510.     ld (Leap),a        ;Reset LeapDays
  511.     ret            ;Return
  512.  
  513. ResetVars:
  514.         xor a                   ;Load 0 into a
  515.         ld (Week),a             ;A into Week
  516.         ld (Day),a              ;A into Day
  517.         ld (Spot),a             ;A into Spot
  518.     ret
  519.  
  520. CheckWeek:
  521.         ld a,(Week)             ;Loads the week into A
  522.         cp 1                    ;Is it 1
  523.         jp z,Week1              ;Then set Week1 Coords
  524.         cp 2                    ;Is it 2
  525.         jp z,Week2              ;Then set Week2 Coords
  526.         cp 3                    ;Is it 3
  527.         jp z,Week3              ;Then set Week3 Coords
  528.         cp 4                    ;Is it 4
  529.         jp z,Week4              ;Then set Week4 Coords
  530.         cp 5                    ;Is it 5
  531.         jp z,Week5              ;Set Week5 Coords
  532.         jp nz,Week6             ;Otherwise .. Week6
  533.  
  534. Week1:
  535.         ld a,15                 ;Load into A
  536.         ld (CURSOR_Y),a          ;Set a as PenRow
  537.         ret                     ;Return
  538.  
  539. Week2:
  540.         ld a,22                 ;Load into A
  541.         ld (CURSOR_Y),a          ;Set a as PenRow
  542.         ret                     ;Return
  543.  
  544. Week3:
  545.         ld a,29                 ;Load into A
  546.         ld (CURSOR_Y),a          ;Set a as PenRow
  547.         ret                     ;Return
  548.  
  549. Week4:
  550.         ld a,36                 ;Load into A
  551.         ld (CURSOR_Y),a          ;Set a as PenRow
  552.         ret                     ;Return
  553.  
  554. Week5:
  555.         ld a,43                 ;Load into A
  556.         ld (CURSOR_Y),a          ;Set a as PenRow
  557.         ret                     ;Return
  558.  
  559. Week6:
  560.         ld a,50                 ;Loads into A
  561.         ld (CURSOR_Y),a          ;Set a as PenRow
  562.         ret
  563.  
  564.  
  565. PutMonth:
  566.         ld a,(Month)            ;Loads Month # into A
  567.         cp 1                    ;If it is 1
  568.         jp z,Month1             ;Goto Month1 [January]
  569.         cp 2                    ;Is it two?
  570.         jp z,Month2             ;Goto Month2 [Febuary]
  571.         cp 3                    ;Is it 3?
  572.         jp z,Month3             ;Goto Month3 [March]
  573.         cp 4                    ;Is it 4
  574.         jp z,Month4             ;Goto Month 4
  575.         cp 5                    ;Is it 5
  576.         jp z,Month5             ;Goto Month5
  577.         cp 6                    ;Is it 6
  578.         jp z,Month6             ;Goto Month 6
  579.         cp 7                    ;Is it 7
  580.         jp z,Month7             ;Goto Month7
  581.         cp 8                    ;Is it 8
  582.         jp z,Month8             ;Goto Month 8
  583.         cp 9                    ;Is it 9
  584.         jp z,Month9             ;Goto Month 9
  585.         cp 10                   ;Is it 10
  586.         jp z,Month10            ;Goto Month10
  587.         cp 11                   ;Is it 11
  588.         jp z,Month11            ;Goto Month11
  589.         jp nz,Month12           ;Otherwise, it has to be 12, so goto Month12
  590.  
  591. Month1:                         ;Month1 Label [January]
  592.         ld a,31                 ;31 into A
  593.         ld (TotalDays),a        ;A -> Total Days 
  594.         call SetText            ;Put coordinates for text
  595.         ld hl,January           ;String into HL
  596.         ret                     ;Return to Call
  597.  
  598. Month2:                         ;Month2 Label [February]
  599.         ld a,(FebDays)          ;February Days into A
  600.         ld (TotalDays),a        ;A => Total Days
  601.         call SetText            ;Put coordinates for text
  602.         ld hl,Febuary           ;String into HL
  603.         ret                     ;Return to Call
  604.  
  605.  
  606. Month3:                         ;Month3 Label [March]
  607.         ld a,31                 ;31 into A
  608.         ld (TotalDays),a        ;A -> Total Days 
  609.         call SetText            ;Put coordinates for text
  610.         ld hl,March             ;String into HL
  611.         ret                     ;Return to Call
  612.  
  613. Month4:                         ;Month4 Label [April]
  614.         ld a,30                 ;30 into A
  615.         ld (TotalDays),a        ;A -> Total Days 
  616.         call SetText            ;Put coordinates for text
  617.         ld hl,April             ;String into HL
  618.         ret                     ;Return to Call
  619.  
  620. Month5:                         ;Month5 Label [May]
  621.         ld a,31                 ;31 into A
  622.         ld (TotalDays),a        ;A -> Total Days 
  623.         call SetText            ;Put coordinates for text
  624.         ld hl,May               ;String into HL
  625.         ret                     ;Return to Call
  626.  
  627. Month6:                         ;Month6 Label [June]
  628.         ld a,30                 ;30 into A
  629.         ld (TotalDays),a        ;A -> Total Days 
  630.         call SetText            ;Put coordinates for text
  631.         ld hl,June              ;String into HL
  632.         ret                     ;Return to Call
  633.  
  634. Month7:                         ;Month7 Label [July]
  635.         ld a,31                 ;31 into A
  636.         ld (TotalDays),a        ;A -> Total Days 
  637.         call SetText            ;Put coordinates for text
  638.         ld hl,July              ;String into HL
  639.         ret                     ;Return to Call
  640.  
  641. Month8:                         ;Month8 Label [August]
  642.         ld a,31                 ;31 into A
  643.         ld (TotalDays),a        ;A -> Total Days 
  644.         call SetText            ;Put coordinates for text
  645.         ld hl,August            ;String into HL
  646.         ret                     ;Return to Call
  647.  
  648. Month9:                         ;Month9 Label [September]
  649.         ld a,30                 ;30 into A
  650.         ld (TotalDays),a        ;A -> Total Days 
  651.         call SetText            ;Put coordinates for text
  652.         ld hl,September         ;String into HL
  653.         ret                     ;Return to Call
  654.  
  655. Month10:                        ;Month1 Label [October]
  656.         ld a,31                 ;31 into A
  657.         ld (TotalDays),a        ;A -> Total Days 
  658.         call SetText            ;Put coordinates for text
  659.         ld hl,October           ;String into HL
  660.         ret                     ;Return to Call
  661.  
  662. Month11:                        ;Month11 Label [November]
  663.         ld a,30                 ;30 into A
  664.         ld (TotalDays),a        ;A -> Total Days 
  665.         call SetText            ;Put coordinates for text
  666.         ld hl,November          ;String into HL
  667.         ret                     ;Return to Call
  668.  
  669. Month12:                        ;Month12 Label [December]
  670.         ld a,31                 ;31 into A
  671.         ld (TotalDays),a        ;A -> Total Days 
  672.         call SetText            ;Put coordinates for text
  673.         ld hl,December          ;String into HL
  674.         ret                     ;Return to Call
  675.  
  676. SetText:
  677.     ld hl,57*256+20        ;Set Coordinates
  678.     ld (CURSOR_X),hl    ;Into PenCol
  679.     ret            ;Return
  680.  
  681. PutYear:
  682.         ld hl,57*256+60         ;Set Coordinates
  683.         ld (CURSOR_X),hl         ;Into PenCol
  684.         ld hl,(Year)            ;Load Year # into HL
  685.         call DispHL             ;Display It!
  686.     res 3,(iy+$05)
  687.     ret
  688.  
  689. PutText:
  690.     ld (CURSOR_X),de
  691.     ROM_CALL(D_ZM_STR)
  692.     ret
  693.  
  694. ;-----------------dispA and HL -----------------------
  695. DispA:
  696.        ld h,0
  697.       ld l,a
  698.  
  699. DispHL:
  700.         push de
  701.         push hl
  702.         ld de,string+5
  703.         xor a
  704.         ld (de),a
  705. Repeat:
  706.         call UNPACK_HL
  707.         add a,'0'
  708.         dec de
  709.         ld (de),a
  710.         ld a,h
  711.         or l
  712.         jr nz,Repeat
  713.         ex de,hl
  714.         ROM_CALL(D_ZM_STR)
  715.         pop hl
  716.         pop de
  717.         ret
  718. ;---------------------------------------------------------
  719.  
  720. TitleString:    .db     "Calendar 82z - By: Ahmed E",0
  721. BlankDay:       .db     "                        ",0
  722.  
  723. Satday:         .db     "S                       ",0
  724. Monday:         .db     "M                       ",0
  725. Thuesday:       .db     "T                       ",0
  726. Wednesday:      .db     "W                       ",0
  727. Friday:         .db     "F                       ",0
  728.  
  729. January:        .db     "January",0
  730. Febuary:        .db     "February",0
  731. March:          .db     "March",0
  732. April:          .db     "April",0
  733. May:            .db     "May",0
  734. June:           .db     "June",0
  735. July:           .db     "July",0
  736. August:         .db     "August",0
  737. September:      .db     "September",0
  738. October:        .db     "October",0
  739. November:       .db     "November",0
  740. December:       .db     "December",0
  741.  
  742. ;-----------------------Variables-------------------------
  743. DayStart:       .db 0
  744. Month:          .db 0 
  745. Week:           .db 0
  746. Spot:           .db 0
  747. TotalDays:      .db 0
  748. Day:            .db 0
  749. Leap:           .db 0
  750. FebDays:        .db 0
  751. Year:           .db 0,0
  752. TestYear:    .db 0,0
  753. ;---------------------------------------------------------
  754.  
  755. .end                                    ;Tell TASM it is all over
  756. END                                     ;Tell TASM it is all over
  757.  
  758.