home *** CD-ROM | disk | FTP | other *** search
/ Frozen Fish 2: PC / frozenfish_august_1995.bin / bbs / d09xx / d0959.lha / AmigaDiary / source / DiaryV1.13.s next >
Text File  |  1992-09-02  |  148KB  |  6,296 lines

  1.  
  2.  
  3. *-------------- IDENTIFICATION -------------------------------------------*
  4.  
  5.  
  6. ; Author         : Andrew K. Pearson
  7. ; Program        : AmigaDiary
  8. ; Version        : 1.13
  9. ; Last Updated    : 28.6.93
  10.  
  11. ; (c) Andrew K. Pearson 1992/93
  12.  
  13.  
  14. *-------------- PROGRAM HISTORY -----------------------------------------*
  15.  
  16. ; v1.0  : The 'original'. Finished around spring '93.
  17.  
  18. ; v1.1  : Finished 20/3/93. Added some features not originally intended,
  19. ;         eg. hotkeys. This version on July '93 Amiga Computing coverdisk.
  20.  
  21. ; v1.11 : Removed a few bugs present in v1.1 Thanks to all the people 
  22. ;         who pointed them out to me.
  23.  
  24. ; v1.12 : Fixed the following bugs:
  25. ;         1. When the diary starts up, the whole entry for today is
  26. ;         displayed, not just the most recently added one.
  27. ;      2. After loading a file, the correct entries are displayed, and
  28. ;         the day shown in the window is today's date - not the last
  29. ;          day loaded from the file.
  30. ;      3. The Edit gadget in the scribblepad window no longer has the
  31. ;            E underlined. (Hotkeys only work in the main window).
  32. ;         4. (Not a bug) I never expected people to want to insert entries
  33. ;            in the past, so I made the lookup date routine add 2000 to the
  34. ;            year if it was less than 90. It would seem, however, that 
  35. ;            if you were keeping records or something then you might want
  36. ;            entries in previous years. Now, only years less than 30 are
  37. ;            21st century. Any others go to 20th century, so for example if
  38. ;            you entered 69 it would become 1969, not 2069. This means the
  39. ;            diary can be used up until 2030. If anyone is still using it
  40. ;            after that don't expect help from me!
  41. ;         5. The program now correctly sets the topaz 8 font in each window
  42. ;            that uses the graphics library text function.
  43. ;         6. Program correctly handles years. (This was a major bug - whoops!)
  44.  
  45. ; v1.13 : Thanks to Peter Wesson for pointing this out. If the date given
  46. ;         in the LookUp Date window is an old date eg. in 1959, the day is
  47. ;         wrong. This was because the exec function datestamp returns the
  48. ;         date as the number of seconds since midnight, 1st Jan 1978. When
  49. ;         I changed the range of years allowed in to 1930 onwards (v1.12), I
  50. ;         forgot to take this into consideration, so any date before 1.1.78
  51. ;         would give the wrong day. This has now been fixed.
  52.  
  53.  
  54. ; Known Bugs
  55. ; ----------
  56.  
  57. ; AmigaDiary seems to cause problems for ToolsDaemon v2.0b - I don't know
  58. ; why. The error reported is "can't find .info!" when I try to select a
  59. ; menu option. I think the problem lies in ToolsDaemon, though, because 
  60. ; I have had this error when AmigaDiary has not even been running.
  61.  
  62.  
  63. *-------------- INCLUDES AND DEFINITIONS --------------------------------*
  64.  
  65.  
  66. ;(* LIBRARIES ...                             *)
  67. execbase    equ    4
  68.  
  69. close        equ    -36        DOS
  70. datestamp    equ    -192
  71. open        equ    -30
  72. read        equ    -42
  73. write        equ    -48
  74.                     
  75. allocmem    equ    -198        EXEC
  76. closelib    equ    -414        
  77. findtask    equ    -294
  78. freemem        equ    -210
  79. getmsg        equ    -372
  80. openlib        equ    -408
  81. replymsg    equ    -378
  82. waitport    equ    -384
  83.                 
  84. closefont    equ    -78        GRAPHICS
  85. rectfill    equ    -306
  86. move        equ    -240
  87. openfont    equ    -72
  88. setApen        equ    -342
  89. setDrMd        equ    -354
  90. setfont        equ    -66
  91. text        equ    -60
  92.                     
  93. activategadget    equ    -462
  94. closewindow    equ    -72        INTUITION        
  95. drawborder    equ    -108
  96. drawimage    equ    -114
  97. openwindow    equ    -204
  98. printItext    equ    -216
  99. refreshGlist    equ    -432
  100.  
  101.  
  102. ;(* DIARY STRUCTURES ...                         *)
  103. cal_year    equ    0        CALENDAR pointer to year
  104.  
  105. yr_size        equ    54        YEAR    total size
  106. yr_year        equ    4            eg.1992
  107. yr_next        equ    0            pointer to next in list
  108. yr_list        equ    6            12 pointers to 12 months            
  109.  
  110. mon_size    equ    6        MONTH    total size
  111. mon_number    equ     4            number of entries in month
  112. mon_day        equ    0            pointer to 1st (used) day
  113.  
  114. day_size    equ    10        DAY    total size
  115. day_day        equ    8            eg. 16 = 16th
  116. day_entry    equ    4            pointer to entry list
  117. day_next    equ    0            pointer to next day 
  118.  
  119. ent_size    equ    14        ENTRY    total size
  120. ent_text    equ    0            pointer to text block
  121. ent_next    equ    4            pointer to next entry 
  122. ent_txt_size    equ    8            size of text block (bytes)
  123. ent_stat    equ    10            control word
  124. ent_time    equ    12            eg 0915 = 9.15 am
  125.  
  126. ;                    SCRIBBLEPAD ENTRY
  127. scribent_size    equ    14            total size
  128. scribent_next    equ    0            next entry in list
  129. scribent_text    equ    4            pointer to text
  130. scribent_txt_size equ    8            size of text block (bytes)
  131. scrib_ident    equ    10            identifier
  132.  
  133. line_width    equ    15        ENTRY TEXT     
  134. ;                        max no. of chars
  135. ;                        (also change line_break!!)
  136.  
  137. scrib_width    equ    35        SCRIBBLEPAD TEXT
  138. ;                        max no. of chars
  139. scrib_bottom    equ    160            pixel position of pad
  140. ;                        lower margin
  141.  
  142. page_limit    equ    150        DIARY PAGE lower limit
  143.  
  144. ;(* EXTERNAL FILE ...                             *)
  145. mode_old    equ    1005
  146. mode_new    equ    1006
  147.  
  148.  
  149. ;(* DATE ...                                 *)
  150. date_yr        equ    0        DATE     year  yyyy
  151. date_mon    equ    4            month mm
  152. date_day1    equ    8            day1  dd (eg. 16th)
  153. date_day2    equ    12            day2  (eg. 0=Sunday)
  154.  
  155.  
  156. ;(* FLAGS ...                                 *)
  157. ;(* Offsets represent bits for each byte flag.                 *)
  158. leap        equ    0        FLAG 1
  159. quitp        equ    1
  160. timeyn        equ    2
  161. linebrk        equ    3
  162. editinp        equ    4
  163. one_entry    equ    5
  164. firstentry    equ    6
  165. scribover    equ    7
  166.  
  167. scribop        equ    0        FLAG 2
  168. addentop    equ    1
  169. shrinkop    equ    2
  170. aboutop        equ    3
  171. requestop    equ    4
  172. lookop        equ    5
  173. loadop        equ    6
  174. saveop        equ    7
  175.  
  176. scribaeop    equ    0        FLAG 3
  177. editop        equ    1
  178. scribeditop    equ    2
  179. strgad        equ    3
  180. hrsgad        equ    4
  181. minsgad        equ    5
  182. topazUset    equ    6
  183. topazset    equ    7
  184.  
  185. scribsplit    equ    0        FLAG 4
  186. pagebottom    equ    1
  187. splitentry    equ    2
  188. sidetwo        equ    3
  189. change        equ    4
  190. scribeditinp    equ    5
  191. defaultfile    equ    6
  192.  
  193.         ;opt     d+
  194.  
  195.  
  196. *-------------- MAIN LOOP -----------------------------------------------*
  197.  
  198. ;(* Initialises variables, opens libraries, opens main window and sets      *)
  199. ;(* the display.                             *)
  200. Start        bsr    Workbench        icon or CLI?
  201.         bsr    Init
  202.         bsr    Openint
  203.         beq    badint
  204.         bsr    Opengfx
  205.         beq    badgfx
  206.         bsr    Opendos
  207.         beq    baddos
  208.         bsr    LoadDefault        load default AD entry file
  209.         bsr    Topaz            open topaz 8 font
  210.         bsr    OpenShrinkwind
  211.         move.l    shrinkhd,d0
  212.         tst.l    d0
  213.         beq    badwind
  214.         bsr    GetDate
  215.         move.w    #45,dateXpos
  216.         move.w    #19,dateYpos
  217.         move.l    shrinkhd,displayhd
  218.         bsr    DisplayDate
  219.  
  220. loop        bsr    Main
  221.         btst    #quitp,flag1        Quit program ?    
  222.         beq    loop
  223.  
  224. error        bsr    DFS            Free all diary memory
  225.         bsr    ScribClear        Free all SP memory
  226.         bsr    CloseTopaz        Close the font
  227.         bsr    CloseAEwind
  228.         bsr    CloseSPwind
  229.         bsr    Closewind        main 
  230.         bsr    CloseShrinkwind        shrink
  231.         bsr    CloseAboutWind        about
  232.         bsr    CloseInvInpWind        invalid inputs
  233.         bsr    CloseLEwind        lookup entry
  234.         bsr    CloseLFwind        load file
  235.         bsr    CloseSFwind        save file
  236.         bsr    CloseSAEwind        scribblepad add entry
  237.         bsr    CloseEditwind        edit entry
  238.         bsr    CloseSEEwind        scribblepad edit entry
  239. badwind        bsr    Closedos
  240. baddos        bsr    Closegfx
  241. badgfx        bsr    Closeint
  242. badint        rts
  243.  
  244.  
  245.  
  246. *-------------- ENVIRONMENT ROUTINES ------------------------------------*
  247.  
  248.  
  249. ;(* If the program is started by clicking an icon, instead of a CLI     *)
  250. ;(* command, a message must be returned.                 *)
  251. Workbench    move.l    execbase,a6
  252.         sub.l    a1,a1
  253.         jsr    findtask(a6)
  254.         move.l    d0,a4
  255.         tst.l    $ac(a4)
  256.         bne    .out        CLI
  257.         lea    $5c(a4),a0
  258.         jsr    waitport(a6)
  259.         jsr    getmsg(a6)
  260. .out        rts
  261.  
  262.  
  263. ;(* Opens the intuition library.                     *)
  264. Openint        move.l    execbase,a6
  265.         lea    intname,a1
  266.         jsr    openlib(a6)
  267.         move.l    d0,intbase
  268.         rts
  269.  
  270. ;(* Opens the graphics library.                         *)
  271. Opengfx        move.l    execbase,a6
  272.         lea    gfxname,a1
  273.         jsr    openlib(a6)
  274.         move.l    d0,gfxbase
  275.         rts
  276.  
  277. ;(* Opens the dos library.                         *)
  278. Opendos        move.l    execbase,a6
  279.         lea    dosname,a1
  280.         jsr    openlib(a6)
  281.         move.l    d0,dosbase
  282.         rts
  283.  
  284. ;(* Opens the main display window.                     *)
  285. Openwind    move.l    intbase,a6
  286.         lea    window_defs,a0
  287.         jsr    openwindow(a6)
  288.         move.l    d0,windowhd
  289.         move.l    d0,displayhd
  290.         bsr    SetTopaz
  291.         rts
  292.  
  293. ;(* Opens the ScribblePad window.                     *)
  294. OpenSPwind    btst    #scribop,flag2        window open?
  295.         bne    .out            yes
  296.         move.l    intbase,a6
  297.         lea    spw_defs,a0
  298.         jsr    openwindow(a6)
  299.         move.l    d0,spwhd
  300.         cmp.l    #0,d0            window open ok?
  301.         beq    .out
  302.         bset    #scribop,flag2
  303.         move.l    d0,displayhd
  304.         bsr    SetTopaz        
  305. .out        rts
  306.  
  307.  
  308. ;(* Opens the Add Entry window.                         *)
  309. OpenAEwind    btst    #addentop,flag2        window open?
  310.         bne    .out            yes
  311.         move.l    intbase,a6
  312.         lea    ae_defs,a0
  313.         jsr    openwindow(a6)
  314.         move.l    d0,aehd
  315.         cmp.l    #0,d0            window open ok?
  316.         beq    .out
  317. ; This activates the gadget so the user does not have to click it. 
  318. ; NB may only work with some versions of intuition (because it is a high
  319. ; offset, it doesn't even appear in my System Programmer's Guide!)
  320.         move.l    intbase,a6
  321.         move.l    #entry_sgadget,a0    gadget
  322.         move.l    d0,a1            window
  323.         move.l    #0,a2            requestor (nil)
  324.         jsr    activategadget(a6)
  325.         bset    #addentop,flag2
  326.         bset    #strgad,flag3
  327.         bclr    #hrsgad,flag3
  328.         bclr    #minsgad,flag3
  329. .out        rts
  330.  
  331.  
  332. ;(* Opens the Shrink window.                         *)
  333. OpenShrinkwind    btst    #shrinkop,flag2        window open?
  334.         bne    .out            yes
  335.         move.l    intbase,a6
  336.         lea    shrink_defs,a0
  337.         jsr    openwindow(a6)
  338.         move.l    d0,shrinkhd
  339.         cmp.l    #0,d0            window open ok?
  340.         beq    .out
  341.         bset    #shrinkop,flag2        
  342.         move.l    d0,displayhd
  343.         bsr    SetTopaz
  344. .out        rts
  345.  
  346.  
  347. ;(* Opens the About window.                         *)
  348. OpenAboutwind    btst    #aboutop,flag2        window open?
  349.         bne    .out            yes
  350.         move.l    intbase,a6
  351.         lea    about_defs,a0
  352.         jsr    openwindow(a6)
  353.         move.l    d0,abouthd
  354.         cmp.l    #0,d0            window open ok?
  355.         beq    .out
  356.         bset    #aboutop,flag2        
  357. .out        rts
  358.  
  359.  
  360. ;(* Opens the Invalid Inputs requestor.                     *)
  361. OpenInvInpwind    btst    #requestop,flag2    window open?
  362.         bne    .out            yes
  363.         move.l    intbase,a6
  364.         lea    request_defs,a0
  365.         jsr    openwindow(a6)
  366.         move.l    d0,requesthd
  367.         cmp.l    #0,d0            window open ok?
  368.         beq    .out
  369.         bset    #requestop,flag2        
  370.         move.l    intbase,a6    
  371.         move.l    requesthd,a0
  372.         move.l    50(a0),a0
  373.         move.l    #invinp_text,a1
  374.         move.l    #0,d0
  375.         move.l    #0,d1
  376.         jsr    printItext(a6)
  377.         move.l    intbase,a6
  378.         move.l    requesthd,a0
  379.         move.l    50(a0),a0        raster
  380.         lea    stop_image,a1
  381.         move.w    #20,d0
  382.         move.w    #22,d1
  383.         jsr    drawimage(a6)
  384. .out        rts
  385.  
  386.  
  387. ;(* Opens the Invalid File requestor.                     *)
  388. OpenBadFilewind    btst    #requestop,flag2    window open?
  389.         bne    .out            yes
  390.         move.l    intbase,a6
  391.         lea    request_defs,a0
  392.         jsr    openwindow(a6)
  393.         move.l    d0,requesthd
  394.         cmp.l    #0,d0            window open ok?
  395.         beq    .out
  396.         bset    #requestop,flag2        
  397.         move.l    intbase,a6    
  398.         move.l    requesthd,a0
  399.         move.l    50(a0),a0
  400.         move.l    #badfile_text,a1
  401.         move.l    #0,d0
  402.         move.l    #0,d1
  403.         jsr    printItext(a6)
  404.         move.l    intbase,a6
  405.         move.l    requesthd,a0
  406.         move.l    50(a0),a0        raster
  407.         lea    stop_image,a1
  408.         move.w    #20,d0
  409.         move.w    #22,d1
  410.         jsr    drawimage(a6)
  411. .out        rts
  412.  
  413.  
  414. ;(* Opens the Lookup Entry window.                     *)
  415. OpenLEwind    btst    #lookop,flag2        window open?
  416.         bne    .out            yes
  417.         move.l    intbase,a6
  418.         lea    le_defs,a0
  419.         jsr    openwindow(a6)
  420.         move.l    d0,lehd
  421.         cmp.l    #0,d0            window open ok?
  422.         beq    .out
  423. ; This activates the gadget so the user does not have to click it. 
  424. ; NB may only work with some versions of intuition (because it is a high
  425. ; offset, it doesn't even appear in my System Programmer's Guide!)
  426.         move.l    intbase,a6
  427.         move.l    #date_sgadget,a0    gadget
  428.         move.l    d0,a1            window
  429.         move.l    #0,a2            requestor (nil)
  430.         jsr    activategadget(a6)
  431.         bset    #lookop,flag2
  432. .out        rts
  433.  
  434.  
  435. ;(* Opens the Load File window.                         *)
  436. OpenLFwind    btst    #loadop,flag2        window open?
  437.         bne    .out            yes
  438.         move.l    intbase,a6
  439.         lea    lf_defs,a0
  440.         jsr    openwindow(a6)
  441.         move.l    d0,lfhd
  442.         cmp.l    #0,d0            window open ok?
  443.         beq    .out
  444. ; This activates the gadget so the user does not have to click it. 
  445. ; NB may only work with some versions of intuition (because it is a high
  446. ; offset, it doesn't even appear in my System Programmer's Guide!)
  447.         move.l    intbase,a6
  448.         move.l    #fileload_sgadget,a0    gadget
  449.         move.l    d0,a1            window
  450.         move.l    #0,a2            requestor (nil)
  451.         jsr    activategadget(a6)
  452.         bset    #loadop,flag2
  453. .out        rts
  454.  
  455.  
  456. ;(* Opens the Save File window.                         *)
  457. OpenSFwind    btst    #saveop,flag2        window open?
  458.         bne    .out            yes
  459.         move.l    intbase,a6
  460.         lea    sf_defs,a0
  461.         jsr    openwindow(a6)
  462.         move.l    d0,sfhd
  463.         cmp.l    #0,d0            window open ok?
  464.         beq    .out
  465. ; This activates the gadget so the user does not have to click it. 
  466. ; NB may only work with some versions of intuition (because it is a high
  467. ; offset, it doesn't even appear in my System Programmer's Guide!)
  468.         move.l    intbase,a6
  469.         move.l    #filesave_sgadget,a0    gadget
  470.         move.l    d0,a1            window
  471.         move.l    #0,a2            requestor (nil)
  472.         jsr    activategadget(a6)
  473.         bset    #saveop,flag2
  474. .out        rts
  475.  
  476.  
  477. ;(* Opens the ScribblePad Add Entry window.                 *)
  478. OpenSAEwind    btst    #scribaeop,flag3    window open?
  479.         bne    .out            yes
  480.         move.l    intbase,a6
  481.         lea    sae_defs,a0
  482.         jsr    openwindow(a6)
  483.         move.l    d0,saehd
  484.         cmp.l    #0,d0            window open ok?
  485.         beq    .out
  486. ; This activates the gadget so the user does not have to click it. 
  487. ; NB may only work with some versions of intuition (because it is a high
  488. ; offset, it doesn't even appear in my System Programmer's Guide!)
  489.         move.l    intbase,a6
  490.         move.l    #scribentry_sgadget,a0    gadget
  491.         move.l    d0,a1            window
  492.         move.l    #0,a2            requestor (nil)
  493.         jsr    activategadget(a6)
  494.         bset    #scribaeop,flag3
  495. .out        rts
  496.  
  497.  
  498. ;(* Opens the ScribblePad Edit Entry window.                 *)
  499. OpenSEEwind    btst    #scribeditop,flag3    window open?
  500.         bne    .out            yes
  501.         move.l    intbase,a6
  502.         lea    scribedit_defs,a0
  503.         jsr    openwindow(a6)
  504.         move.l    d0,scribedithd
  505.         cmp.l    #0,d0            window open ok?
  506.         beq    .out
  507. ; This activates the gadget so the user does not have to click it. 
  508. ; NB may only work with some versions of intuition (because it is a high
  509. ; offset, it doesn't even appear in my System Programmer's Guide!)
  510.         move.l    intbase,a6
  511.         move.l    #scribedit_sgadget,a0    gadget
  512.         move.l    d0,a1            window
  513.         move.l    #0,a2            requestor (nil)
  514.         jsr    activategadget(a6)
  515.         bset    #scribeditop,flag3
  516. .out        rts
  517.  
  518.  
  519. ;(* Opens the Edit Entry window.                     *)
  520. OpenEditwind    btst    #editop,flag3        window open?
  521.         bne    .out            yes
  522.         move.l    intbase,a6
  523.         lea    edit_defs,a0
  524.         jsr    openwindow(a6)
  525.         move.l    d0,edithd
  526.         cmp.l    #0,d0            window open ok?
  527.         beq    .out
  528.         move.l    d0,displayhd
  529.         bsr    SetTopaz
  530. ; This activates the gadget so the user does not have to click it. 
  531. ; NB may only work with some versions of intuition (because it is a high
  532. ; offset, it doesn't even appear in my System Programmer's Guide!)
  533.         move.l    intbase,a6
  534.         move.l    #editentry_sgadget,a0    gadget
  535.         move.l    d0,a1            window
  536.         move.l    #0,a2            requestor (nil)
  537.         jsr    activategadget(a6)
  538.         bset    #editop,flag3
  539.         bset    #strgad,flag3
  540.         bclr    #hrsgad,flag3
  541.         bclr    #minsgad,flag3
  542. .out        rts
  543.  
  544.  
  545. ;(* Sets up the display in the main window, displays the date.         *)
  546. SetUpDisplay    bsr    BlankPages
  547.         move.w    #120,dateXpos
  548.         move.w    #163,dateYpos
  549.         move.l    windowhd,displayhd
  550.         bsr    GetDate
  551.         bsr    DisplayDate        display today's date
  552.         rts
  553.  
  554.  
  555. ;(* Sets the display in the Add Entry window.                 *)
  556. SetUpAEDisplay    move.l    gfxbase,a6
  557.         move.l    aehd,a1
  558.         move.l    #1,d0
  559.         bsr    pencolour        set white pen    
  560.         move.w    #330,d0
  561.         move.w    #46,d1
  562.         move.l    aehd,a1
  563.         bsr    movepos            move the cursor
  564.         move.l    #includetime,a0
  565.         move.l    aehd,a1
  566.         move.l    #13,d0
  567.         bsr    displaytext
  568. ;(* Set the time option gadget to reflect the status of the time yes/no  *)
  569. ;(* flag. This way, the default yes/no value is the same as the last      *)
  570. ;(* entry specified.                             *)
  571.         btst    #timeyn,flag1        time on?
  572.         beq    .notime
  573.         bsr    timey_disp        yes
  574.         bra    .out
  575. .notime        bsr    timen_disp
  576. .out        rts
  577.  
  578.  
  579. ;(* Sets the display in the Edit Entry window.                 *)
  580. SetUpEditDisplay
  581.         move.l    gfxbase,a6
  582.         move.l    edithd,a1
  583.         move.l    #1,d0
  584.         bsr    pencolour        set white pen    
  585.         move.w    #200,d0
  586.         move.w    #51,d1
  587.         move.l    edithd,a1
  588.         bsr    movepos            move the cursor
  589.         move.l    #includetime,a0
  590.         move.l    edithd,a1
  591.         move.l    #13,d0
  592.         bsr    displaytext
  593.         rts
  594.  
  595.  
  596. ;(* Display the time yes/no gadget as selected.                 *)
  597. timey_disp    move.l    intbase,a6
  598.         btst    #addentop,flag2        which window?
  599.         beq    .edit
  600. ;(* Change the gadget in the add entry window.                 *)
  601.         move.l    aehd,a0
  602.         move.w    #440,d0
  603.         move.w    #38,d1
  604.         bra    .out
  605. ;(* Change the gadget in the edit entry window.                 *)
  606. .edit        move.l    edithd,a0
  607.         move.w    #310,d0
  608.         move.w    #43,d1
  609. .out        move.l    50(a0),a0        raster
  610.         lea    timeyesi_image,a1
  611.         jsr    drawimage(a6)
  612.         rts
  613.  
  614. ;(* Display the time yes/no gadget as not selected.             *)
  615. timen_disp    move.l    intbase,a6
  616.         btst    #addentop,flag2        which window?
  617.         beq    .edit
  618. ;(* Change the gadget in the add entry window.                 *)
  619.         move.l    aehd,a0
  620.         move.w    #440,d0
  621.         move.w    #38,d1
  622.         bra    .out
  623. ;(* Change the gadget in the edit entry window.                 *)
  624. .edit        move.l    edithd,a0
  625.         move.w    #310,d0
  626.         move.w    #43,d1
  627. .out        move.l    50(a0),a0        raster
  628.         lea    timeyes_image,a1
  629.         jsr    drawimage(a6)
  630.         rts
  631.  
  632.  
  633. ;(* Sets the flag for when the entry string gadget is seleted.         *)
  634. StrSel        bset    #strgad,flag3
  635.         bclr    #hrsgad,flag3
  636.         bclr    #minsgad,flag3
  637.         bra    reply
  638.  
  639. ;(* Sets the flag for when the entry string gadget is seleted.         *)
  640. HrsSel        bset    #hrsgad,flag3
  641.         bclr    #strgad,flag3
  642.         bclr    #minsgad,flag3
  643.         bra    reply
  644.  
  645. ;(* Sets the flag for when the entry string gadget is seleted.         *)
  646. MinsSel        bset    #minsgad,flag3
  647.         bclr    #strgad,flag3
  648.         bclr    #strgad,flag3
  649.         bra    reply
  650.  
  651.  
  652. ;(* Clears the pages of the diary by drawing a white rectangle.         *)
  653. BlankPages    move.l    windowhd,a1
  654.         move.l    #1,d0
  655.         bsr    pencolour
  656.         move.l    gfxbase,a6
  657.         move.l    windowhd,a1
  658.         move.l    50(a1),a1        rastport
  659.         move.l    #8,d0
  660.         move.l    #13,d1
  661.         move.l    #352,d2
  662.         move.l    #149,d3
  663.         jsr    rectfill(a6)        fill 'pages'
  664.         move.l    windowhd,a0
  665.         lea    border1,a1
  666.         move    #0,d0
  667.         move    #0,d1
  668.         bsr    BorderDraw
  669.         move.l    intbase,a6
  670.         move.l    #flip_gadget,a0
  671.         move.l    windowhd,a1
  672.         move.l    #0,a2
  673.         move.l    #1,d0            number of gadgets
  674.         jsr    refreshGlist(a6)
  675.         rts
  676.  
  677.  
  678. ;(* Expects window hd in a0, border structure in a1. X,Y pos in d0,d1     *)
  679. BorderDraw    move.l    intbase,a6
  680.         move.l    50(a0),a0 
  681.         jsr    drawborder(a6)
  682.         rts
  683.  
  684.  
  685. Init        move.l    #0,calendar        pointer to years list        
  686.         move.l    #0,start_entry
  687.         move.l    #0,next_entry
  688.         move.l    #0,page_start
  689.         move.l    #1,scribmarker
  690.         move.b    #0,flag1        clear all flags
  691.         move.b    #0,flag2
  692.         move.b    #0,flag3
  693.         move.b    #0,flag4
  694.         bset    #timeyn,flag1        time yes (AE gadgets)
  695.         bsr    ClearEntryString
  696.         bsr    ClearEditString
  697.         rts
  698. t
  699.  
  700. ;(* Opens the topaz 8 font, normal and underlined.             *)
  701. Topaz        move.l    gfxbase,a6
  702.         move.l    #topaz_defs,a0
  703.         jsr    Openfont(a6)        result in d0
  704.         tst.l    d0
  705.         beq    .out
  706.         move.l    d0,topazbase
  707.         bset    #topazset,flag3
  708. ;(* Now open the underlined topaz font                     *)
  709.         move.l    gfxbase,a6
  710.         move.l    #topazU_defs,a0
  711.         jsr    Openfont(a6)        result in d0
  712.         tst.l    d0
  713.         beq    .out
  714.         move.l    d0,topazUbase
  715. .out        rts
  716.  
  717.  
  718. ;(* Sets the topaz 8 font. Expects current window pointer in displayhd.     *)
  719. SetTopaz    move.l    gfxbase,a6
  720.         move.l    topazbase,a0
  721.         move.l    displayhd,a1
  722.         move.l    50(a1),a1
  723.         jsr    Setfont(a6)
  724.         rts
  725.  
  726.  
  727. ;(* Sets the year, month, day to zero.                     *)
  728. ClearDate    move.l    #date,a0
  729.         move.l    #0,date_yr(a0)        clear date
  730.         move.l    #0,date_mon(a0)
  731.         move.l    #0,date_day1(a0)
  732.         move.l    #0,date_day2(a0)
  733.         rts
  734.  
  735. ;(* Introduces blank characters into the string displayed as a 5-digit     *)
  736. ;(* decimal number.                             *)
  737. ClearDecString    move.l    #0,decnumber
  738.         move.l    #decstring,a0
  739.         move.l    "    ",(a0)+        clear decstring
  740.         move.b    " ",(a0)
  741.         rts
  742.  
  743.  
  744. ;(* Closes all open program windows, and displays the shrink window. *)
  745. Shrink        bsr    Closewind
  746.         bsr    CloseSPwind
  747.         bsr    CloseAEwind
  748.         bsr    CloseAboutwind
  749.         bsr    CloseInvInpwind
  750.         bsr    CloseLEwind
  751.         bsr    CloseLFwind
  752.         bsr    CloseSFwind
  753.         bsr    CloseSAEwind
  754.         bsr    CloseSEEwind
  755.         bsr    CloseEditwind
  756.         bsr    OpenShrinkwind
  757.         bsr    GetDate
  758.         move.w    #45,dateXpos
  759.         move.w    #19,dateYpos
  760.         move.l    shrinkhd,displayhd
  761.         bsr    DisplayDate
  762.         bra    finishmessage        cannot replymessage 
  763.                            ;because main window
  764.                            ;closed.
  765.  
  766. ;(* Closes the shrink window, and restores the main window and diary     *)
  767. ;(* pages.                                 *)
  768. Unshrink    bsr    CloseShrinkwind        
  769.         bsr    Openwind
  770.         bsr    SetUpDisplay
  771.         bsr    FindEntry
  772.         move.l    a1,start_entry
  773.         move.l    a1,page_start
  774.         bsr    DisplayPages         re-display entries
  775.         bra    finishwait
  776.         
  777.  
  778. ;(* Opens the about window and displays author & program information     *)
  779. About        bsr    OpenAboutwind
  780.         tst.l    d0
  781.         beq    .error
  782.         move.l    intbase,a6    
  783.         move.l    abouthd,a0
  784.         move.l    50(a0),a0
  785.         move.l    #line1_text,a1
  786.         move.l    #0,d0
  787.         move.l    #0,d1
  788.         jsr    printItext(a6)
  789. .error        bra    reply
  790.  
  791.  
  792. ;(* Closes the invalid inputs requestor after selecting the OK gadget.     *)
  793. Ok        bsr    CloseInvInpwind
  794.         bra    finishmessage
  795.         
  796.  
  797. Main        btst    #shrinkop,flag2        shrunk?
  798.         beq    .next            no, continue
  799.         move.l    shrinkhd,currentwindow
  800.         bsr    Wait
  801.         rts
  802. .next        btst    #requestop,flag2    Error requestor?
  803.         beq    .next1
  804.         move.l    requesthd,currentwindow
  805.         bsr    Checkmsg
  806.         rts
  807. .next1        btst    #addentop,flag2        AE window open?
  808.         beq    .next3
  809.         move.l    aehd,currentwindow
  810.         bsr    Checkmsg
  811.         rts
  812. .next3        btst    #aboutop,flag2        About window open?
  813.         beq    .next4
  814.         move.l    abouthd,currentwindow
  815.         bsr    Checkmsg
  816.         rts
  817. .next4        btst    #lookop,flag2        Lookup Entry window open?
  818.         beq    .next5
  819.         move.l    lehd,currentwindow
  820.         bsr    Checkmsg
  821.         rts
  822. .next5        btst    #loadop,flag2        Load File window open?
  823.         beq    .next6
  824.         move.l    lfhd,currentwindow
  825.         bsr    Checkmsg
  826.         rts
  827. .next6        btst    #saveop,flag2        Save File window open?
  828.         beq    .next7    
  829.         move.l    sfhd,currentwindow
  830.         bsr    Checkmsg
  831.         rts
  832. .next7        btst    #scribaeop,flag3    ScribblePad Add Entry?
  833.         beq    .next8
  834.         move.l    saehd,currentwindow
  835.         bsr    Checkmsg
  836.         rts
  837. .next8        btst    #scribeditop,flag3    ScribblePad Edit Entry?
  838.         beq    .next9
  839.         move.l    scribedithd,currentwindow
  840.         bsr    Checkmsg
  841.         rts
  842. .next9        btst    #editop,flag3        Edit Entry window open?
  843.         beq    .next10
  844.         move.l    edithd,currentwindow
  845.         bsr    Checkmsg
  846.         rts
  847. .next10        btst    #scribop,flag2        SP window open?
  848.         beq    .next11
  849.         move.l    spwhd,currentwindow    
  850.         bsr    Checkmsg
  851.         rts
  852. .next11        move.l    windowhd,currentwindow    Main window
  853.         bsr    Checkmsg
  854. .out        rts
  855.  
  856.  
  857. ;(* Waits for a message from the shrink window. This speeds up other     *)
  858. ;(* programs that are multitasking.                     *)
  859. Wait        move.l    execbase,a6
  860.         move.l    currentwindow,a0
  861.         move.l    86(a0),a0
  862.         jsr    waitport(a6)
  863.         move.l    currentwindow,a0
  864.         move.l    86(a0),a0
  865.         jsr    getmsg(a6)
  866.         move.l    d0,message
  867.         bra    CloseGadget        unshrink gadget selected 
  868. finishwait    rts
  869.  
  870.  
  871. ;(* Checks for the occurence of an event, and calls the correct      *)
  872. ;(* routine to interpret that event.                     *)
  873. Checkmsg    bsr    ClearPort        remove any queued messages
  874.         move.l    execbase,a6
  875.         move.l    currentwindow,a0
  876.         move.l    86(a0),a0
  877.         jsr    waitport(a6)
  878.         move.l    execbase,a6
  879.         move.l    currentwindow,a0
  880.         move.l    86(a0),a0        UserPort (^MsgPort)
  881.         jsr    getmsg(a6)
  882.         move.l    d0,message        ^IntuiMessage
  883.         cmp.l    #0,d0            did event occur?
  884.         beq    finishmessage        no
  885.         move.l    d0,d6
  886.         bsr    replymessage
  887.         move.l    d6,a0            
  888.         move.l    20(a0),d6        message Class
  889.         cmp.l    #$8,d6
  890.         beq    MouseHit
  891.         cmp.l    #$20,d6
  892.         beq    GadgetHit
  893.         cmp.l    #$40,d6
  894.         beq    GadgetHit
  895.         cmp.l    #$200,d6
  896.         beq    CloseGadget
  897.         cmp.l    #$400,d6
  898.         beq    Keypress
  899. reply        
  900. finishmessage    rts
  901.  
  902.  
  903. ;(* Clears the port of any messages that are already waiting. This      *)
  904. ;(* prevents messages 'queueing' on a window that is not yet ready to     *)
  905. ;(* receive messages.                             *)
  906. ClearPort    move.l    execbase,a6
  907. .loop        move.l    currentwindow,a0
  908.         move.l    86(a0),a0
  909.         jsr    getmsg(a6)
  910.         tst.l    d0
  911.         beq    .out
  912.         move.l    d0,message
  913.         bsr    replymessage
  914.         bra    .loop    
  915. .out        rts
  916.  
  917.  
  918. ;(* Replies to a system message.                     *)
  919. ReplyMessage    move.l    execbase,a6
  920.         move.l    message,a1
  921.         jsr    replymsg(a6)
  922.         rts
  923.  
  924.  
  925. ;(* If in shrink mode, 'unshrink' diary, else set quitp flag true.     *)
  926. CloseGadget    btst    #shrinkop,flag2        Window shrunk?
  927.         bne    Unshrink
  928.         bset    #quitp,flag1        Quit program
  929.         bra    finishmessage
  930.  
  931.  
  932. MouseHit    btst    #aboutop,flag2        About window open?
  933.         beq    .out
  934.         bsr    CloseAboutwind
  935. .out        bra    finishmessage
  936.  
  937.  
  938. ;(* Takes appropriate action for a keypress. Expects pointer to      *)
  939. ;(* IntuiMessage in a0.                             *)
  940. Keypress    move.w    26(a0),d1        message qualifier
  941.         btst    #3,d1            Ctrl key?
  942.         bne    .Ctrl            yes
  943.         move.w    24(a0),d0        message code
  944.         cmp.w    #$c4,d0            CR within gadget?
  945.         beq    .CR            yes
  946.         cmp.w    #$44,d0            CR?
  947.         bne    .out
  948. .CR        btst    #lookop,flag2
  949.         bne    LookUpDate        as gadget $41
  950.         btst    #loadop,flag2
  951.         bne    Load_File        as gadget $61
  952.         btst    #saveop,flag2
  953.         bne    SaveFile        as gadget $51
  954.         btst    #addentop,flag2
  955.         bne    AddEntryCR        
  956.         btst    #editop,flag3
  957.         bne    EditEntryCR
  958.         btst    #scribaeop,flag3
  959.         bne    AddScribEntry        as gadget $81
  960.         btst    #scribeditop,flag3
  961.         bne    ChangeScribEntry    as gadget $a3
  962.         bra    .out
  963. .Ctrl        move.w    24(a0),d0        message code
  964.         cmp.w    #$21,d0            Ctrl + s?
  965.         beq    Save
  966.         cmp.w    #$28,d0            Ctrl + l?
  967.         beq    Load
  968.         cmp.w    #$35,d0            Ctrl + b?
  969.         beq    About
  970.         cmp.w    #$25,d0            Ctrl + h?
  971.         beq    Shrink
  972.         cmp.w    #$18,d0            Ctrl + o?
  973.         beq    SelectLE
  974.         cmp.w    #$20,d0            Ctrl + a?
  975.         beq    SelectAE
  976.         cmp.w    #$12,d0            Ctrl + e?
  977.         beq    Edit
  978.         cmp.w    #$33,d0            Ctrl + c?
  979.         beq    SelectSP
  980. .out        rts
  981.  
  982.  
  983. ;(* Takes appropriate action for a gadget click. Expects pointer to     *)
  984. ;(* IntuiMessage in a0.                             *)
  985. GadgetHit    move.l    28(a0),a1    report structure (gadget structure
  986. ;                    in this instance)
  987.         move.w    38(a1),d0    Gadget ID
  988.         cmp.w    #$10,d0
  989.         beq    DayForward
  990.         cmp.w    #$11,d0
  991.         beq    DayBackward
  992.         cmp.w    #$12,d0
  993.         beq    WeekBackward
  994.         cmp.w    #$13,d0
  995.         beq    WeekForward
  996.         cmp.w    #$14,d0
  997.         beq    SelectAE
  998.         cmp.w    #$15,d0
  999.         beq    SelectSP
  1000.         cmp.w    #$16,d0
  1001.         beq    SelectLE
  1002.         cmp.w    #$17,d0
  1003.         beq    Edit
  1004.         cmp.w    #$18,d0
  1005.         beq    Load
  1006.         cmp.w    #$19,d0
  1007.         beq    Save
  1008.         cmp.w    #$1a,d0
  1009.         beq    About
  1010.         cmp.w    #$1b,d0
  1011.         beq    Shrink
  1012.         cmp.w    #$1c,d0
  1013.         beq    FlipPage
  1014.         cmp.w    #$20,d0
  1015.         beq    InsertAnEntry
  1016.         cmp.w    #$21,d0
  1017.         beq    ClearInput
  1018.         cmp.w    #$22,d0
  1019.         beq    CloseAE
  1020.         cmp.w    #$23,d0
  1021.         beq    StrSel
  1022.         cmp.w    #$24,d0
  1023.         beq    HrsSel
  1024.         cmp.w    #$25,d0
  1025.         beq    MinsSel
  1026.         cmp.w    #$28,d0
  1027.         beq    TimeOption
  1028.         cmp.w    #$41,d0
  1029.         beq    LookupDate
  1030.         cmp.w    #$42,d0
  1031.         beq    CloseLE
  1032.         cmp.w    #$51,d0
  1033.         beq    SaveFile
  1034.         cmp.w    #$52,d0
  1035.         beq    CloseSF
  1036.         cmp.w    #$61,d0
  1037.         beq    Load_File
  1038.         cmp.w    #$62,d0
  1039.         beq    CloseLF
  1040.         cmp.w    #$70,d0
  1041.         beq    SelectSAE
  1042.         cmp.w    #$71,d0
  1043.         beq    CloseSP
  1044.         cmp.w    #$72,d0
  1045.         beq    NextSP
  1046.         cmp.w    #$73,d0
  1047.         beq    SelectSee
  1048.         cmp.w    #$81,d0
  1049.         beq    AddScribEntry
  1050.         cmp.w    #$82,d0
  1051.         beq    ClearScribInput
  1052.         cmp.w    #$83,d0
  1053.         beq    CloseSAE
  1054.         cmp.w    #$90,d0
  1055.         beq    StrSel
  1056.         cmp.w    #$91,d0
  1057.         beq    HrsSel
  1058.         cmp.w    #$92,d0
  1059.         beq    MinsSel
  1060.         cmp.w    #$93,d0
  1061.         beq    TimeOption
  1062.         cmp.w    #$94,d0
  1063.         beq    NextEntry
  1064.         cmp.w    #$95,d0
  1065.         beq    PrevEntry
  1066.         cmp.w    #$96,d0
  1067.         beq    DelEntry
  1068.         cmp.w    #$97,d0
  1069.         beq    ClearEditInput
  1070.         cmp.w    #$98,d0
  1071.         beq    ChangeEntry
  1072.         cmp.w    #$99,d0
  1073.         beq    CloseEdit
  1074.         cmp.w    #$a1,d0
  1075.         beq    DelScribEntry
  1076.         cmp.w    #$a2,d0
  1077.         beq    ClearSEditInput
  1078.         cmp.w    #$a3,d0
  1079.         beq    ChangeScribEntry
  1080.         cmp.w    #$a4,d0
  1081.         beq    CloseSEE
  1082.         cmp.w    #$a5,d0
  1083.         beq    NextScribEntry
  1084.         cmp.w    #$a6,d0
  1085.         beq    PrevScribEntry
  1086. .request    cmp.w    #$30,d0
  1087.         beq    Ok
  1088.         bra    reply
  1089.  
  1090.  
  1091. ;(* moves the text cursor. Expects x,y positon in d0,d1. Also window hd  *)
  1092. ;(* in a1                                 *)
  1093. movepos        move.l    gfxbase,a6        x,y in d0,d1
  1094.         move.l    50(a1),a1
  1095.         jsr    move(a6)
  1096.         rts
  1097.  
  1098.  
  1099. ;(* displays text in the current window. Expects text address in a0,     *)
  1100. ;(* window hd in a1, text length in d0.                      *)  
  1101. Displaytext    move.l    gfxbase,a6    
  1102.         move.l    50(a1),a1        rastport
  1103.         jsr    text(a6)
  1104.         rts
  1105.  
  1106.  
  1107. ;(* changes the pen colour. Expects colour in d0, window hd in a1     *)
  1108. PenColour    move.l    gfxbase,a6
  1109.         move.l    50(a1),a1        get rastport
  1110.         jsr    SetApen(a6)
  1111.         rts
  1112.  
  1113.  
  1114. ;(* Closes the topaz font, if open.                     *)
  1115. CloseTopaz    btst    #topazset,flag3
  1116.         beq    .out
  1117.         move.l    gfxbase,a6
  1118.         move.l    topazbase,a1
  1119.         jsr    Closefont(a6)
  1120.         bclr    #topazset,flag3
  1121.         btst    #topazUset,flag3
  1122.         beq    .out
  1123.         move.l    gfxbase,a6
  1124.         move.l    topazUbase,a1
  1125.         jsr    Closefont(a6)
  1126.         bclr    #topazUset,flag3
  1127. .out        rts
  1128.  
  1129.  
  1130. ;(* Closes the Edit Entry window, if open.                 *)
  1131. CloseEditwind    btst    #editop,flag3        window open?
  1132.         beq    .out            no
  1133.         move.l    intbase,a6
  1134.         move.l    edithd,a0
  1135.         jsr    closewindow(a6)
  1136.         bclr    #editop,flag3
  1137. .out        rts
  1138.  
  1139.  
  1140. ;(* Closes the ScribblePad Add Entry window, if open.             *)
  1141. CloseSAEwind    btst    #scribaeop,flag3    window open?
  1142.         beq    .out            no
  1143.         move.l    intbase,a6
  1144.         move.l    saehd,a0
  1145.         jsr    closewindow(a6)
  1146.         bclr    #scribaeop,flag3
  1147. .out        rts
  1148.  
  1149.  
  1150. ;(* Closes the ScribblePad Edit Entry window, if open.             *)
  1151. CloseSEEwind    btst    #scribeditop,flag3    window open?
  1152.         beq    .out            no
  1153.         move.l    intbase,a6
  1154.         move.l    scribedithd,a0
  1155.         jsr    closewindow(a6)
  1156.         bclr    #scribeditop,flag3
  1157. .out        rts
  1158.  
  1159.  
  1160. ;(* Closes the Save File window, if open.                 *)
  1161. CloseSFwind    btst    #saveop,flag2        window open?
  1162.         beq    .out            no
  1163.         move.l    intbase,a6
  1164.         move.l    sfhd,a0
  1165.         jsr    closewindow(a6)
  1166.         bclr    #saveop,flag2
  1167. .out        rts
  1168.  
  1169.  
  1170. ;(* Closes the Load File window, if open.                 *)
  1171. CloseLFwind    btst    #loadop,flag2        window open?
  1172.         beq    .out            no
  1173.         move.l    intbase,a6
  1174.         move.l    lfhd,a0
  1175.         jsr    closewindow(a6)
  1176.         bclr    #loadop,flag2
  1177. .out        rts
  1178.  
  1179.  
  1180. ;(* Closes the Lookup Entry window, if open.                 *)
  1181. CloseLEwind    btst    #lookop,flag2        window open?
  1182.         beq    .out            no
  1183.         move.l    intbase,a6
  1184.         move.l    lehd,a0
  1185.         jsr    closewindow(a6)
  1186.         bclr    #lookop,flag2
  1187. .out        rts
  1188.  
  1189.  
  1190. ;(* Closes the Invalid Inputs Requestor, if open             *)
  1191. CloseInvInpwind    btst    #requestop,flag2    window open?
  1192.         beq    .out            no
  1193.         move.l    intbase,a6
  1194.         move.l    requesthd,a0
  1195.         jsr    closewindow(a6)
  1196.         bclr    #requestop,flag2
  1197. .out        rts
  1198.  
  1199.  
  1200. ;(* Closes the About window, if open                     *)
  1201. CloseAboutwind    btst    #aboutop,flag2        window open?
  1202.         beq    .out            no
  1203.         move.l    intbase,a6
  1204.         move.l    abouthd,a0
  1205.         jsr    closewindow(a6)
  1206.         bclr    #aboutop,flag2
  1207. .out        rts
  1208.  
  1209.  
  1210. ;(* Closes the shrink window, if open.                     *)
  1211. CloseShrinkwind    btst    #shrinkop,flag2        window open?
  1212.         beq    .out            no
  1213. ;(* First, save the position of the window by copying the position to     *)
  1214. ;(* the window structure used by openwindow.                 *)
  1215.         move.l    shrinkhd,a0        window structure
  1216.         move.l    #shrink_defs,a1        open window structure
  1217.         move.w    4(a0),(a1)        copy x pos
  1218.         move.w    6(a0),2(a1)        copy y pos
  1219. ;(* Now close the window.                         *)
  1220.         move.l    intbase,a6
  1221.         move.l    shrinkhd,a0
  1222.         jsr    closewindow(a6)
  1223.         bclr    #shrinkop,flag2
  1224. .out        rts
  1225.  
  1226.  
  1227. ;(* Closes the Add Entry window, if open                 *)
  1228. CloseAEwind    btst    #addentop,flag2        window open?
  1229.         beq    .out            no
  1230.         move.l    intbase,a6
  1231.         move.l    aehd,a0
  1232.         jsr    closewindow(a6)
  1233.         bclr    #addentop,flag2
  1234. .out        rts
  1235.  
  1236.  
  1237. ;(* Closes the ScribblePad window, if open.                 *)
  1238. CloseSPwind    btst    #scribop,flag2        window open?
  1239.         beq    .out            no
  1240.         move.l    intbase,a6
  1241.         move.l    spwhd,a0
  1242.         jsr    closewindow(a6)
  1243.         bclr    #scribop,flag2
  1244. .out        rts
  1245.  
  1246.  
  1247. ;(* Closes the main window, if open.                     *)
  1248. Closewind    btst    #shrinkop,flag2        shrunk?
  1249.         bne    .out            yes
  1250. ;(* First, save the position of the window by copying the position to     *)
  1251. ;(* the window structure used by openwindow.                 *)
  1252.         move.l    windowhd,a0        window structure
  1253.         move.l    #window_defs,a1        open window structure
  1254.         move.w    4(a0),(a1)        copy x pos
  1255.         move.w    6(a0),2(a1)        copy y pos
  1256. ;(* Now close the window.                         *)
  1257.         move.l    intbase,a6
  1258.         move.l    windowhd,a0
  1259.         jsr    closewindow(a6)
  1260. .out        rts
  1261.  
  1262.  
  1263. ;(* Closes the dos library.                         *)
  1264. Closedos    move.l    execbase,a6
  1265.         move.l    dosbase,a1
  1266.         jsr    closelib(a6)
  1267.         rts
  1268.  
  1269.  
  1270. ;(* Closes the Graphics library.                     *)
  1271. Closegfx    move.l    execbase,a6
  1272.         move.l    gfxbase,a1
  1273.         jsr    closelib(a6)
  1274.         rts
  1275.  
  1276.  
  1277. ;(* Closes the Intuition library.                     *)
  1278. Closeint    move.l    execbase,a6
  1279.         move.l    intbase,a1
  1280.         jsr    closelib(a6)
  1281.         rts    
  1282.  
  1283.  
  1284.  
  1285. *-------------- DATE ROUTINES -------------------------------------------*
  1286.  
  1287.  
  1288. ;(* Gets the internal format of date & time, and returns the date in the *)
  1289. ;(* four longwords stored as 'date'. Format is day1 (eg. Sun, Mon etc)   *)
  1290. ;(* year, month, day2 (eg. 16th)                          *)
  1291.  
  1292. GetDate        bsr    ClearDate
  1293.         bclr    #leap,flag1        clear, because bit is used
  1294.         move.l    dosbase,a6
  1295.         move.l    #date,d1        3 reserved longwords
  1296.         jsr    datestamp(a6)
  1297.         move.l    d1,a0            address of date
  1298.         move.l    (a0),d0            number of days since... 
  1299.         move.l    d0,d5            ...Jan 1st, 1978
  1300.         move.l    d0,d1            store
  1301. ; Get the day (0=Sunday, 1=Monday etc) first
  1302.         divs    #7,d0
  1303.         and.l    #$ffff0000,d0        get upper half (remainder) 
  1304.         swap    d0            move to lower half
  1305.         move.l  #date,a0
  1306.         move.l    d0,date_day2(a0)    store in structure
  1307. ; Get the year next
  1308.         move.l    d1,d0            restore value
  1309.         move.l    #years,a1        year lengths (days)
  1310.         move.l    #0,d2            number of years
  1311.         move.l    #0,d3            counter for list
  1312. .yearloop    cmp.w    #8,d3            end of list?
  1313.         bne    .ok            no
  1314.         move.l    #0,d3            back to start of list
  1315. .ok        move.w    (a1,d3),d4
  1316.         sub.w    d4,d0
  1317.         cmp.w    #0,d0            got right year?
  1318.         blt    .foundyear
  1319.         move.l    d0,d1            update store
  1320.         add.w    #2,d3            update counter
  1321.         addq    #1,d2            increment year
  1322.         bra    .yearloop
  1323. .foundyear    move.l    d2,d4            d4=number of years
  1324.         add.l    #1978,d2
  1325.         move.l    #date,a1
  1326.         move.l    d2,date_yr(a1)        THIS YEAR
  1327.  
  1328.         divs    #4,d2
  1329.         swap    d2
  1330.         cmp.w    #0,d2            is this a leap year?
  1331.         bne    .notleap
  1332.         bset    #leap,flag1        yes
  1333. .notleap
  1334.         move.l    d1,d0            number days this year
  1335.         move.l    #months,a0
  1336.         move.l    #0,d3            month (jan = 0)
  1337. .loop        move.w    (a0)+,d2
  1338.         cmp.w    #28,d2            feb?
  1339.         bne    .notfeb
  1340.         btst    #leap,flag1        leap year?
  1341.         beq    .notfeb            no
  1342.         add.w    #1,d2            add one day for 29th
  1343. .notfeb        sub.w    d2,d0
  1344.         cmp.w    #0,d0
  1345.         blt    .foundmonth
  1346.         move.l    d0,d1            update store
  1347.         add.l    #1,d3    
  1348.         bra    .loop
  1349. .foundmonth    add.l    #1,d1
  1350.         move.l    d1,date_day1(a1)    DAYS THIS MONTH
  1351.         move.l    d3,date_mon(a1)        MONTH
  1352.         rts
  1353.  
  1354.  
  1355. ;(* Given a date in normal format (dd-mon-yy) workout which day of the   *)
  1356. ;(* week it is. Expects date as 1st 3 longwords of date, returns weekday *)
  1357. ;(* as 4th longword.                             *)
  1358. ;(* Advances forward from 1st Jan 1978, to given date, or backwards if   *)
  1359. ;(* the date is before 1st Jan 1978.                     *)
  1360. CorrectDay    move.l    #1,tmpday
  1361.         move.l    #1978,tmpyear
  1362.         move.l    #date,a0
  1363.         move.l    #0,date_day2(a0)    Jan 1st, 1978
  1364.         move.l    date_yr(a0),d0
  1365.         cmp.l    #1978,d0
  1366.         blt    .back
  1367.         bsr    CorrectForwards
  1368.         rts
  1369. .back        bsr    CorrectBackwards
  1370.         rts
  1371.  
  1372. ;(* Works out the week day by moving forwards from 1st Jan 1978 until     *)
  1373. ;(* the given date is found.                         *)
  1374.  
  1375. CorrectForwards
  1376.         move.l    #0,tmpmon
  1377. ; while year < NewYear do begin
  1378. .year        move.l    #date,a0
  1379.         move.l    date_yr(a0),d3
  1380.         cmp.l    tmpyear,d3
  1381.         ble    .month
  1382. ;   if year is leap, advance day2 by 2, else advance by 1
  1383.         move.l    tmpyear,d0
  1384.         bsr    isleapyear        returns boolean result
  1385.         tst.l    d0
  1386.         beq    .notleap
  1387.         move.l    #1,d0
  1388.         bsr    AdvanceWeekday
  1389. .notleap    move.l    #1,d0
  1390.         bsr    AdvanceWeekday
  1391.         add.l    #1,tmpyear
  1392.         bra    .year            end while {year}
  1393. ; while mon < NewMonth do begin
  1394. .month        move.l    #date,a0
  1395.         move.l    date_mon(a0),d2
  1396.         cmp.l    tmpmon,d2
  1397.         ble    .day
  1398. ;   get month length from table
  1399.         move.l    #months,a1        table of lengths
  1400.         move.l    tmpmon,d0
  1401.         muls    #2,d0            word lengths
  1402.         add.l    d0,a1
  1403.         move.w    (a1),d5            get month length
  1404.         sub.w    #1,d5
  1405. .loop1        move.l    #1,d0
  1406.         bsr    AdvanceWeekday        move through month
  1407.         dbf    d5,.loop1
  1408.         add.l    #1,tmpmon            
  1409.         bra    .month            end while {month}
  1410. ; while day < NewDay do begin
  1411. .day        move.l    #date,a0
  1412.         move.l    date_day1(a0),d1
  1413.         cmp.l    tmpday,d1
  1414.         ble    .foundday
  1415.         move.l    #1,d0
  1416.         bsr    AdvanceWeekday        move forward another day
  1417.         add.l    #1,tmpday
  1418.         bra    .day
  1419. .foundday    rts                end {day}
  1420. tmpday        dc.l    0
  1421. tmpmon        dc.l    0
  1422. tmpyear        dc.l    0
  1423.  
  1424.  
  1425. ;(* If the date given is before 1st Jan 1978, must search backwards to      *)
  1426. ;(* get correct weekday.                         *)
  1427. CorrectBackwards
  1428.         move.l    #11,tmpmon
  1429.         move.l    #months,a1        table of lengths
  1430.         move.l    tmpmon,d0
  1431.         muls    #2,d0            word lengths
  1432.         add.l    d0,a1
  1433.         move.w    (a1),d5            get month length
  1434.         ;sub.l    #1,d5            month starts at 0
  1435.         move.l    d5,tmpday
  1436. ; while year > NewYear do begin
  1437. .year        move.l    #date,a0
  1438.         move.l    date_yr(a0),d3
  1439.         cmp.l    tmpyear,d3
  1440.         bge    .month
  1441. ;   if year is leap, retreat day2 by 2, else retreat by 1
  1442.         move.l    tmpyear,d0
  1443.         bsr    isleapyear        returns boolean result
  1444.         tst.l    d0
  1445.         beq    .notleap
  1446.         move.l    #1,d0
  1447.         bsr    RetreatWeekday
  1448. .notleap    move.l    #1,d0
  1449.         bsr    RetreatWeekday
  1450.         sub.l    #1,tmpyear
  1451.         bra    .year            end while {year}
  1452. ; while mon > NewMonth do begin
  1453. .month        move.l    #date,a0
  1454.         move.l    date_mon(a0),d2
  1455.         cmp.l    tmpmon,d2
  1456.         bge    .day
  1457. ;   get month length from table
  1458.         move.l    #months,a1        table of lengths
  1459.         move.l    tmpmon,d0
  1460.         muls    #2,d0            word lengths
  1461.         add.l    d0,a1
  1462.         move.w    (a1),d5            get month length
  1463.         sub.w    #1,d5
  1464. .loop1        move.l    #1,d0
  1465.         bsr    RetreatWeekday        move through month
  1466.         dbf    d5,.loop1
  1467.         sub.l    #1,tmpmon            
  1468.         bra    .month            end while {month}
  1469. ; while day > NewDay do begin
  1470. .day        move.l    #date,a0
  1471.         move.l    date_day1(a0),d1
  1472.         cmp.l    tmpday,d1
  1473.         bge    .foundday
  1474.         move.l    #1,d0
  1475.         bsr    RetreatWeekday        move backward another day
  1476.         sub.l    #1,tmpday
  1477.         bra    .day
  1478. .foundday    rts                end {day}
  1479.  
  1480.  
  1481.  
  1482. ;(* Gets the date in internal format, converts it to normal format, and  *)
  1483. ;(* displays it in the window as dd-mon-yy. Expects x,y position in      *)
  1484. ;(* dateXpos, dateYpos. Expects current window in displayhd         *)
  1485.  
  1486. DisplayDate    bsr    ClearDecString
  1487.         move.l    gfxbase,a6
  1488.         move.l    displayhd,a1
  1489.         move.l    50(a1),a1
  1490.         move.l    #1,d0            JAM2
  1491.         jsr    setDrMd(a6)        set mode
  1492.         move.l    displayhd,a1
  1493.         move.l    #3,d0
  1494.         bsr    pencolour        set orange pen
  1495.         move.l    #date,a0
  1496.         move.l    date_day1(a0),d0    day
  1497.         bsr    Convert
  1498.         move.w    dateXpos,d0
  1499.         move.w    dateYpos,d1
  1500.         move.l    displayhd,a1
  1501.         bsr    movepos
  1502.         move.w    #2,digits
  1503.         lea    decnumber,a0
  1504.         add.l    #2,a0
  1505.         bsr    DisplayDecimal        display day 
  1506.  
  1507.         move.w    dateXpos,d0
  1508.         add.w    #17,d0
  1509.         move.w    dateYpos,d1
  1510.         move.l    displayhd,a1
  1511.         bsr    movepos
  1512.         move.l    #date,a0
  1513.         move.l    date_mon(a0),d0        month
  1514.         muls    #3,d0
  1515.         lea    monthnames,a0
  1516.         add.l    d0,a0
  1517.         lea    decstring,a1
  1518.         move.b    #"-",(a1)+
  1519.         move.b    (a0)+,(a1)+
  1520.         move.b    (a0)+,(a1)+
  1521.         move.b    (a0),(a1)+
  1522.         move.b    #"-",(a1)
  1523.         lea    decstring,a0
  1524.         move.l    displayhd,a1
  1525.         move.w    #5,d0
  1526.         bsr    displaytext        display month 
  1527.  
  1528.         move.l    #0,decnumber        clear values
  1529.         move.l    #date,a0
  1530.         move.l    date_yr(a0),d0        year
  1531.         bsr    Convert
  1532.         move.w    dateXpos,d0
  1533.         add.w    #58,d0
  1534.         move.w    dateYpos,d1
  1535.         move.l    displayhd,a1
  1536.         bsr    movepos
  1537.         move.w    #4,digits
  1538.         lea    decnumber,a0
  1539.         bsr    DisplayDecimal        display year
  1540.  
  1541.         move.l    #date,a0
  1542.         move.l    date_day2(a0),d0    day of week
  1543.         muls    #6,d0            length of strings
  1544.         move.l    #daynames,a1        table of names
  1545.         add.l    d0,a1            get desired day
  1546.         lea    spare_text,a2        address of text
  1547.         move.w    #5,d1            length
  1548. .loop        move.b    (a1)+,(a2)+
  1549.         dbf    d1,.loop
  1550.         lea    spare_text,a0        string
  1551.         move.l    displayhd,a1
  1552.         move.w    #6,d0
  1553.         bsr    displaytext        display day 
  1554.         rts
  1555.  
  1556.  
  1557. ;(* Changes the date as a result of user selecting day forward or week   *)
  1558. ;(* forward. Expects number of days moved (1 or 7) in d0         *)
  1559.  
  1560. DateForward    bsr    AdvanceWeekday
  1561.         move.l    #date,a0
  1562.         move.l    date_mon(a0),d1        month
  1563.         move.l    d1,d4
  1564.         move.l    date_day1(a0),d2    day
  1565.         add.l    d0,d2            add number of days
  1566.         move.l    #months,a1        month lengths
  1567.         muls    #2,d4
  1568.         move.w    (a1,d4),d3        length of this month
  1569.         cmp.w    #28,d3
  1570.         bne    .notfeb
  1571.         move.l    date_yr(a0),d0        year
  1572.         bsr    IsLeapYear
  1573.         add.w    d0,d3            result 1 or 0 added
  1574. .notfeb        cmp.w    d2,d3            still in this month?
  1575.         bge    .ok
  1576.         sub.w    d3,d2                    
  1577.         add.w    #1,d1            one month forward
  1578.         cmp.w    #12,d1            end of year?
  1579.         blt    .ok
  1580.         move.l    #0,date_mon(a0)        month = Jan    
  1581.         add.l    #1,date_yr(a0)        increment year
  1582.         move.l    d2,date_day1(a0)    new date
  1583.         rts
  1584. .ok        move.l    d2,date_day1(a0)
  1585.         move.l    d1,date_mon(a0)
  1586.         rts
  1587.  
  1588.  
  1589. ;(* Changes the date forward by one day, displays change in main window     *)
  1590. DayForward    move.l    #1,d0
  1591.         bsr    DateForward
  1592.         move.w    #120,dateXpos
  1593.         move.w    #163,dateYpos
  1594.         move.l    windowhd,displayhd
  1595.         bsr    DisplayDate
  1596.         bsr    FindEntry
  1597.         move.l    a1,start_entry
  1598.         move.l    a1,page_start
  1599.         bsr    DisplayPages
  1600.         bra    reply
  1601.  
  1602.  
  1603. ;(* Changes the date forward by one week, displays change in main window *)
  1604. WeekForward    move.l    #7,d0
  1605.         bsr    DateForward
  1606.         move.w    #120,dateXpos
  1607.         move.w    #163,dateYpos
  1608.         move.l    windowhd,displayhd
  1609.         bsr    DisplayDate
  1610.         bsr    FindEntry
  1611.         move.l    a1,start_entry
  1612.         move.l    a1,page_start
  1613.         bsr    DisplayPages
  1614.         bra    reply
  1615.  
  1616.  
  1617. ;(* Moves the weekday (sun=0, mon=1 etc) forward by a number of days.     *)
  1618. ;(* Expects number of days in d0 (1 or 7).                 *) 
  1619. ;(* Reflects the change in date.                     *)
  1620. AdvanceWeekday    move.l    #date,a0
  1621.         move.l    date_day2(a0),d2    day (0=sun, 1=mon)
  1622.         add.l    d0,d2
  1623.         cmp.l    #6,d2
  1624.         ble    .dayfine
  1625.         sub.l    #7,d2            have gone into next week
  1626. .dayfine    move.l    d2,date_day2(a0)    reflect change in date    
  1627.         rts
  1628.  
  1629.  
  1630. ;(* Moves the weekday (sun=0, mon=1 etc) backward by a number of days.     *)
  1631. ;(* Expects number of days in d0 (1 or 7).                 *) 
  1632. ;(* Reflects the change in date.                     *)
  1633. RetreatWeekday    move.l    #date,a0
  1634.         move.l    date_day2(a0),d2    day (0=sun, 1=mon)
  1635.         cmp.l    #0,d2
  1636.         bne    .notsun
  1637.         move.l    #7,d2
  1638. .notsun        sub.l    d0,d2
  1639.         cmp.l    #0,d2
  1640.         bge    .dayfine
  1641.         add.l    #7,d2            have gone into next week
  1642. .dayfine    move.l    d2,date_day2(a0)    reflect change in date    
  1643.         rts
  1644.  
  1645.  
  1646. ;(* Changes the date as a result of user selecting day backward or week  *)
  1647. ;(* backward. Expects number of days moved (1 or 7) in d0         *)
  1648. DateBackward    bsr    RetreatWeekday        change the weekday
  1649.         move.l    #date,a0
  1650.         move.l    date_mon(a0),d1        month
  1651.         move.l    date_day1(a0),d2    day
  1652.         sub.l    d0,d2            number of days
  1653.         cmp.w    #0,d2            still this month?
  1654.         bgt    .ok
  1655.         sub.l    #1,d1            go back one month
  1656.         move.l    d1,d4            store
  1657.         cmp.l    #0,d1            still this year?
  1658.         bge    .yearok
  1659.         move.l    #11,date_mon(a0)    December
  1660.         add.l    #31,d2            set date
  1661.         move.l    d2,date_day1(a0)
  1662.         sub.l    #1,date_yr(a0)        go back one year
  1663.         rts
  1664. .yearok        move.l    #months,a1
  1665.         muls    #2,d4
  1666.         move.w    (a1,d4),d4        month length
  1667.         cmp.w    #28,d4
  1668.         bne    .notfeb
  1669.         move.l    date_yr(a0),d0        year
  1670.         bsr    IsLeapYear
  1671.         add.w    d0,d4            result 1 or 0 added
  1672. .notfeb        add.w    d4,d2            number of days
  1673. .ok        move.l    d2,date_day1(a0)        date
  1674.         move.l    d1,date_mon(a0)        month
  1675.         rts
  1676.         
  1677.  
  1678. ;(* Changes the date back by one day, displays change in main window     *)
  1679. DayBackward    move.l    #1,d0
  1680.         bsr    DateBackward
  1681.         move.w    #120,dateXpos
  1682.         move.w    #163,dateYpos
  1683.         move.l    windowhd,displayhd
  1684.         bsr    DisplayDate
  1685.         bsr    FindEntry
  1686.         move.l    a1,start_entry
  1687.         move.l    a1,page_start
  1688.         bsr    DisplayPages
  1689.         bra    reply
  1690.  
  1691.  
  1692. ;(* Changes the date back by one week, displays change in main window.     *)
  1693. WeekBackward    move.l    #7,d0
  1694.         bsr    DateBackward
  1695.         move.w    #120,dateXpos
  1696.         move.w    #163,dateYpos
  1697.         move.l    windowhd,displayhd
  1698.         bsr    DisplayDate
  1699.         bsr    FindEntry
  1700.         move.l    a1,start_entry
  1701.         move.l    a1,page_start
  1702.         bsr    DisplayPages
  1703.         bra    reply
  1704.  
  1705.  
  1706. ;(* Determines whether or not a year is a leap year. Expects year in d0  *)
  1707. ;(* Returns boolean value in d0.                     *)
  1708. IsLeapYear    divs    #4,d0
  1709.         swap    d0
  1710.         cmp.w    #0,d0            remainder = 0?
  1711.         beq    .isleap
  1712.         move.l    #0,d0
  1713.         rts
  1714. .isleap        move.l    #1,d0
  1715.         rts
  1716.  
  1717.  
  1718. ;(* Opens the Load Entry window, and returns to the main loop.         *)
  1719. SelectLE    bsr    ClearDateString
  1720.         bsr    OpenLEwind
  1721.         tst.l    d0
  1722.         beq    .error
  1723. .error        bra    reply
  1724.  
  1725.  
  1726. ;(* Closes the Lookup Entry window, and returns to the main display.     *)
  1727. CloseLE        bsr    CloseLEwind
  1728.         bra    finishmessage
  1729.  
  1730.  
  1731. ;(* Closes the Load File window, and returns to the main display.     *)
  1732. CloseLF        bsr    CloseLFwind
  1733.         bra    finishmessage
  1734.  
  1735.  
  1736. ;(* Closes the Save File window, and returns to the main display.     *)
  1737. CloseSF        bsr    CloseSFwind
  1738.         bra    finishmessage
  1739.  
  1740.  
  1741.  
  1742. ;(* Introduces blank characters into the string that is displayed as     *)
  1743. ;(* the date in the main and shrink windows.                 *)
  1744. ClearDateString
  1745.         move.l    #datebuffer,a0
  1746.         cmp.l    #0,a0
  1747.         beq    .error
  1748.         move.l    #0,(a0)+        clear string
  1749.         move.l    #0,(a0)+
  1750.         move.l    #0,(a0)+
  1751.         move.l    #0,(a0)+
  1752.         move.l    #0,(a0)+
  1753.         move.l    #0,(a0)+
  1754.         move.l    #0,(a0)+
  1755.         move.l    #0,(a0)+
  1756.         move.l    #0,(a0)+
  1757.         move.l    #date_sinfo,a0
  1758.         move.l    #0,28(a0)        clear numerical value
  1759. .error        rts
  1760.  
  1761.  
  1762. ;(* Gets the information from the integer gadget, and sets the date     *)
  1763. ;(* to that value. Also goes to that page of the diary.             *)
  1764.  
  1765. LookupDate    move.l    #date_sinfo,a0
  1766.         move.l    #datecopy,a1        
  1767.         move.l    28(a0),d0
  1768.         divs    #10000,d0        get day
  1769.         move.l    d0,d2            store
  1770.         and.l    #$ff,d0
  1771.         move.l    d0,date_day1(a1)    set day in buffer
  1772.         move.l    d2,d1
  1773.         swap     d1
  1774.         and.l    #$ffff,d1        mask lower half
  1775.         divs    #100,d1            get month
  1776.         move.l    d1,d2            store
  1777.         and.l    #$ff,d1
  1778.         sub.l    #1,d1            jan = 0 (remember?)
  1779.         move.l    d1,date_mon(a1)        set month in buffer
  1780.         move.l    d2,d0
  1781.         swap     d0
  1782.         and.l    #$ff,d0            get year
  1783.         cmp.l    #0,d0
  1784.         blt    .error
  1785.         cmp.l    #99,d0
  1786.         bgt    .error
  1787.         cmp.l    #30,d0
  1788.         blt    .2000
  1789.         add.l    #1900,d0        make 4 digits
  1790.         bra    .done
  1791. .2000        add.l    #2000,d0
  1792. .done        move.l    d0,date_yr(a1)        set year in buffer
  1793.         bsr    CheckDate
  1794.         cmp.l    #0,d0
  1795.         beq    .error
  1796.         move.l    #datecopy,a0        if date is valid
  1797.         move.l    #date,a1        copy from buffer
  1798.         move.l    (a0)+,(a1)+
  1799.         move.l    (a0)+,(a1)+
  1800.         move.l    (a0),(a1)
  1801.         move.w    #120,dateXpos
  1802.         move.w    #163,dateYpos
  1803.         move.l    windowhd,displayhd
  1804.         bsr    CorrectDay        set weekday
  1805.         bsr    DisplayDate
  1806.         bsr    FindEntry
  1807.         move.l    a1,start_entry
  1808.         move.l    a1,page_start
  1809.         bsr    DisplayPages
  1810.         bsr    CloseLEwind
  1811.         bra    finishmessage
  1812. .error        bsr    Openinvinpwind
  1813.         bra    finishmessage
  1814.  
  1815.  
  1816.  
  1817. ;(* Checks the validity of the day for a given month, eg. Feb 31st is     *)
  1818. ;(* invalid. Also checks month is in range Jan...Dec. Assumes validity     *)
  1819. ;(* of year lower half (00-99) to have been checked by calling routine.  *)
  1820. ;(* Expects date in datecopy (3 longwords yymmdd). Returns boolean      *)
  1821. ;(* result in d0.                              *)
  1822.  
  1823. CheckDate    move.l    #months,a0        month lengths
  1824.         move.l    #datecopy,a1
  1825.         move.l    date_mon(a1),d1
  1826.         cmp.l    #0,d1            < Jan?
  1827.         blt    .error
  1828.         cmp.l    #11,d1            > Dec?
  1829.         bgt    .error
  1830.         move.l    d1,d3            store month
  1831.         muls    #2,d1            must be even
  1832.         move.w    (a0,d1),d1        length
  1833.         cmp.l    #1,d3            Feb?
  1834.         bne    .notleap
  1835.         move.l    date_yr(a1),d0
  1836.         bsr    IsLeapYear        
  1837.         cmp.l    #0,d0
  1838.         beq    .notleap
  1839.         add.l    #1,d1            Feb 29th
  1840. .notleap    move.l    #datecopy,a1
  1841.         move.l    date_day1(a1),d0
  1842.         cmp.w    d0,d1            check day
  1843.         bge    .fine
  1844. .error        move.l    #0,d0            false
  1845.         rts
  1846. .fine        move.l    #1,d0            true
  1847.         rts
  1848.  
  1849.  
  1850. *-------------- DIARY TEXT ROUTINES -------------------------------------*
  1851.  
  1852.  
  1853. ;(* Handles the displaying of entries in the pages of the diary. Expects *)
  1854. ;(* address of first entry on the page in page_start.             *)
  1855.  
  1856. DisplayPages    bsr    BlankPages        clear previous entries
  1857.         bsr    SetPageFlags        
  1858.         bsr    SetPageMode
  1859.         move.w    #56,lineXpos        initial positions
  1860.         move.w    #22,lineYpos
  1861.         move.l    page_start,a1
  1862. .loop        cmp.l    #0,a1            no entry?
  1863.         beq    .noentries
  1864.         move.l    a1,a5            store
  1865.         move.w    lineXpos,d0
  1866.         sub.w    #36,d0            time is in left margin
  1867.         move.w    lineYpos,d1
  1868.         bsr    SetTimePos
  1869.         move.l    a5,a1            restore entry pointer
  1870.         bsr    DisplayEntryTime
  1871.         bsr    SetEntryPos        move cursor
  1872.         move.l    a5,a1            restore pointer
  1873.         bsr    DisplayEntry        display one entry
  1874.         btst    #pagebottom,flag4    limit reached?
  1875.         beq    .skip            no
  1876.         btst    #sidetwo,flag4        second half?
  1877.         bne    .endpage        yes
  1878.         btst    #splitentry,flag4    entry split at bottom?
  1879.         beq    .nosplit        no
  1880.         move.l    #19,leftmargin
  1881.         move.l    #180,rightmargin
  1882.         bsr     clearoldlines
  1883. .nosplit    move.w    #221,lineXpos        move to second page
  1884.         move.w    #22,lineYpos
  1885.         bset    #sidetwo,flag4
  1886.         btst    #splitentry,flag4    entry split at bottom?
  1887.         beq    .skip              no
  1888.         move.l    a5,a1            re-display last entry
  1889.         bra    .loop
  1890. ;(* Entry has been displayed, and no flags have been set. Find next     *)
  1891. ;(* entry and continue displaying page.                     *)
  1892. .skip        move.l    ent_next(a5),a1
  1893.         cmp.l    #0,a1            end of list?
  1894.         bne    .loop    
  1895.         bra    .backtostart
  1896.  
  1897. ;(* At this stage, bottom of the second half page has been reached.     *)
  1898. .endpage    btst    #splitentry,flag4    split entry?
  1899.         beq    .nosplit2        no
  1900.         move.l    #186,leftmargin
  1901.         move.l    #342,rightmargin
  1902.         bsr    clearoldlines
  1903.         move.l    a5,next_entry        start of next page
  1904.         rts
  1905. .nosplit2    move.l    ent_next(a5),a1
  1906.         cmp.l    #0,a1
  1907.         beq    .backtostart
  1908.         move.l    a1,next_entry        set start of next page
  1909.         rts
  1910. ;(* Here, the next entry in the list is nul, so set first entry for the     *)
  1911. ;(* day as the first entry on next page.                 *)
  1912. .backtostart    bsr    FindDay            result in a0
  1913.         move.l    day_entry(a0),next_entry first entry for day
  1914. ;                         set as start of next page
  1915. .noentries    rts                no entries on that page
  1916.  
  1917.  
  1918. ;(* Sets the drawing mode to JAM1, required to display the entries in      *)
  1919. ;(* the window.                                 *)
  1920. SetPageMode    move.l    gfxbase,a6
  1921.         move.l    windowhd,a1
  1922.         move.l    50(a1),a1
  1923.         move.l    #0,d0            JAM1
  1924.         jsr    setDrMd(a6)        set mode
  1925.         rts
  1926.  
  1927.  
  1928. ;(* Sets/Clears the relevant flags for the state of a page initially.     *)
  1929. SetPageFlags    bclr    #linebrk,flag1        line break
  1930.         bclr    #pagebottom,flag4
  1931.         bclr    #splitentry,flag4
  1932.         bclr    #sidetwo,flag4
  1933.         rts
  1934.  
  1935.  
  1936. ;(* Moves the cursor to the start of line position, to display the entry *)
  1937. ;(* time for a diary entry. Also changes the pen colour to orange.     *)
  1938. SetTimePos    move.l    windowhd,a1
  1939.         bsr    movepos            move cursor
  1940.         move.l    windowhd,a1
  1941.         move.l    #3,d0    
  1942.         bsr    pencolour        set orange pen
  1943.         rts
  1944.  
  1945.  
  1946. ;(* Moves the cursor to the start of line position, to display a diary     *)
  1947. ;(* entry. Also sets the pen colour to black.                 *)
  1948. SetEntryPos    move.w    lineXpos,d0
  1949.         move.w    lineYpos,d1
  1950.         move.l    windowhd,a1
  1951.         bsr    movepos
  1952.         move.l    windowhd,a1
  1953.         move.l    #2,d0    
  1954.         bsr    pencolour        set black pen
  1955.         rts
  1956.  
  1957.  
  1958. ;(* Removes traces of a split entry from its first location.         *)
  1959. clearoldlines    move.l    windowhd,a1
  1960.         move.l    #1,d0
  1961.         bsr    pencolour        set pen white
  1962.         move.w    entry_lines,d5        # of lines of text
  1963.         sub.w    #1,d5            because dbf
  1964.         add.w    #1,lineYpos
  1965. .blankloop    bsr    upline
  1966.         move.l    gfxbase,a6
  1967.         move.l    windowhd,a1
  1968.         move.l    50(a1),a1        rastport
  1969.         move.l    #0,d1
  1970.         move.l    leftmargin,d0        topleft x
  1971.         move.w    lineYpos,d1        topleft y
  1972.         move.w    d1,d3            bottomright y
  1973.         sub.w    #9,d1
  1974.         move.l    rightmargin,d2        bottomright x
  1975.         jsr    rectfill(a6)        fill 'pages'        
  1976.         dbf    d5,.blankloop
  1977.         move.l    intbase,a6
  1978.         move.l    #flip_gadget,a0
  1979.         move.l    windowhd,a1
  1980.         move.l    #0,a2
  1981.         move.l    #1,d0            number of gadgets
  1982.         jsr    refreshGlist(a6)
  1983.         rts
  1984.  
  1985.  
  1986. ;(* Flips to the next 'page' of the diary without changing the date.     *)
  1987. ;(* Necessary when there are too many entries for one page.         *)
  1988. FlipPage    move.l    next_entry,page_start
  1989.         bsr    DisplayPages
  1990.         bra    reply
  1991.  
  1992.  
  1993. ;(* Finds the pointer to the day structure for the day shown in the      *)
  1994. ;(* window date. Returns pointer to day in a0.                 *)
  1995. FindDay        move.l    calendar,a0        pointer to first year
  1996.         move.l    #date,a1        
  1997.         move.l    date_yr(a1),d0        get year    
  1998. .loop        cmp.l    #0,a0            end of list
  1999.         beq    .noentries
  2000.         move.w    yr_year(a0),d1        get year number eg. 1992
  2001.         cmp.w    d0,d1
  2002.         beq    .foundyear
  2003.         move.l    yr_next(a0),a0        pointer to next year
  2004.         bra    .loop
  2005. .foundyear    move.l    date_mon(a1),d0        get month
  2006.         muls    #4,d0
  2007.         add.l    #yr_list,a0        start of months
  2008.         move.l    (a0,d0),a0        pointer to month
  2009.         cmp.l    #0,a0            no month?
  2010.         beq    .noentries
  2011.         move.l    date_day1(a1),d0        get day from date
  2012.         move.w    #0,d1
  2013.         move.l    mon_day(a0),a0        pointer to day
  2014. .dayloop    cmp.l    #0,a0            
  2015.         beq    .noentries
  2016.         move.b    day_day(a0),d1        get day from day struct.
  2017.         cmp.w    d0,d1
  2018.         beq    .foundentry
  2019.         move.l    day_next(a0),a0        get next day
  2020.         bra    .dayloop
  2021. .foundentry    rts                address in a0
  2022. .noentries    move.l    #0,a0            set nul value
  2023.         rts
  2024.  
  2025.  
  2026. ;(* Finds the first entry for the day shown in the window date. Returns  *)
  2027. ;(* pointer to entry in a1                         *)
  2028. FindEntry    bsr    FindDay            get address in a0
  2029.         cmp.l    #0,a0            any entries?
  2030.         beq    .noentries
  2031.         move.l    day_entry(a0),a1    pointer to entry
  2032.         rts
  2033. .noentries    move.l    #0,a1            nul pointer
  2034.         rts
  2035.  
  2036.  
  2037.  
  2038. ;(* Displays a single entry in a diary page. Expects pointer to entry      *)
  2039. ;(* in a1.                                 *)
  2040.  
  2041. DisplayEntry    bclr    #pagebottom,flag4    clear overflow
  2042.         bset     #splitentry,flag4    assume split initially
  2043.         move.w    #0,entry_lines
  2044.         move.l    ent_text(a1),a0
  2045. .line        clr.w    d0
  2046.         clr.w    d1            number of chars
  2047.         move.b    (a0),d0
  2048.         cmp.w    #0,d0            end of text?
  2049.         beq    .break
  2050.         cmp.w    #" ",d0
  2051.         bne    .nospace        
  2052.         add.l    #1,a0            skip space at start
  2053. .nospace    move.l    a0,a2            store start of line
  2054. .loop        move.b    (a0)+,d0        inspect one char
  2055.         cmp.w    #0,d0            end of text?
  2056.         beq    .endtext
  2057.         addq    #1,d1
  2058.         cmp.w    #line_width,d1        line full?
  2059.         beq    .wholeline
  2060.         bra    .loop
  2061.     
  2062. .wholeline    clr.w    d2
  2063.         move.b    (a0)+,d2        complete word at EOL?
  2064.         cmp.w    #" ",d2
  2065.         beq    .okline
  2066.         cmp.w    #0,d2
  2067.         beq    .okline
  2068.         sub.l    #1,a0            go back one char
  2069. .backloop    cmp.w    #" ",d0            last char a space?
  2070.         beq    .okline
  2071.         subq    #1,d1            decrease width
  2072.         move.b    -(a0),d0
  2073.         cmp.l    a0,a2            back to start?
  2074.         bne    .backloop        search back through line
  2075.         move.l    #line_width,d1        full line
  2076.         add.l    #line_width,a0
  2077.  
  2078. .okline        move.l    a0,a4            start of next line
  2079.         move.l    a2,a0            start of this line
  2080.         move.l    d1,d0            number of chars
  2081.         bsr    displayline
  2082.         move.l    a4,a0
  2083.         bsr    downline        move down a line
  2084.         add.w    #1,entry_lines
  2085.         move.w    lineYpos,d1
  2086.         cmp.w    #page_limit,d1        over?
  2087.         bgt    .over
  2088.         bra    .line            do next line
  2089.  
  2090. .endtext    bclr    #splitentry,flag4    entry is not split
  2091.         move.l    a2,a0            start of line
  2092.         move.l    d1,d0            number of chars
  2093.         bsr    displayline
  2094.         bsr    downline
  2095.         add.w    #1,entry_lines
  2096. .break        bsr    downline
  2097.         add.w    #1,entry_lines
  2098.         move.w    lineYpos,d1
  2099.         cmp.w    #page_limit,d1
  2100.         bgt    .over
  2101.         rts
  2102. .over        bset    #pagebottom,flag4
  2103.         rts
  2104.  
  2105.  
  2106. ;(* Displays the entry time in the diary page. Expects entry address in  *)
  2107. ;(* a1.                                     *)
  2108. DisplayEntryTime
  2109.         move.w    ent_stat(a1),d0        get entry status
  2110.         btst    #timeyn,d0        time specified?
  2111.         beq    .out            no
  2112.         move.w    ent_time(a1),d0        get time combination
  2113.         move.l    #spare_text,a0        text string
  2114.         divs    #100,d0            get HOURS
  2115.         move.l    d0,d1
  2116.         and.l    #$ffff,d0        mask out remainder
  2117.         divs    #10,d0            split digits
  2118.         add.w    #$30,d0            convert to ASCII
  2119.         move.b    d0,(a0)            copy to text string
  2120.         swap    d0            get other digit
  2121.         add.w    #$30,d0
  2122.         move.b    d0,1(a0)
  2123.  
  2124.         swap    d1            get MINUTES (remainder)
  2125.         and.l    #$ffff,d1        mask out upper half
  2126.         divs    #10,d1            split digits
  2127.         add.w    #$30,d1
  2128.         move.b    d1,2(a0)
  2129.         swap    d1            get other digit
  2130.         add.w    #$30,d1
  2131.         move.b    d1,3(a0)
  2132.  
  2133.         move.l    #4,d0            number of chars        
  2134.         bsr    DisplayLine
  2135.         rts
  2136. .out        btst    #linebrk,flag1        line break displayed?
  2137.         bne    .nobreak
  2138.         bset    #linebrk,flag1
  2139.         move.w    #line_width,d0
  2140.         add.w    #5,d0
  2141.         move.l    #line_break,a0
  2142.         bsr    displayline
  2143.         bsr    downline
  2144. .nobreak    rts
  2145.  
  2146.  
  2147. ;(* Moves the text cursor down one line                     *)
  2148. downline    add.w    #10,lineYpos
  2149.         move.w    lineXpos,d0
  2150.         move.w    lineYpos,d1
  2151.         move.l    windowhd,a1
  2152.         bsr    movepos            
  2153.         rts
  2154.  
  2155.  
  2156. ;(* Moves the text cursor up one line                     *)
  2157. upline        sub.w    #10,lineYpos
  2158.         move.w    lineXpos,d0
  2159.         move.w    lineYpos,d1
  2160.         move.l    windowhd,a1
  2161.         bsr    movepos            
  2162.         rts
  2163.  
  2164.  
  2165. ;(* Displays a single line of text for a diary entry. Expects pointer to *)
  2166. ;(* to text in a0, number of chars in d0                 *)
  2167.  
  2168. DisplayLine    move.l    windowhd,a1
  2169.         bsr    displaytext        
  2170.         rts
  2171.  
  2172.  
  2173. ;(* Changes the time option on/off for diary entries.             *)
  2174. TimeOption    bchg    #timeyn,flag1
  2175.         bra    reply
  2176.  
  2177.  
  2178. *-------------- ADD ENTRY ROUTINES --------------------------------------*
  2179.  
  2180. ;(* Opens the Add Entry window, and returns to main loop.         *)
  2181. SelectAE    bsr    ClearEntryString
  2182.         bsr    OpenAEwind
  2183.         tst.l    d0
  2184.         beq    .error
  2185.         bsr    SetUpAEDisplay
  2186. .error        bra    reply
  2187.  
  2188.  
  2189. ;(* Replies to the message, closes the Add Entry window, and returns to     *)
  2190. ;(* the main loop.                             *)
  2191. CloseAE        bsr    CloseAEwind
  2192.         bra    finishmessage
  2193.  
  2194. ;(* Takes appropriate action when CR is hit in the Add Entry window.     *)
  2195. ;(* The program moves through each of the string gadgets, then acts as     *)
  2196. ;(* if OK had been selected.                         *)
  2197. AddEntryCR    btst    #timeyn,flag1        if time OFF, do not need
  2198.         beq    InsertAnEntry        to check hrs/mins
  2199.         btst    #strgad,flag3        first gadget?
  2200.         bne    .acthrs            yes, activate hours gadget
  2201.         btst    #hrsgad,flag3        second gadget?
  2202.         bne    .actmins        yes, activate mins gadget
  2203.         bra    InsertAnEntry        as gadget $20
  2204. .acthrs        move.l    intbase,a6
  2205.         move.l    #hours_sgadget,a0    gadget
  2206.         move.l    aehd,a1            window
  2207.         move.l    #0,a2            requestor (nil)
  2208.         jsr    activategadget(a6)
  2209.         bclr    #strgad,flag3        set gadget flags ... 
  2210.         bset    #hrsgad,flag3        ... appropriately
  2211.         bclr    #minsgad,flag3
  2212.         bra    .out
  2213. .actmins    move.l    intbase,a6
  2214.         move.l    #mins_sgadget,a0    gadget
  2215.         move.l    aehd,a1            window
  2216.         move.l    #0,a2            requestor (nil)
  2217.         jsr    activategadget(a6)
  2218.         bclr    #hrsgad,flag3
  2219.         bset    #minsgad,flag3
  2220.         bclr    #strgad,flag3
  2221. .out        bra    reply
  2222.  
  2223.  
  2224. ;(* Introduces blank characters into the add entry string gadgets.     *)
  2225. ClearEntryString
  2226.         move.l    #entrybuffer,a0        clear string buffer
  2227.         moveq    #71,d0
  2228. .loop        move.b    #0,(a0)+
  2229.         dbf    d0,.loop
  2230.         move.l    #hoursbuffer,a0
  2231.         move.l    #0,(a0)+        clear hours
  2232.         move.l    #0,(a0)+
  2233.         move.l    #0,(a0)
  2234.         move.l    #minsbuffer,a0
  2235.         move.l    #0,(a0)+        clear mins
  2236.         move.l    #0,(a0)+
  2237.         move.l    #0,(a0)
  2238.         move.l    #hours_sinfo,a0
  2239.         move.l    #0,28(a0)
  2240.         move.l    #mins_sinfo,a0
  2241.         move.l    #0,28(a0)
  2242.         rts
  2243.  
  2244.  
  2245. ;(* Clears the current user selection from the add entry window.     *)
  2246. ClearInput    bsr    ClearEntryString
  2247.         move.l    intbase,a6
  2248.         move.l    #entry_sgadget,a0
  2249.         move.l    AEhd,a1
  2250.         move.l    #0,a2
  2251.         move.l    #3,d0            number of gadgets
  2252.         jsr    refreshGlist(a6)
  2253.         bra    reply
  2254.  
  2255.  
  2256. ;(* Deals with the whole process of creating an entry from the info      *)
  2257. ;(* provided by the user in the Add Entry window, and inserting the      *)
  2258. ;(* entry into the diary.                         *)
  2259.  
  2260. InsertAnEntry    bsr    CheckInputs
  2261.         btst    #requestop,flag2    Error requestor
  2262.         bne    .error            yes
  2263.         bsr    CloseAEwind
  2264.         move.l    #date,a0
  2265.         move.l    date_yr(a0),d0        year (today)
  2266.         move.l    date_yr(a0),d4        store
  2267.         bsr    YearExists
  2268.         cmp.l    #1,d1
  2269.         beq    .year
  2270. .noyear        move.l    d4,d0
  2271.         bsr    ReserveYear        returns address in a1
  2272. .year        move.l    a1,a4            store
  2273.         move.l    #date,a0
  2274.         move.l    date_mon(a0),d0        month (today)
  2275.         move.l    date_mon(a0),d4        store
  2276.         move.l    a1,a0            year address
  2277.         bsr    MonthExists        returns address in a1
  2278.         cmp.l    #1,d1
  2279.         beq    .month
  2280. .nomonth    move.l    a4,a0            year address
  2281.         move.l    d4,d0            month 
  2282.         bsr    ReserveMonth
  2283. .month        move.l    #date,a0
  2284.         move.l    date_day1(a0),d0    day (today)
  2285.         move.l    a1,a0            month address
  2286.         move.l    a1,a4            store
  2287.         bsr    DayExists        returns address in a1
  2288.         cmp.l    #1,d1
  2289.         bne    .noday
  2290.         move.l    a1,a4            save address 
  2291.         bra    .day
  2292. .noday        bsr    CreateDay        returns address in d0
  2293.         move.l    a4,a0            month address
  2294.         move.l    d0,a1            day address
  2295.         move.l    d0,a4            store
  2296.         bsr    InsertDay
  2297. .day        bclr    #editinp,flag1        Take inputs from AE window
  2298.         bsr    ReserveEntry        result in d0
  2299.         move.l    d0,a1            entry address
  2300.         move.l    a4,a0            day address
  2301.         move.l    a0,daystore
  2302.         bsr    InsertEntry
  2303.         bsr    DisplayPages
  2304. .error        bra    finishmessage                
  2305.  
  2306.  
  2307.  
  2308. ;(* Checks the validity of the inputs for an entry made by the user in      *)
  2309. ;(* the add entry window.                         *)
  2310.  
  2311. CheckInputs    move.l    #hours_sinfo,a0
  2312.         move.l    28(a0),d0        get hours value
  2313.         cmp.l    #23,d0
  2314.         bgt    .error
  2315.         cmp.l    #0,d0
  2316.         blt    .error
  2317.         move.l    #mins_sinfo,a0
  2318.         move.l    28(a0),d0        get mins value
  2319.         cmp.l    #59,d0
  2320.         bgt    .error
  2321.         cmp.l    #0,d0
  2322.         blt    .error
  2323.         rts                inputs fine
  2324. .error        bsr    OpenInvInpwind        invalid inputs
  2325.         rts
  2326.  
  2327.  
  2328.  
  2329. ;(* Inserts a day into a month. Expects month in a0, day in a1           *)
  2330.  
  2331. InsertDay    clr.w    d0
  2332.         move.b    mon_number(a0),d0    number of entries
  2333.         cmp.w    #0,d0            empty?
  2334.         bne    .notempty
  2335.         move.b    #1,mon_number(a0)    trivial case
  2336.         move.l    a1,mon_day(a0)
  2337.         rts
  2338. .notempty    clr.w    d0
  2339.         move.b    day_day(a1),d0        date of new day
  2340.         move.l    a0,a3            store previous
  2341.         move.l    mon_day(a0),a2        pointer to first day
  2342. .scan        clr.w    d1
  2343.         move.b    day_day(a2),d1        date of day in list
  2344.         cmp.w    d1,d0
  2345.         blt    .found
  2346.         move.l    a2,a3            store previous
  2347.         move.l    day_next(a2),a2        next day in list
  2348.         cmp.l    #0,a2            end of list?
  2349.         bne     .scan            no
  2350.         move.l    a1,day_next(a3)        yes
  2351.         rts
  2352. .found        move.l    day_next(a3),day_next(a1)
  2353. ;                        pointer to next day
  2354.         move.l    a1,day_next(a3)        insert our day
  2355.         rts
  2356.  
  2357.  
  2358. ;(* Inserts an entry into the entry list for a particular day. Expects   *)
  2359. ;(* address of day in a0, address of entry in a1                 *)
  2360.  
  2361. InsertEntry    move.l    day_entry(a0),d0    pointer to list of entries
  2362.         cmp.l    #0,d0            empty list?
  2363.         bne    .notempty
  2364.         move.l    a1,day_entry(a0)    trivial case
  2365.         move.l    a1,start_entry        first entry on page
  2366.         move.l    a1,next_entry
  2367.         move.l    a1,page_start
  2368.         rts
  2369. .notempty    move.w    ent_stat(a1),d1        status
  2370.         btst    #timeyn,d1        time specified?
  2371.         beq    .notime            no (add to end of list)
  2372. ; if the first entry in the list has no time specified, and the new 
  2373. ; entry does, then insert at the start.
  2374. .time        move.l    day_entry(a0),a2    first entry
  2375.         move.w    ent_stat(a2),d1        status
  2376.         btst    #timeyn,d1        time specified?
  2377.         bne    .findplace        yes
  2378.         move.l    a2,ent_next(a1)
  2379.         move.l    a1,day_entry(a0)    insert at start
  2380.         move.l    a1,start_entry        set first entry
  2381.         move.l    a1,next_entry        start of next page
  2382.         move.l    a1,page_start        and page start
  2383.         rts
  2384. ; New entry does not go at the start or end, so scan through list 
  2385. ; until a correct time slot is found, or until the next entry has no 
  2386. ; time, in which case insert there.
  2387. .findplace    move.l    day_entry(a0),a2    address of entry list
  2388.         move.l    a0,a3            store previous
  2389. .scanlist    move.w    ent_stat(a2),d0        entry status
  2390.         btst    #timeyn,d0        time specified?
  2391.         beq    .found            no
  2392.         move.w    ent_time(a2),d0        time of entry
  2393.         move.w    ent_time(a1),d1        time of new entry
  2394.         cmp.w    d0,d1
  2395.         ble    .found
  2396.         move.l    a2,a3            store previous
  2397.         move.l    ent_next(a2),a2        next entry
  2398.         cmp.l    #0,a2            end of list?
  2399.         beq    .listend        yes
  2400.         bra    .scanlist
  2401. .listend    move.l    a1,ent_next(a3)        add new entry to end of 
  2402.         rts                list
  2403. .found        move.l    ent_next(a3),ent_next(a1)
  2404.         move.l    a1,ent_next(a3)        insert our new entry
  2405.         cmp.l    daystore,a3        start of list?
  2406.         bne    .endfound        no
  2407.         move.l    a1,start_entry        yes, set first entry
  2408.         move.l    a1,next_entry
  2409.         move.l    a1,page_start        and page start
  2410. .endfound    rts
  2411. .notime        move.l    day_entry(a0),a2    first entry
  2412. .loop        move.l    a2,a3            copy pointer
  2413.         move.l    ent_next(a2),a2        next entry
  2414.         cmp.l    #0,a2            end of list?
  2415.         bne    .loop            no
  2416.         bra    .listend        yes
  2417.  
  2418.  
  2419.  
  2420. ;(* Creates a diary entry from the information supplied by the user in   *)
  2421. ;(* the add entry window. Returns address of entry in d0, returns 0      *)
  2422. ;(* (error) if there was no memory.                          *)
  2423. ;(* Uses Add Entry inputs if bit clear, otherwise use Edit Entry inputs  *)
  2424. ReserveEntry    btst    #editinp,flag1        which window inputs?
  2425.         bne    .edit            edit entry window
  2426.         move.l    #entrybuffer,a0        add entry window
  2427.         bra    .add
  2428. .edit        move.l    #editentrybuffer,a0
  2429. .add        clr.l    d0            number of bytes
  2430. .loop        clr.l    d1
  2431.         move.b    (a0)+,d1
  2432.         cmp.w    #0,d1            end of string?
  2433.         beq    .done            yes
  2434.         addq    #1,d0
  2435.         bra    .loop
  2436. .done        addq    #1,d0            this adds nul char at eot
  2437.         move.l    d0,d3            store size
  2438.         move.l    execbase,a6        number of bytes in d0
  2439.         move.l    #$10000,d1        clear & reserve
  2440.         jsr    allocmem(a6)    
  2441.         cmp.l    #0,d0            enough memory?
  2442.         beq    .nomem
  2443.         move.l    d0,d2            store address
  2444.         bsr    CreateEntry
  2445.         cmp.l    #0,d0            enough memory?
  2446.         beq    .nomem
  2447.         move.l    d0,a0            address of entry
  2448.         move.l    d2,ent_text(a0)        pointer to text block        
  2449.         move.w    d3,ent_txt_size(a0)    size of text block (bytes)
  2450.         btst    #editinp,flag1        which inputs?
  2451.         bne    .edit1
  2452.         move.l    #entrybuffer,a1        source
  2453.         bra    .add1
  2454. .edit1        move.l    #editentrybuffer,a1
  2455. .add1        move.l    d2,a2            destination
  2456.         sub.l    #1,d3            counter
  2457. .cloop        move.b    (a1)+,(a2)+        copy text to memory
  2458.         dbf    d3,.cloop
  2459.         btst    #timeyn,flag1        time yes/no
  2460.         beq    .out
  2461.         move.w    #%00000100,ent_stat(a0)    set time yes
  2462.         move.l    #hours_sinfo,a1
  2463.         move.l    28(a1),d0        get hours from gadget
  2464.         muls    #100,d0
  2465.         move.l    #mins_sinfo,a1        get mins from gadget
  2466.         add.l    28(a1),d0    
  2467.         move.w    d0,ent_time(a0)        put in entry
  2468. .out        move.l    a0,d0            address of entry
  2469. .nomem        rts
  2470.  
  2471.  
  2472.  
  2473. ;(* Determines the existence of a day in the month                     *)
  2474. ;(* Expects day (date, eg. 16) as a word passed in d0, month address in  *)
  2475. ;(* a0. Returns result in d1, address of day in a1                     *)
  2476.  
  2477. DayExists    move.l    mon_day(a0),a0        pointer to first (used) day
  2478.         cmp.l    #0,a0            empty list?
  2479.         beq    .notpresent        yes
  2480. .scanlist    clr.l    d2
  2481.         move.b    day_day(a0),d2        date
  2482.         cmp.w    d0,d2
  2483.         beq    .present
  2484.         move.l    day_next(a0),a0        next day
  2485.         cmp.l    #0,a0            end of list?
  2486.         bne    .scanlist        no
  2487. .notpresent    move.l    #0,d1
  2488.         rts
  2489. .present     move.l    #1,d1
  2490.         move.l    a0,a1            address of day
  2491.         rts
  2492.  
  2493.  
  2494. ;(* Determines the existence of a month in a particular year.            *)
  2495. ;(* Expects month in d0 (0 = jan, 1 = feb, etc.), address of year in a0  *)
  2496. ;(* Returns d1 as exists yes/no, address of month in a1             *)
  2497.  
  2498. MonthExists    add.l    #yr_list,a0        start of months
  2499.         muls    #4,d0
  2500.         move.l    (a0,d0),a1
  2501.         cmp.l    #0,a1
  2502.         beq    .notexists
  2503. .exists        move.l    #1,d1
  2504.         rts
  2505. .notexists    move.l    #0,d1
  2506.         rts
  2507.  
  2508.  
  2509. ;(* Creates a new month and inserts it into month list for that year.     *)
  2510. ;(* Does not check for duplicates.                      *)
  2511. ;(* Expects month in d0, address of year in a0                 *)
  2512. ;(* Returns address of month in a1                     *)
  2513.  
  2514. ReserveMonth    move.l    a0,a1
  2515.         add.l    #yr_list,a1        start of months
  2516.         muls    #4,d0
  2517.         add.l    d0,a1            address of our month
  2518.         move.l    a1,a2
  2519.         bsr    CreateMonth
  2520.         move.l    d0,(a2)            insert address into list
  2521.         move.l    d0,a1
  2522.         rts
  2523.  
  2524.  
  2525. ;(* Determines the existence of a year in the calendar list.             *)
  2526. ;(* Expects year passed in d0.                          *)
  2527. ;(* Returns result in d1, address of year in a1                     *)
  2528.  
  2529. YearExists    move.l    calendar,a1        assume year in d0
  2530.         cmp.l    #0,a1
  2531.         beq    .notpresent        empty list
  2532. .scanlist    move.w    yr_year(a1),d1        year date eg. 1992
  2533.         cmp.w    d0,d1
  2534.         beq    .present
  2535.         move.l    yr_next(a1),a1        next entry
  2536.         cmp.l    #0,a1            nil pointer? (end of list)
  2537.         bne    .scanlist
  2538. .notpresent    move.l    #0,d1            year does not exist
  2539.         rts
  2540. .present    move.l    #1,d1            year does exist
  2541.         rts
  2542.  
  2543.  
  2544. ;(* Creates a new year and inserts it into calendar list. Does not check *)
  2545. ;(* for duplicates. Expects year in d0, returns address of year in a1    *)
  2546.  
  2547. ReserveYear    move.w    d0,year
  2548.         move.l    #calendar,a1
  2549.         move.l    a1,a4            store
  2550.         move.l    cal_year(a1),a2        address of year
  2551.         cmp.l    #0,a2            no years yet?
  2552.         beq    .empty            no, insert at start
  2553.         move.l    a1,yearstore
  2554. ;(* Search through list of years until a place is found (new year < year) *)
  2555. ;(* or the end of the list is reached - new year goes at end.           *)
  2556. ;(* loop invariant :  {(listyear.next <> null) and (new year > year)}     *)
  2557. .yrloop        move.w    yr_year(a2),d1        year number
  2558.         cmp.w    d0,d1
  2559.         bgt    .foundplace
  2560.         move.l    yr_next(a2),a0        next year
  2561.         cmp.l    #0,a0            end of list?
  2562.         beq    .foundend
  2563.         move.l    a2,yearstore        store tmp
  2564.         move.l    a0,a2            get next year
  2565.         bra    .yrloop            continue searching
  2566. ;(* At this point, the end of the years list has been reached, so insert *)
  2567. ;(* our new year at the end.                         *)
  2568. .foundend    move.l    a2,a4            store year
  2569.         bsr    CreateYear
  2570.         cmp.l    #0,d0
  2571.         beq    .error
  2572.         move.l    d0,a1
  2573.         move.w    year,yr_year(a1)    set year number
  2574.         move.l    d0,yr_next(a4)        end of list points to
  2575.         rts                new year
  2576. ;(* At this point, the new year has found to be less than the year at     *)
  2577. ;(* this point in the years list. Now we must insert the new year into   *)
  2578. ;(* the list.                                 *)
  2579. .foundplace    move.l    a2,a4            store current year
  2580.         bsr    CreateYear
  2581.         cmp.l    #0,d0
  2582.         beq    .error
  2583.         move.l    d0,a1
  2584.         move.w    year,yr_year(a1)
  2585.         move.l    yearstore,a2        tmp
  2586.         move.l    a4,yr_next(a1)
  2587.         move.l    a1,yr_next(a2)
  2588.         rts
  2589. ;(* At this point, years list was empty, so insert new year as the head  *)
  2590. ;(* of a previously empty list.                             *)
  2591. .empty        bsr    CreateYear        ^year in d0
  2592.         cmp.l    #0,d0
  2593.         beq    .error
  2594.         move.l    d0,a1
  2595.         move.w    year,yr_year(a1)
  2596.         move.l    d0,cal_year(a4)        list is new year only
  2597. ;(* Could not get memory for year, so exit.                 *)
  2598. .error        rts
  2599.  
  2600.                 
  2601.  
  2602. ;(* Allocs block of memory for 1 year, returns address in d0          *)
  2603. CreateYear    move.l    execbase,a6
  2604.         move.l    #yr_size,d0        size in bytes
  2605.         move.l    #$10000,d1        clear & reserve
  2606.         jsr    allocmem(a6)
  2607.         rts
  2608.  
  2609.  
  2610. ;(* Allocs block of memory for 1 month, returns address in d0         *)
  2611. CreateMonth    move.l    execbase,a6
  2612.         move.l    #mon_size,d0        size in bytes
  2613.         move.l    #$10000,d1        clear & reserve
  2614.         jsr    allocmem(a6)
  2615.         rts
  2616.  
  2617.  
  2618. ;(* Allocs block of memory for 1 day, returns address in d0          *)
  2619. ;(* Also set current date in day structure.                 *)
  2620. CreateDay    move.l    execbase,a6
  2621.         move.l    #day_size,d0        size in bytes
  2622.         move.l    #$10000,d1        clear & reserve
  2623.         jsr    allocmem(a6)
  2624.         cmp.l    #0,d0
  2625.         beq    .error
  2626.         move.l    d0,a0
  2627.         move.l    #date,a1
  2628.         move.l    date_day1(a1),d1        get today's date
  2629.         move.b    d1,day_day(a0)        put date in day
  2630. .error        rts
  2631.  
  2632.  
  2633.  
  2634. ;(* Allocs block of memory for 1 entry, returns address in d0         *)
  2635. CreateEntry    move.l    execbase,a6
  2636.         move.l    #ent_size,d0        size in bytes for entry
  2637.         move.l    #$10000,d1
  2638.         jsr    allocmem(a6)
  2639.         rts
  2640.  
  2641.  
  2642. *-------------- REMOVE STRUCTURES ROUTINES ------------------------------*
  2643.  
  2644.  
  2645. ;(* Clears all calendar structures and gives back reserved memory using  *)
  2646. ;(* a depth first search.                         *)
  2647.  
  2648. DFS        move.l    calendar,a0        start
  2649. .loop        cmp.l    #0,a0            end?
  2650.         beq    .done
  2651.         move.l    a0,yearstore        store
  2652.         bsr    FreeYear        search deeper...
  2653.         move.l    yearstore,a1
  2654.         move.l    yr_next(a1),a5        store next year
  2655.         move.l    #yr_size,d0
  2656.         bsr    freeup            de-allocate year structure
  2657.         move.l    a5,a0            get next
  2658.         bra    .loop
  2659. .done        move.l    #0,calendar
  2660.         rts
  2661.  
  2662.  
  2663. ;(* Clears the scribblepad structures and gives back reserved memory.     *)
  2664. ScribClear    move.l    scribble,a0        start
  2665. .loop        cmp.l    #0,a0            end?
  2666.         beq    .done
  2667.         move.l    a0,a5            store
  2668.         move.l    scribent_text(a0),a1
  2669.         move.l    #0,d0
  2670.         move.w    scribent_txt_size(a0),d0
  2671.         bsr    freeup            free text mem
  2672.         move.l    a5,a1
  2673.         move.l    #scribent_size,d0
  2674.         move.l    scribent_next(a5),a5    store next
  2675.         bsr    freeup            free entry mem
  2676.         move.l    a5,a0            get next
  2677.         bra    .loop
  2678. .done        move.l    #0,scribble
  2679.         rts
  2680.  
  2681.  
  2682.  
  2683. ;(* Frees all months for a year. Expects year in a0.             *)
  2684.  
  2685. FreeYear    move.l    #0,monthsoff        pointer offset
  2686.         add.l    #yr_list,a0        start of months
  2687.         move.l    a0,monthsbase        store base
  2688.         move.l    monthsoff,d0
  2689. .loop        move.l    monthsbase,a0
  2690.         move.l    (a0,d0),a0        pointer to month
  2691.         cmp.l    #0,a0
  2692.         beq    .next
  2693.         move.l    a0,monthstore        
  2694.         bsr    FreeMonth        search deeper...
  2695.         move.l    monthstore,a1
  2696.         move.l    #mon_size,d0
  2697.         bsr    freeup            free month structure
  2698. .next        move.l    monthsoff,d0
  2699.         add.l    #4,d0            next month
  2700.         move.l    d0,monthsoff        update
  2701.         cmp.l    #48,d0            end of months?
  2702.         bne    .loop
  2703.         rts
  2704.  
  2705.  
  2706.  
  2707. ;(* Frees all days for a month. Expects month in a0.             *)
  2708.  
  2709. FreeMonth    move.l    mon_day(a0),a0        pointer to first day
  2710. .loop        cmp.l    #0,a0            end?
  2711.         beq    .done
  2712.         move.l    a0,daystore        store
  2713.         bsr    FreeDay            search deeper...
  2714.         move.l    daystore,a1
  2715.         move.l    day_next(a1),a5        store next day
  2716.         move.l    #day_size,d0
  2717.         bsr    freeup            free day structure mem
  2718.         move.l    a5,a0            get next 
  2719.         bra    .loop
  2720. .done        rts
  2721.  
  2722.  
  2723.  
  2724. ;(* Frees all entries for a day. Expects day in a0.             *)
  2725.  
  2726. FreeDay        move.l    day_entry(a0),a0    pointer to first day
  2727. .loop        cmp.l    #0,a0            end?
  2728.         beq    .done
  2729.         move.l    a0,entrystore        store
  2730.         bsr    FreeEntry        search deeper...
  2731.         move.l    entrystore,a1
  2732.         move.l    ent_next(a1),a5        store next entry
  2733.         move.l    #ent_size,d0
  2734.         bsr    freeup            free entry structure mem
  2735.         move.l    a5,a0            get next
  2736.         bra    .loop
  2737. .done        rts
  2738.  
  2739.  
  2740.  
  2741. ;(* Frees memory for an entry. Expects entry in a0.             *)
  2742.  
  2743. FreeEntry    move.l    ent_text(a0),a1
  2744.         cmp.l    #0,a1            no text?
  2745.         beq    .done
  2746.         move.l    #0,d0
  2747.         move.w    ent_txt_size(a0),d0    size of reserved block
  2748.         bsr    freeup
  2749. .done        rts
  2750.  
  2751.  
  2752.  
  2753. ;(* De-allocates a block of reserved memory. Expects memory address in      *)
  2754. ;(* a1, size of block (bytes) in d0.                     *)
  2755.  
  2756. freeup        move.l    execbase,a6
  2757.         jsr    freemem(a6)
  2758.         rts
  2759.  
  2760.  
  2761.  
  2762. *-------------- EXTERNAL FILE ROUTINES ----------------------------------*
  2763.  
  2764.  
  2765. ;(* Opens the Save File window, and returns to the main loop.         *)
  2766. Save        bsr    OpenSFwind
  2767.         bra    reply
  2768.  
  2769.  
  2770. ;(* Writes the entire diary contents, including ScribblePad, to an     *)
  2771. ;(* external file.                             *)
  2772. SaveFile    move.l    #mode_new,d2
  2773.         bsr    openfile
  2774.         tst.l    d0
  2775.         beq    .error            put requestor here
  2776.         bsr    writeheader
  2777.         move.l    calendar,a0
  2778. .yrloop        cmp.l    #0,a0
  2779.         beq    .out            
  2780.         bsr    SaveYear
  2781.         bra    .yrloop            repeat for other years
  2782. .out        bsr    SaveScribble
  2783.         move.l    #filestop_code,d2
  2784.         move.l    #1,d3
  2785.         bsr    writefile
  2786.         bsr    closefile
  2787.         bsr    CloseSFwind
  2788.         bra    finishmessage
  2789. .error        bsr    OpenBadFilewind
  2790.         bra    finishmessage
  2791.         
  2792.  
  2793.  
  2794. ;(* Writes a year to a disk file. Expects year in a0. Returns next year     *)
  2795. ;(* in a0.                                  *) 
  2796. SaveYear    move.l    a0,yearstore        store
  2797.         move.l    #year_code,d2
  2798.         move.l    #1,d3
  2799.         bsr    writefile        write year identifier
  2800.         move.l    yearstore,a0
  2801.         move.w    yr_year(a0),d2
  2802.         move.w    d2,buffer
  2803.         move.l    #buffer,d2
  2804.         move.l    #2,d3
  2805.         bsr    writefile        write year number
  2806.         move.l    yearstore,a0
  2807.         move.l    #0,monthsoff        clear offset
  2808.         add.l    #yr_list,a0        start of months
  2809.         move.l    a0,monthsbase        store
  2810.         move.l    monthsoff,d0
  2811. .loop        move.l    monthsbase,a0        
  2812.         move.l    (a0,d0),a0        get month
  2813.         cmp.l    #0,a0
  2814.         beq    .next
  2815.         divs    #4,d0
  2816.         lsl    #8,d0            shift 1 byte left
  2817.         move.l    a0,monthstore
  2818.         bsr    SaveMonth
  2819. .next        move.l    monthsoff,d0
  2820.         add.l    #4,d0
  2821.         move.l    d0,monthsoff
  2822.         cmp.l    #48,d0            end of year?
  2823.         bne    .loop
  2824.         move.l    yearstore,a0
  2825.         move.l    (a0),a0
  2826.         rts
  2827.  
  2828.  
  2829. ;(* Writes a month to a disk file. Expects month pointer in a0, month    *)
  2830. ;(* number in d0.                             *)
  2831. SaveMonth    move.w    d0,buffer        store
  2832.         move.l    #month_code,d2
  2833.         move.l    #1,d3
  2834.         bsr    writefile        month identifier code
  2835.         move.l    #buffer,d2
  2836.         move.l    #1,d3
  2837.         bsr    writefile        month number (jan=0, etc)
  2838.         move.l    monthstore,a0
  2839.         move.l    mon_day(a0),a0
  2840. .loop        cmp.l    #0,a0
  2841.         beq    .out
  2842.         move.l    a0,daystore
  2843.         bsr    SaveDay
  2844.         move.l    daystore,a0
  2845.         move.l    day_next(a0),a0
  2846.         bra    .loop
  2847. .out        rts
  2848.             
  2849.  
  2850.  
  2851. ;(* Writes a day to a disk file. Expects pointer to day in a0.         *)
  2852. SaveDay        move.w    day_day(a0),d0
  2853.         move.w    d0,buffer        store date
  2854.         move.l    #day_code,d2
  2855.         move.l    #1,d3
  2856.         bsr    writefile        day identifier code
  2857.         move.l    #buffer,d2
  2858.         move.l    #1,d3
  2859.         bsr    writefile        write date (eg. 16th)
  2860.         move.l    daystore,a0
  2861.         move.l    day_entry(a0),a0
  2862. .loop        cmp.l    #0,a0
  2863.         beq    .out
  2864.         move.l    a0,entrystore
  2865.         bsr    SaveEntry
  2866.         move.l    entrystore,a0
  2867.         move.l    ent_next(a0),a0
  2868.         bra    .loop
  2869. .out        rts        
  2870.  
  2871.  
  2872.  
  2873. ;(* Writes an entry to a disk file. Expects pointer to entry in a0.     *)
  2874. SaveEntry    move.l    #entry_code,d2
  2875.         move.l    #1,d3
  2876.         bsr    writefile        entry identifier code
  2877.         move.l    entrystore,a0
  2878.         move.w    ent_stat(a0),buffer
  2879.         move.l    #buffer,d2
  2880.         move.l    #2,d3
  2881.         bsr    writefile        entry status
  2882.         move.l    entrystore,a0
  2883.         move.w    ent_time(a0),buffer
  2884.         move.l    #buffer,d2
  2885.         move.l    #2,d3
  2886.         bsr    writefile
  2887.         move.l    entrystore,a0
  2888.         move.w    ent_txt_size(a0),d0
  2889.         move.w    d0,buffer
  2890.         move.l    #buffer,d2
  2891.         move.l    #2,d3
  2892.         bsr    writefile        text size (bytes)
  2893.         move.l    entrystore,a0
  2894.         move.l    ent_text(a0),d2
  2895.         move.l    #0,d3
  2896.         move.w    buffer,d3        size
  2897.         bsr    writefile        entry text
  2898.         rts
  2899.  
  2900.  
  2901. ;(* Saves the scribblepad entries to the end of a disk file.         *)
  2902. SaveScribble    move.l    scribble,a0        start
  2903. .loop        cmp.l    #0,a0            empty list?
  2904.         beq    .out
  2905.         move.l    a0,a5            store
  2906.         move.l    #scribent_code,d2
  2907.         move.l    #1,d3
  2908.         bsr    writefile        entry identifier code
  2909.         move.w    scribent_txt_size(a5),d0
  2910.         move.w    d0,buffer
  2911.         move.l    #buffer,d2
  2912.         move.l    #2,d3
  2913.         bsr    writefile        write text size
  2914.         move.l    #0,d3
  2915.         move.w    buffer,d3
  2916.         move.l    scribent_text(a5),d2
  2917.         bsr    writefile
  2918.         move.l    scribent_next(a5),a0
  2919.         bra    .loop
  2920. .out        rts
  2921.  
  2922.  
  2923. ;(* Loads a file, and returns to the main loop.                 *)
  2924. Load        bsr    OpenLFwind
  2925.         bra    reply
  2926.  
  2927.  
  2928. ;(* Loads the default AmigaDiary entries file. Suppress error requestors *)
  2929. ;(* if the file cannot be found.                     *)
  2930. LoadDefault    move.l    #default_file,a0    text string
  2931.         move.l    #filebuffer,a1        file name buffer
  2932.         clr.w    d0
  2933. .loop        move.b    (a0),d0
  2934.         move.b    (a0)+,(a1)+        copy 1 byte
  2935.         cmp.w    #0,d0            finished?
  2936.         bne    .loop
  2937.         bset    #defaultfile,flag4    suppress error requestor
  2938.         bsr    LoadFile
  2939.         bclr    #defaultfile,flag4
  2940.         rts
  2941.  
  2942.  
  2943. ;(* Allows LoadFile to exit with an rts, and then branches to          *)
  2944. ;(* finishmessage to allow loadfile to be called from gadgethit.     *)
  2945. Load_File    bsr    LoadFile
  2946.         bsr    GetDate
  2947.         move.l    windowhd,displayhd
  2948.         bsr    DisplayDate
  2949.         bsr    FindEntry
  2950.         move.l    a1,start_entry
  2951.         move.l    a1,page_start
  2952.         bsr    DisplayPages
  2953.         bra    finishmessage
  2954.  
  2955.  
  2956. ;(* Loads an Amiga Diary file from disk, and creates the necessary      *)
  2957. ;(* structures.                              *)
  2958. LoadFile    move.l    #mode_old,d2
  2959.         bsr    openfile
  2960.         tst.l    d0
  2961.         beq    .error            could not open file
  2962.         bsr    isvalidheader
  2963.         beq    .out            not an AmigaDiary file
  2964.         bsr    dfs            clear old entries
  2965.         bsr    scribclear        clear old scribblepad
  2966.         move.l    #1,scribmarker        unique identifier
  2967. .loop        move.l    #buffer,d2
  2968.         move.l    #1,d3
  2969.         bsr    readfile        read one byte
  2970.         move.w    buffer,d0
  2971.         and.l    #$ff00,d0
  2972.         cmp.w    filestop_code,d0    end of file?
  2973.         beq    .out
  2974.         cmp.w    year_code,d0    
  2975.         bne    .next
  2976.         bsr    LoadYear
  2977.         cmp.l    #0,a1
  2978.         beq    .out
  2979.         bra    .loop
  2980. .next        cmp.w    month_code,d0
  2981.         bne    .next1
  2982.         bsr    LoadMonth
  2983.         cmp.l    #0,a1
  2984.         beq    .out
  2985.         bra    .loop
  2986. .next1        cmp.w    day_code,d0
  2987.         bne    .next2
  2988.         bsr    LoadDay
  2989.         beq    .out
  2990.         bra    .loop
  2991. .next2        cmp.w    entry_code,d0
  2992.         bne    .next3
  2993.         bsr    LoadEntry
  2994.         beq    .out
  2995.         bra    .loop
  2996. .next3        cmp.w    scribent_code,d0
  2997.         bne    .out
  2998.         bsr    LoadScribEnt
  2999.         beq    .out
  3000.         bra    .loop
  3001. .out        bsr    closefile
  3002.         btst    #defaultfile,flag4
  3003.         bne    .suppress2        called from LoadDefault
  3004.         bsr    CloseLFwind        
  3005.         bra    finishmessage
  3006. .error        btst    #defaultfile,flag4    default file?
  3007.         bne    .suppress2        yes
  3008.         bsr    OpenBadFilewind        no, open requestor
  3009. .suppress    bra    finishmessage
  3010. .suppress2    rts                called from LoadDefault
  3011.  
  3012.  
  3013. ;(* Determines whether a file is a valid AmigaDiary file. Returns      *)
  3014. ;(* boolean result in d0.                         *)
  3015. isvalidheader    move.l    #buffer,d2
  3016.         move.l    #2,d3
  3017.         bsr    readfile
  3018.         move.w    buffer,d2
  3019.         cmp.w    #"AD",d2
  3020.         bne    .invalid
  3021.         move.l    #buffer,d2
  3022.         move.l    #2,d3
  3023.         bsr    readfile        skip 2 bytes (version)
  3024.         move.l    #buffer,d2
  3025.         move.l    #1,d3
  3026.         bsr    readfile        read version, start
  3027.         move.w    buffer,d0
  3028.         and.l    #$ff00,d0        isolate lower byte
  3029.         cmp.w    filestart_code,d0
  3030.         bne    .invalid
  3031.         move.l    #1,d0
  3032.         rts
  3033. .invalid    move.l    #0,d0
  3034.         rts
  3035.  
  3036.  
  3037. ;(* Loads a year from a disk file, and creates a year structure.     *)
  3038. ;(* Returns year address in a1.                         *)
  3039. LoadYear    move.l    #buffer,d2
  3040.         move.l    #2,d3
  3041.         bsr    readfile        get year
  3042.         move.l    #0,d0
  3043.         move.w    buffer,d0
  3044.         bsr    ReserveYear        create year
  3045.         move.l    a1,yearstore
  3046.         rts
  3047.  
  3048.  
  3049.  
  3050. ;(* Loads a month from a disk file, and creates a month structure.      *)
  3051. ;(* Returns month address in a1.                     *)
  3052. LoadMonth    move.l    #buffer,d2
  3053.         move.l    #1,d3
  3054.         bsr    readfile        get month
  3055.         move.l    #0,d0
  3056.         move.w    buffer,d0
  3057.         lsr.l    #8,d0
  3058.         move.l    yearstore,a0
  3059.         bsr    ReserveMonth        create month
  3060.         move.l    a1,monthstore
  3061.         rts
  3062.  
  3063.  
  3064. ;(* Loads a day from a disk file, and creates a day structure. Returns     *)
  3065. ;(* address of day in a1.                         *)
  3066. LoadDay        move.l    #buffer,d2
  3067.         move.l    #1,d3
  3068.         bsr    readfile
  3069.         move.l    #0,d0
  3070.         move.w    buffer,d0
  3071.         lsr.l    #8,d0
  3072.         move.l    #date,a0
  3073.         move.l    d0,date_day1(a0)        set date to entry
  3074.         bsr    CreateDay
  3075.         beq    .out
  3076.         move.l    monthstore,a0
  3077.         move.l    d0,daystore
  3078.         move.l    d0,a1            day address
  3079.         bsr    InsertDay
  3080. .out        rts
  3081.  
  3082.  
  3083. ;(* Loads an entry from a disk file, and creates an entry structure.      *)
  3084. ;(* Also reserves memory for text, and reads text from file.         *)
  3085. LoadEntry    move.l    #buffer,d2
  3086.         move.l    #2,d3
  3087.         bsr    readfile        get status word
  3088.         move.l    #0,d5
  3089.         move.w    buffer,d5        store
  3090.         move.l    #buffer,d2
  3091.         move.l    #2,d3
  3092.         bsr    readfile        get time
  3093.         move.l    #0,d4
  3094.         move.w    buffer,d4        store
  3095.         bsr    CreateEntry        returns address in d0
  3096.         beq    .out
  3097.         move.l    daystore,a0
  3098.         move.l    d0,entrystore
  3099.         move.l    d0,a1
  3100.         bsr    InsertEntry        insert into day
  3101.         move.l    entrystore,a0
  3102.         move.w    d4,ent_time(a0)
  3103.         move.w    d5,ent_stat(a0)
  3104.         move.l    #buffer,d2
  3105.         move.l    #2,d3
  3106.         bsr    readfile        get text length
  3107.         move.l    execbase,a6
  3108.         move.l    #0,d0
  3109.         move.w    buffer,d0
  3110.         move.l    entrystore,a0
  3111.         move.w    d0,ent_txt_size(a0)
  3112.         move.l    #$10000,d1
  3113.         jsr    allocmem(a6)        get text mem
  3114.         beq    .out
  3115.         move.l    entrystore,a0
  3116.         move.l    d0,ent_text(a0)
  3117.         move.w    ent_txt_size(a0),d3
  3118.         move.l    d0,d2
  3119.         bsr    readfile        get text
  3120. .out        rts
  3121.  
  3122.  
  3123.  
  3124. ;(* Loads a scribblepad entry from an external file.             *)
  3125. LoadScribEnt    move.l    #2,d3
  3126.         move.l    #buffer,d2
  3127.         bsr    readfile        get text size
  3128.         move.l    #0,d0
  3129.         move.w    buffer,d0
  3130.         move.l    #$10000,d1
  3131.         move.l    execbase,a6
  3132.         jsr    allocmem(a6)        get text mem
  3133.         beq    .out
  3134.         move.l    d0,d5            store
  3135.         move.l    d0,d2
  3136.         move.l    #0,d3
  3137.         move.w    buffer,d3
  3138.         bsr    readfile        read text into mem
  3139.         bsr     CreateScribEntry
  3140.         beq    .out
  3141.         move.l    d0,a0            address of entry
  3142.         move.l    d5,scribent_text(a0)    pointer to text
  3143.         move.w    buffer,scribent_txt_size(a0)    text size
  3144.         move.l    scribmarker,scrib_ident(a0)    identifier
  3145.         add.l    #1,scribmarker
  3146.         bsr    InsertScribEntry
  3147. .out        rts
  3148.  
  3149.  
  3150.  
  3151. ;(* Writes the AmigaDiary file header.                     *)
  3152. writeheader    move.l    #header,d2
  3153.         move.l    #5,d3            size in bytes
  3154.         bsr    writefile
  3155.         rts
  3156.  
  3157.  
  3158. ;(* Opens an external file. Expects mode old/new in d2.             *)
  3159. openfile    move.l    dosbase,a6
  3160.         move.l    #filebuffer,d1
  3161.         jsr    open(a6)
  3162.         move.l    d0,filehd
  3163.         rts
  3164.  
  3165. ;(* Closes the external file, previously opened by the program.         *)
  3166. closefile    move.l    dosbase,a6
  3167.         move.l    filehd,d1
  3168.         jsr    close(a6)
  3169.         rts
  3170.  
  3171. ;(* Writes data to a previously opened file. Expects pointer to data in  *)
  3172. ;(* d2, and number of bytes in d3.                     *)
  3173. writefile    move.l    dosbase,a6
  3174.         move.l    filehd,d1
  3175.         jsr    write(a6)
  3176.         rts
  3177.  
  3178. ;(* Reads data from a previously opened file. Expects area of memory in  *)
  3179. ;(* d2, number of bytes in d3.                         *)
  3180. readfile    move.l    dosbase,a6
  3181.         move.l    filehd,d1
  3182.         jsr    read(a6)
  3183.         rts
  3184.  
  3185.  
  3186. *-------------- HEX TO DEC ROUTINES -------------------------------------*
  3187.  
  3188.  
  3189. ;(* NB Unless otherwise stated, a digit refers to a decimal digit     *)
  3190. ;(* Decimal number is stored in the string backwards, ie.         *)
  3191. ;(* units, tens, hundreds etc.                         *)
  3192.  
  3193. ;(* Converts a hex number to decimal, placing each decimal digit in a    *)
  3194. ;(* byte. Assume hex number passed in d0, decimal result 0-9999          *)
  3195. Convert        lea    decnumber,a0        address of decimal string
  3196.         move.l    #0,(a0)            clear previous values
  3197.         move.l    #1000,d1        first power of ten
  3198.         moveq    #3,d3            HEX digits-1 (dbf)
  3199. convertdigit    bsr    dodigit
  3200.         addq    #1,a0            move left to next digit
  3201.         divs    #10,d1            lower power
  3202.         dbf    d3,convertdigit        repeat for all HEX digits
  3203.         rts
  3204.  
  3205. ;(* Sets a single digit to the correct decimal value. Used with Convert  *)
  3206. dodigit        cmp    d1,d0        Does number include this power? 
  3207.         blt    nodigit            no
  3208.         add.b    #1,(a0)            increment correct digit
  3209.         moveq    #4,d2            number of digits-1 (dbf)
  3210.         move.l    a0,a1
  3211.         bsr    checknumber        Is it 10?
  3212.         sub    d1,d0            subtract power from column
  3213.         bra    dodigit
  3214. nodigit        rts                    
  3215.  
  3216. ;(* Checks whether a digit exceeds nine. If it does, increment the next     *)
  3217. ;(* highest power, and clear this one.                        *)
  3218. ;(* Expects address of number in a1.                     *)
  3219. checknumber    move.w    #0,d4            clear store
  3220.         move.b    (a1),d4
  3221.         cmp.w     #$a,d4            digit = 10?
  3222.         bne    .checknext        no
  3223.         add.b    #1,1(a1)        increment next power
  3224.         clr.b    (a1)            clear this power
  3225. .checknext    addq    #1,a1
  3226.         dbf    d2,checknumber        repeat for all digits
  3227.         rts
  3228.  
  3229.  
  3230. ;(* converts a decimal number to ASCII format, and displays it in the      *)
  3231. ;(* current window. Assumes the number is at address a0             *)
  3232.  
  3233. DisplayDecimal    lea    decstring,a1
  3234.         move    digits,d1
  3235.         sub.w    #1,d1
  3236. dectostring    move.b    (a0),d0
  3237.         add.b    #$30,d0
  3238.         move.b    d0,(a1)
  3239.         addq    #1,a0
  3240.         addq    #1,a1
  3241.         dbf    d1,dectostring
  3242.         lea    decstring,a0
  3243.         move.l    displayhd,a1
  3244.         move.w    digits,d0
  3245.         bsr    displaytext
  3246.         rts
  3247.  
  3248.  
  3249.  
  3250. *-------------- SCRIBBLEPAD ROUTINES ------------------------------------*
  3251.  
  3252.  
  3253. ;(* Opens the ScribblePad window, displays a page, and returns to the      *)
  3254. ;(* main loop.                                 *)
  3255. SelectSP    bsr    OpenSPwind
  3256.         tst.l    d0
  3257.         beq    .error
  3258.         bsr    BlankPad
  3259.         bclr    #scribover,flag1        no overflow yet
  3260.         move.l    scribble,a1
  3261.         move.l    a1,scrib_curentry        first page        
  3262.         bsr    DisplaySpad
  3263. .error        bra    reply
  3264.  
  3265.  
  3266. ;(* Closes the ScribblePad window, and returns to the main display.     *)
  3267. CloseSP        bsr    CloseSPwind
  3268.         bra    finishmessage
  3269.  
  3270.  
  3271. ;(* Displays the next page of the scribblepad.                 *)
  3272. NextSP        move.l    scrib_nextentry,a1        move to next
  3273.         move.l    a1,scrib_curentry        page
  3274.         bsr    BlankPad            clear pages
  3275.         bsr    DisplaySPad            display entries
  3276.         bra    reply
  3277.  
  3278.  
  3279. ;(* Opens the ScribblePad Add Entry window, and returns to the main loop.*)
  3280. SelectSAE    bsr    ClearScribString
  3281.         bsr    OpenSAEwind
  3282.         bra    reply
  3283.  
  3284.  
  3285. ;(* Closes the ScribblePad Add Entry window, and returns to the main      *)
  3286. ;(* display.                                 *)
  3287. CloseSAE    bsr    CloseSAEwind
  3288.         bra    finishmessage
  3289.  
  3290.  
  3291. ;(* Opens the ScribblePad Edit Entry window, and returns to the main loop*)
  3292. SelectSEE    bsr    OpenSEEwind
  3293.         move.l    scribble,a0        first entry
  3294.         bsr    RecallScribEntry    display in window
  3295.         bra     reply
  3296.  
  3297.  
  3298. ;(* Closes the ScribblePad Edit Entry window, and returns to the main      *)
  3299. ;(* loop.                                 *)
  3300. CloseSEE    bsr    CloseSEEwind
  3301.         bra    finishmessage
  3302.  
  3303.  
  3304. ;(* Draws a white rectangle to represent the 'pages' of the scribblepad. *)
  3305. BlankPad    move.l    spwhd,a1
  3306.         move.l    #1,d0
  3307.         bsr    pencolour
  3308.         move.l    gfxbase,a6
  3309.         move.l    spwhd,a1
  3310.         move.l    50(a1),a1        rastport
  3311.         move.l    #8,d0
  3312.         move.l    #13,d1
  3313.         move.l    #292,d2
  3314.         move.l    #160,d3
  3315.         jsr    rectfill(a6)        fill 'pages'
  3316.         rts
  3317.  
  3318.  
  3319. ;(* Introduces blank characters into the scribblepad edit entry string      *)
  3320. ;(* gadget.                                  *)
  3321. ClearScribEdit    move.l    #scribeditbuffer,a0    clear string buffer
  3322.         moveq    #71,d0
  3323. .loop        move.b    #0,(a0)+
  3324.         dbf    d0,.loop
  3325.         rts
  3326.  
  3327.  
  3328. ;(* Clears the scribblepad edit entry string gadget, refreshes the gadget*)
  3329. ;(* and returns to the main loop.                     *)
  3330. ClearSEditInput    bsr    ClearScribEdit
  3331.         move.l    intbase,a6
  3332.         move.l    #scribedit_sgadget,a0
  3333.         move.l    Scribedithd,a1
  3334.         move.l    #0,a2
  3335.         move.l    #1,d0            number of gadgets
  3336.         jsr    refreshGlist(a6)
  3337.         bra    reply
  3338.  
  3339.  
  3340. ;(* Clears the current user selection from the scribblepad add entry        *)
  3341. ;(* window.                                  *)
  3342. ClearScribInput    bsr    ClearScribString
  3343.         move.l    intbase,a6
  3344.         move.l    #scribentry_sgadget,a0
  3345.         move.l    SAEhd,a1
  3346.         move.l    #0,a2
  3347.         move.l    #1,d0            number of gadgets
  3348.         jsr    refreshGlist(a6)
  3349.         bra    reply
  3350.  
  3351.  
  3352. ;(* Introduces blank characters into the scribblepad add entry string     *)
  3353. ;(* buffer.                                 *)
  3354. ClearScribString
  3355.         move.l    #scribentrybuffer,a0    clear string buffer
  3356.         moveq    #71,d0
  3357. .loop        move.b    #0,(a0)+
  3358.         dbf    d0,.loop
  3359.         rts
  3360.  
  3361.  
  3362. ;(* Adds a scribblepad entry.                         *)
  3363. AddScribEntry    bclr    #scribeditinp,flag4    use add entry inputs
  3364.         bsr    ReserveScribEntry
  3365.         cmp.l    #0,d0
  3366.         beq    .out
  3367.         bsr    InsertScribEntry
  3368.         bsr    DisplaySPad
  3369. .out        bsr    CloseSAEwind
  3370.         bra     finishmessage
  3371.  
  3372.  
  3373. ;(* Allocates memory for 1 scribblepad entry. Returns address in d0.     *)
  3374. CreateScribEntry
  3375.         move.l    execbase,a6
  3376.         move.l    #scribent_size,d0
  3377.         move.l    #$10000,d1
  3378.         jsr    allocmem(a6)
  3379.         rts
  3380.  
  3381.  
  3382. ;(* Inserts an entry into the scribblepad entry list. Expects pointer to *)
  3383. ;(* entry in d0.                             *)
  3384. InsertScribEntry
  3385.         move.l    scribble,a1        start of list
  3386.         cmp.l    #0,a1            empty list?
  3387.         bne    .notempty
  3388.         move.l    d0,scribble        trivial case
  3389.         move.l    d0,scrib_curentry    pointer to page
  3390.         rts
  3391. .notempty    move.l    a1,a2            store previous
  3392.         move.l    scribent_next(a1),a1
  3393.         cmp.l    #0,a1            end of list?
  3394.         bne    .notempty
  3395.         move.l    d0,scribent_next(a2)    insert new entry
  3396.         rts
  3397.  
  3398.  
  3399. ;(* Creates a scribblepad entry from inputs supplied in the scribblepad  *)
  3400. ;(* add entry window, and gives the entry a unique identifier.         *)
  3401. ;(* Returns entry address in d0.                      *)
  3402. ReserveScribEntry
  3403.         btst    #scribeditinp,flag4
  3404.         bne    .edit
  3405.         move.l    #scribentrybuffer,a0
  3406.         bra    .next
  3407. .edit        move.l    #scribeditbuffer,a0
  3408. .next        clr.l    d0            counter
  3409. .loop        clr.l    d1
  3410.         move.b    (a0)+,d1
  3411.         cmp.w    #0,d1            end of text?
  3412.         beq    .done
  3413.         addq    #1,d0
  3414.         bra    .loop
  3415. .done        addq    #1,d0            add nul char at eot
  3416.         move.l    d0,d3            store size
  3417.         move.l    execbase,a6
  3418.         move.l    #$10000,d1
  3419.         jsr    allocmem(a6)
  3420.         beq    .error            no mem
  3421.         move.l    d0,d4            store text address
  3422.         bsr    CreateScribEntry
  3423.         beq    .error            no mem
  3424.         move.l    d0,a0
  3425.         move.l    d4,scribent_text(a0)
  3426.         move.w    d3,scribent_txt_size(a0)    text size
  3427.         move.l    scribmarker,scrib_ident(a0)    identifier
  3428.         add.l    #1,scribmarker        each entry is unique
  3429.         btst    #scribeditinp,flag4    which input window?
  3430.         bne    .edit1
  3431.         move.l    #scribentrybuffer,a1    add entry source
  3432.         bra    .next1
  3433. .edit1        move.l    #scribeditbuffer,a1    edit entry source
  3434. .next1        move.l    d4,a2            destination
  3435.         sub.l    #1,d3            because dbf ... 
  3436. .cloop        move.b    (a1)+,(a2)+        copy text to mem
  3437.         dbf    d3,.cloop
  3438. .out        move.l    a0,d0
  3439. .error        rts
  3440.  
  3441.  
  3442. ;(* Finds the previous scribblepad entry. Expects entry address in a0.      *)
  3443. ;(* Returns address in a0, zero if unsuccessful.             *)
  3444. FindScribPrev    move.l    scribble,a1
  3445.         cmp.l    #0,a1    
  3446.         beq    .error            no entries
  3447.         cmp.l    scribble,a0        only one entry?
  3448.         beq    .one
  3449.         move.l    scrib_ident(a0),d0    get identifier of current
  3450. .loop        move.l    a1,a2            store previous
  3451.         move.l    scribent_next(a1),a1    get next
  3452.         move.l    scrib_ident(a1),d1
  3453.         cmp.l    d0,d1
  3454.         bne    .loop            no match, so repeat
  3455.         move.l    a2,a0            return address
  3456.         rts
  3457. .error        move.l    #0,a0            return nil
  3458.         rts
  3459. .one        move.l    scribble,a0        point to single entry
  3460.         rts
  3461.  
  3462.  
  3463. ;(* Deletes an entry from the scribblepad list. Expects entry address in *)
  3464. ;(* a0.                                     *)
  3465. RemoveScribEntry
  3466.         move.l    scribent_next(a0),a1
  3467.         cmp.l    #0,a1            end of list?
  3468.         beq    .last            yes
  3469.         move.l    a0,a5            store
  3470.         cmp.l    scribble,a0        first entry?
  3471.         beq    .first
  3472.         bsr    findscribprev        result in a0
  3473.         move.l    a0,scribentry
  3474.         move.l    scribent_next(a5),a2    skip over entry being
  3475.         move.l    a2,scribent_next(a0)    deleted
  3476.         bra    .free
  3477. .last        move.l    a0,a5            store
  3478.         cmp.l    scribble,a0        one entry?
  3479.         beq    .one
  3480.         bsr    findscribprev        get previous
  3481.         move.l    a0,scribentry
  3482.         move.l    #0,scribent_next(a0)    
  3483. .free        move.l    a5,a1
  3484.         move.l    #scribent_size,d0
  3485.         bsr    freeup
  3486.         rts
  3487. .one        move.l    a0,a1
  3488.         move.l    #scribent_size,d0
  3489.         bsr    freeup
  3490.         move.l    #0,scribble
  3491.         rts
  3492. .first        move.l    a1,a0
  3493.         move.l    a5,a1
  3494.         move.l    a0,a5            store next entry
  3495.         move.l    #scribent_size,d0
  3496.         bsr    freeup
  3497.         move.l    a5,scribble
  3498.         rts
  3499.  
  3500.  
  3501. ;(* Removes an entry from the ScribblePad list, and returns to main loop *)
  3502. DelScribEntry    move.l    scribentry,a0
  3503.         bsr    RemoveScribEntry
  3504.         bsr    BlankPad
  3505.         move.l    scribble,scrib_curentry
  3506.         bsr    DisplaySPad
  3507.         bsr    ClearScribEdit
  3508.         move.l    scribentry,a0
  3509.         bsr    RecallScribEntry
  3510.         bra    reply
  3511.  
  3512.  
  3513. ;(* Changes a scribblepad entry to the new values shown in the          *)
  3514. ;(* scribblepad edit entry window.                     *)
  3515. ChangeScribEntry
  3516.         move.l    scribentry,a0
  3517.         bsr    RemoveScribEntry    clear old version
  3518.         bset    #scribeditinp,flag4    inputs from Scr. Ed. win.
  3519.         bsr    ReserveScribEntry    create new version
  3520.         move.l    d0,scribentry        store
  3521.         bsr    InsertScribEntry    insert new version
  3522.         bsr    BlankPad
  3523.         move.l    scribble,scrib_curentry
  3524.         bsr    DisplaySPad
  3525.         bra    reply
  3526.  
  3527.  
  3528. ;(* Refreshes the string gadgets in the ScribblePad Edit Entry window.     *)
  3529. ScribEditRefresh
  3530.         move.l    intbase,a6
  3531.         move.l    #scribedit_sgadget,a0
  3532.         move.l    scribedithd,a1
  3533.         move.l    #0,a2
  3534.         move.l    #1,d0            number of gadgets
  3535.         jsr    refreshGlist(a6)
  3536.         rts
  3537.  
  3538.  
  3539. ;(* Recalls scribblepad entry information and displays it in the      *)
  3540. ;(* scribblepad edit entry window. Expects entry address in a0.         *)
  3541. RecallScribEntry
  3542.         cmp.l    #0,a0
  3543.         beq    .out
  3544.         move.l    a0,scribentry
  3545.         move.l    #scribeditbuffer,a2
  3546.         move.l    scribent_text(a0),a1
  3547. .loop        move.w    #0,d0
  3548.         move.b    (a1),d0
  3549.         cmp.w    #0,d0
  3550.         beq    .done
  3551.         move.b    (a1)+,(a2)+
  3552.         bra    .loop
  3553. .done
  3554. .out        bsr    scribeditrefresh
  3555.         rts
  3556.  
  3557.  
  3558. ;(* Finds the next scribblepad entry and displays it in the edit entry      *)
  3559. ;(* window. Expects the current entry in scribentry.             *)
  3560. NextScribEntry    bsr    ClearScribEdit
  3561.         bsr    ScribEditRefresh
  3562.         move.l    scribentry,a0
  3563.         cmp.l    #0,a0
  3564.         beq    .empty
  3565.         move.l    scribent_next(a0),a0
  3566.         cmp.l    #0,a0
  3567.         beq    .endlist
  3568.         bsr    RecallScribEntry
  3569.         bra    reply
  3570. .endlist    move.l    scribentry,a0
  3571.         bsr    RecallScribEntry
  3572. .empty        bra    reply
  3573.  
  3574.  
  3575.  
  3576. ;(* Finds the previous scribblepad entry and displays it in the edit     *)
  3577. ;(* entry window. Expects the current entry in scribentry.         *)
  3578. PrevScribEntry    bsr    ClearScribEdit
  3579.         bsr    ScribEditRefresh
  3580.         move.l    scribentry,a0
  3581.         bsr    FindScribPrev
  3582.         bsr    RecallScribEntry
  3583.         bra    reply
  3584.  
  3585.  
  3586. ;(* Displays scribblepad entries in the window.    Expects address of first *) 
  3587. ;(* entry on that page in scrib_curentry.                 *)
  3588. DisplaySPad    move.l    gfxbase,a6
  3589.         move.l    spwhd,a1
  3590.         move.l    50(a1),a1
  3591.         move.l    #0,d0            JAM1
  3592.         jsr    setDrMd(a6)        set mode
  3593.         move.l    spwhd,a1
  3594.         move.l    #2,d0    
  3595.         bsr    pencolour        set black pen
  3596.         move.w    #10,scribXpos
  3597.         move.w    scribXpos,d0
  3598.         move.w    #22,scribYpos
  3599.         move.w    scribYpos,d1
  3600.         move.l    spwhd,a1
  3601.         bsr    movepos    
  3602.         move.l    scrib_curentry,a1    start of page
  3603. .loop        cmp.l    #0,a1            end of list?
  3604.         beq    .out
  3605.         move.l    a1,a5            store
  3606.         bsr    DisplayScribEntry
  3607.         btst    #scribsplit,flag4    entry split at bottom?
  3608.         bne    .split
  3609.         btst    #scribover,flag1
  3610.         bne    .overflow
  3611.         move.l     scribent_next(a5),a1
  3612.         bra    .loop
  3613. .overflow    move.l    scribent_next(a5),a1
  3614.         move.l    a1,scrib_nextentry    store pointer for next page
  3615.         rts
  3616. .out        move.l    scribble,a1        no overflow here, so go
  3617.         move.l    a1,scrib_nextentry    back to start
  3618.         rts
  3619. ; repeat entry at start of next page of scribblepad, and blank trailing
  3620. ; lines of split entry
  3621. .split        move.l    spwhd,a1
  3622.         move.l    #1,d0
  3623.         bsr    pencolour
  3624.         move.w    lines_used,d5
  3625.         sub.w    #1,d5
  3626. .blankloop    bsr    uppadline
  3627.         move.l    gfxbase,a6
  3628.         move.l    spwhd,a1
  3629.         move.l    50(a1),a1        rastport
  3630.         move.l    #0,d0
  3631.         move.l    #0,d1
  3632.         move.w    scribXpos,d0        topleft x
  3633.         move.w    scribYpos,d1        topleft y
  3634.         ;sub.w    #8,d1
  3635.         move.w    d1,d3            bottomright y
  3636.         sub.w    #8,d1
  3637.         move.l    #286,d2            bottomright x
  3638.         jsr    rectfill(a6)        fill 'pages'        
  3639.         dbf    d5,.blankloop
  3640.         move.l    currententry,scrib_nextentry
  3641.         rts
  3642.  
  3643.  
  3644.  
  3645.  
  3646. ;(* Displays a single scribblepad entry. Expects pointer to entry in a1. *)
  3647. DisplayScribEntry
  3648.         move.w    #0,lines_used        no lines used yet    
  3649.         bclr    #scribsplit,flag4
  3650.         move.l    scribent_text(a1),a0
  3651.         move.l    a1,currententry        store pointer
  3652.         cmp.l    #0,a0            no entries?
  3653.         beq    .break
  3654. .line        clr.w    d0
  3655.         clr.w    d1            number of chars
  3656.         move.b    (a0),d0
  3657.         cmp.w    #0,d0            end of text?
  3658.         beq    .break
  3659.         cmp.w    #" ",d0
  3660.         bne    .nospace        
  3661.         add.l    #1,a0            skip space at start
  3662. .nospace    move.l    a0,a2            store start of line
  3663. .loop        move.b    (a0)+,d0        inspect one char
  3664.         cmp.w    #0,d0            end of text?
  3665.         beq    .endtext
  3666.         addq    #1,d1
  3667.         cmp.w    #scrib_width,d1        line full?
  3668.         beq    .wholeline
  3669.         bra    .loop
  3670.     
  3671. .wholeline    clr.w    d2
  3672.         move.b    (a0)+,d2        complete word at EOL?
  3673.         cmp.w    #" ",d2
  3674.         beq    .okline
  3675.         cmp.w    #0,d2
  3676.         beq    .okline
  3677.         sub.l    #1,a0            go back one char
  3678. .backloop    cmp.w    #" ",d0            last char a space?
  3679.         beq    .okline
  3680.         subq    #1,d1            decrease width
  3681.         move.b    -(a0),d0
  3682.         cmp.l    a0,a2            back to start?
  3683.         bne    .backloop        search back through line
  3684.         move.l    #scrib_width,d1        full line
  3685.         add.l    #scrib_width,a0
  3686.  
  3687. .okline        move.l    a0,a4            start of next line
  3688.         move.l    a2,a0            start of this line
  3689.         move.l    d1,d0            number of chars
  3690.         bsr    displayscribline
  3691.         move.l    a4,a0
  3692.         bsr    downpadline        move down a line
  3693.         add.w    #1,lines_used        
  3694.         btst    #scribover,flag1    bottom reached?
  3695.         bne    .split            yes
  3696.         bra    .line            do next line
  3697.  
  3698. .endtext    move.l    a2,a0            start of line
  3699.         move.l    d1,d0            number of chars
  3700.         bsr    displayscribline
  3701.         bsr    downpadline        no need to check for
  3702.         add.w    #1,lines_used 
  3703.         bra    .break            bottom here
  3704. .split        bset    #scribsplit,flag4    entry is split
  3705. .break        rts                
  3706.  
  3707.  
  3708.  
  3709. ;(* Displays a single line of text for a scribblepad entry. Expects      *)
  3710. ;(* pointer to text in a0, number of chars in d0             *)
  3711. DisplayScribLine
  3712.         move.l    spwhd,a1
  3713.         bsr    displaytext        
  3714.         rts
  3715.  
  3716.  
  3717. ;(* Moves the text cursor down one line    in the scribblepad.         *)
  3718. downpadline    bclr    #scribover,flag1    clear flag initially
  3719.         add.w    #10,scribYpos
  3720.         move.w    scribXpos,d0
  3721.         move.w    scribYpos,d1
  3722.         cmp.w    #scrib_bottom,d1    bottom of page reached?
  3723.         bgt    .error
  3724.         move.l    spwhd,a1
  3725.         bsr    movepos            
  3726.         rts
  3727. .error        bset    #scribover,flag1    overflow flag set
  3728.         rts
  3729.  
  3730.  
  3731. ;(* Moves the cursor up one line in the scribblepad.             *)
  3732. uppadline    sub.w    #9,scribYpos
  3733.         move.w    scribXpos,d0
  3734.         move.w    scribYpos,d1
  3735.         move.l    spwhd,a1
  3736.         bsr    movepos
  3737.         rts
  3738.  
  3739.  
  3740. *-------------- EDIT ENTRY ROUTINES -------------------------------------*
  3741.  
  3742.  
  3743. ;(* Opens the edit window and places the first entry for that day in it. *)
  3744. Edit        bsr    OpenEditwind
  3745.         move.l    edithd,d0
  3746.         tst.l    d0
  3747.         beq    .error
  3748.         bsr    SetupEditDisplay
  3749.         bsr    FindEntry
  3750.         move.l    a1,a0
  3751.         bsr    RecallEntry        display first entry
  3752. .error        bra    reply
  3753.  
  3754.  
  3755. ;(* Closes the Edit Entry window, and restores the main diary display.     *)
  3756. CloseEdit    bsr    CloseEditwind
  3757.         bsr    FindEntry
  3758.         move.l    a1,start_entry
  3759.         move.l    a1,page_start
  3760.         bsr    DisplayPages        update display
  3761.         bra    finishmessage
  3762.  
  3763. ;(* Takes appropriate action when CR is hit in the Add Entry window.     *)
  3764. ;(* The program moves through each of the string gadgets, then acts as     *)
  3765. ;(* if OK had been selected.                         *)
  3766. EditEntryCR    btst    #timeyn,flag1        if time OFF, do not need
  3767.         beq    ChangeEntry        to check hrs/mins
  3768.         btst    #strgad,flag3        first gadget?
  3769.         bne    .acthrs            yes, activate hours gadget
  3770.         btst    #hrsgad,flag3        second gadget?
  3771.         bne    .actmins        yes, activate mins gadget
  3772.         bra    ChangeEntry        as gadget $98
  3773. .acthrs        move.l    intbase,a6
  3774.         move.l    #edithours_sgadget,a0    gadget
  3775.         move.l    edithd,a1        window
  3776.         move.l    #0,a2            requestor (nil)
  3777.         jsr    activategadget(a6)
  3778.         bclr    #strgad,flag3        set gadget flags ... 
  3779.         bset    #hrsgad,flag3        ... appropriately
  3780.         bclr    #minsgad,flag3
  3781.         bra    .out
  3782. .actmins    move.l    intbase,a6
  3783.         move.l    #editmins_sgadget,a0    gadget
  3784.         move.l    edithd,a1        window
  3785.         move.l    #0,a2            requestor (nil)
  3786.         jsr    activategadget(a6)
  3787.         bclr    #hrsgad,flag3
  3788.         bset    #minsgad,flag3
  3789.         bclr    #strgad,flag3
  3790. .out        bra    reply
  3791.  
  3792.  
  3793. ;(* Clears the current user selection from the edit entry window.     *)
  3794. ClearEditInput    bsr    ClearEditString
  3795.         bsr    EditRefresh
  3796.         bra    reply
  3797.  
  3798.  
  3799. ;(* Introduces blank characters into the edit entry string gadgets.     *)
  3800. ClearEditString
  3801.         move.l    #editentrybuffer,a0    clear string buffer
  3802.         moveq    #71,d0
  3803. .loop        move.b    #0,(a0)+
  3804.         dbf    d0,.loop
  3805.         move.l    #hoursbuffer,a0
  3806.         move.l    #0,(a0)+        clear hours
  3807.         move.l    #0,(a0)+
  3808.         move.l    #0,(a0)
  3809.         move.l    #minsbuffer,a0
  3810.         move.l    #0,(a0)+        clear mins
  3811.         move.l    #0,(a0)+
  3812.         move.l    #0,(a0)
  3813.         move.l    #hours_sinfo,a0
  3814.         move.l    #0,28(a0)
  3815.         move.l    #mins_sinfo,a0
  3816.         move.l    #0,28(a0)
  3817.         rts
  3818.  
  3819.  
  3820. ;(* Refreshes the string gadgets in the Edit Entry window.         *)
  3821. EditRefresh    move.l    intbase,a6
  3822.         move.l    #editentry_sgadget,a0
  3823.         move.l    edithd,a1
  3824.         move.l    #0,a2
  3825.         move.l    #3,d0            number of gadgets
  3826.         jsr    refreshGlist(a6)
  3827.         rts
  3828.  
  3829.  
  3830. ;(* Recalls entry information and displays it in the edit entry window.  *)
  3831. ;(* Expects entry address in a0.                     *)
  3832. RecallEntry    cmp.l    #0,a0
  3833.         beq    .out
  3834.         move.l    a0,currententry
  3835.         move.w    ent_stat(a0),d0        get status
  3836. ; Alter the time option gadget to selected yes/no depending on whether
  3837. ; or not time is specified for this entry
  3838.         btst    #timeyn,d0        time specified?
  3839.         beq    .notime            no
  3840.         bsr    timey_disp        yes, display image
  3841.         bset    #timeyn,flag1
  3842.         bra    .dotime
  3843. .notime        bsr    timen_disp        no, display other image
  3844.         bclr    #timeyn,flag1
  3845. .dotime        bsr    ClearEditString
  3846.         move.l    currententry,a0
  3847.         move.l    #editentrybuffer,a2
  3848.         move.l    ent_text(a0),a1
  3849. .loop        move.w    #0,d0
  3850.         move.b    (a1),d0
  3851.         cmp.w    #0,d0
  3852.         beq    .done
  3853.         move.b    (a1)+,(a2)+
  3854.         bra    .loop
  3855. .done        move.w    ent_time(a0),d0
  3856.         divs    #100,d0
  3857.         move.l    d0,d1                
  3858.         and.l    #$ff,d0            get hours
  3859.         move.l    #hours_sinfo,a1
  3860.         move.l    d0,28(a1)
  3861.         swap    d1
  3862.         and.l    #$ff,d1            get mins
  3863.         move.l    #mins_sinfo,a1
  3864.         move.l    d1,28(a1)
  3865.         move.l    d1,d5            store
  3866.         bsr    convert            number in d0
  3867.         move.l    #decnumber,a0
  3868.         add.l    #2,a0            only lower 2 bytes
  3869.         move.l    #hoursbuffer,a1
  3870.         bsr    copy2bytes
  3871.         move.l    d5,d0
  3872.         bsr    convert
  3873.         move.l    #decnumber,a0
  3874.         add.l    #2,a0
  3875.         move.l    #minsbuffer,a1
  3876.         bsr    copy2bytes
  3877. .out        bsr    EditRefresh
  3878.         rts
  3879.  
  3880.  
  3881. ;(* Copies two bytes from address a0 to a1, and changes result to ASCII     *)
  3882. copy2bytes    move.b    (a0)+,d0
  3883.         add.b    #$30,d0            convert to ASCII
  3884.         move.b    d0,(a1)+
  3885.         move.b    (a0),d0
  3886.         add.b    #$30,d0            convert to ASCII
  3887.         move.b    d0,(a1)
  3888.         rts
  3889.  
  3890.  
  3891.  
  3892. ;(* Gets the next entry from the entry list.                 *)
  3893. NextEntry    bsr    ClearEditString
  3894.         bsr    EditRefresh
  3895.         move.l    currententry,a0
  3896.         cmp.l    #0,a0
  3897.         beq    .noentry
  3898.         move.l    ent_next(a0),a0
  3899.         cmp.l    #0,a0
  3900.         beq    .error
  3901.         bsr    RecallEntry
  3902.         bra    reply
  3903. .error        move.l    currententry,a0
  3904.         bsr    RecallEntry
  3905. .noentry    bra    reply
  3906.  
  3907.  
  3908. ;(* Gets the previous entry from the entry list. Starts at the beginning *)
  3909. ;(* and searches until it finds the entry that points to currententry.      *)
  3910. ;(* This gets round my omission of a previous pointer in the entry      *)
  3911. ;(* structure. Returns address in a1.                     *)
  3912. PrevEntry    bsr    ClearEditString
  3913.         bsr    EditRefresh
  3914.         move.l    currententry,a0
  3915.         cmp.l    #0,a0
  3916.         beq    .noentry
  3917.         bsr    FindPrev
  3918.         bsr    RecallEntry
  3919. .noentry    bra    reply
  3920.  
  3921.         
  3922. ;(* Finds the entry previous to the one being considered. Expects      *)
  3923. ;(* current entry in a0. Returns result in a0. If entry is the only one  *)
  3924. ;(* for that day, or the first entry in the list, return itself.     *)
  3925. FindPrev    bclr    #one_entry,flag1    do not know # of entries
  3926.         bclr    #firstentry,flag1
  3927.         move.l    a0,a5            store
  3928.         bsr    FindEntry        puts first entry in a1
  3929.         cmp.l    a5,a1            first entry?
  3930.         beq    .first
  3931. .loop        move.l    ent_next(a1),a0        next entry for that day
  3932.         cmp.l    a5,a0            found entry?
  3933.         beq    .out            yes
  3934.         move.l    a0,a1            get next entry
  3935.         bra    .loop
  3936. .out        move.l    a1,a0
  3937.         rts
  3938. .first        move.l    a5,a0            first entry in list, so
  3939.         bset    #firstentry,flag1    return itself
  3940.         move.l    ent_next(a0),a1        end of list?
  3941.         cmp.l    #0,a1            yes => only one entry
  3942.         beq    .one                   in list                
  3943.         rts
  3944. .one        bset    #one_entry,flag1
  3945.         rts
  3946.  
  3947.  
  3948. ;(* Deletes an entry from the entry list. Expects entry address in      *)
  3949. ;(* currententry.                             *)
  3950. DelEntry    bclr    #change,flag4
  3951.         bsr    RemoveEntry
  3952.         bra    reply    
  3953.  
  3954.  
  3955. ;(* Removes an entry from the entry list. Used for deletion and also for *)
  3956. ;(* editing ie. delete old version, insert new version.             *)
  3957. ;(* Expects entry address in currententry. If change flag is set [flag4] *)
  3958. ;(* do not delete contents of edit buffer, because same entry must be    *)
  3959. ;(* re-created with new inputs.                         *)
  3960. RemoveEntry    move.l    currententry,a0
  3961.         move.l    ent_next(a0),store    store next
  3962.         cmp.l    page_start,a0        first on page?
  3963.         bne    .notstart        no
  3964.         move.l    ent_next(a0),page_start    yes        
  3965. .notstart    bsr    FindPrev        result in a0
  3966.         btst    #one_entry,flag1    only one entry?
  3967.         bne    .one            yes
  3968.         btst    #firstentry,flag1    first entry?
  3969.         bne    .first
  3970.         move.l    a0,entrystore        store previous
  3971.         move.l    currententry,a1        needed for freeup
  3972.         move.l    #ent_size,d0
  3973.         bsr    freeup            clear structure
  3974.         move.l    entrystore,a0        get previous    
  3975.         move.l    store,ent_next(a0)    set next pointer
  3976.         btst    #change,flag4
  3977.         bne    .nochange
  3978.         bsr    ClearEditString
  3979.         bsr    EditRefresh
  3980.         move.l    entrystore,a0
  3981.         bsr    RecallEntry        update display
  3982. .nochange    rts
  3983. .one        bsr    FindDay            returns day in a0
  3984.         move.l    a0,store
  3985.         move.l    day_entry(a0),a1    needed for freeup
  3986.         move.l    #ent_size,d0
  3987.         bsr    freeup            clear structure
  3988.         move.l    store,a0
  3989.         move.l    #0,day_entry(a0)    clear pointer to first entry
  3990.         move.l    #0,currententry
  3991.         btst    #change,flag4
  3992.         bne    .nochange1
  3993.         bsr    ClearEditString
  3994.         bsr    EditRefresh
  3995. .nochange1    rts
  3996. .first        move.l    store,entrystore    store next entry
  3997.         bsr    FindDay            returns day in a0
  3998.         move.l    a0,store        store day
  3999.         move.l    day_entry(a0),a1
  4000.         move.l    #ent_size,d0
  4001.         bsr    freeup
  4002.         move.l    store,a0
  4003.         move.l    entrystore,day_entry(a0)
  4004.         btst    #change,flag4
  4005.         bne    .nochange2
  4006.         bsr    ClearEditString
  4007.         bsr    EditRefresh
  4008.         move.l    entrystore,a0
  4009.         bsr    RecallEntry        update display
  4010. .nochange2    rts
  4011.  
  4012.  
  4013. ;(* Changes an entry in the entry list, to the values shown in the edit  *)
  4014. ;(* entry window.                             *)
  4015. ChangeEntry    move.l    currententry,a0
  4016.         cmp.l    #0,a0
  4017.         beq    .error
  4018.         bsr    CheckInputs
  4019.         btst    #requestop,flag2    Error requestor
  4020.         bne    .error            yes
  4021.         bsr    CloseEditwind
  4022.         bset    #change,flag4        do not delete inputs
  4023.         bsr    RemoveEntry        clear old version
  4024.         bset    #editinp,flag1        inputs from Edit window
  4025.         bsr    ReserveEntry        create new version
  4026.         move.l    d0,currententry        store
  4027.         bsr    FindDay            get day address (a0)
  4028.         move.l    currententry,a1        entry address
  4029.         bsr    InsertEntry        insert new version
  4030.         bsr    FindEntry
  4031.         move.l    a1,start_entry
  4032.         move.l    a1,page_start
  4033.         bsr    DisplayPages
  4034. .error        bra    finishmessage
  4035.  
  4036.  
  4037. *-------------- WINDOW STRUCTURES ---------------------------------------*
  4038.  
  4039.         even                Main Window
  4040. window_defs    dc.w    100            -----------
  4041.         dc.w    20
  4042.         dc.w    360
  4043.         dc.w    210
  4044.         dc.b    0
  4045.         dc.b    1
  4046.         dc.l    $660            IDCMP flags
  4047.         dc.l    $200100e        wbenchwindow            
  4048.         dc.l    df_gadget
  4049.         dc.l    0            standard checkmark
  4050.         dc.l    windowname
  4051.         dc.l    0            screenhd
  4052.         dc.l    0            no bitmap
  4053.         dc.w    0
  4054.         dc.w    0
  4055.         dc.w    640
  4056.         dc.w    256
  4057.         dc.w    1            wbenchscreen
  4058. windowname    dc.b    " AmigaDiary v1.13 ",0
  4059.         even    
  4060. windowhd    dc.l    0    
  4061.  
  4062.  
  4063.         even                Scribble Pad
  4064. spw_defs    dc.w    50            ------------
  4065.         dc.w    40
  4066.         dc.w    300
  4067.         dc.w    200
  4068.         dc.b    0
  4069.         dc.b    1
  4070.         dc.l    $260            IDCMP flags
  4071.         dc.l    $2001002        wbenchwindow            
  4072.         dc.l    sae_gadget
  4073.         dc.l    0            standard checkmark
  4074.         dc.l    spwname
  4075.         dc.l    0            screenhd
  4076.         dc.l    0            no bitmap
  4077.         dc.w    0
  4078.         dc.w    0
  4079.         dc.w    640
  4080.         dc.w    256
  4081.         dc.w    1            wbenchscreen
  4082. spwname        dc.b    " ScribblePad ",0
  4083.         even    
  4084. spwhd        dc.l    0    
  4085.  
  4086.  
  4087.         even                Add Entry
  4088. ae_defs        dc.w    40            ---------
  4089.         dc.w    60
  4090.         dc.w    528
  4091.         dc.w    80
  4092.         dc.b    0
  4093.         dc.b    1
  4094.         dc.l    $660            IDCMP flags
  4095.         dc.l    $2001002        wbenchwindow            
  4096.         dc.l    entry_sgadget
  4097.         dc.l    0            standard checkmark
  4098.         dc.l    aename
  4099.         dc.l    0            screenhd
  4100.         dc.l    0            no bitmap
  4101.         dc.w    0
  4102.         dc.w    0
  4103.         dc.w    640
  4104.         dc.w    256
  4105.         dc.w    1            wbenchscreen
  4106. aename        dc.b    " Add Entry ",0
  4107.         even    
  4108. aehd        dc.l    0    
  4109.  
  4110.  
  4111.         even                Shrink Window
  4112. shrink_defs    dc.w    200            -------------
  4113.         dc.w    30
  4114.         dc.w    220
  4115.         dc.w    25
  4116.         dc.b    0
  4117.         dc.b    1
  4118.         dc.l    $260            IDCMP flags
  4119.         dc.l    $200100e        wbenchwindow            
  4120.         dc.l    0            gadgets
  4121.         dc.l    0            standard checkmark
  4122.         dc.l    shrinkname
  4123.         dc.l    0            screenhd
  4124.         dc.l    0            no bitmap
  4125.         dc.w    0
  4126.         dc.w    0
  4127.         dc.w    640
  4128.         dc.w    256
  4129.         dc.w    1            wbenchscreen
  4130. shrinkname    dc.b    " AmigaDiary v1.13 ",0
  4131.         even    
  4132. shrinkhd    dc.l    0    
  4133.  
  4134.  
  4135.         even                About Window
  4136. about_defs    dc.w    100            ------------
  4137.         dc.w    60
  4138.         dc.w    360
  4139.         dc.w    100
  4140.         dc.b    0
  4141.         dc.b    1
  4142.         dc.l    $8            IDCMP flags
  4143.         dc.l    $2001002        wbenchwindow            
  4144.         dc.l    0
  4145.         dc.l    0            standard checkmark
  4146.         dc.l    aboutname
  4147.         dc.l    0            screenhd
  4148.         dc.l    0            no bitmap
  4149.         dc.w    0
  4150.         dc.w    0
  4151.         dc.w    640
  4152.         dc.w    256
  4153.         dc.w    1            wbenchscreen
  4154. aboutname    dc.b    " About AmigaDiary ",0
  4155.         even    
  4156. abouthd        dc.l    0    
  4157.  
  4158.         
  4159.         even
  4160. request_defs    dc.w    188            Error Requestor
  4161.         dc.w    80            ---------------
  4162.         dc.w    212
  4163.         dc.w    68
  4164.         dc.b    0
  4165.         dc.b    1
  4166.         dc.l    $60            IDCMP flags
  4167.         dc.l    $2001002            
  4168.         dc.l    ok_gadget
  4169.         dc.l    0            standard checkmark
  4170.         dc.l    requestname
  4171.         dc.l    0
  4172.         dc.l    0            no bitmap
  4173.         dc.w    200
  4174.         dc.w    50
  4175.         dc.w    640
  4176.         dc.w    256
  4177.         dc.w    1            wbench screen
  4178. requestname    dc.b    "      System Message      ",0
  4179.         even    
  4180. requesthd    dc.l    0
  4181.  
  4182.  
  4183.         even                Lookup Entry Window
  4184. le_defs        dc.w    150            ------------------
  4185.         dc.w    70
  4186.         dc.w    240
  4187.         dc.w    70
  4188.         dc.b    0
  4189.         dc.b    1
  4190.         dc.l    $660            IDCMP flags
  4191.         dc.l    $2001002        wbenchwindow            
  4192.         dc.l    date_sgadget
  4193.         dc.l    0            standard checkmark
  4194.         dc.l    lename
  4195.         dc.l    0            screenhd
  4196.         dc.l    0            no bitmap
  4197.         dc.w    0
  4198.         dc.w    0
  4199.         dc.w    640
  4200.         dc.w    256
  4201.         dc.w    1            wbenchscreen
  4202. lename        dc.b    " LookUp Entry ",0
  4203.         even    
  4204. lehd        dc.l    0    
  4205.  
  4206.  
  4207.         even                Load File Window
  4208. lf_defs        dc.w    110            ----------------
  4209.         dc.w    70
  4210.         dc.w    340
  4211.         dc.w    70
  4212.         dc.b    0
  4213.         dc.b    1
  4214.         dc.l    $660            IDCMP flags
  4215.         dc.l    $2001002        wbenchwindow            
  4216.         dc.l    fileload_sgadget
  4217.         dc.l    0            standard checkmark
  4218.         dc.l    lfname
  4219.         dc.l    0            screenhd
  4220.         dc.l    0            no bitmap
  4221.         dc.w    0
  4222.         dc.w    0
  4223.         dc.w    640
  4224.         dc.w    256
  4225.         dc.w    1            wbenchscreen
  4226. lfname        dc.b    " Load File ",0
  4227.         even    
  4228. lfhd        dc.l    0    
  4229.  
  4230.  
  4231.         even                Save File Window
  4232. sf_defs        dc.w    110            ----------------
  4233.         dc.w    70
  4234.         dc.w    340
  4235.         dc.w    70
  4236.         dc.b    0
  4237.         dc.b    1
  4238.         dc.l    $660            IDCMP flags
  4239.         dc.l    $2001002        wbenchwindow            
  4240.         dc.l    filesave_sgadget
  4241.         dc.l    0            standard checkmark
  4242.         dc.l    sfname
  4243.         dc.l    0            screenhd
  4244.         dc.l    0            no bitmap
  4245.         dc.w    0
  4246.         dc.w    0
  4247.         dc.w    640
  4248.         dc.w    256
  4249.         dc.w    1            wbenchscreen
  4250. sfname        dc.b    " Save File ",0
  4251.         even    
  4252. sfhd        dc.l    0    
  4253.  
  4254.  
  4255.         even                Add Entry (ScribblePad)
  4256. sae_defs    dc.w    40            -----------------------
  4257.         dc.w    60
  4258.         dc.w    528
  4259.         dc.w    65
  4260.         dc.b    0
  4261.         dc.b    1
  4262.         dc.l    $660            IDCMP flags
  4263.         dc.l    $2001002        wbenchwindow            
  4264.         dc.l    scribentry_sgadget
  4265.         dc.l    0            standard checkmark
  4266.         dc.l    saename
  4267.         dc.l    0            screenhd
  4268.         dc.l    0            no bitmap
  4269.         dc.w    0
  4270.         dc.w    0
  4271.         dc.w    640
  4272.         dc.w    256
  4273.         dc.w    1            wbenchscreen
  4274. saename        dc.b    " ScribblePad Add Entry ",0
  4275.         even    
  4276. saehd        dc.l    0    
  4277.  
  4278.  
  4279.         even                Edit Entry (ScribblePad)
  4280. scribedit_defs    dc.w    40            ------------------------
  4281.         dc.w    60
  4282.         dc.w    550
  4283.         dc.w    65
  4284.         dc.b    0
  4285.         dc.b    1
  4286.         dc.l    $660            IDCMP flags
  4287.         dc.l    $2001002        wbenchwindow            
  4288.         dc.l    scribedit_sgadget
  4289.         dc.l    0            standard checkmark
  4290.         dc.l    scribeditname
  4291.         dc.l    0            screenhd
  4292.         dc.l    0            no bitmap
  4293.         dc.w    0
  4294.         dc.w    0
  4295.         dc.w    640
  4296.         dc.w    256
  4297.         dc.w    1            wbenchscreen
  4298. scribeditname    dc.b    " ScribblePad Edit Entry ",0
  4299.         even    
  4300. scribedithd    dc.l    0    
  4301.  
  4302.  
  4303.         even                Edit Entry Window
  4304. edit_defs    dc.w    40            -----------------
  4305.         dc.w    60
  4306.         dc.w    548
  4307.         dc.w    90
  4308.         dc.b    0
  4309.         dc.b    1
  4310.         dc.l    $660            IDCMP flags
  4311.         dc.l    $2001002        wbenchwindow            
  4312.         dc.l    editentry_sgadget
  4313.         dc.l    0            standard checkmark
  4314.         dc.l    editname
  4315.         dc.l    0            screenhd
  4316.         dc.l    0            no bitmap
  4317.         dc.w    0
  4318.         dc.w    0
  4319.         dc.w    640
  4320.         dc.w    256
  4321.         dc.w    1            wbenchscreen
  4322. editname    dc.b    " Edit Entry ",0
  4323.         even    
  4324. edithd        dc.l    0    
  4325.  
  4326.  
  4327.  
  4328. *-------------- BORDER STRUCTURES ---------------------------------------*
  4329.  
  4330.  
  4331. border1        dc.w    0,9            x,y distances
  4332.         dc.b    2,0            colours
  4333.         dc.b    0            JAM1
  4334.         dc.b    15            number of coord pairs
  4335.         dc.l    coord1            coords table
  4336.         dc.l    0            next border
  4337. coord1        dc.w    8,4,352,4,352,140,8,140,8,4
  4338.         dc.w    12,4,12,140,16,140,16,4
  4339.         dc.w    183,4,183,140,344,140,344,4
  4340.         dc.w    348,4,348,140
  4341.  
  4342.  
  4343. gen_border    dc.w    0,0
  4344.         dc.b    1,0
  4345.         dc.b    0
  4346.         dc.b    5
  4347.         dc.l    ae_coord
  4348.         dc.l    ae_shadow        next border
  4349. ae_coord    dc.w    0,0,77,0,77,12,0,12,0,0
  4350.  
  4351. ae_shadow    dc.w    0,0
  4352.         dc.b    2,0
  4353.         dc.b    0
  4354.         dc.b    8
  4355.         dc.l    ae_scoord
  4356.         dc.l    0            no more borders
  4357. ae_scoord    dc.w    78,1,78,13,2,13,2,14,79,14
  4358.         dc.w    79,1,80,1,80,13
  4359.  
  4360.  
  4361. entry_border    dc.w    0,0            no offset
  4362.         dc.b    2,0            colour
  4363.         dc.b    0            JAM1
  4364.         dc.b    5            # coord pairs
  4365.         dc.l    entry_coord
  4366.         dc.l    0            
  4367. entry_coord    dc.w    -6,-2,426,-2,426,9,-6,9,-6,-2
  4368.  
  4369.  
  4370. hours_border    dc.w    0,0            no offset
  4371.         dc.b    2,0            colour
  4372.         dc.b    0            JAM1
  4373.         dc.b    5            # coord pairs
  4374.         dc.l    hours_coord
  4375.         dc.l    0            
  4376. hours_coord    dc.w    -6,-2,25,-2,25,9,-6,9,-6,-2
  4377.  
  4378.  
  4379. am_border    dc.w    0,0            no offset
  4380.         dc.b    2,0            colour
  4381.         dc.b    0            JAM1
  4382.         dc.b    5            # coord pairs
  4383.         dc.l    am_coord
  4384.         dc.l    0            
  4385. am_coord    dc.w    0,0,31,0,31,11,0,11,0,0
  4386.  
  4387.  
  4388. date_border    dc.w    0,0            no offset
  4389.         dc.b    2,0            colour
  4390.         dc.b    0            JAM1
  4391.         dc.b    5            # coord pairs
  4392.         dc.l    date_coord
  4393.         dc.l    0            
  4394. date_coord    dc.w    -6,-2,54,-2,54,9,-6,9,-6,-2
  4395.  
  4396.  
  4397. file_border    dc.w    0,0            no offset
  4398.         dc.b    2,0            colour
  4399.         dc.b    0            JAM1
  4400.         dc.b    5            # coord pairs
  4401.         dc.l    file_coord
  4402.         dc.l    0            
  4403. file_coord    dc.w    -6,-2,264,-2,264,9,-6,9,-6,-2
  4404.  
  4405.  
  4406. *-------------- IMAGE STRUCTURES ----------------------------------------*
  4407.  
  4408.  
  4409. ;(* Day Forward                                 *)
  4410. df_image    dc.w    0,0            no offset
  4411.         dc.w    19,12            pixels
  4412.         dc.w    2            bit planes
  4413.         dc.l    df_data            data
  4414.         dc.b    3,0            colours
  4415.         dc.l    0
  4416. dfi_image    dc.w    0,0            no offset
  4417.         dc.w    19,12            pixels
  4418.         dc.w    2            bit planes
  4419.         dc.l    dfi_data        data
  4420.         dc.b    3,0            colours
  4421.         dc.l    0
  4422.  
  4423.  
  4424. ;(* Day Backward                              *)
  4425. db_image    dc.w    0,0            no offset
  4426.         dc.w    19,12            pixels
  4427.         dc.w    2            bit planes
  4428.         dc.l    db_data            data
  4429.         dc.b    3,0            colours
  4430.         dc.l    0
  4431. dbi_image    dc.w    0,0            no offset
  4432.         dc.w    19,12            pixels
  4433.         dc.w    2            bit planes
  4434.         dc.l    dbi_data        data
  4435.         dc.b    3,0            colours
  4436.         dc.l    0
  4437.  
  4438.  
  4439. ;(* Week Backward                             *)
  4440. wb_image    dc.w    0,0            no offset
  4441.         dc.w    33,12            pixels
  4442.         dc.w    2            bit planes
  4443.         dc.l    wb_data            data
  4444.         dc.b    3,0            colours
  4445.         dc.l    0
  4446. wbi_image    dc.w    0,0            no offset
  4447.         dc.w    33,12            pixels
  4448.         dc.w    2            bit planes
  4449.         dc.l    wbi_data        data
  4450.         dc.b    3,0            colours
  4451.         dc.l    0
  4452.  
  4453.  
  4454. ;(* Week Forward                             *)
  4455. wf_image    dc.w    0,0            no offset
  4456.         dc.w    33,12            pixels
  4457.         dc.w    2            bit planes
  4458.         dc.l    wf_data            data
  4459.         dc.b    3,0            colours
  4460.         dc.l    0
  4461. wfi_image    dc.w    0,0            no offset
  4462.         dc.w    33,12            pixels
  4463.         dc.w    2            bit planes
  4464.         dc.l    wfi_data        data
  4465.         dc.b    3,0            colours
  4466.         dc.l    0
  4467.  
  4468.  
  4469. ;(* Time yes/no option in add entry / edit entry window.         *)
  4470. timeyes_image    dc.w    0,0            no offset
  4471.         dc.w    31,12            pixels
  4472.         dc.w    2            bit planes
  4473.         dc.l    timeyes_data        data
  4474.         dc.b    3,0            colours
  4475.         dc.l    0
  4476. timeyesi_image    dc.w    0,0            no offset
  4477.         dc.w    31,12            pixels
  4478.         dc.w    2            bit planes
  4479.         dc.l    timeyesi_data        data
  4480.         dc.b    3,0            colours
  4481.         dc.l    0
  4482.  
  4483.  
  4484. stop_image    dc.w    0,0
  4485.         dc.w    30,15,2
  4486.         dc.l    stop_data
  4487.         dc.b    3,0
  4488.         dc.l    0
  4489.  
  4490.  
  4491. *-------------- TEXT STRUCTURES -----------------------------------------*
  4492.  
  4493.  
  4494. ds_text        dc.b    1,0            colours
  4495.         dc.b    1            mode
  4496.         even
  4497.         dc.w    6,3            x,y pos        
  4498.         dc.l    topaz_defs        font
  4499.         dc.l    ds_ttext
  4500.         dc.l    ds1_text        next text
  4501. ds_ttext    dc.b    "S",0
  4502.         even
  4503. ds1_text    dc.b    1,0            colours
  4504.         dc.b    1            mode
  4505.         even
  4506.         dc.w    15,3            x,y pos        
  4507.         dc.l    topazU_defs        font
  4508.         dc.l    ds1_ttext
  4509.         dc.l    ds2_text        next text
  4510. ds1_ttext    dc.b    "c",0
  4511.         even
  4512. ds2_text    dc.b    1,0            colours
  4513.         dc.b    1            mode
  4514.         even
  4515.         dc.w    24,3            x,y pos        
  4516.         dc.l    topaz_defs        font
  4517.         dc.l    ds2_ttext
  4518.         dc.l    0            next text
  4519. ds2_ttext    dc.b    "ribble",0
  4520.         even
  4521.  
  4522.  
  4523. le_text        dc.b    1,0            colours
  4524.         dc.b    1            mode
  4525.         even
  4526.         dc.w    16,3            x,y pos        
  4527.         dc.l    topaz_defs        font
  4528.         dc.l    le_ttext
  4529.         dc.l    le1_text        next text
  4530. le_ttext    dc.b    "L",0
  4531.         even
  4532. le1_text    dc.b    1,0            colours
  4533.         dc.b    1            mode
  4534.         even
  4535.         dc.w    25,3            x,y pos        
  4536.         dc.l    topazU_defs        font
  4537.         dc.l    le1_ttext
  4538.         dc.l    le2_text        next text
  4539. le1_ttext    dc.b    "o",0
  4540.         even
  4541. le2_text    dc.b    1,0            colours
  4542.         dc.b    1            mode
  4543.         even
  4544.         dc.w    34,3            x,y pos        
  4545.         dc.l    topaz_defs        font
  4546.         dc.l    le2_ttext
  4547.         dc.l    0            next text
  4548. le2_ttext    dc.b    "okup",0
  4549.         even
  4550.  
  4551.  
  4552. ed_text        dc.b    1,0            colours
  4553.         dc.b    1            mode
  4554.         even
  4555.         dc.w    24,3            x,y pos        
  4556.         dc.l    topazU_defs        font
  4557.         dc.l    ed_ttext
  4558.         dc.l    ed1_text        next text
  4559. ed_ttext    dc.b    "E",0
  4560.         even
  4561. ed1_text    dc.b    1,0            colours
  4562.         dc.b    1            mode
  4563.         even
  4564.         dc.w    33,3            x,y pos        
  4565.         dc.l    topaz_defs        font
  4566.         dc.l    ed1_ttext
  4567.         dc.l    0            next text
  4568. ed1_ttext    dc.b    "dit",0
  4569.         even
  4570.  
  4571. ed2_text    dc.b    1,0            colours
  4572.         dc.b    1            mode
  4573.         even
  4574.         dc.w    24,3            x,y pos        
  4575.         dc.l    topaz_defs        font
  4576.         dc.l    ed2_ttext
  4577.         dc.l    0            next text
  4578. ed2_ttext    dc.b    "Edit",0
  4579.         even
  4580.  
  4581.  
  4582. ld_text        dc.b    1,0            colours
  4583.         dc.b    1            mode
  4584.         even
  4585.         dc.w    24,3            x,y pos        
  4586.         dc.l    topazU_defs        font
  4587.         dc.l    ld_ttext
  4588.         dc.l    ld1_text        next text
  4589. ld_ttext    dc.b    "L",0
  4590.         even
  4591. ld1_text    dc.b    1,0            colours
  4592.         dc.b    1            mode
  4593.         even
  4594.         dc.w    33,3            x,y pos        
  4595.         dc.l    topaz_defs        font
  4596.         dc.l    ld1_ttext
  4597.         dc.l    0            next text
  4598. ld1_ttext    dc.b    "oad",0
  4599.         even
  4600.  
  4601.  
  4602. sd_text        dc.b    1,0            colours
  4603.         dc.b    1            mode
  4604.         even
  4605.         dc.w    26,3            x,y pos        
  4606.         dc.l    topazU_defs        font
  4607.         dc.l    sd_ttext
  4608.         dc.l    sd1_text        next text
  4609. sd_ttext    dc.b    "S",0
  4610.         even
  4611. sd1_text    dc.b    1,0            colours
  4612.         dc.b    1            mode
  4613.         even
  4614.         dc.w    35,3            x,y pos        
  4615.         dc.l    topaz_defs        font
  4616.         dc.l    sd1_ttext
  4617.         dc.l    0            next text
  4618. sd1_ttext    dc.b    "ave",0
  4619.         even
  4620.  
  4621.  
  4622. ab_text        dc.b    1,0            colours
  4623.         dc.b    1            mode
  4624.         even
  4625.         dc.w    21,3            x,y pos        
  4626.         dc.l    topaz_defs        font
  4627.         dc.l    ab_ttext
  4628.         dc.l    ab1_text        next text
  4629. ab_ttext    dc.b    "A",0
  4630.         even
  4631. ab1_text    dc.b    1,0            colours
  4632.         dc.b    1            mode
  4633.         even
  4634.         dc.w    30,3            x,y pos        
  4635.         dc.l    topazU_defs        font
  4636.         dc.l    ab1_ttext
  4637.         dc.l    ab2_text        next text
  4638. ab1_ttext    dc.b    "b",0
  4639.         even
  4640. ab2_text    dc.b    1,0            colours
  4641.         dc.b    1            mode
  4642.         even
  4643.         dc.w    39,3            x,y pos        
  4644.         dc.l    topaz_defs        font
  4645.         dc.l    ab2_ttext
  4646.         dc.l    0            next text
  4647. ab2_ttext    dc.b    "out",0
  4648.         even
  4649.  
  4650.  
  4651. sh_text        dc.b    1,0            colours
  4652.         dc.b    1            mode
  4653.         even
  4654.         dc.w    16,3            x,y pos        
  4655.         dc.l    topaz_defs        font
  4656.         dc.l    sh_ttext
  4657.         dc.l    sh1_text        next text
  4658. sh_ttext    dc.b    "S",0
  4659.         even
  4660. sh1_text    dc.b    1,0            colours
  4661.         dc.b    1            mode
  4662.         even
  4663.         dc.w    25,3            x,y pos        
  4664.         dc.l    topazU_defs        font
  4665.         dc.l    sh1_ttext
  4666.         dc.l    sh2_text        next text
  4667. sh1_ttext    dc.b    "h",0
  4668.         even
  4669. sh2_text    dc.b    1,0            colours
  4670.         dc.b    1            mode
  4671.         even
  4672.         dc.w    34,3            x,y pos        
  4673.         dc.l    topaz_defs        font
  4674.         dc.l    sh2_ttext
  4675.         dc.l    0            next text
  4676. sh2_ttext    dc.b    "rink",0
  4677.         even
  4678.  
  4679.  
  4680. add_text    dc.b    1,0            colours
  4681.         dc.b    1            mode
  4682.         even
  4683.         dc.w    28,3            x,y pos        
  4684.         dc.l    topazU_defs        font
  4685.         dc.l    add_ttext
  4686.         dc.l    add1_text        next text
  4687. add_ttext    dc.b    "A",0
  4688.         even
  4689. add1_text    dc.b    1,0            colours
  4690.         dc.b    1            mode
  4691.         even
  4692.         dc.w    37,3            x,y pos        
  4693.         dc.l    topaz_defs        font
  4694.         dc.l    add1_ttext
  4695.         dc.l    0            next text
  4696. add1_ttext    dc.b    "dd",0
  4697.         even
  4698.  
  4699.  
  4700. line_break    dc.b    "--------------------",0
  4701.         even
  4702.  
  4703.  
  4704. line1_text    dc.b    3,0            colours
  4705.         dc.b    1            mode
  4706.         even
  4707.         dc.w    148,20            x,y pos        
  4708.         dc.l    topaz_defs        font
  4709.         dc.l    line1_ttext
  4710.         dc.l    line2_text        next text
  4711. line1_ttext    dc.b    "AmigaDiary",0
  4712.         even
  4713.  
  4714.  
  4715. line2_text    dc.b    2,0            colours
  4716.         dc.b    1            mode
  4717.         even
  4718.         dc.w    145,40            x,y pos        
  4719.         dc.l    topaz_defs        font
  4720.         dc.l    line2_ttext
  4721.         dc.l    line3_text        next text
  4722. line2_ttext    dc.b    "version 1.13",0
  4723.         even
  4724.  
  4725.  
  4726. line3_text    dc.b    2,0            colours
  4727.         dc.b    1            mode
  4728.         even
  4729.         dc.w    75,60            x,y pos        
  4730.         dc.l    topaz_defs        font
  4731.         dc.l    line3_ttext
  4732.         dc.l    line4_text        next text
  4733. line3_ttext    dc.b    "written by Andrew K. Pearson",0
  4734.         even
  4735.  
  4736.  
  4737. line4_text    dc.b    2,0            colours
  4738.         dc.b    1            mode
  4739.         even
  4740.         dc.w    80,80            x,y pos        
  4741.         dc.l    topaz_defs        font
  4742.         dc.l    line4_ttext
  4743.         dc.l    0            next text
  4744. line4_ttext    dc.b    "(c) Andrew Pearson 1992/93",0
  4745.         even
  4746.  
  4747.  
  4748. date_text    dc.b    1,0            colours
  4749.         dc.b    1            mode
  4750.         even
  4751.         dc.w    -120,0            x,y pos        
  4752.         dc.l    topaz_defs        font
  4753.         dc.l    date_ttext
  4754.         dc.l    0            next text
  4755. date_ttext    dc.b    "Date (ddmmyy)",0
  4756.         even
  4757.  
  4758.  
  4759. next_text    dc.b    1,0            colours
  4760.         dc.b    1            mode
  4761.         even
  4762.         dc.w    24,3            x,y pos        
  4763.         dc.l    topaz_defs        font
  4764.         dc.l    next_ttext
  4765.         dc.l    0            next text
  4766. next_ttext    dc.b    "Next",0
  4767.         even
  4768.  
  4769.  
  4770. prev_text    dc.b    1,0            colours
  4771.         dc.b    1            mode
  4772.         even
  4773.         dc.w    24,3            x,y pos        
  4774.         dc.l    topaz_defs        font
  4775.         dc.l    prev_ttext
  4776.         dc.l    0            next text
  4777. prev_ttext    dc.b    "Prev",0
  4778.         even
  4779.  
  4780.  
  4781. delete_text    dc.b    1,0            colours
  4782.         dc.b    1            mode
  4783.         even
  4784.         dc.w    15,3            x,y pos        
  4785.         dc.l    topaz_defs        font
  4786.         dc.l    delete_ttext
  4787.         dc.l    0            next text
  4788. delete_ttext    dc.b    "Delete",0
  4789.         even
  4790.  
  4791.  
  4792. invinp_text    dc.b    1,0            colours
  4793.         dc.b    1            mode
  4794.         even
  4795.         dc.w    60,25            x,y pos        
  4796.         dc.l    topaz_defs        font
  4797.         dc.l    invinp_ttext
  4798.         dc.l    0            next text
  4799. invinp_ttext    dc.b    "Invalid Inputs!",0
  4800.         even
  4801.  
  4802.  
  4803. badfile_text    dc.b    1,0            colours
  4804.         dc.b    1            mode
  4805.         even
  4806.         dc.w    60,25            x,y pos        
  4807.         dc.l    topaz_defs        font
  4808.         dc.l    badfile_ttext
  4809.         dc.l    0            next text
  4810. badfile_ttext    dc.b    "Invalid File!",0
  4811.         even
  4812.  
  4813.  
  4814. done_text    dc.b    1,0            colours
  4815.         dc.b    1            mode
  4816.         even
  4817.         dc.w    26,3            x,y pos        
  4818.         dc.l    topaz_defs        font
  4819.         dc.l    done_ttext
  4820.         dc.l    0            next text
  4821. done_ttext    dc.b    "Done",0
  4822.         even
  4823.  
  4824.  
  4825. ae_text        dc.b    1,0            colours
  4826.         dc.b    1            mode
  4827.         even
  4828.         dc.w    28,3            x,y pos        
  4829.         dc.l    topaz_defs        font
  4830.         dc.l    ae_ttext
  4831.         dc.l    0            next text
  4832. ae_ttext    dc.b    "Add",0
  4833.         even
  4834.  
  4835.  
  4836. entry_text    dc.b    1,0            colours
  4837.         dc.b    1            mode
  4838.         even
  4839.         dc.w    -50,0            x,y pos        
  4840.         dc.l    topaz_defs        font
  4841.         dc.l    entry_ttext
  4842.         dc.l    0            next text
  4843. entry_ttext    dc.b    "Entry",0
  4844.         even
  4845.  
  4846.  
  4847. hours_text    dc.b    1,0            colours
  4848.         dc.b    1            mode
  4849.         even
  4850.         dc.w    -50,0            x,y pos        
  4851.         dc.l    topaz_defs        font
  4852.         dc.l    hours_ttext
  4853.         dc.l    0            next text
  4854. hours_ttext    dc.b    "Hours",0
  4855.         even
  4856.  
  4857.  
  4858. mins_text    dc.b    1,0            colours
  4859.         dc.b    1            mode
  4860.         even
  4861.         dc.w    -65,0            x,y pos        
  4862.         dc.l    topaz_defs        font
  4863.         dc.l    mins_ttext
  4864.         dc.l    0            next text
  4865. mins_ttext    dc.b    "Minutes",0
  4866.         even
  4867.  
  4868.  
  4869. yes_text    dc.b    1,0            colours
  4870.         dc.b    1            mode
  4871.         even
  4872.         dc.w    4,2            x,y pos        
  4873.         dc.l    topaz_defs        font
  4874.         dc.l    yes_ttext
  4875.         dc.l    0            next text
  4876. yes_ttext    dc.b    "Yes",0
  4877.         even
  4878.  
  4879.  
  4880. cr_text        dc.b    1,0            colours
  4881.         dc.b    1            mode
  4882.         even
  4883.         dc.w    20,3            x,y pos        
  4884.         dc.l    topaz_defs        font
  4885.         dc.l    cr_ttext
  4886.         dc.l    0            next text
  4887. cr_ttext    dc.b    "Clear",0
  4888.         even
  4889.  
  4890.  
  4891. ok_text        dc.b    1,0            colours
  4892.         dc.b    1            mode
  4893.         even
  4894.         dc.w    30,3            x,y pos        
  4895.         dc.l    topaz_defs        font
  4896.         dc.l    ok_ttext
  4897.         dc.l    0            next text
  4898. ok_ttext    dc.b    "Ok!",0
  4899.         even
  4900.  
  4901.  
  4902. cancel_text    dc.b    1,0            colours
  4903.         dc.b    1            mode
  4904.         even
  4905.         dc.w    15,3            x,y pos        
  4906.         dc.l    topaz_defs        font
  4907.         dc.l    cancel_ttext
  4908.         dc.l    0            next text
  4909. cancel_ttext    dc.b    "Cancel",0
  4910.         even
  4911.  
  4912.  
  4913. change_text    dc.b    1,0            colours
  4914.         dc.b    1            mode
  4915.         even
  4916.         dc.w    15,3            x,y pos        
  4917.         dc.l    topaz_defs        font
  4918.         dc.l    change_ttext
  4919.         dc.l    0            next text
  4920. change_ttext    dc.b    "Change",0
  4921.         even
  4922.  
  4923.  
  4924. file_text    dc.b    1,0            colours
  4925.         dc.b    1            mode
  4926.         even
  4927.         dc.w    -46,0            x,y pos        
  4928.         dc.l    topaz_defs        font
  4929.         dc.l    file_ttext
  4930.         dc.l    0            next text
  4931. file_ttext    dc.b    "File",0
  4932.         even
  4933.  
  4934.  
  4935. includetime    dc.b    "include time?",0
  4936.         even
  4937.  
  4938.  
  4939. *-------------- GADGET STRUCTURES (MAIN WINDOW) -------------------------*
  4940.  
  4941.  
  4942. ;(* Day Forward                              *)
  4943. df_gadget    dc.l    db_gadget        next gadget
  4944.         dc.w    280,155            x,y pos
  4945.         dc.w    19,12            width, height (hit box)
  4946.         dc.w    6            image, new image
  4947.         dc.w    1            flags
  4948.         dc.w    1            type : boolean
  4949.         dc.l    df_image        image
  4950.         dc.l    dfi_image        inverse data
  4951.         dc.l    0            no text
  4952.         dc.l    0            no exclude
  4953.         dc.l    0            no special info
  4954.         dc.w    $10            gadget ID    
  4955.         dc.l    0            user data
  4956.  
  4957.  
  4958. ;(* Day Backward                             *)        
  4959. db_gadget    dc.l    wb_gadget        next gadget
  4960.         dc.w    65,155            x,y pos
  4961.         dc.w    19,12            width, height (hit box)
  4962.         dc.w    6            flags
  4963.         dc.w    1            flags
  4964.         dc.w    1            type : boolean
  4965.         dc.l    db_image        image
  4966.         dc.l    dbi_image        inverse data
  4967.         dc.l    0            no text
  4968.         dc.l    0            no exclude
  4969.         dc.l    0            no special info
  4970.         dc.w    $11            gadget ID    
  4971.         dc.l    0            user data
  4972.  
  4973.  
  4974. ;(* Week Backward                             *)
  4975. wb_gadget    dc.l    wf_gadget        next gadget
  4976.         dc.w    23,155            x,y pos
  4977.         dc.w    33,12            width, height (hit box)
  4978.         dc.w    6            flags
  4979.         dc.w    1            flags
  4980.         dc.w    1            type : boolean
  4981.         dc.l    wb_image        image
  4982.         dc.l    wbi_image        inverse data
  4983.         dc.l    0            no text
  4984.         dc.l    0            no exclude
  4985.         dc.l    0            no special info
  4986.         dc.w    $12            gadget ID    
  4987.         dc.l    0            user data
  4988.  
  4989.  
  4990. ;(* Week Forward                             *)
  4991. wf_gadget    dc.l    ae_gadget        next gadget
  4992.         dc.w    308,155            x,y pos
  4993.         dc.w    33,12            width, height (hit box)
  4994.         dc.w    6            flags
  4995.         dc.w    1            flags
  4996.         dc.w    1            type : boolean
  4997.         dc.l    wf_image        image
  4998.         dc.l    wfi_image        inverse data
  4999.         dc.l    0            no text
  5000.         dc.l    0            no exclude
  5001.         dc.l    0            no special info
  5002.         dc.w    $13            gadget ID    
  5003.         dc.l    0            user data
  5004.  
  5005.  
  5006. ;(* Add Entry                                 *)
  5007. ae_gadget    dc.l    ds_gadget        next gadget
  5008.         dc.w    97,170            x,y pos
  5009.         dc.w    77,12            width, height (hit box)
  5010.         dc.w    0            flags:inverse
  5011.         dc.w    1            flags
  5012.         dc.w    1            type : boolean
  5013.         dc.l    gen_border        image
  5014.         dc.l    0            inverse data
  5015.         dc.l    add_text        text
  5016.         dc.l    0            no exclude
  5017.         dc.l    0            no special info
  5018.         dc.w    $14            gadget ID    
  5019.         dc.l    0            user data
  5020.  
  5021.  
  5022. ;(* Display ScribblePad                             *)
  5023. ds_gadget    dc.l    le_gadget        next gadget
  5024.         dc.w    267,170            x,y pos
  5025.         dc.w    77,12            width, height (hit box)
  5026.         dc.w    0            flags
  5027.         dc.w    1            flags
  5028.         dc.w    1            type : boolean
  5029.         dc.l    gen_border        image
  5030.         dc.l    0            inverse data
  5031.         dc.l    ds_text            text
  5032.         dc.l    0            no exclude
  5033.         dc.l    0            no special info
  5034.         dc.w    $15            gadget ID    
  5035.         dc.l    0            user data
  5036.  
  5037.  
  5038. ;(* Lookup Entry                             *)
  5039. le_gadget    dc.l    ed_gadget        next gadget
  5040.         dc.w    12,170            x,y pos
  5041.         dc.w    77,12            width, height (hit box)
  5042.         dc.w    0            flags
  5043.         dc.w    1            flags
  5044.         dc.w    1            type : boolean
  5045.         dc.l    gen_border        image
  5046.         dc.l    0            inverse data
  5047.         dc.l    le_text            text
  5048.         dc.l    0            no exclude
  5049.         dc.l    0            no special info
  5050.         dc.w    $16            gadget ID    
  5051.         dc.l    0            user data
  5052.  
  5053.  
  5054. ;(* Remove Entry                             *)
  5055. ed_gadget    dc.l    ld_gadget        next gadget
  5056.         dc.w    182,170            x,y pos
  5057.         dc.w    77,12            width, height (hit box)
  5058.         dc.w    0            flags
  5059.         dc.w    1            flags
  5060.         dc.w    1            type : boolean
  5061.         dc.l    gen_border        image
  5062.         dc.l    0            inverse data
  5063.         dc.l    ed_text            text
  5064.         dc.l    0            no exclude
  5065.         dc.l    0            no special info
  5066.         dc.w    $17            gadget ID    
  5067.         dc.l    0            user data
  5068.  
  5069.  
  5070. ;(* Load Diary                                 *)
  5071. ld_gadget    dc.l    sd_gadget        next gadget
  5072.         dc.w    12,188            x,y pos
  5073.         dc.w    77,12            width, height (hit box)
  5074.         dc.w    0            flags
  5075.         dc.w    1            flags
  5076.         dc.w    1            type : boolean
  5077.         dc.l    gen_border        image
  5078.         dc.l    0            inverse data
  5079.         dc.l    ld_text            text
  5080.         dc.l    0            no exclude
  5081.         dc.l    0            no special info
  5082.         dc.w    $18            gadget ID    
  5083.         dc.l    0            user data
  5084.  
  5085.  
  5086. ;(* Save Diary                                 *)
  5087. sd_gadget    dc.l    ab_gadget        next gadget
  5088.         dc.w    97,188            x,y pos
  5089.         dc.w    77,12            width, height (hit box)
  5090.         dc.w    0            flags
  5091.         dc.w    1            flags
  5092.         dc.w    1            type : boolean
  5093.         dc.l    gen_border        image
  5094.         dc.l    0            inverse data
  5095.         dc.l    sd_text            text
  5096.         dc.l    0            no exclude
  5097.         dc.l    0            no special info
  5098.         dc.w    $19            gadget ID    
  5099.         dc.l    0            user data
  5100.  
  5101.  
  5102. ;(* About                                  *)
  5103. ab_gadget    dc.l    sh_gadget        next gadget
  5104.         dc.w    182,188            x,y pos
  5105.         dc.w    77,12            width, height (hit box)
  5106.         dc.w    0            flags
  5107.         dc.w    1            flags
  5108.         dc.w    1            type : boolean
  5109.         dc.l    gen_border        image
  5110.         dc.l    0            inverse data
  5111.         dc.l    ab_text            text
  5112.         dc.l    0            no exclude
  5113.         dc.l    0            no special info
  5114.         dc.w    $1a            gadget ID    
  5115.         dc.l    0            user data
  5116.  
  5117.  
  5118. ;(* Shrink                                 *)
  5119. sh_gadget    dc.l    flip_gadget        next gadget
  5120.         dc.w    267,188            x,y pos
  5121.         dc.w    77,12            width, height (hit box)
  5122.         dc.w    0            flags
  5123.         dc.w    1            flags
  5124.         dc.w    1            type : boolean
  5125.         dc.l    gen_border        image
  5126.         dc.l    0            inverse data
  5127.         dc.l    sh_text            text
  5128.         dc.l    0            no exclude
  5129.         dc.l    0            no special info
  5130.         dc.w    $1b            gadget ID    
  5131.         dc.l    0            user data
  5132.  
  5133.  
  5134. ;(* Flip Page                                  *)
  5135. flip_gadget    dc.l    0            next gadget
  5136.         dc.w    329,135            x,y pos
  5137.         dc.w    19,12            width, height (hit box)
  5138.         dc.w    6            image, new image
  5139.         dc.w    1            flags
  5140.         dc.w    1            type : boolean
  5141.         dc.l    df_image        image
  5142.         dc.l    dfi_image        inverse data
  5143.         dc.l    0            no text
  5144.         dc.l    0            no exclude
  5145.         dc.l    0            no special info
  5146.         dc.w    $1c            gadget ID    
  5147.         dc.l    0            user data
  5148.  
  5149.  
  5150. *-------------- GADGET STRUCTURES (ADD ENTRY WINDOW) --------------------*
  5151.  
  5152.  
  5153. entry_sgadget    dc.l    hours_sgadget        next gadget
  5154.         dc.w    69,20            x,y pos
  5155.         dc.w    425,10            width, height
  5156.         dc.w    0            flags
  5157.         dc.w    2            activation
  5158.         dc.w    4            type : string
  5159.         dc.l    entry_border        border structure
  5160.         dc.l    0            no drawing
  5161.         dc.l    entry_text        text
  5162.         dc.l    0            no exclude
  5163.         dc.l    entry_sinfo
  5164.         dc.w    $23            gadget ID
  5165.         dc.l    0            user data
  5166.  
  5167.  
  5168. hours_sgadget    dc.l    mins_sgadget        next gadget
  5169.         dc.w    69,40            x,y pos
  5170.         dc.w    30,10            width, height
  5171.         dc.w    0            flags
  5172.         dc.w    $802            integer 
  5173.         dc.w    4            type : string
  5174.         dc.l    hours_border        border structure
  5175.         dc.l    0            no drawing
  5176.         dc.l    hours_text        text
  5177.         dc.l    0            no exclude
  5178.         dc.l    hours_sinfo
  5179.         dc.w    $24            gadget ID
  5180.         dc.l    0            user data
  5181.  
  5182.  
  5183. mins_sgadget    dc.l    yes_gadget        next gadget
  5184.         dc.w    179,40            x,y pos
  5185.         dc.w    30,10            width, height
  5186.         dc.w    0            flags
  5187.         dc.w    $802            integer 
  5188.         dc.w    4            type : string
  5189.         dc.l    hours_border        border structure
  5190.         dc.l    0            no drawing
  5191.         dc.l    mins_text        text
  5192.         dc.l    0            no exclude
  5193.         dc.l    mins_sinfo
  5194.         dc.w    $25            gadget ID
  5195.         dc.l    0            user data
  5196.  
  5197.  
  5198. yes_gadget    dc.l    ae1_gadget        next gadget
  5199.         dc.w    440,38            x,y pos
  5200.         dc.w    31,11            width, height (hit box)
  5201.         dc.w    $80            flags
  5202.         dc.w    $101            flags
  5203.         dc.w    1            type : boolean
  5204.         dc.l    am_border        image
  5205.         dc.l    0            inverse data
  5206.         dc.l    yes_text        text
  5207.         dc.l    0            no exclude
  5208.         dc.l    0            no special info
  5209.         dc.w    $28            gadget ID    
  5210.         dc.l    0            user data
  5211.  
  5212.  
  5213. ae1_gadget    dc.l    cr_gadget        next gadget
  5214.         dc.w    32,55            x,y pos
  5215.         dc.w    77,12            width, height (hit box)
  5216.         dc.w    0            flags
  5217.         dc.w    1            flags
  5218.         dc.w    1            type : boolean
  5219.         dc.l    gen_border        image
  5220.         dc.l    0            inverse data
  5221.         dc.l    ae_text            text
  5222.         dc.l    0            no exclude
  5223.         dc.l    0            no special info
  5224.         dc.w    $20            gadget ID    
  5225.         dc.l    0            user data
  5226.  
  5227.  
  5228. cr_gadget    dc.l    cancel_gadget        next gadget
  5229.         dc.w    205,55            x,y pos
  5230.         dc.w    77,12            width, height (hit box)
  5231.         dc.w    0            flags
  5232.         dc.w    1            flags
  5233.         dc.w    1            type : boolean
  5234.         dc.l    gen_border        image
  5235.         dc.l    0            inverse data
  5236.         dc.l    cr_text            text
  5237.         dc.l    0            no exclude
  5238.         dc.l    0            no special info
  5239.         dc.w    $21            gadget ID    
  5240.         dc.l    0            user data
  5241.  
  5242.  
  5243. cancel_gadget    dc.l    0            next gadget
  5244.         dc.w    385,55            x,y pos
  5245.         dc.w    77,12            width, height (hit box)
  5246.         dc.w    0            flags
  5247.         dc.w    1            flags
  5248.         dc.w    1            type : boolean
  5249.         dc.l    gen_border        image
  5250.         dc.l    0            inverse data
  5251.         dc.l    cancel_text        text
  5252.         dc.l    0            no exclude
  5253.         dc.l    0            no special info
  5254.         dc.w    $22            gadget ID    
  5255.         dc.l    0            user data
  5256.  
  5257.  
  5258. *-------------- GADGET STRUCTURES (LOOKUP ENTRY) ------------------------*
  5259.  
  5260.  
  5261. date_sgadget    dc.l    ok1_gadget        next gadget
  5262.         dc.w    140,20            x,y pos
  5263.         dc.w    225,10            width, height
  5264.         dc.w    0            flags
  5265.         dc.w    $802            activation
  5266.         dc.w    4            type : string
  5267.         dc.l    date_border        border structure
  5268.         dc.l    0            no drawing
  5269.         dc.l    date_text        text
  5270.         dc.l    0            no exclude
  5271.         dc.l    date_sinfo
  5272.         dc.w    $40            gadget ID
  5273.         dc.l    0            user data
  5274.  
  5275.  
  5276. ok1_gadget    dc.l    cancel1_gadget        next gadget
  5277.         dc.w    20,40            x,y pos
  5278.         dc.w    77,12            width, height (hit box)
  5279.         dc.w    0            flags
  5280.         dc.w    1            flags
  5281.         dc.w    1            type : boolean
  5282.         dc.l    gen_border        image
  5283.         dc.l    0            inverse data
  5284.         dc.l    ok_text            text
  5285.         dc.l    0            no exclude
  5286.         dc.l    0            no special info
  5287.         dc.w    $41            gadget ID    
  5288.         dc.l    0            user data
  5289.  
  5290.  
  5291. cancel1_gadget    dc.l    0            next gadget
  5292.         dc.w    140,40            x,y pos
  5293.         dc.w    77,12            width, height (hit box)
  5294.         dc.w    0            flags
  5295.         dc.w    1            flags
  5296.         dc.w    1            type : boolean
  5297.         dc.l    gen_border        image
  5298.         dc.l    0            inverse data
  5299.         dc.l    cancel_text        text
  5300.         dc.l    0            no exclude
  5301.         dc.l    0            no special info
  5302.         dc.w    $42            gadget ID    
  5303.         dc.l    0            user data
  5304.  
  5305.  
  5306. *-------------- GADGET STRUCTURES (FILE SAVE) ---------------------------*
  5307.  
  5308.  
  5309. filesave_sgadget
  5310.         dc.l    saveok_gadget        next gadget
  5311.         dc.w    60,20            x,y pos
  5312.         dc.w    265,10            width, height
  5313.         dc.w    0            flags
  5314.         dc.w    2            activation
  5315.         dc.w    4            type : string
  5316.         dc.l    file_border        border structure
  5317.         dc.l    0            no drawing
  5318.         dc.l    file_text        text
  5319.         dc.l    0            no exclude
  5320.         dc.l    file_sinfo
  5321.         dc.w    $50            gadget ID
  5322.         dc.l    0            user data
  5323.  
  5324.  
  5325. saveok_gadget    dc.l    savecancel_gadget    next gadget
  5326.         dc.w    30,40            x,y pos
  5327.         dc.w    77,12            width, height (hit box)
  5328.         dc.w    0            flags
  5329.         dc.w    1            flags
  5330.         dc.w    1            type : boolean
  5331.         dc.l    gen_border        image
  5332.         dc.l    0            inverse data
  5333.         dc.l    ok_text            text
  5334.         dc.l    0            no exclude
  5335.         dc.l    0            no special info
  5336.         dc.w    $51            gadget ID    
  5337.         dc.l    0            user data
  5338.  
  5339.  
  5340. savecancel_gadget
  5341.         dc.l    0            next gadget
  5342.         dc.w    230,40            x,y pos
  5343.         dc.w    77,12            width, height (hit box)
  5344.         dc.w    0            flags
  5345.         dc.w    1            flags
  5346.         dc.w    1            type : boolean
  5347.         dc.l    gen_border        image
  5348.         dc.l    0            inverse data
  5349.         dc.l    cancel_text        text
  5350.         dc.l    0            no exclude
  5351.         dc.l    0            no special info
  5352.         dc.w    $52            gadget ID    
  5353.         dc.l    0            user data
  5354.  
  5355.  
  5356.  
  5357. *-------------- GADGET STRUCTURES (FILE LOAD) ---------------------------*
  5358.  
  5359.  
  5360. fileload_sgadget
  5361.         dc.l    loadok_gadget        next gadget
  5362.         dc.w    60,20            x,y pos
  5363.         dc.w    265,10            width, height
  5364.         dc.w    0            flags
  5365.         dc.w    2            activation
  5366.         dc.w    4            type : string
  5367.         dc.l    file_border        border structure
  5368.         dc.l    0            no drawing
  5369.         dc.l    file_text        text
  5370.         dc.l    0            no exclude
  5371.         dc.l    file_sinfo
  5372.         dc.w    $60            gadget ID
  5373.         dc.l    0            user data
  5374.  
  5375.  
  5376. loadok_gadget    dc.l    loadcancel_gadget    next gadget
  5377.         dc.w    30,40            x,y pos
  5378.         dc.w    77,12            width, height (hit box)
  5379.         dc.w    0            flags
  5380.         dc.w    1            flags
  5381.         dc.w    1            type : boolean
  5382.         dc.l    gen_border        image
  5383.         dc.l    0            inverse data
  5384.         dc.l    ok_text            text
  5385.         dc.l    0            no exclude
  5386.         dc.l    0            no special info
  5387.         dc.w    $61            gadget ID    
  5388.         dc.l    0            user data
  5389.  
  5390.  
  5391. loadcancel_gadget
  5392.         dc.l    0            next gadget
  5393.         dc.w    230,40            x,y pos
  5394.         dc.w    77,12            width, height (hit box)
  5395.         dc.w    0            flags
  5396.         dc.w    1            flags
  5397.         dc.w    1            type : boolean
  5398.         dc.l    gen_border        image
  5399.         dc.l    0            inverse data
  5400.         dc.l    cancel_text        text
  5401.         dc.l    0            no exclude
  5402.         dc.l    0            no special info
  5403.         dc.w    $62            gadget ID    
  5404.         dc.l    0            user data
  5405.  
  5406.  
  5407.  
  5408. *-------------- GADGET STRUCTURES (SCRIBBLEPAD) -------------------------*
  5409.  
  5410.  
  5411. ;(* Add entry ...                             *)
  5412. sae_gadget    dc.l    done_gadget        next gadget
  5413.         dc.w    20,180            x,y pos
  5414.         dc.w    77,12            width, height (hit box)
  5415.         dc.w    0            flags:inverse
  5416.         dc.w    1            flags
  5417.         dc.w    1            type : boolean
  5418.         dc.l    gen_border        image
  5419.         dc.l    0            inverse data
  5420.         dc.l    ae_text            text
  5421.         dc.l    0            no exclude
  5422.         dc.l    0            no special info
  5423.         dc.w    $70            gadget ID    
  5424.         dc.l    0            user data
  5425.  
  5426.  
  5427. ;(* Done entry ...                             *)
  5428. done_gadget    dc.l    scribnext_gadget    next gadget
  5429.         dc.w    200,180            x,y pos
  5430.         dc.w    77,12            width, height (hit box)
  5431.         dc.w    0            flags:inverse
  5432.         dc.w    1            flags
  5433.         dc.w    1            type : boolean
  5434.         dc.l    gen_border        image
  5435.         dc.l    0            inverse data
  5436.         dc.l    done_text        text
  5437.         dc.l    0            no exclude
  5438.         dc.l    0            no special info
  5439.         dc.w    $71            gadget ID    
  5440.         dc.l    0            user data
  5441.  
  5442.  
  5443. ;(* Next Page of ScribblePad ...                     *)
  5444. scribnext_gadget
  5445.         dc.l    scribedit_gadget    next gadget
  5446.         dc.w    270,163            x,y pos
  5447.         dc.w    19,12            width, height (hit box)
  5448.         dc.w    6            image, new image
  5449.         dc.w    1            flags
  5450.         dc.w    1            type : boolean
  5451.         dc.l    df_image        image
  5452.         dc.l    dfi_image        inverse data
  5453.         dc.l    0            no text
  5454.         dc.l    0            no exclude
  5455.         dc.l    0            no special info
  5456.         dc.w    $72            gadget ID    
  5457.         dc.l    0            user data
  5458.  
  5459.  
  5460. ;(* Edit entry ...                             *)
  5461. scribedit_gadget
  5462.         dc.l    0            next gadget
  5463.         dc.w    110,180            x,y pos
  5464.         dc.w    77,12            width, height (hit box)
  5465.         dc.w    0            flags:inverse
  5466.         dc.w    1            flags
  5467.         dc.w    1            type : boolean
  5468.         dc.l    gen_border        image
  5469.         dc.l    0            inverse data
  5470.         dc.l    ed2_text        text
  5471.         dc.l    0            no exclude
  5472.         dc.l    0            no special info
  5473.         dc.w    $73            gadget ID    
  5474.         dc.l    0            user data
  5475.  
  5476.  
  5477.  
  5478. *-------------- GADGET STRUCTURES (SCRIBBLEPAD ADD ENTRY) ---------------*
  5479.  
  5480.  
  5481. scribentry_sgadget
  5482.         dc.l    sae1_gadget        next gadget
  5483.         dc.w    69,20            x,y pos
  5484.         dc.w    425,10            width, height
  5485.         dc.w    0            flags
  5486.         dc.w    2            activation
  5487.         dc.w    4            type : string
  5488.         dc.l    entry_border        border structure
  5489.         dc.l    0            no drawing
  5490.         dc.l    entry_text        text
  5491.         dc.l    0            no exclude
  5492.         dc.l    scribentry_sinfo
  5493.         dc.w    $80            gadget ID
  5494.         dc.l    0            user data
  5495.  
  5496.  
  5497. sae1_gadget    dc.l    scr_gadget        next gadget
  5498.         dc.w    32,40            x,y pos
  5499.         dc.w    77,12            width, height (hit box)
  5500.         dc.w    0            flags
  5501.         dc.w    1            flags
  5502.         dc.w    1            type : boolean
  5503.         dc.l    gen_border        image
  5504.         dc.l    0            inverse data
  5505.         dc.l    ae_text            text
  5506.         dc.l    0            no exclude
  5507.         dc.l    0            no special info
  5508.         dc.w    $81            gadget ID    
  5509.         dc.l    0            user data
  5510.  
  5511.  
  5512. ;(* Clear.                                 *)
  5513. scr_gadget    dc.l    scancel_gadget        next gadget
  5514.         dc.w    215,40            x,y pos
  5515.         dc.w    77,12            width, height (hit box)
  5516.         dc.w    0            flags
  5517.         dc.w    1            flags
  5518.         dc.w    1            type : boolean
  5519.         dc.l    gen_border        image
  5520.         dc.l    0            inverse data
  5521.         dc.l    cr_text            text
  5522.         dc.l    0            no exclude
  5523.         dc.l    0            no special info
  5524.         dc.w    $82            gadget ID    
  5525.         dc.l    0            user data
  5526.  
  5527.  
  5528. scancel_gadget    dc.l    0            next gadget
  5529.         dc.w    395,40            x,y pos
  5530.         dc.w    77,12            width, height (hit box)
  5531.         dc.w    0            flags
  5532.         dc.w    1            flags
  5533.         dc.w    1            type : boolean
  5534.         dc.l    gen_border        image
  5535.         dc.l    0            inverse data
  5536.         dc.l    cancel_text        text
  5537.         dc.l    0            no exclude
  5538.         dc.l    0            no special info
  5539.         dc.w    $83            gadget ID    
  5540.         dc.l    0            user data
  5541.  
  5542.  
  5543. *-------------- GADGET STRUCTURES (SCRIBBLEPAD EDIT ENTRY) --------------*
  5544.  
  5545.  
  5546. ;(* String gadget for entry text.                     *)
  5547. scribedit_sgadget
  5548.         dc.l    seditdel_gadget        next gadget
  5549.         dc.w    90,20            x,y pos
  5550.         dc.w    425,10            width, height
  5551.         dc.w    0            flags
  5552.         dc.w    2            activation
  5553.         dc.w    4            type : string
  5554.         dc.l    entry_border        border structure
  5555.         dc.l    0            no drawing
  5556.         dc.l    entry_text        text
  5557.         dc.l    0            no exclude
  5558.         dc.l    scribedit_sinfo
  5559.         dc.w    $a0            gadget ID
  5560.         dc.l    0            user data
  5561.  
  5562.  
  5563. ;(* Delete entry.                             *)
  5564. seditdel_gadget    dc.l    seditcr_gadget        next gadget
  5565.         dc.w    10,40            x,y pos
  5566.         dc.w    77,12            width, height (hit box)
  5567.         dc.w    0            flags
  5568.         dc.w    1            flags
  5569.         dc.w    1            type : boolean
  5570.         dc.l    gen_border        image
  5571.         dc.l    0            inverse data
  5572.         dc.l    delete_text        text
  5573.         dc.l    0            no exclude
  5574.         dc.l    0            no special info
  5575.         dc.w    $a1            gadget ID    
  5576.         dc.l    0            user data
  5577.  
  5578.  
  5579. ;(* Clear entry.                             *)
  5580. seditcr_gadget    dc.l    seditch_gadget        next gadget
  5581.         dc.w    100,40            x,y pos
  5582.         dc.w    77,12            width, height (hit box)
  5583.         dc.w    0            flags
  5584.         dc.w    1            flags
  5585.         dc.w    1            type : boolean
  5586.         dc.l    gen_border        image
  5587.         dc.l    0            inverse data
  5588.         dc.l    cr_text            text
  5589.         dc.l    0            no exclude
  5590.         dc.l    0            no special info
  5591.         dc.w    $a2            gadget ID    
  5592.         dc.l    0            user data
  5593.  
  5594.  
  5595. ;(* Change Entry.                             *)
  5596. seditch_gadget    dc.l    seditdone_gadget    next gadget
  5597.         dc.w    190,40            x,y pos
  5598.         dc.w    77,12            width, height (hit box)
  5599.         dc.w    0            flags
  5600.         dc.w    1            flags
  5601.         dc.w    1            type : boolean
  5602.         dc.l    gen_border        image
  5603.         dc.l    0            inverse data
  5604.         dc.l    change_text        text
  5605.         dc.l    0            no exclude
  5606.         dc.l    0            no special info
  5607.         dc.w    $a3            gadget ID    
  5608.         dc.l    0            user data
  5609.  
  5610.  
  5611. ;(* Done, ie. Confirm changes.                         *)
  5612. seditdone_gadget    
  5613.         dc.l    seditnext_gadget    next gadget
  5614.         dc.w    460,40            x,y pos
  5615.         dc.w    77,12            width, height (hit box)
  5616.         dc.w    0            flags
  5617.         dc.w    1            flags
  5618.         dc.w    1            type : boolean
  5619.         dc.l    gen_border        image
  5620.         dc.l    0            inverse data
  5621.         dc.l    done_text        text
  5622.         dc.l    0            no exclude
  5623.         dc.l    0            no special info
  5624.         dc.w    $a4            gadget ID    
  5625.         dc.l    0            user data
  5626.  
  5627.  
  5628. seditnext_gadget
  5629.         dc.l    seditprev_gadget    next gadget
  5630.         dc.w    370,40            x,y pos
  5631.         dc.w    77,12            width, height (hit box)
  5632.         dc.w    0            flags
  5633.         dc.w    1            flags
  5634.         dc.w    1            type : boolean
  5635.         dc.l    gen_border        image
  5636.         dc.l    0            inverse data
  5637.         dc.l    next_text        text
  5638.         dc.l    0            no exclude
  5639.         dc.l    0            no special info
  5640.         dc.w    $a5            gadget ID    
  5641.         dc.l    0            user data
  5642.  
  5643.  
  5644. seditprev_gadget
  5645.         dc.l    0            next gadget
  5646.         dc.w    280,40            x,y pos
  5647.         dc.w    77,12            width, height (hit box)
  5648.         dc.w    0            flags
  5649.         dc.w    1            flags
  5650.         dc.w    1            type : boolean
  5651.         dc.l    gen_border        image
  5652.         dc.l    0            inverse data
  5653.         dc.l    prev_text        text
  5654.         dc.l    0            no exclude
  5655.         dc.l    0            no special info
  5656.         dc.w    $a6            gadget ID    
  5657.         dc.l    0            user data
  5658.  
  5659.  
  5660. *-------------- GADGET STRUCTURES (EDIT ENTRY) --------------------------*
  5661.                                     
  5662.  
  5663. editentry_sgadget
  5664.         dc.l    edithours_sgadget    next gadget
  5665.         dc.w    69,20            x,y pos
  5666.         dc.w    425,10            width, height
  5667.         dc.w    0            flags
  5668.         dc.w    2            activation
  5669.         dc.w    4            type : string
  5670.         dc.l    entry_border        border structure
  5671.         dc.l    0            no drawing
  5672.         dc.l    entry_text        text
  5673.         dc.l    0            no exclude
  5674.         dc.l    editentry_sinfo
  5675.         dc.w    $90            gadget ID
  5676.         dc.l    0            user data
  5677.  
  5678.  
  5679. edithours_sgadget
  5680.         dc.l    editmins_sgadget    next gadget
  5681.         dc.w    60,45            x,y pos
  5682.         dc.w    30,10            width, height
  5683.         dc.w    0            flags
  5684.         dc.w    $802            integer 
  5685.         dc.w    4            type : string
  5686.         dc.l    hours_border        border structure
  5687.         dc.l    0            no drawing
  5688.         dc.l    hours_text        text
  5689.         dc.l    0            no exclude
  5690.         dc.l    hours_sinfo
  5691.         dc.w    $91            gadget ID
  5692.         dc.l    0            user data
  5693.  
  5694.  
  5695. editmins_sgadget
  5696.         dc.l    edityes_gadget        next gadget
  5697.         dc.w    165,45            x,y pos
  5698.         dc.w    30,10            width, height
  5699.         dc.w    0            flags
  5700.         dc.w    $802            integer 
  5701.         dc.w    4            type : string
  5702.         dc.l    hours_border        border structure
  5703.         dc.l    0            no drawing
  5704.         dc.l    mins_text        text
  5705.         dc.l    0            no exclude
  5706.         dc.l    mins_sinfo
  5707.         dc.w    $92            gadget ID
  5708.         dc.l    0            user data
  5709.  
  5710.  
  5711. edityes_gadget    dc.l    editnext_gadget        next gadget
  5712.         dc.w    310,43            x,y pos
  5713.         dc.w    31,11            width, height (hit box)
  5714.         dc.w    $80            flags
  5715.         dc.w    $101            flags
  5716.         dc.w    1            type : boolean
  5717.         dc.l    am_border        image
  5718.         dc.l    0            inverse data
  5719.         dc.l    yes_text        text
  5720.         dc.l    0            no exclude
  5721.         dc.l    0            no special info
  5722.         dc.w    $93            gadget ID    
  5723.         dc.l    0            user data
  5724.  
  5725.  
  5726. editnext_gadget    dc.l    editprev_gadget        next gadget
  5727.         dc.w    450,41            x,y pos
  5728.         dc.w    77,12            width, height (hit box)
  5729.         dc.w    0            flags
  5730.         dc.w    1            flags
  5731.         dc.w    1            type : boolean
  5732.         dc.l    gen_border        image
  5733.         dc.l    0            inverse data
  5734.         dc.l    next_text        text
  5735.         dc.l    0            no exclude
  5736.         dc.l    0            no special info
  5737.         dc.w    $94            gadget ID    
  5738.         dc.l    0            user data
  5739.  
  5740.  
  5741. editprev_gadget    dc.l    editdel_gadget        next gadget
  5742.         dc.w    360,41            x,y pos
  5743.         dc.w    77,12            width, height (hit box)
  5744.         dc.w    0            flags
  5745.         dc.w    1            flags
  5746.         dc.w    1            type : boolean
  5747.         dc.l    gen_border        image
  5748.         dc.l    0            inverse data
  5749.         dc.l    prev_text        text
  5750.         dc.l    0            no exclude
  5751.         dc.l    0            no special info
  5752.         dc.w    $95            gadget ID    
  5753.         dc.l    0            user data
  5754.  
  5755.  
  5756. editdel_gadget    dc.l    editcr_gadget        next gadget
  5757.         dc.w    40,65            x,y pos
  5758.         dc.w    77,12            width, height (hit box)
  5759.         dc.w    0            flags
  5760.         dc.w    1            flags
  5761.         dc.w    1            type : boolean
  5762.         dc.l    gen_border        image
  5763.         dc.l    0            inverse data
  5764.         dc.l    delete_text        text
  5765.         dc.l    0            no exclude
  5766.         dc.l    0            no special info
  5767.         dc.w    $96            gadget ID    
  5768.         dc.l    0            user data
  5769.  
  5770.  
  5771. ;(* Clear.                                 *)
  5772. editcr_gadget    dc.l    editch_gadget        next gadget
  5773.         dc.w    170,65            x,y pos
  5774.         dc.w    77,12            width, height (hit box)
  5775.         dc.w    0            flags
  5776.         dc.w    1            flags
  5777.         dc.w    1            type : boolean
  5778.         dc.l    gen_border        image
  5779.         dc.l    0            inverse data
  5780.         dc.l    cr_text            text
  5781.         dc.l    0            no exclude
  5782.         dc.l    0            no special info
  5783.         dc.w    $97            gadget ID    
  5784.         dc.l    0            user data
  5785.  
  5786.  
  5787. ;(* Change.                                 *)
  5788. editch_gadget    dc.l    editdone_gadget        next gadget
  5789.         dc.w    305,65            x,y pos
  5790.         dc.w    77,12            width, height (hit box)
  5791.         dc.w    0            flags
  5792.         dc.w    1            flags
  5793.         dc.w    1            type : boolean
  5794.         dc.l    gen_border        image
  5795.         dc.l    0            inverse data
  5796.         dc.l    change_text        text
  5797.         dc.l    0            no exclude
  5798.         dc.l    0            no special info
  5799.         dc.w    $98            gadget ID    
  5800.         dc.l    0            user data
  5801.  
  5802.  
  5803. editdone_gadget    
  5804.         dc.l    0            next gadget
  5805.         dc.w    430,65            x,y pos
  5806.         dc.w    77,12            width, height (hit box)
  5807.         dc.w    0            flags
  5808.         dc.w    1            flags
  5809.         dc.w    1            type : boolean
  5810.         dc.l    gen_border        image
  5811.         dc.l    0            inverse data
  5812.         dc.l    done_text        text
  5813.         dc.l    0            no exclude
  5814.         dc.l    0            no special info
  5815.         dc.w    $99            gadget ID    
  5816.         dc.l    0            user data
  5817.  
  5818.  
  5819. *-------------- GADGET STRUCTURES (INVALID INPUTS) ----------------------*
  5820.  
  5821.  
  5822. ok_gadget    dc.l    0            next gadget
  5823.         dc.w    68,47            x,y pos
  5824.         dc.w    77,12            width, height (hit box)
  5825.         dc.w    0            flags
  5826.         dc.w    1            flags
  5827.         dc.w    1            type : boolean
  5828.         dc.l    gen_border        image
  5829.         dc.l    0            inverse data
  5830.         dc.l    ok_text            text
  5831.         dc.l    0            no exclude
  5832.         dc.l    0            no special info
  5833.         dc.w    $30            gadget ID    
  5834.         dc.l    0            user data
  5835.  
  5836.  
  5837.  
  5838. *-------------- SPECIALINFO STRUCTURES ----------------------------------*
  5839.  
  5840.  
  5841. entry_sinfo    dc.l    entrybuffer        text buffer
  5842.         dc.l    entryundo        undo buffer
  5843.         dc.w    0            cursor position
  5844.         dc.w    60            max # of characters
  5845.         dc.w    0            output text from this char
  5846.         dc.w    0            char pos in undo buffer
  5847.         dc.w    0            # of chars in buffer
  5848.         dc.w    0            # of chars visible in box
  5849.         dc.w    0            horiz box offset
  5850.         dc.w    0            vert box offset
  5851.         dc.l    0            rastport
  5852.         dc.l    0            value of input (for int)
  5853.         dc.l    0            standard keyboard table
  5854.  
  5855. entrybuffer    ds.b    72
  5856.         even
  5857. entryundo    ds.b    72
  5858.         even
  5859.  
  5860.  
  5861. hours_sinfo    dc.l    hoursbuffer        text buffer
  5862.         dc.l    hoursundo        undo buffer
  5863.         dc.w    0            cursor position
  5864.         dc.w    3            max # of characters
  5865.         dc.w    0            output text from this char
  5866.         dc.w    0            char pos in undo buffer
  5867.         dc.w    0            # of chars in buffer
  5868.         dc.w    0            # of chars visible in box
  5869.         dc.w    0            horiz box offset
  5870.         dc.w    0            vert box offset
  5871.         dc.l    0            rastport
  5872.         dc.l    0            value of input (for int)
  5873.         dc.l    0            standard keyboard table
  5874.  
  5875. hoursbuffer    ds.l    3
  5876.         even
  5877. hoursundo    ds.l    3
  5878.         even
  5879.  
  5880.  
  5881. mins_sinfo    dc.l    minsbuffer        text buffer
  5882.         dc.l    minsundo        undo buffer
  5883.         dc.w    0            cursor position
  5884.         dc.w    3            max # of characters
  5885.         dc.w    0            output text from this char
  5886.         dc.w    0            char pos in undo buffer
  5887.         dc.w    0            # of chars in buffer
  5888.         dc.w    0            # of chars visible in box
  5889.         dc.w    0            horiz box offset
  5890.         dc.w    0            vert box offset
  5891.         dc.l    0            rastport
  5892.         dc.l    0            value of input (for int)
  5893.         dc.l    0            standard keyboard table
  5894.  
  5895. minsbuffer    ds.l    3
  5896.         even
  5897. minsundo    ds.l    3
  5898.         even
  5899.  
  5900.  
  5901. date_sinfo    dc.l    datebuffer        text buffer
  5902.         dc.l    dateundo        undo buffer
  5903.         dc.w    0            cursor position
  5904.         dc.w    7            max # of characters
  5905.         dc.w    0            output text from this char
  5906.         dc.w    0            char pos in undo buffer
  5907.         dc.w    0            # of chars in buffer
  5908.         dc.w    0            # of chars visible in box
  5909.         dc.w    0            horiz box offset
  5910.         dc.w    0            vert box offset
  5911.         dc.l    0            rastport
  5912.         dc.l    0            value of input (for int)
  5913.         dc.l    0            standard keyboard table
  5914. datebuffer    ds.l    7
  5915.         even
  5916. dateundo    ds.l    7
  5917.         even
  5918.  
  5919.  
  5920. file_sinfo    dc.l    filebuffer        text buffer
  5921.         dc.l    fileundo        undo buffer
  5922.         dc.w    0            cursor position
  5923.         dc.w    50            max # of characters
  5924.         dc.w    0            output text from this char
  5925.         dc.w    0            char pos in undo buffer
  5926.         dc.w    0            # of chars in buffer
  5927.         dc.w    0            # of chars visible in box
  5928.         dc.w    0            horiz box offset
  5929.         dc.w    0            vert box offset
  5930.         dc.l    0            rastport
  5931.         dc.l    0            value of input (for int)
  5932.         dc.l    0            standard keyboard table
  5933. filebuffer    ds.l    50
  5934.         even
  5935. fileundo    ds.l    50
  5936.         even
  5937.  
  5938.  
  5939. scribentry_sinfo
  5940.         dc.l    scribentrybuffer    text buffer
  5941.         dc.l    scribentryundo        undo buffer
  5942.         dc.w    0            cursor position
  5943.         dc.w    70            max # of characters
  5944.         dc.w    0            output text from this char
  5945.         dc.w    0            char pos in undo buffer
  5946.         dc.w    0            # of chars in buffer
  5947.         dc.w    0            # of chars visible in box
  5948.         dc.w    0            horiz box offset
  5949.         dc.w    0            vert box offset
  5950.         dc.l    0            rastport
  5951.         dc.l    0            value of input (for int)
  5952.         dc.l    0            standard keyboard table
  5953.         even
  5954. scribentrybuffer
  5955.         ds.b    72
  5956.         even
  5957. scribentryundo    ds.b    72
  5958.         even
  5959.  
  5960.  
  5961.  
  5962. scribedit_sinfo
  5963.         dc.l    scribeditbuffer        text buffer
  5964.         dc.l    scribeditundo        undo buffer
  5965.         dc.w    0            cursor position
  5966.         dc.w    70            max # of characters
  5967.         dc.w    0            output text from this char
  5968.         dc.w    0            char pos in undo buffer
  5969.         dc.w    0            # of chars in buffer
  5970.         dc.w    0            # of chars visible in box
  5971.         dc.w    0            horiz box offset
  5972.         dc.w    0            vert box offset
  5973.         dc.l    0            rastport
  5974.         dc.l    0            value of input (for int)
  5975.         dc.l    0            standard keyboard table
  5976.         even
  5977. scribeditbuffer
  5978.         ds.b    72
  5979.         even
  5980. scribeditundo    ds.b    72
  5981.         even
  5982.  
  5983.  
  5984.  
  5985. editentry_sinfo    dc.l    editentrybuffer        text buffer
  5986.         dc.l    editentryundo        undo buffer
  5987.         dc.w    0            cursor position
  5988.         dc.w    60            max # of characters
  5989.         dc.w    0            output text from this char
  5990.         dc.w    0            char pos in undo buffer
  5991.         dc.w    0            # of chars in buffer
  5992.         dc.w    0            # of chars visible in box
  5993.         dc.w    0            horiz box offset
  5994.         dc.w    0            vert box offset
  5995.         dc.l    0            rastport
  5996.         dc.l    0            value of input (for int)
  5997.         dc.l    0            standard keyboard table
  5998.         even
  5999. editentrybuffer    ds.b    72
  6000.         even
  6001. editentryundo    ds.b    72
  6002.         even
  6003.  
  6004.  
  6005. *-------------- GADGET IMAGE DATA ---------------------------------------*
  6006.  
  6007.         section images,code_c
  6008.  
  6009.  
  6010. df_data        dc.w    $FFFF,$8000,$8000,$8000,$8E00,$8000
  6011.         dc.w    $8FC0,$8000,$8FF0,$8000,$8FC0,$8000
  6012.         dc.w    $8E00,$8000,$8000,$8000,$8000,$8000
  6013.         dc.w    $FFFF,$8000,$0000,$0000,$0000,$0000
  6014.         dc.w    $0000,$0000,$0000,$6000,$0000,$6000
  6015.         dc.w    $1000,$6000,$1000,$6000,$1030,$6000
  6016.         dc.w    $11C0,$6000,$1E00,$6000,$0000,$6000
  6017.         dc.w    $0000,$6000,$3FFF,$E000,$3FFF,$E000
  6018. dfi_data    dc.w    $FFFF,$8000,$FFFF,$8000,$F1FF,$8000
  6019.         dc.w    $E03F,$8000,$E00F,$8000,$E00F,$8000
  6020.         dc.w    $E01F,$8000,$E1FF,$8000,$FFFF,$8000
  6021.         dc.w    $FFFF,$8000,$0000,$0000,$0000,$0000
  6022.         dc.w    $0000,$0000,$0000,$6000,$0000,$6000
  6023.         dc.w    $1000,$6000,$1000,$6000,$1030,$6000
  6024.         dc.w    $11E0,$6000,$1E00,$6000,$0000,$6000
  6025.         dc.w    $0000,$6000,$3FFF,$E000,$3FFF,$E000
  6026.  
  6027.  
  6028. db_data        dc.w    $FFFF,$8000,$8000,$8000,$8038,$8000
  6029.         dc.w    $81F8,$8000,$87F8,$8000,$81F8,$8000
  6030.         dc.w    $8038,$8000,$8000,$8000,$8000,$8000
  6031.         dc.w    $FFFF,$8000,$0000,$0000,$0000,$0000
  6032.         dc.w    $0000,$0000,$0000,$6000,$0000,$6000
  6033.         dc.w    $0004,$6000,$0004,$6000,$0604,$6000
  6034.         dc.w    $01C4,$6000,$003C,$6000,$0000,$6000
  6035.         dc.w    $0000,$6000,$3FFF,$E000,$3FFF,$E000
  6036. dbi_data    dc.w    $FFFF,$8000,$FFFF,$8000,$FFC7,$8000
  6037.         dc.w    $FE03,$8000,$F803,$8000,$F803,$8000
  6038.         dc.w    $FE03,$8000,$FFC3,$8000,$FFFF,$8000
  6039.         dc.w    $FFFF,$8000,$0000,$0000,$0000,$0000
  6040.         dc.w    $0000,$0000,$0000,$6000,$0000,$6000
  6041.         dc.w    $0004,$6000,$0004,$6000,$0604,$6000
  6042.         dc.w    $01C4,$6000,$003C,$6000,$0000,$6000
  6043.         dc.w    $0000,$6000,$3FFF,$E000,$3FFF,$E000
  6044.  
  6045.  
  6046. wf_data        dc.w    $FFFF,$FFFE,$0000,$8000,$0002,$0000
  6047.         dc.w    $8E00,$3802,$0000,$8FC0,$3F02,$0000
  6048.         dc.w    $8FF0,$3FC2,$0000,$8FC0,$3F02,$0000
  6049.         dc.w    $8E00,$3802,$0000,$8000,$0002,$0000
  6050.         dc.w    $8000,$0002,$0000,$FFFF,$FFFE,$0000
  6051.         dc.w    $0000,$0000,$0000,$0000,$0000,$0000
  6052.         dc.w    $0000,$0000,$0000,$0000,$0001,$8000
  6053.         dc.w    $0000,$0001,$8000,$1000,$4001,$8000
  6054.         dc.w    $1000,$4001,$8000,$1030,$40C1,$8000
  6055.         dc.w    $11C0,$4701,$8000,$1E00,$7801,$8000
  6056.         dc.w    $0000,$0001,$8000,$0000,$0001,$8000
  6057.         dc.w    $3FFF,$FFFF,$8000,$3FFF,$FFFF,$8000
  6058. wfi_data    dc.w    $FFFF,$FFFE,$0000,$FFFF,$FFFE,$0000
  6059.         dc.w    $F1FF,$C7FE,$0000,$E03F,$80FE,$0000
  6060.         dc.w    $E00F,$803E,$0000,$E00F,$803E,$0000
  6061.         dc.w    $E03F,$80FE,$0000,$E1FF,$87FE,$0000
  6062.         dc.w    $FFFF,$FFFE,$0000,$FFFF,$FFFE,$0000
  6063.         dc.w    $0000,$0000,$0000,$0000,$0000,$0000
  6064.         dc.w    $0000,$0000,$0000,$0000,$0001,$8000
  6065.         dc.w    $0000,$0001,$8000,$1000,$4001,$8000
  6066.         dc.w    $1000,$4001,$8000,$1030,$40C1,$8000
  6067.         dc.w    $11C0,$4701,$8000,$1E00,$7801,$8000
  6068.         dc.w    $0000,$0001,$8000,$0000,$0001,$8000
  6069.         dc.w    $3FFF,$FFFF,$8000,$3FFF,$FFFF,$8000
  6070.  
  6071.  
  6072. wb_data        dc.w    $FFFF,$FFFE,$0000,$8000,$0002,$0000
  6073.         dc.w    $8038,$00E2,$0000,$81F8,$07E2,$0000
  6074.         dc.w    $87F8,$1FE2,$0000,$81F8,$07E2,$0000
  6075.         dc.w    $8038,$00E2,$0000,$8000,$0002,$0000
  6076.         dc.w    $8000,$0002,$0000,$FFFF,$FFFE,$0000
  6077.         dc.w    $0000,$0000,$0000,$0000,$0000,$0000
  6078.         dc.w    $0000,$0000,$0000,$0000,$0001,$8000
  6079.         dc.w    $0000,$0001,$8000,$0004,$0011,$8000
  6080.         dc.w    $0004,$0011,$8000,$0604,$1811,$8000
  6081.         dc.w    $01C4,$0711,$8000,$003C,$00F1,$8000
  6082.         dc.w    $0000,$0001,$8000,$0000,$0001,$8000
  6083.         dc.w    $3FFF,$FFFF,$8000,$3FFF,$FFFF,$8000
  6084. wbi_data    dc.w    $FFFF,$FFFE,$0000,$FFFF,$FFFE,$0000
  6085.         dc.w    $FFC7,$FF1E,$0000,$FE03,$F80E,$0000
  6086.         dc.w    $F803,$E00E,$0000,$F803,$E00E,$0000
  6087.         dc.w    $FE03,$F80E,$0000,$FFC3,$FF0E,$0000
  6088.         dc.w    $FFFF,$FFFE,$0000,$FFFF,$FFFE,$0000
  6089.         dc.w    $0000,$0000,$0000,$0000,$0000,$0000
  6090.         dc.w    $0000,$0000,$0000,$0000,$0001,$8000
  6091.         dc.w    $0000,$0001,$8000,$0004,$0011,$8000
  6092.         dc.w    $0004,$0011,$8000,$0604,$1811,$8000
  6093.         dc.w    $01C4,$0711,$8000,$003C,$00F1,$8000
  6094.         dc.w    $0000,$0001,$8000,$0000,$0001,$8000
  6095.         dc.w    $3FFF,$FFFF,$8000,$3FFF,$FFFF,$8000
  6096.  
  6097. timeyes_data
  6098.     DC.W    $0000,$0000,$0000,$0000,$0C30,$0000
  6099.     DC.W    $0C30,$0000,$0663,$C3E0,$03C6,$6600
  6100.     DC.W    $0187,$E3C0,$0186,$0060,$03C3,$C7C0
  6101.     DC.W    $0000,$0000,$0000,$0000,$0000,$0000
  6102.     DC.W    $FFFF,$FFFE,$8000,$0002,$8000,$0002
  6103.     DC.W    $8000,$0002,$8000,$0002,$8000,$0002
  6104.     DC.W    $8000,$0002,$8000,$0002,$8000,$0002
  6105.     DC.W    $8000,$0002,$8000,$0002,$FFFF,$FFFE
  6106.  
  6107.     
  6108. timeyesi_data
  6109.     DC.W    $FFFF,$FFFE,$FFFF,$FFFC,$F3CF,$FFFC
  6110.     DC.W    $F3CF,$FFFC,$F99C,$3C1C,$FC39,$99FC
  6111.     DC.W    $FE78,$1C3C,$FE79,$FF9C,$FC3C,$383C
  6112.     DC.W    $FFFF,$FFFC,$FFFF,$FFFC,$0000,$0000
  6113.     DC.W    $0000,$0000,$7FFF,$FFFE,$7FFF,$FFFE
  6114.     DC.W    $7FFF,$FFFE,$7FFF,$FFFE,$7FFF,$FFFE
  6115.     DC.W    $7FFF,$FFFE,$7FFF,$FFFE,$7FFF,$FFFE
  6116.     DC.W    $7FFF,$FFFE,$7FFF,$FFFE,$FFFF,$FFFE
  6117.     
  6118.  
  6119. stop_data    dc.w    $01FF,$FE00,$07FF,$FF80,$1FFF,$FFE0
  6120.         dc.w    $7FFF,$FFF8,$FFFF,$FFFC,$F082,$083C
  6121.         dc.w    $F7EE,$EBBC,$F0EE,$E83C,$FEEE,$EBFC
  6122.         dc.w    $F0EE,$0BFC,$FFFF,$FFFC,$7FFF,$FFF8
  6123.         dc.w    $1FFF,$FFE0,$07FF,$FF80,$01FF,$FE00
  6124.         dc.w    $01FF,$FE00,$0600,$0180,$1800,$0060
  6125.         dc.w    $6000,$0018,$8000,$0004,$BFFF,$FFF4
  6126.         dc.w    $BFFF,$FFF4,$BFFF,$FFF4,$BFFF,$FFF4
  6127.         dc.w    $BFFF,$FFF4,$8000,$0004,$6000,$0018
  6128.         dc.w    $1800,$0060,$0600,$0180,$01FF,$FE00
  6129.  
  6130.  
  6131. *-------------- LIBRARIES -----------------------------------------------*
  6132.                 
  6133. intname        dc.b    "intuition.library",0
  6134.         even
  6135. intbase        dc.l    0
  6136.  
  6137.  
  6138. gfxname        dc.b    "graphics.library",0
  6139.         even
  6140. gfxbase        dc.l    0
  6141.  
  6142.  
  6143. dosname        dc.b    "dos.library",0
  6144.         even
  6145. dosbase        dc.l    0
  6146.  
  6147.  
  6148. *-------------- FONTS ---------------------------------------------------*
  6149.  
  6150.  
  6151. ;(* Normal 80 col topaz font                         *)
  6152. topaz_defs    dc.l    topazname
  6153.         dc.w    8            size 8
  6154.         dc.b    0            style : normal
  6155.         dc.b    1            flags : ROM font
  6156.  
  6157. ;(* Underlined 80 col topaz font                     *) 
  6158. topazU_defs    dc.l    topazname
  6159.         dc.w    8            size 8
  6160.         dc.b    1            style : underline
  6161.         dc.b    1            flags : ROM font
  6162.  
  6163.  
  6164. topazname    dc.b    "topaz.font",0
  6165.         even
  6166. topazbase    dc.l    0
  6167. topazUbase    dc.l    0
  6168.  
  6169.  
  6170. *--------------    INDEPENDANT VARIABLES -----------------------------------*
  6171.  
  6172. message        dc.l    0        result of getmsg call
  6173. currentwindow    dc.l    0        window being considered
  6174.  
  6175. calendar    dc.l    0        pointer to calendar list
  6176. scribble    dc.l    0        pointer to scribblepad list
  6177. scrib_curentry    dc.l    0        pointer to scribble entry at start
  6178. ;                    of page to be displayed
  6179. scrib_nextentry    dc.l    0        pointer to first entry at start
  6180. ;                    of page after the one being displayed
  6181. year        dc.w    0        address of newly reserved year
  6182.  
  6183. lines_used    dc.w    0        number of lines occupied by a
  6184. ;                    scribblepad entry
  6185. entry_lines    dc.w    0        number of lines occupied by a 
  6186. ;                    diary entry
  6187.  
  6188. spare_text    ds.b    20
  6189.  
  6190. decnumber    ds.b    4
  6191.         even
  6192. decstring    dc.b    "     ",0
  6193.         even
  6194.  
  6195. date        dc.l    0            } Today's date
  6196.         dc.l    0            } yyyy-mm-dd
  6197.         dc.l    0            }
  6198.         dc.l    0            } 0=Sunday etc
  6199. datecopy    dc.l    0            Buffer used to hold
  6200.         dc.l    0            date until it has been
  6201.         dc.l    0            validated.
  6202.         dc.l    0
  6203. months        dc.w    31,28,31,30,31,30    Jan-Jun
  6204.         dc.w    31,31,30,31,30,31    Jul-Dec
  6205. monthnames    dc.b    "Jan","Feb","Mar","Apr","May","Jun"
  6206.         dc.b    "Jul","Aug","Sep","Oct","Nov","Dec"
  6207. daynames    dc.b    ", Sun ",", Mon ",", Tue "
  6208.         dc.b    ", Wed ",", Thur",", Fri "
  6209.         dc.b    ", Sat "
  6210. years        dc.w    365,365,366,365        1978,1979,1980,1981...
  6211.  
  6212. dateXpos    dc.w    0        positions used by DisplayDate
  6213. dateYpos    dc.w    0
  6214. displayhd    dc.l    0        window to display text in
  6215.  
  6216. lineXpos    dc.w    0        position for line of entry
  6217. lineYpos    dc.w    0        being displayed
  6218. rightmargin    dc.l    0        set according to left/right side of page
  6219. leftmargin    dc.l    0        as above
  6220.  
  6221. scribXpos    dc.w    0        position for line of entry (scribblepad)
  6222. scribYpos    dc.w    0        being displayed
  6223.  
  6224. scribmarker    dc.l    0        store for next scribblepad identifier
  6225.  
  6226. digits        dc.w    0        number of digits in number
  6227.  
  6228.  
  6229. monthsbase    dc.l    0        base address of months (dfs)
  6230. monthsoff    dc.l    0        offset for month pointer (dfs)
  6231.  
  6232. monthstore    dc.l    0        month being considered 
  6233. yearstore    dc.l    0        year being considered 
  6234. daystore    dc.l    0        day being considered 
  6235. entrystore    dc.l    0        entry being considered 
  6236. store        dc.l    0        general store
  6237.  
  6238. currententry    dc.l    0        address of entry being edited
  6239. start_entry    dc.l    0        first entry on the page
  6240. next_entry    dc.l    0        first entry on next page
  6241. page_start    dc.l    0        first entry on page being displayed
  6242.  
  6243. scribentry    dc.l    0        address of scribblepad entry
  6244. ;                    being edited
  6245.  
  6246. ;(* EXTERNAL FILE ...                             *)
  6247.     
  6248. filestart_code    dc.w    $0100        only upper byte is used, but
  6249. filestop_code    dc.w    $0200        these codes are words so they
  6250. year_code    dc.w    $0300        will be on even addresses
  6251. month_code    dc.w    $0400        
  6252. day_code    dc.w    $0500        
  6253. entry_code    dc.w    $0600        
  6254. text_code    dc.w    $0700
  6255. scribent_code    dc.w    $0800
  6256.  
  6257.  
  6258. ;(* The default AmigaDiary entries file, loaded up on startup.         *)
  6259. default_file    dc.b    "s:diary.def",0
  6260.         even
  6261.  
  6262. header        dc.b    "AD","11",$01    ;AmigaDiary, version (x10), start
  6263.         even
  6264.  
  6265. filehd        dc.l    0        
  6266.  
  6267. buffer        dc.w    0
  6268.  
  6269.  
  6270. ;(* FLAGS ...                                 *)
  6271. flag1        dc.b    0        ;0 - Leap Year
  6272.                     ;1 - Close gadget (main window)
  6273.                     ;2 - Time yes/no (AE gadgets)
  6274.                     ;3 - Line break has been displayed
  6275.                     ;4 - Use inputs from edit window
  6276.                     ;5 - Only one entry for that day
  6277.                     ;6 - Entry being deleted is first 
  6278.                     ;7 - Full SP page
  6279.                     
  6280.             
  6281. flag2        dc.b    0        ;0 - Scribblepad window open
  6282.                     ;1 - Add Entry window open
  6283.                     ;2 - Shrink window open
  6284.                     ;3 - About window open
  6285.                     ;4 - Invalid Inputs window open
  6286.                     ;5 - Lookup Entry window open
  6287.                     ;6 - Load File window open
  6288.                     ;7 - Save File window open
  6289.  
  6290.  
  6291. flag3        dc.b    0        ;0 - Scribblepad Add Entry window
  6292.                     ;1 - Edit Entry window open
  6293.  
  6294.  
  6295. flag4        dc.b    0        ;0 - Scrib Entry split at bottom
  6296.