; Fargo IDE header ;============================================================================= ; Last save: Sun Dec 20 13:28:06 1998 ; 6.24 1.0 1.0 1.0 1.0 1.0 ;============================================================================= /***************************************************************************** * UGPBRWSE.S Copyright (C) 1998 David Kuehling ***************************************************************************** * * Author: David Kuehling * Last Modification: 20th december 1998 * * This is a Fargo programm that needs to be precompiled by PreFargo. * you should get this precompiler from http://www.ticalc.org, or if not: * (E)mail me: * * Email: dkuehlin@hell1og.be.schule.de (don't mix up 'l' and '1') * * Mail: David Kuehling * Lion-Feuchtwanger-Str. 44 * 12619 Berlin * GERMANY * * This Programm is Freeware. */ /*****************************************************************************/ #include #include #include /*****************************************************************************/ /*****************************************************************************/ XDEF _main XDEF _comment /*****************************************************************************/ /*** * Helper function (decreases the size of UGPBrwse) * Input: d0.w = handle * Output: a0.l = address */ DEREF_d0_a0: tios::DEREF d0, a0 rts /****************************************************************************** * Callback routine, that shows the chosen file * Input: * d0.w = handle of file * Output: * d4.b = Abort browser? */ DisplayUGP: bsr DEREF_d0_a0 // a0 = Pointer to UGP-STR addq.l #6, a0 // skip Var-Size-Word and UGP Signature \SkipTitleLoop: tst.b (a0)+ // skip title bne \SkipTitleLoop move.l a0, d0 // get the next even address addq.l #1, d0 bclr #0, d0 movea.l d0, a0 /****** Display UGP Picture ******/ move.w (a0)+, d2 // d2 = delaytime per picture jsr ugplib::AutoDisp // display picture (a0) with speed d2 tst.b d0 // if d0 is nonzero: there was an error beq \End /****** Failure ******/ lea ErrorStr(PC), a4 // Title of message box is "ERROR" lea FailureStr(PC), a5 // Message is "UGP Display Failure" jsr brwselib::MessageBox \End: sf d4 // do not abort the browser! rts /****************************************************************************** * Callback routine, that filters out any files that are not UGP pictures * Input: * d0.w = handle of file * Output: * d4.b = Add file to list? (0 = do it; nonzero = don't add it) */ FilterUGP: bsr DEREF_d0_a0 // a0 = Pointer to UGP-STR cmp.l #$55475000, 2(a0) // check UGP Signature ("UGP\0") sne d4 // if file doesn't have correct signature: d4.b = -1 rts /****************************************************************************** * Info callback routine, that shows the title of a UGP picture * Input: * d0.w = handle of file */ InfoUGP: bsr DEREF_d0_a0 // a0 = Pointer to UGP-STR addq.l #6, a0 // skip Var-Size-Word and UGP signature moveq #INFO_WIDTH/2+3, d0 // get X-coordinate to center the title movea.l a0, a1 \GetXLoop: subq.w #3, d0 tst.b (a1)+ bne \GetXLoop moveq #INFO_HEIGHT/2-4, d1 // Y-coordinate moveq #4, d2 // color jsr brwselib::ClearInfo jmp brwselib::InfoString // rts executed in brwselib::InfoString /****************************************************************************** * MAIN */ _main: /****** Execute the Browser ******/ lea FilterUGP(PC), a0 // a0 = address of filter callback routine lea InfoUGP(PC), a1 // a1 = address of info callback routine lea DisplayUGP(PC), a5 // a5 = address of invoke-callback routine lea _comment(PC), a4 // a4 = pointer to title of browser window jmp brwselib::Browse _comment: dc.b "UGP Picture Browser - by D.K.", 0 /****************************************************************************** * DATA */ ErrorStr: dc.b "ERROR", 0 FailureStr: dc.b "UGP Display Failure", 0 /*****************************************************************************/ END