home *** CD-ROM | disk | FTP | other *** search
/ Fish 'n' More 2 / fishmore-publicdomainlibraryvol.ii1991xetec.iso / disks / disk396.lzh / PBar / PBar.asm < prev    next >
Assembly Source File  |  1990-10-29  |  17KB  |  852 lines

  1. ;    PBar V1.0
  2. ;    By Preben Nielsen
  3. ;    OPT O+
  4. ;    OPT O1+        ;Tells when a branch could be optimised to short
  5. ;    OPT i+        ;Tells when '#' is probably missing
  6.  
  7.     incdir    "INCLUDE:"
  8.     include "exec/exec_lib.i"
  9.     include "graphics/graphics_lib.i"
  10.     include "intuition/intuition.i"
  11.     include "intuition/intuition_lib.i"
  12.     include "libraries/dos.i"
  13.     include "libraries/dosextens.i"
  14.     include "libraries/dos_lib.i"
  15.     include "workbench/workbench.i"
  16.     include "workbench/icon_lib.i"
  17.  
  18. NL        =0
  19.  
  20. PSID        =0
  21. MSID        =1
  22. STRID        =2
  23. CREATEID    =3
  24.  
  25. PStartx        =26
  26. PStarty        =50
  27. MStartx        =26
  28. MStarty        =106
  29.  
  30. BoxSizex    =12
  31. BoxSizey    =6
  32.  
  33. StartX        =0
  34. StartY        =2
  35. SizeX        =4
  36. SizeY        =6
  37. SpaceX        =8
  38. SpaceY        =10
  39. Cols        =12
  40. Rows        =14
  41. Buffer        =16
  42. ColorSet    =20
  43. ColorClr    =22
  44.  
  45. LoadBase    MACRO
  46.         IFNC        '\1','ExecBase'
  47.         movea.l        \1(PC),A6
  48.         ENDC
  49.         IFC        '\1','ExecBase'
  50.         movea.l        4.W,A6
  51.         ENDC
  52.         ENDM
  53. CallLib        MACRO
  54.         jsr        _LVO\1(A6)
  55.         ENDM
  56. Call        MACRO
  57.         bsr        \1
  58.         ENDM
  59. Push        MACRO
  60.         movem.l        \1,-(SP)
  61.         ENDM
  62. Pop        MACRO
  63.         movem.l        (SP)+,\1
  64.         ENDM
  65. Gadget        MACRO
  66.         dc.l        \1
  67.         dc.w        \2,\3,\4,\5,\6,\7,\8
  68.         ENDM
  69. Gadget2        MACRO
  70.         dc.l        \1,\2,\3,\4,\5
  71.         dc.w        \6
  72.         dc.l        \7
  73.         ENDM
  74. Border        MACRO
  75.         dc.w        \1,\2
  76.         dc.b        \3,\4,\5,\6
  77.         dc.l        \7,\8
  78.         ENDM
  79. IntuiText    MACRO
  80.         dc.b        \1,\2,\3,0
  81.         dc.w        \4,\5
  82.         dc.l        TxtAttr1,\6,\7
  83.         ENDM
  84.  
  85.     SECTION PBAR,CODE
  86. Init        Push        D0-D7/A0-A6
  87.         LoadBase    ExecBase
  88.         suba.l        A1,A1
  89.         CallLib        FindTask        ;Find us
  90.         movea.l        D0,A2
  91.         tst.l        pr_CLI(A2)
  92.         bne.S        CLIAndWBStartup
  93. WBenchStartup    lea        pr_MsgPort(A2),A0
  94.         CallLib        WaitPort        ;wait for a message
  95.         lea        pr_MsgPort(A2),A0
  96.         CallLib        GetMsg            ;then get it
  97.         move.l        D0,WBenchMsg        ;save it for later reply
  98. CLIAndWBStartup    lea        DosName(PC),A1
  99.         CallLib        OldOpenLibrary
  100.         move.l        D0,DosBase
  101.         beq.S        Exit
  102.         lea        GfxName(PC),A1
  103.         CallLib        OldOpenLibrary
  104.         move.l        D0,GfxBase
  105.         beq.S        Exit
  106.         lea        IntName(PC),A1
  107.         CallLib        OldOpenLibrary
  108.         move.l        D0,IntBase
  109.         beq.S        Exit
  110.         LoadBase    IntBase
  111.         lea        NW(PC),A0
  112.         CallLib        OpenWindow
  113.         move.l        D0,PWindow
  114.         movea.l        D0,A0
  115.         beq.S        Exit
  116.         move.l        wd_RPort(A0),Rp        ;save RastPort
  117.         lea        WinTitle(PC),A1
  118.         lea        ScrTitle(PC),A2
  119.         CallLib        SetWindowTitles
  120.         bra.S        Main
  121. Exit
  122. FreeWindow    LoadBase    IntBase
  123.         move.l        PWindow(PC),D0
  124.         beq.S        FreeIntui
  125.         movea.l        D0,A0
  126.         CallLib        CloseWindow
  127. FreeIntui    LoadBase    ExecBase
  128.         move.l        IntBase(PC),D0
  129.         beq.S        FreeGfx
  130.         movea.l        D0,A1
  131.         CallLib        CloseLibrary
  132. FreeGfx        move.l        GfxBase(PC),D0
  133.         beq.S        FreeDos
  134.         movea.l        D0,A1
  135.         CallLib        CloseLibrary
  136. FreeDos        move.l        DosBase(PC),D0
  137.         beq.S        ReplyWB
  138.         movea.l        D0,A1
  139.         CallLib        CloseLibrary
  140. ReplyWB        move.l        WBenchMsg(PC),D0
  141.         beq.S        AllDone
  142.         CallLib        Forbid
  143.         movea.l        D0,A1
  144.         CallLib        ReplyMsg        ;Reply WBenchMessage if we are started from WB
  145. AllDone        Pop        D0-D7/A0-A6
  146.         moveq        #0,D0
  147.         rts
  148.  
  149. Main        Call        DrawPatBoxes
  150.         Call        DrawMaskBoxes
  151.         Call        FillPatBoxes
  152.         Call        FillMaskBoxes
  153. RefreshPart    move.w        PCopy,Pattern
  154.         move.w        MCopy,Mask
  155.         Call        DrawPat
  156.         Call        DrawMask
  157.         Call        DrawActiveBar
  158.         Call        DrawGhostedBar
  159. GetNextMsg    LoadBase    ExecBase
  160.         movea.l        PWindow(PC),A0
  161.         movea.l        wd_UserPort(A0),A0
  162.         CallLib        WaitPort
  163.         movea.l        PWindow(PC),A0
  164.         movea.l        wd_UserPort(A0),A0
  165.         CallLib        GetMsg
  166.         tst.l        D0
  167.         beq.S        GetNextMsg
  168. GotAMessage    movea.l        D0,A1
  169.         move.l        im_Class(A1),D3
  170.         move.l        im_IAddress(A1),IAddress
  171.         move.w        im_MouseX(A1),MouseX
  172.         move.w        im_MouseY(A1),MouseY
  173.         CallLib        ReplyMsg
  174. DecodeMessage    cmpi.l        #CLOSEWINDOW,D3
  175.         beq        Exit
  176.         cmpi.w        #GADGETUP,D3
  177.         beq.S        DoGadget
  178.         cmpi.w        #GADGETDOWN,D3
  179.         bne.S        GetNextMsg
  180.  
  181. DoGadget    movea.l        IAddress(PC),A1
  182.         move.w        gg_GadgetID(A1),D0        ;GadgetID
  183.         lsl.l        #1,D0
  184.         move.w        GJ(PC,D0.W),D0
  185.         jmp        GJ(PC,D0.W)
  186. GJ        dc.w        PSelect-GJ
  187.         dc.w        MSelect-GJ
  188.         dc.w        DoSaveAs-GJ
  189.         dc.w        DoChange-GJ
  190.  
  191. * User clicked on the 'Active Pattern drawing area' gadget
  192. PSelect        lea        PatBoxes(PC),A5
  193.         bra.S        DoSelect
  194. * User clicked on the 'Ghost Mask drawing area' gadget
  195. MSelect        lea        MaskBoxes(PC),A5
  196. DoSelect    Call        ClearBarPat
  197. FindMousePos    move.w        MouseX(PC),D5
  198.         move.w        MouseY(PC),D6
  199.         sub.w        StartX(A5),D5
  200.         sub.w        StartY(A5),D6
  201.         ext.l        D5
  202.         ext.l        D6
  203.         move.w        SizeX(A5),D2
  204.         move.w        SizeY(A5),D3
  205.         add.w        SpaceX(A5),D2
  206.         add.w        SpaceY(A5),D3
  207.         divu        D2,D5
  208.         divu        D3,D6
  209.         ext.l        D5
  210.         ext.l        D6
  211.         movea.l        Buffer(A5),A1
  212.         adda.l        D6,A1
  213.         adda.l        D6,A1
  214.         moveq        #15,D3
  215.         sub.w        D5,D3
  216.         mulu        Cols(A5),D6
  217.         add.l        D6,D5
  218.         move.w        (A1),D2
  219.         bchg        D3,D2
  220.         move.w        D2,(A1)
  221.         bchg        D3,D2
  222.         bne.S        SetPMBit
  223. ClearPMBit    move.w        ColorClr(A5),D0
  224.         bra.S        DoCom
  225. SetPMBit    move.w        ColorSet(A5),D0
  226. DoCom        Call        SetPenA
  227.         Call        SetField
  228.         bra        RefreshPart
  229.  
  230. ;The user pressed RETURN in the 'Save as' gadget
  231. DoSaveAs    lea        Pattern,A0
  232.         lea        PatCopy(PC),A1
  233.         moveq        #7,D0
  234. PatLoop        move.w        (A0)+,(A1)+
  235.         dbf        D0,PatLoop
  236.         lea        Mask,A0
  237.         lea        MaskCopy(PC),A1
  238.         moveq        #3,D0
  239. MaskLoop    move.w        (A0)+,(A1)+
  240.         dbf        D0,MaskLoop
  241.         lea        CharBuf(PC),A0
  242.         LoadBase    DosBase
  243.         move.l        A0,D1
  244.         move.l        #MODE_NEWFILE,D2
  245.         CallLib        Open
  246.         move.l        D0,D7
  247.         beq.S        DoneSave
  248.         move.l        D7,D1
  249.         lea        PBar(PC),A0
  250.         move.l        A0,D2
  251.         move.l        #PBarEnd-PBar,D3
  252.         CallLib        Write
  253.         move.l        D7,D1
  254.         CallLib        Close
  255.         move.l        ITxtCreate+12(PC),D0
  256.         lea        TxtCreate1(PC),A1
  257.         cmp.l        A1,D0
  258.         bne.S        DoneSave
  259.         Call        CreateIcon
  260.         LoadBase    ExecBase        ;Save Icon
  261.         lea        IconName(PC),A1
  262.         CallLib        OldOpenLibrary
  263.         move.l        D0,D7
  264.         beq.S        DoneSave
  265.         lea        CharBuf(PC),A0
  266.         lea        MyDiskObject(PC),A1
  267.         move.l        D7,A6
  268.         CallLib        PutIcon
  269.         LoadBase    ExecBase
  270.         move.l        D7,A1
  271.         CallLib        CloseLibrary
  272. DoneSave    bra        GetNextMsg
  273.  
  274. ;The user clicked the 'Save WITH(OUT) Icon' gadget
  275. DoChange    lea        ITxtCreate+it_IText(PC),A0
  276.         lea        TxtCreate1(PC),A1
  277.         lea        TxtCreate2(PC),A2
  278.         move.l        (A0),D0
  279.         cmp.l        A2,D0
  280.         beq.S        Change
  281.         move.l        A2,A1
  282. Change        move.l        A1,(A0)
  283.         moveq        #1,D0
  284.         lea        CreateGad(PC),A0
  285.         movea.l        PWindow(PC),A1
  286.         suba.l        A2,A2
  287.         LoadBase    IntBase
  288.         CallLib        RefreshGList
  289.         bra        GetNextMsg
  290.  
  291. DrawPatBoxes    lea        PatBoxes(PC),A5
  292.         bra.S        DrawBoxes
  293. DrawMaskBoxes    lea        MaskBoxes(PC),A5
  294. ;A5=structure
  295. DrawBoxes    Push        D0-D7/A0-A1
  296.         Call        SetAPen1
  297.         LoadBase    GfxBase
  298.         move.w        StartX(A5),D0
  299.         move.w        Cols(A5),D2
  300.         subq.w        #1,D2
  301. ColLoop        move.w        StartY(A5),D1
  302.         move.w        Rows(A5),D3
  303.         subq.w        #1,D3
  304. RowLoop        Push        D0-D5/A5
  305.         move.w        D0,D2
  306.         move.w        D1,D3
  307.         moveq        #0,D0
  308.         moveq        #2,D1
  309.         move.w        SizeX(A5),D4
  310.         move.w        SizeY(A5),D5
  311.         lea        ImageData,A0
  312.         movea.l        Rp(PC),A1
  313.         CallLib        BltTemplate        ;BltTemplate((APTR)AltFont,8,192,rp,x,y,8,8);
  314.         Pop        D0-D5/A5
  315.         add.w        SizeY(A5),D1
  316.         add.w        SpaceY(A5),D1
  317.         dbf        D3,RowLoop
  318.         add.w        SizeX(A5),D0
  319.         add.w        SpaceX(A5),D0
  320.         dbf        D2,ColLoop
  321. EndColLoop    Pop        D0-D7/A0-A1
  322.         rts
  323.  
  324. FillPatBoxes    lea        PatBoxes(PC),A5
  325.         bra.S        FillPMBoxes
  326. FillMaskBoxes    lea        MaskBoxes(PC),A5
  327. FillPMBoxes    movea.l        Buffer(A5),A4
  328.         moveq        #0,D1
  329. FillPMLoop    move.w        (A4)+,D0
  330.         Call        FillWORD
  331.         addq.w        #1,D1
  332.         cmp.w        Rows(A5),D1
  333.         bne.S        FillPMLoop
  334.         rts
  335.  
  336. ;D0=word, D1=row, A5=structure
  337. FillWORD    Push        D0-D7/A0-A1
  338.         move.l        D0,D7
  339.         move.l        D1,D6
  340.         move.w        Cols(A5),D4
  341.         move.w        D4,D3
  342.         subq.w        #1,D4
  343. FillWORDLoop    move.l        D6,D5
  344.         mulu        D3,D5
  345.         add.w        D3,D5
  346.         subq.w        #1,D5
  347.         sub.w        D4,D5
  348.         btst        D4,D7
  349.         beq.S        ClearBit
  350. SetBit        move.w        ColorSet(A5),D0
  351.         bra.S        ContWORDLoop
  352. ClearBit    move.w        ColorClr(A5),D0
  353. ContWORDLoop    Call        SetPenA
  354.         Call        SetField
  355.         dbf        D4,FillWORDLoop
  356.         Pop        D0-D7/A0-A1
  357.         rts
  358.  
  359. ;D5=number, A5=structure
  360. SetField    Push        D0-D7/A0-A1
  361.         move.l        D5,D0
  362.         divu        Cols(A5),D0
  363.         move.w        D0,D1        ;Row
  364.         swap        D0        ;Col
  365.         ext.l        D0
  366.         ext.l        D1
  367.         move.w        SizeX(A5),D2
  368.         move.w        SizeY(A5),D3
  369.         add.w        SpaceX(A5),D2
  370.         add.w        SpaceY(A5),D3
  371.         mulu        D2,D0
  372.         mulu        D3,D1
  373.         add.w        StartX(A5),D0
  374.         add.w        StartY(A5),D1
  375.         move.l        D0,D2
  376.         move.l        D1,D3
  377.         addq.w        #4,D0
  378.         addq.w        #2,D1
  379.         subq.w        #3,D2
  380.         subq.w        #2,D3
  381.         add.w        SizeX(A5),D2
  382.         add.w        SizeY(A5),D3
  383.         movea.l        Rp(PC),A1
  384.         LoadBase    GfxBase
  385.         CallLib        RectFill
  386.         Pop        D0-D7/A0-A1
  387.         rts
  388.  
  389. ClearBarPat    suba.l        A0,A0
  390.         moveq        #0,D0
  391.         bra.S        SetPattern
  392. SetActivePat    lea        Pattern+2,A0
  393.         moveq        #3,D0
  394.         bra.S        SetPattern
  395. SetGhostPat    lea        Mask+2,A0
  396.         moveq        #2,D0
  397. SetPattern    movea.l        Rp(PC),A1
  398.         move.l        A0,rp_AreaPtrn(A1)
  399.         move.b        D0,rp_AreaPtSz(A1)
  400.         rts
  401.  
  402. DrawPat        Call        SetActivePat
  403.         lea        PatBoxes(PC),A5
  404.         moveq        #40,D6
  405.         moveq        #47,D7
  406.         bra.S        DrawPM
  407. DrawMask    Call        SetGhostPat
  408.         lea        MaskBoxes(PC),A5
  409.         moveq        #100,D6
  410.         moveq        #103,D7
  411. DrawPM        Call        SetDrMd1
  412.         move.w        ColorSet(A5),D0
  413.         Call        SetPenA
  414.         move.w        ColorClr(A5),D0
  415.         Call        SetPenB
  416.         move.w        #160,D0
  417.         move.w        D6,D1
  418.         move.w        #175,D2
  419.         move.w        D7,D3
  420.         LoadBase    GfxBase
  421.         movea.l        Rp(PC),A1
  422.         CallLib        RectFill
  423.         rts
  424.  
  425. DrawActiveBar    moveq        #28,D7
  426. DrawAGB        Call        DrawBack
  427.         Call        SetActivePat
  428.         Call        SetDrMd1
  429.         Call        SetAPen0
  430.         Call        SetBPen1
  431.         Call        DrawBar
  432.         rts
  433.  
  434. DrawGhostedBar    moveq        #114,D7
  435.         Call        DrawAGB
  436.         Call        SetGhostPat
  437.         Call        SetDrMd0
  438.         Call        SetAPen1
  439.         Call        SetBPen0
  440.         Call        DrawBar
  441.         rts
  442.  
  443. ;D7=x-offset
  444. DrawBack    Call        ClearBarPat
  445.         Call        SetAPen1
  446.         Call        SetDrMd1
  447.         move.w        D7,D0
  448.         subq.w        #2,D0
  449.         moveq        #23,D1
  450.         move.w        D7,D2
  451.         addi.w        #72,D2
  452.         moveq        #32,D3
  453.         bra.S        FillRect
  454. ;D7=x-offset
  455. DrawBar        move.w        D7,D0
  456.         moveq        #24,D1
  457.         move.w        D7,D2
  458.         addi.w        #70,D2
  459.         moveq        #31,D3
  460. FillRect    LoadBase    GfxBase
  461.         movea.l        Rp(PC),A1
  462.         CallLib        RectFill
  463.         rts
  464.  
  465. SetAPen0    moveq        #0,D0
  466.         bra.S        SetPenA
  467. SetAPen1    moveq        #1,D0
  468.         bra.S        SetPenA
  469. SetAPen2    moveq        #2,D0
  470. SetPenA        movea.l        Rp(PC),A1        ;D0=Color
  471.         LoadBase    GfxBase
  472.         CallLib        SetAPen
  473.         rts
  474.  
  475. SetBPen0    moveq        #0,D0
  476.         bra.S        SetPenB
  477. SetBPen1    moveq        #1,D0
  478. SetPenB        movea.l        Rp(PC),A1        ;D0=Color
  479.         LoadBase    GfxBase
  480.         CallLib        SetBPen
  481.         rts
  482.  
  483. SetDrMd0    moveq        #0,D0
  484.         bra.S        SetMdDr
  485. SetDrMd1    moveq        #1,D0
  486. SetMdDr        movea.l        Rp(PC),A1        ;D0=Mode
  487.         LoadBase    GfxBase
  488.         CallLib        SetDrMd
  489.         rts
  490.  
  491.  
  492. ; Create an icon that shows the new-made pattern
  493. CreateIcon    lea        PatCopy+2(PC),A5
  494.         lea        IconData+19(PC),A4
  495.         moveq        #6,D0
  496.         Call        PutData
  497.         lea        PatCopy(PC),A5
  498.         moveq        #0,D0
  499.         Call        PutData
  500.         rts
  501. PutData
  502. CreateLoop    move.l        A4,A1
  503.         move.l        A5,A2
  504.  
  505.         move.b        (A1),D1
  506.         lsl.l        #8,D1
  507.         move.b        1(A1),D1
  508.         lsl.l        #8,D1
  509.         move.b        2(A1),D1
  510.         lsl.l        #8,D1
  511.         move.b        3(A1),D1
  512.  
  513.         andi.l        #%11111110000000000000000000000000,D1
  514.  
  515.         move.b        (A2),D2
  516.         lsl.l        #8,D2
  517.         move.b        1(A2),D2
  518.         lsl.l        #8,D2
  519.         move.b        (A2),D2
  520.         lsl.l        #1,D2
  521.         not.l        D2
  522.         andi.l        #%00000001111111111111111111111111,D2
  523.  
  524.         or.l        D2,D1
  525.  
  526.         move.b        D1,3(A1)
  527.         lsr.l        #8,D1
  528.         move.b        D1,2(A1)
  529.         lsr.l        #8,D1
  530.         move.b        D1,1(A1)
  531.         lsr.l        #8,D1
  532.         move.b        D1,(A1)
  533.  
  534.         addq.w        #2,A5
  535.         add.w        #16,A4
  536.         dbf        D0,CreateLoop
  537.         rts
  538.  
  539. DosName        dc.b        'dos.library',0
  540. GfxName        dc.b        'graphics.library',0
  541. IntName        dc.b        'intuition.library',0
  542. IconName    dc.b        'icon.library',0
  543.  
  544.         EVEN
  545. IAddress    dc.l        0
  546. MouseX        dc.w        0
  547. MouseY        dc.w        0
  548. StartSP        dc.l        0
  549. DosBase        dc.l        0
  550. GfxBase        dc.l        0
  551. IntBase        dc.l        0
  552.  
  553. WBenchMsg    dc.l        0
  554. PWindow        dc.l        0
  555. Rp        dc.l        0        ;RastPort
  556. Up        dc.l        0        ;UserPort
  557.         EVEN
  558.  
  559. ;--- Window and gadgets
  560. NW        dc.w        220,15,220,167
  561.         dc.b        0,1
  562.         dc.l        GADGETUP!GADGETDOWN!CLOSEWINDOW,WINDOWCLOSE!WINDOWDRAG!WINDOWDEPTH!ACTIVATE,GadgetList,0,0,0,0
  563.         dc.w        0,0,0,0,WBENCHSCREEN
  564.  
  565. BWIDTH        =198
  566. BHEIGHT        =11
  567. BBorder        Border        -2,-1,3,0,1,9,BVectors,NL
  568. BVectors    dc.w        2,0,BWIDTH+1,0,BWIDTH+3,2,BWIDTH+3,BHEIGHT-1,BWIDTH+1,BHEIGHT+1,2,BHEIGHT+1,0,BHEIGHT-1,0,2,2,0
  569. PWIDTH        =22
  570. PHEIGHT        =12
  571. PBorder        Border        129,-13,1,0,1,9,PVectors,NL
  572. PVectors    dc.w        2,0,PWIDTH+1,0,PWIDTH+3,2,PWIDTH+3,PHEIGHT-1,PWIDTH+1,PHEIGHT+1,2,PHEIGHT+1,0,PHEIGHT-1,0,2,2,0
  573. MWIDTH        =22
  574. MHEIGHT        =8
  575. MBorder        Border        129,-9,1,0,1,9,MVectors,NL
  576. MVectors    dc.w        2,0,MWIDTH+1,0,MWIDTH+3,2,MWIDTH+3,MHEIGHT-1,MWIDTH+1,MHEIGHT+1,2,MHEIGHT+1,0,MHEIGHT-1,0,2,2,0
  577. STRWIDTH    =135
  578. STRHEIGHT    =10
  579. StrBorder    Border        -3,-2,3,0,1,9,StrBVectors,NL
  580. StrBVectors    dc.w        2,0,STRWIDTH,0,STRWIDTH+2,2,STRWIDTH+2,STRHEIGHT,STRWIDTH,STRHEIGHT+2,2,STRHEIGHT+2,0,STRHEIGHT,0,2,2,0
  581.  
  582. GadgetList
  583. PSGad        Gadget        MSGad,PStartx,PStarty,16*(BoxSizex-2),8*(BoxSizey-1),GADGHNONE,GADGIMMEDIATE,BOOLGADGET
  584.         Gadget2        PBorder,NL,ITxtAP,NL,NL,PSID,NL
  585. MSGad        Gadget        StrGad,MStartx,MStarty,16*(BoxSizex-2),4*(BoxSizey-1),GADGHNONE,GADGIMMEDIATE,BOOLGADGET
  586.         Gadget2        MBorder,NL,ITxtGM,NL,NL,MSID,NL
  587. StrGad        Gadget        CreateGad,75,133,STRWIDTH,STRHEIGHT,GADGHCOMP,RELVERIFY,STRGADGET
  588.         Gadget2        StrBorder,NL,ITxtSaveAs,NL,StrInfo,STRID,NL
  589. CreateGad    Gadget        NL,11,149,BWIDTH,BHEIGHT,GADGHCOMP,RELVERIFY,BOOLGADGET
  590.         Gadget2        BBorder,NL,ITxtCreate,NL,NL,CREATEID,NL
  591.  
  592. StrInfo        dc.l        CharBuf,NL
  593.         dc.w        NL,60,NL,NL,NL,NL,NL,NL
  594.         dc.l        NL,NL,NL
  595.  
  596. CharBuf        dcb.b        60,0
  597.         EVEN
  598.  
  599. ITxtAP        IntuiText    1,0,1,-6,-9,TxtAP,ITxtAB
  600. ITxtGM        IntuiText    1,0,1,-6,-9,TxtGM,NL
  601. ITxtAB        IntuiText    1,0,1,2,-35,TxtAB,ITxtGB
  602. ITxtGB        IntuiText    1,0,1,90,-35,TxtGB,NL
  603. ITxtSaveAs    IntuiText    1,0,1,-65,0,TxtSaveAs,NL
  604. ITxtCreate    IntuiText    1,0,1,34,2,TxtCreate1,NL
  605.  
  606.  
  607. ScrTitle    dc.b        'PBar V1.0 by Preben Nielsen in 1990. This is Public Domain',0
  608. WinTitle    dc.b        'PBar V1.0',0
  609. TxtAP        dc.b        "'Active' Pattern",0
  610. TxtGM        dc.b        "'Ghost' Mask",0
  611. TxtAB        dc.b        "'Active'",0
  612. TxtGB        dc.b        "'Ghosted'",0
  613. TxtSaveAs    dc.b        'Save as',0
  614. TxtCreate1    dc.b        '  Save WITH Icon ',0
  615. TxtCreate2    dc.b        'Save WITHOUT Icon',0
  616.  
  617. FontName    dc.b        'topaz.font',0
  618.         EVEN
  619. TxtAttr1    dc.l        FontName
  620.         dc.w        TOPAZ_EIGHTY
  621.         dc.b        FS_NORMAL,FPB_ROMFONT
  622.  
  623. PatBoxes    dc.w        PStartx,PStarty        ;posx,posy
  624.         dc.w        BoxSizex,BoxSizey    ;width,height
  625.         dc.w        -2,-1            ;spacex,spacey
  626.         dc.w        16,8            ;cols,rows
  627.         dc.l        Pattern+2        ;buffer
  628.         dc.w        0,1
  629.  
  630. MaskBoxes    dc.w        MStartx,MStarty
  631.         dc.w        BoxSizex,BoxSizey
  632.         dc.w        -2,-1
  633.         dc.w        16,4
  634.         dc.l        Mask+2
  635.         dc.w        1,0
  636. ; This rest is for the icon
  637. MyDiskObject    dc.w        WB_DISKMAGIC,WB_DISKVERSION
  638.         dc.l        0
  639.         dc.w        0,0,115,10
  640.         dc.w        GADGIMAGE!GADGHCOMP,RELVERIFY!GADGIMMEDIATE,BOOLGADGET
  641.         dc.l        IconImage,0,0,0,0
  642.         dc.w        0
  643.         dc.l        0
  644.         dc.b        WBTOOL,0    
  645.         dc.l        0,0,100,40,0,0,0
  646.  
  647. IconImage    dc.w        0,0        ; LeftEdge, TopEdge
  648.         dc.w        115,10        ; Width, Height
  649.         dc.w        2        ; Depth
  650.         dc.l        IconData    ; ImageData
  651.         dc.b        3,0        ; PlanePick, PlaneOnOff
  652.         dc.l        0        ; Next Image
  653.  
  654. IconData    ; Plane 0
  655.         dc.w        $f3ff
  656.         dc.w        $ffcf
  657.         dc.w        $ffff
  658.         dc.w        $ffe7
  659.         dc.w        $ffff
  660.         dc.w        $e3ff
  661.         dc.w        $fff3
  662.         dc.w        $e000
  663.         dc.w        $f300
  664.         dc.w        $00cf
  665.         dc.w        $ffff
  666.         dc.w        $ffe6
  667.         dc.w        $0007
  668.         dc.w        $e300
  669.         dc.w        $03f3
  670.         dc.w        $e000
  671.         dc.w        $f33f
  672.         dc.w        $fcce
  673.         dc.w        $0000
  674.         dc.w        $00e6
  675.         dc.w        $7fe7
  676.         dc.w        $e300
  677.         dc.w        $0033
  678.         dc.w        $e000
  679.         dc.w        $f33f
  680.         dc.w        $fcce
  681.         dc.w        $0000
  682.         dc.w        $00e6
  683.         dc.w        $6000
  684.         dc.w        $6303
  685.         dc.w        $ff33
  686.         dc.w        $e000
  687.         dc.w        $f33c
  688.         dc.w        $3ccf
  689.         dc.w        $ffff
  690.         dc.w        $ffe6
  691.         dc.w        $6000
  692.         dc.w        $6303
  693.         dc.w        $ff33
  694.         dc.w        $e000
  695.         dc.w        $f33c
  696.         dc.w        $3ccf
  697.         dc.w        $ffff
  698.         dc.w        $ffe6
  699.         dc.w        $6000
  700.         dc.w        $6303
  701.         dc.w        $ff33
  702.         dc.w        $e000
  703.         dc.w        $f33f
  704.         dc.w        $fcce
  705.         dc.w        $0000
  706.         dc.w        $00e6
  707.         dc.w        $0000
  708.         dc.w        $6303
  709.         dc.w        $ff33
  710.         dc.w        $e000
  711.         dc.w        $f33f
  712.         dc.w        $fcce
  713.         dc.w        $0000
  714.         dc.w        $00e7
  715.         dc.w        $e000
  716.         dc.w        $63f3
  717.         dc.w        $ff33
  718.         dc.w        $e000
  719.         dc.w        $f300
  720.         dc.w        $00cf
  721.         dc.w        $ffff
  722.         dc.w        $ffe7
  723.         dc.w        $e000
  724.         dc.w        $63f0
  725.         dc.w        $0033
  726.         dc.w        $e000
  727.         dc.w        $f3ff
  728.         dc.w        $ffcf
  729.         dc.w        $ffff
  730.         dc.w        $ffe7
  731.         dc.w        $ffff
  732.         dc.w        $e3ff
  733.         dc.w        $fff3
  734.         dc.w        $e000
  735.         ; Plane 1
  736.         dc.w        $0000
  737.         dc.w        $0000
  738.         dc.w        $0000
  739.         dc.w        $0000
  740.         dc.w        $0000
  741.         dc.w        $0000
  742.         dc.w        $0000
  743.         dc.w        $0000
  744.         dc.w        $0000
  745.         dc.w        $0000
  746.         dc.w        $0000
  747.         dc.w        $0000
  748.         dc.w        $0000
  749.         dc.w        $00ff
  750.         dc.w        $fc00
  751.         dc.w        $0000
  752.         dc.w        $0000
  753.         dc.w        $0000
  754.         dc.w        $0000
  755.         dc.w        $0000
  756.         dc.w        $0000
  757.         dc.w        $00f0
  758.         dc.w        $0000
  759.         dc.w        $0000
  760.         dc.w        $0000
  761.         dc.w        $0000
  762.         dc.w        $0000
  763.         dc.w        $0000
  764.         dc.w        $1fff
  765.         dc.w        $80f0
  766.         dc.w        $0000
  767.         dc.w        $0000
  768.         dc.w        $0003
  769.         dc.w        $c000
  770.         dc.w        $0000
  771.         dc.w        $0000
  772.         dc.w        $1fff
  773.         dc.w        $80f0
  774.         dc.w        $0000
  775.         dc.w        $0000
  776.         dc.w        $0003
  777.         dc.w        $c000
  778.         dc.w        $0000
  779.         dc.w        $0000
  780.         dc.w        $1fff
  781.         dc.w        $80f0
  782.         dc.w        $0000
  783.         dc.w        $0000
  784.         dc.w        $0000
  785.         dc.w        $0000
  786.         dc.w        $0000
  787.         dc.w        $0000
  788.         dc.w        $1fff
  789.         dc.w        $80f0
  790.         dc.w        $0000
  791.         dc.w        $0000
  792.         dc.w        $0000
  793.         dc.w        $0000
  794.         dc.w        $0000
  795.         dc.w        $0000
  796.         dc.w        $1fff
  797.         dc.w        $8000
  798.         dc.w        $0000
  799.         dc.w        $0000
  800.         dc.w        $0000
  801.         dc.w        $0000
  802.         dc.w        $0000
  803.         dc.w        $0000
  804.         dc.w        $1fff
  805.         dc.w        $8000
  806.         dc.w        $0000
  807.         dc.w        $0000
  808.         dc.w        $0000
  809.         dc.w        $0000
  810.         dc.w        $0000
  811.         dc.w        $0000
  812.         dc.w        $0000
  813.         dc.w        $0000
  814.         dc.w        $0000
  815.         dc.w        $0000
  816.  
  817. * This is to be written to disk as an executable file
  818. * The code contains no absolute references
  819. PBar        dc.l        $000003F3,$00000000,$00000001,$00000000
  820.         dc.l        $00000000,$00000030,$000003E9,$00000030
  821.         dc.l        $48E7FFFE,$2C780004,$93C94EAE,$FEDA2440
  822.         dc.l        $4AAA00AC,$661641EA,$005C4EAE,$FE8041EA
  823.         dc.l        $005C4EAE,$FE8C23C0,$000000A2,$43FA0062
  824.         dc.l        $4EAEFE68,$2A404A80,$673043ED,$031641FA
  825.         dc.l        $00667017,$12D851C8,$FFFC2C4D,$286D003C
  826.         dc.l        $200C6716,$266C0004,$200B670A,$20404EAE
  827.         dc.l        $FE382653,$60F22854,$60E62C78,$0004200D
  828.         dc.l        $67062240,$4EAEFE62,$203A0028,$670A4EAE
  829.         dc.l        $FF7C2240,$4EAEFE86,$4CDF7FFF,$70004E75
  830.         dc.l        $696E7475,$6974696F,$6E2E6C69,$62726172
  831.         dc.l        $79000000
  832.         dc.w        $0000
  833. PatCopy        dc.l        $00000000,$FFFFFFFF,$00000000,$FFFFFFFF
  834. MaskCopy    dc.l        $44441111,$44441111
  835.         dc.l        $00000000,$03EC0000,$00010000,$0000000,$00280000
  836.         dc.w        $0000,$0000,$03F2
  837. PBarEnd
  838.  
  839.     SECTION IMAGEDATA,DATA_C        ;Image-data has to be in CHIP-RAM
  840. Pattern        dc.l        $00000000,$FFFFFFFF,$00000000,$FFFFFFFF
  841. PCopy        dc.w        $0000
  842. Mask        dc.l        $44441111,$44441111
  843. MCopy        dc.w        $4444
  844. ImageData    dc.w        %1111111111110000
  845.         dc.w        %1100000000110000
  846.         dc.w        %1100000000110000
  847.         dc.w        %1100000000110000
  848.         dc.w        %1100000000110000
  849.         dc.w        %1111111111110000
  850.         END
  851.  
  852.