;*************************************************************
;*   This code is to be used with the VidCell video digitizer.
;*   Updates on the code depends on two things: The first being
;*   how interested people are in it, and second, Updates that
;*   people send me.  Feel free to modify the code for your own
;*   use, but PLEASE do not release it.... send it to me, and I
;*   will re-release it if I like it (of course giving you credit).
;*   Have fun, and remember who put this thing out in the Public Domain.
;*   I put quite a bit of time and money in this thing, so if you feel
;*   generous, then don't hesitate to drown me with gifts of money.....
;*************************************************************


            include     "exec/nodes.i"
            include     "exec/io.i"
            include     "exec/tasks.i"
            include     "exec/interrupts.i"
            include     "devices/input.i"
            include     "exec/devices.i"
            include     "devices/inputevent.i"
            include     "exec/types.i"
            include     "exec/libraries.i"
            include     "exec/memory.i"
            include     "graphics/gfxbase.i"
            include     "hardware/custom.i"
            include     "hardware/dmabits.i"
            include     "hardware/intbits.i"
            include     "hardware/blit.i"
            include     "libraries/dosextens.i"
            include     "intuition/intuition.i"
            include     "graphics/view.i"
            include     "graphics/rastport.i"
            include     "graphics/text.i"
            include     "graphics/gfx.i"
            include     "exec/ports.i"
            include     "requester/fileio.i"

            XREF        _AbsExecBase
            XREF        _LVOAllocMem
            XREF        _LVOCloseLibrary
            XREF        _LVOCloseWorkBench
            XREF        _LVODelay
            XREF        _LVOFindTask
            XREF        _LVOFreeMem
            XREF        _LVOForbid
            XREF        _LVOOpenLibrary
            XREF        _LVOOpenWorkBench
            XREF        _LVOOpenWindow
            XREF        _LVOCloseWindow
            XREF        _LVOSetMenuStrip
            XREF        _LVOClearMenuStrip
            XREF        _LVOWaitPort
            XREF        _LVOReplyMsg
            XREF        _LVOWaitPort
            XREF        _LVOOpen
            XREF        _LVOWrite
            XREF        _LVOClose
            XREF        _LVOWait
            XREF        _LVOOpenScreen
            XREF        _LVOCloseScreen
            XREF        _LVOSetRast
            XREF        _LVOSetRGB4
            XREF        _LVOGetMsg
            XREF        _LVOReplyMsg
            XREF        _LVOWindowToFront
            XREF        _LVORead
            XREF        _LVOOnMenu
            XREF        _LVOSetMenuStrip
            XREF        _LVOClearMenuStrip
            XREF        _LVOLoadRGB4
            XREF        _LVOViewPortAddress
            XREF        _LVOOpenResource
            XREF        _LVOShowTitle
            XREF        _LVOPrintIText
            XREF        _LVOShowTitle
            XREF        _LVOMoveScreen
            XREF        _LVOWaitTOF
            XREF        _LVOFindTask
            XREF        _LVODoIO
            XREF        _LVOOpenDevice
            XREF        _LVOCreateStdIO
            XREF        _LVOAllocSignal
            XREF        _LVOFindTask
            XREF        _LVOForbid
            XREF        _LVOPermit
            XREF        _LVOSPDiv
            XREF        _LVOSPAdd
            XREF        _LVOSPSub
            XREF        _LVOSPMul
            XREF        _LVOSPFix
            XREF        _LVOSPFlt
            XREF        _LVOScreenToFront
;*************************
            XREF        ZapIt3x2
            XREF        ZapIt3x4
            XREF        ZapIt6x2
            XREF        ZapIt6x4
            XREF        ClearScreen
            XREF        ScreenBack3x2
            XREF        ScreenBack3x4
            XREF        ScreenBack6x2
            XREF        ScreenBack6x4
            XREF        Negative
            XREF        bindec
            XREF        Save
            XREF        saveiff
            XREF        Load
            XREF        IFFFormLen
            XREF        PicSize
            XREF        PageSize
            XREF        BodyLen
            XREF        PicSizeSV
            XREF        PicWSV
            XREF        PicHSV
     ;************************************
            XDEF        Main
            XDEF        bp1
            XDEF        bp2
            XDEF        bp3
            XDEF        bp4
            XDEF        tempscr
            XDEF        tempscr2
            XDEF        smoothflg
            XDEF        BrightVal
            XDEF        ContrastVal
            XDEF        sc_Function
            XDEF        sc_Value
            XDEF        sc_IVal
            XDEF        sc_CVal
            XDEF        sc_SVal
            XDEF        ChangeTitle
            XDEF        mathbase
            XDEF        intuitionbase
            XDEF        dosbase
            XDEF        gfxbase
            XDEF        requesterbase
            XDEF        MyScreen
            XDEF        MyScreen2
            XDEF        ToggleCP
            XDEF        ThreshHold
            XDEF        BandWFlg
            XDEF        ZapMode
            XDEF        FileIO
            XDEF        ScreenBack

custom      EQU         $dff000
NULL        EQU         $0


                move.l      a7,initialSP
                move.l      _AbsExecBase,a6

                suba.l      a1,a1
                jsr         _LVOFindTask(a6)
                move.l      d0,a4

                tst.l       pr_CLI(a4)
                beq         WBStart

                move.l      #1,clicode
                bra         startit

WBStart:
                jsr         waitmsgWB
                move.l      d0,returnMsg


startit:
            move.l      _AbsExecBase,a6

            move.l      #dosname,a1
            moveq.l     #0,d0
            CALLLIB     _LVOOpenLibrary
            move.l      d0,dosbase
            beq         xit

            move.l      #gfxname,a1
            moveq.l     #0,d0
            CALLLIB     _LVOOpenLibrary
            move.l      d0,gfxbase
            beq         xit

            move.l      #intuiname,a1
            moveq.l     #0,d0
            CALLLIB     _LVOOpenLibrary
            move.l      d0,intuitionbase
            beq         xit

            move.l      #mathname,a1
            moveq.l     #0,d0
            CALLLIB     _LVOOpenLibrary
            move.l      d0,mathbase
            beq         xit

            move.l      #requestername,a1
            moveq.l     #0,d0
            CALLLIB     _LVOOpenLibrary
            move.l      d0,requesterbase
            beq         xit


            LINKLIB     _LVOCloseWorkBench,intuitionbase

;*****************************************************
                jsr         Reset


                LINKLIB     _LVOGetFileIO,requesterbase
                move.l      d0,FileIO
                beq         Abort
                move.l      d0,a0

                move.b      #1,FILEIO_DRAWMODE(a0)
                move.b      #2,FILEIO_PENA(a0)
                move.b      #0,FILEIO_PENB(a0)
                move.l      #Buffer,FILEIO_BUFFER(a0)



                move.l      #256000,d0
                move.l      #MEMF_PUBLIC,d1
                CALLLIB     _LVOAllocMem
                move.l      d0,tempscr
                beq         Abort

                move.l      #256000,d0
                move.l      #MEMF_PUBLIC,d1
                CALLLIB     _LVOAllocMem
                move.l      d0,tempscr2
                beq         Abort


                move.l      MyScreen2,a0
                lea.l       sc_BitMap(a0),a0
                move.l      bm_Planes(a0),a1
                move.l      a1,bp1
                adda.l      #4,a0
                move.l      bm_Planes(a0),a2
                move.l      a2,bp2
                adda.l      #4,a0
                move.l      bm_Planes(a0),a3
                move.l      a3,bp3
                adda.l      #4,a0
                move.l      bm_Planes(a0),a4
                move.l      a4,bp4

                move.l      #15999,d0
Fillp:
                move.b      #%01010101,(a1)+
                move.b      #%01010101,(a2)+
                move.b      #%01010101,(a3)+
                move.b      #%01010101,(a4)+
                dbra        d0,Fillp


                move.l      #MyInterrupt,a0
                move.l      #MyData,IS_DATA(a0)
                move.l      #MyCode,IS_CODE(a0)
                move.b      #51,LN_PRI(a0)

                move.l      #MyMsgPort,a0
                move.b      #NT_MSGPORT,LN_TYPE(a0)

                movea.l     _AbsExecBase,a6
                move.l      #0,a1
                jsr         _LVOFindTask(a6)
                move.l      d0,MyTask

                movea.l     _AbsExecBase,a6
                move.l      #-1,d0
                jsr         _LVOAllocSignal(a6)
                move.l      d0,MySigBit

                move.l      #MyMsgPort,a0
                move.l      MyTask,MP_SIGTASK(a0)
                move.b      MySigBit,MP_SIGBIT(a0)
                move.b      #PA_SIGNAL,MP_FLAGS(a0)

                move.l      #MyIOStdReq,a0
                move.l      #MyMsgPort,MN_REPLYPORT(a0)
                move.b      #NT_MESSAGE,LN_TYPE(a0)

                movea.l     _AbsExecBase,a6
                move.l      #DevName,a0
                move.l      #0,d0
                move.l      #MyIOStdReq,a1
                move.l      #0,d1
                jsr         _LVOOpenDevice(a6)
                tst.l       d0
                bne         Abort


                move.l      #MyIOStdReq,a0
                move.w      #IND_ADDHANDLER,IO_COMMAND(a0)
                move.l      #MyInterrupt,IO_DATA(a0)

                movea.l     _AbsExecBase,a6
                move.l      #MyIOStdReq,a1
                jsr         _LVODoIO(a6)
                tst.l       d0
                bne         Abort
                bra         Init
MyCode:
                movem.l     d0-d7/a0-a5,-(a7)
                move.l      a0,EV

                move.l      EV,a0
                cmpi.b      #IECLASS_RAWMOUSE,ie_Class(a0)
                bne         EndHandler
                cmpi.w      #IECODE_RBUTTON,ie_Code(a0)
                bne         EndHandler
                jsr         gettime
                move.l      d7,buttontime2

                move.l      buttontime,d6
                sub.l       d6,d7
                cmpi.l      #20,d7
                bhi         NoTogg
                jsr         ToggleCP
                bra         EndHandler

NoTogg:
                move.l      buttontime2,buttontime

EndHandler:

                movem.l     (a7)+,d0-d7/a0-a5
                move.l      EV,a0
                move.l      EV,d0

                rts

gettime:
                move.b      $bfea01,d7
                lsl.l       #4,d7
                lsl.l       #4,d7
                move.b      $bfe901,d7
                lsl.l       #4,d7
                lsl.l       #4,d7
                move.b      $bfe801,d7
                rts
reg7            dc.l        0
buttontime:     dc.l        0
buttontime2:    dc.l        0
togglebutton:   dc.w        0


Init:

Main:

                tst.l       GadAdd12
                beq         NoAdd1
                move.l      GadAdd12,a0
                move.l      gg_SpecialInfo(a0),a0
                move.w      pi_VertPot(a0),BrightVal
NoAdd1:
                move.w      BrightVal,d0
                cmp.w       OldBrightVal,d0
                beq         ChkGad2
                clr.l       d0
                move.w      BrightVal,d0
                divu.w      #257,d0
                andi.w      #$ff,d0
                andi.b      #$ff,d0
                bmi         NegBri
                eori.b      #$7f,d0
                bra         ConvertBri

NegBri:
                andi.b      #$7f,d0

ConvertBri:
                LINKLIB     _LVOSPFlt,mathbase
                move.l      d0,MVal1              ;convert d0 to ffp

                move.l      #128,d0               ;convert 128 to ffp
                LINKLIB     _LVOSPFlt,mathbase
                move.l      d0,d1
                move.l      MVal1,d0
                LINKLIB     _LVOSPDiv,mathbase    ;divide d0 by 128
                move.l      d0,MVal1              ;save ffp result
                move.l      #100,d0
                LINKLIB     _LVOSPFlt,mathbase    ;convert 100 to ffp
                move.l      MVal1,d1
                LINKLIB     _LVOSPMul,mathbase    ;mult result x 100
                LINKLIB     _LVOSPFix,mathbase    ;convert percentage to int
                andi.w      #$7f,d0

                move.l      #sc_IVal,a0
                jsr         bindec

                LINKLIB     _LVOWaitTOF,gfxbase

                move.l      MyScreen,a0
                move.l      #1,d0
                LINKLIB     _LVOShowTitle,intuitionbase
                move.w      BrightVal,OldBrightVal

ChkGad2:
                tst.l       GadAdd11
                beq         NoAdd2
                move.l      GadAdd11,a0
                move.l      gg_SpecialInfo(a0),a0
                move.w      pi_VertPot(a0),ContrastVal
NoAdd2:
                move.w      ContrastVal,d0
                cmp.w       OldContrastVal,d0
                beq         ChkGad3
                clr.l       d0
                move.w      ContrastVal,d0
                divu.w      #257,d0
                andi.w      #$ff,d0
                eori.b      #$ff,d0


ConvertCon:
                LINKLIB     _LVOSPFlt,mathbase
                move.l      d0,MVal1              ;convert d0 to ffp

                move.l      #256,d0               ;convert 256 to ffp
                LINKLIB     _LVOSPFlt,mathbase
                move.l      d0,d1
                move.l      MVal1,d0
                LINKLIB     _LVOSPDiv,mathbase    ;divide d0 by 256
                move.l      d0,MVal1              ;save ffp result
                move.l      #100,d0
                LINKLIB     _LVOSPFlt,mathbase    ;convert 100 to ffp
                move.l      MVal1,d1
                LINKLIB     _LVOSPMul,mathbase    ;mult result x 100
                LINKLIB     _LVOSPFix,mathbase    ;convert percentage to int
                andi.w      #$7f,d0

                move.l      #sc_CVal,a0
                jsr         bindec

                LINKLIB     _LVOWaitTOF,gfxbase

                move.l      MyScreen,a0
                move.l      #1,d0
                LINKLIB     _LVOShowTitle,intuitionbase
                move.w      ContrastVal,OldContrastVal

ChkGad3:
                tst.l       GadAdd10
                beq         NoAdd3
                move.l      GadAdd10,a0
                move.l      gg_SpecialInfo(a0),a0
                move.w      pi_VertPot(a0),ThreshHold
NoAdd3:
                move.w      ThreshHold,d0
                cmp.w       OldThreshHold,d0
                beq         ChkGad4
                clr.l       d0
                move.w      ThreshHold,d0
                divu.w      #257,d0
                andi.w      #$ff,d0
                eori.b      #$ff,d0


ConvertTH:
                LINKLIB     _LVOSPFlt,mathbase
                move.l      d0,MVal1              ;convert d0 to ffp

                move.l      #256,d0               ;convert 256 to ffp
                LINKLIB     _LVOSPFlt,mathbase
                move.l      d0,d1
                move.l      MVal1,d0
                LINKLIB     _LVOSPDiv,mathbase    ;divide d0 by 256
                move.l      d0,MVal1              ;save ffp result
                move.l      #100,d0
                LINKLIB     _LVOSPFlt,mathbase    ;convert 100 to ffp
                move.l      MVal1,d1
                LINKLIB     _LVOSPMul,mathbase    ;mult result x 100
                LINKLIB     _LVOSPFix,mathbase    ;convert percentage to int
                andi.w      #$7f,d0

                move.l      #sc_TVal,a0
                jsr         bindec

                LINKLIB     _LVOWaitTOF,gfxbase

                move.l      MyScreen,a0
                move.l      #1,d0
                LINKLIB     _LVOShowTitle,intuitionbase
                move.w      ThreshHold,OldThreshHold

ChkGad4:

GetMessage:

                move.l      Userport,a0
                CALLLIB     _LVOGetMsg
                tst.l       d0
                beq         Main

                move.l      d0,a1
                move.l      im_Class(a1),Class
                move.w      im_Code(a1),Code
                move.l      im_IAddress(a1),IAddress
                CALLLIB     _LVOReplyMsg

                cmpi.l      #RAWKEY,Class
                beq         CheckKey
                cmpi.l      #GADGETUP,Class
                beq         CheckGadget
                cmpi.l      #MENUPICK,Class
                beq         CheckMenu
                jmp         Main
CheckKey:
                cmpi.w      #$45,Code    ;ESC KEY
                beq         Quit
                cmpi.w      #$40,Code
                beq         ToggleControlPanel
                jmp         Main

ToggleControlPanel:
                jsr         ToggleCP
                jmp         Main


ToggleCP:
                bchg        #1,ControlPanel
                tst.l       ControlPanel
                beq         PanelBack

                move.l      #9,d2
MoveCPlp:
                move.l      MyScreen,a0
                move.l      #0,d0
                move.l      #20,d1

                LINKLIB     _LVOMoveScreen,intuitionbase
                dbra        d2,MoveCPlp
                rts

PanelBack:
                move.l      #9,d2
MoveCPlp2:
                move.l      MyScreen,a0
                move.l      #0,d0
                move.l      #-20,d1

                LINKLIB     _LVOMoveScreen,intuitionbase
                dbra        d2,MoveCPlp2
                rts


CheckGadget:
                move.l      IAddress,a0
                move.w      gg_GadgetID(a0),GadgetID
                cmpi.w      #7,GadgetID
                beq         ZpIt
                cmpi.w      #8,GadgetID
                beq         ZpIt
                cmpi.w      #3,GadgetID
                beq         Smoothtgl
                cmpi.w      #5,GadgetID
                beq         Clscrn
                cmpi.w      #6,GadgetID
                beq         Remap
                cmpi.w      #4,GadgetID
                beq         Negtiv
                cmpi.w      #9,GadgetID
                beq         ResetIt
                jmp         Main
ZpIt:
                cmpi.w      #$01,ZapMode
                beq         zp3x2
                cmpi.w      #$02,ZapMode
                beq         zp3x4
                cmpi.w      #$03,ZapMode
                beq         zp6x2
                cmpi.w      #$04,ZapMode
                beq         zp6x4
                jmp         Main

zp3x2:
                jsr         ZapIt3x2
                jmp         Main

zp3x4:
                jsr         ZapIt3x4
                jmp         Main

zp6x2:
                jsr         ZapIt6x2
                jmp         Main

zp6x4:
                jsr         ZapIt6x4
                jmp         Main



Smoothtgl:
                bchg        #1,smoothflg
                jmp         Main

Clscrn:
                jsr         ClearScreen
                jmp         Main

Remap:
                jsr         ScreenBack
                jmp         Main

ResetIt:
            move.l      MyWindow,a0
            LINKLIB     _LVOClearMenuStrip,intuitionbase

            move.l      MyWindow,a0
            LINKLIB     _LVOCloseWindow,intuitionbase


            move.l      MyScreen,a0
            LINKLIB     _LVOCloseScreen,intuitionbase

            move.l      MyScreen2,a0
            LINKLIB     _LVOCloseScreen,intuitionbase


                jsr         Reset
                jmp         Main

Reset:
            move.l      #$fa60,IFFFormLen
            move.w      #$280,PicSize
            move.w      #$280,PageSize
            move.w      #$c8,PicSize+2
            move.w      #$c8,PageSize+2
            move.l      #$fa00,BodyLen
            move.l      #$fa00,PicSizeSV
            move.l      #79,PicWSV
            move.l      #199,PicHSV

            move.w      #$03,ZapMode

                move.w      #-32768,POT10+2
                move.w      #65535,POT11+2
                move.w      #32768,POT12+2


                move.l      #NewScreenStructure5,a0
                LINKLIB     _LVOOpenScreen,intuitionbase
                move.l      d0,MyScreen2
                beq         Abort


                move.l      #NewScreenStructure,a0
                LINKLIB     _LVOOpenScreen,intuitionbase
                move.l      d0,MyScreen
                move.l      d0,CS1
                beq         Abort

                move.l      MyScreen,a0
                lea.l       sc_ViewPort(a0),a0
                move.l      #Palette,a1
                move.l      #PaletteColorCount,d0
                LINKLIB     _LVOLoadRGB4,gfxbase

                move.l      MyScreen2,a0
                lea.l       sc_ViewPort(a0),a0
                move.l      #Palette2,a1
                move.l      #PaletteColorCount2,d0
                LINKLIB     _LVOLoadRGB4,gfxbase


                move.l      #NewWindowStructure1,a0
                LINKLIB     _LVOOpenWindow,intuitionbase
                move.l      d0,MyWindow
                beq         Abort

                move.l      MyScreen2,a0
                lea.l       sc_BitMap(a0),a0
                move.l      bm_Planes(a0),a1
                move.l      a1,bp1
                adda.l      #4,a0
                move.l      bm_Planes(a0),a2
                move.l      a2,bp2
                adda.l      #4,a0
                move.l      bm_Planes(a0),a3
                move.l      a3,bp3
                adda.l      #4,a0
                move.l      bm_Planes(a0),a4
                move.l      a4,bp4


                move.l      MyWindow,a0
                move.l      wd_FirstGadget(a0),a0
                move.l      a0,GadAdd1
                move.l      (a0),a0
                move.l      a0,GadAdd2
                move.l      (a0),a0
                move.l      a0,GadAdd3
                move.l      (a0),a0
                move.l      a0,GadAdd4
                move.l      (a0),a0
                move.l      a0,GadAdd5
                move.l      (a0),a0
                move.l      a0,GadAdd6
                move.l      (a0),a0
                move.l      a0,GadAdd7
                move.l      (a0),a0
                move.l      a0,GadAdd8
                move.l      (a0),a0
                move.l      a0,GadAdd9
                move.l      (a0),a0
                move.l      a0,GadAdd10
                move.l      (a0),a0
                move.l      a0,GadAdd11
                move.l      (a0),a0
                move.l      a0,GadAdd12

                move.l      MyWindow,a0
                LINKLIB     _LVOViewPortAddress,intuitionbase
                move.l      d0,MyView

                move.l      #MenuList1,a1
                move.l      MyWindow,a0
                LINKLIB     _LVOSetMenuStrip,intuitionbase

                move.l      MyWindow,a0
                move.l      wd_UserPort(a0),Userport

                rts

ScreenBack:
                cmpi.w      #$01,ZapMode
                bne         chkzm2
                jsr         ScreenBack3x2
                rts
chkzm2:
                cmpi.w      #$02,ZapMode
                bne         chkzm3
                jsr         ScreenBack3x4
                rts
chkzm3:
                cmpi.w      #$03,ZapMode
                bne         chkzm4
                jsr         ScreenBack6x2
                rts

chkzm4:
                jsr         ScreenBack6x4
                rts


Negtiv:
                jsr         Negative
                jmp         Main

CheckMenu:
                cmpi.w      #MENUNULL,Code
                beq         CheckMenuEnd
                move.w      Code,d0
                andi.w      #$1f,d0
                cmpi.w      #$00,d0
                beq         Mnu1
                cmpi.w      #$01,d0
                beq         Mnu2

CheckMenuEnd:   jmp         Main

Mnu1:
                move.w      Code,d0
                lsr         #$5,d0
                andi.w      #$3f,d0
                cmpi.w      #$02,d0
                beq         Quit
                cmpi.w      #$01,d0
                beq         Saveit
                cmpi.w      #$00,d0
                beq         Loadit
                jmp         Main

Saveit:
                move.w      Code,d0
                move.w      #11,d1
                lsr.w       d1,d0
                andi.w      #$1f,d0
                cmpi.w      #$00,d0
                beq         saveraw
                cmpi.w      #$01,d0
                beq         Saveiff
                jmp         Main

Saveiff:
                jmp         saveiff
saveraw:
                jmp         Save

Loadit:
                jmp         Load

Mnu2:
                move.w      Code,d0
                lsr         #$5,d0
                andi.w      #$3f,d0
                cmpi.w      #$00,d0
                beq         CheckColor
                cmpi.w      #$01,d0
                beq         ChkMode
                cmpi.w      #$03,d0
                beq         DoGray
                cmpi.w      #$04,d0
                beq         DoBandW
                jmp         Main

DoGray:
                move.w      #$00,BandWFlg
                jmp         Main

DoBandW:
                move.w      #$01,BandWFlg
                jmp         Main

CheckColor:
                move.w      Code,d0
                move.w      #11,d1
                lsr.w       d1,d0
                andi.w      #$1f,d0
                cmpi.w      #$00,d0
                beq         ColorRed
                cmpi.w      #$01,d0
                beq         ColorGrn
                cmpi.w      #$02,d0
                beq         ColorBlu
                cmpi.w      #$03,d0
                beq         ColorMon
                cmpi.w      #$04,d0
                beq         ColorPseudo
                jmp         Main

ChkMode:
                move.w      Code,d0
                move.w      #11,d1
                lsr.w       d1,d0
                andi.w      #$1f,d0
                cmpi.w      #$00,d0
                beq         m3x2
                cmpi.w      #$01,d0
                beq         m3x4
                cmpi.w      #$02,d0
                beq         m6x2
                cmpi.w      #$03,d0
                beq         m6x4
                jmp         Main

m3x2:
                move.w      #$01,ZapMode

            move.l      #$7d60,IFFFormLen
            move.w      #$140,PicSize
            move.w      #$140,PageSize
            move.w      #$c8,PicSize+2
            move.w      #$c8,PageSize+2
            move.l      #$7d00,BodyLen
            move.l      #$7d00,PicSizeSV
            move.l      #39,PicWSV
            move.l      #199,PicHSV

            tst.l       MyScreen2
            beq         skipm3x2cs
            move.l      MyScreen2,a0
            LINKLIB     _LVOCloseScreen,intuitionbase

skipm3x2cs:

                move.l      #NewScreenStructure3,a0
                LINKLIB     _LVOOpenScreen,intuitionbase
                move.l      d0,MyScreen2
                beq         Abort

                move.l      MyScreen2,a0
                lea.l       sc_ViewPort(a0),a0
                move.l      #Palette2,a1
                move.l      #PaletteColorCount2,d0
                LINKLIB     _LVOLoadRGB4,gfxbase

                move.l      MyScreen2,a0
                lea.l       sc_BitMap(a0),a0
                move.l      bm_Planes(a0),a1
                move.l      a1,bp1
                adda.l      #4,a0
                move.l      bm_Planes(a0),a2
                move.l      a2,bp2
                adda.l      #4,a0
                move.l      bm_Planes(a0),a3
                move.l      a3,bp3
                adda.l      #4,a0
                move.l      bm_Planes(a0),a4
                move.l      a4,bp4

                move.l      MyScreen,a0
                LINKLIB     _LVOScreenToFront,intuitionbase

                jmp         Main

m3x4:

                move.w      #$02,ZapMode

            move.l      #$fa60,IFFFormLen
            move.w      #$140,PicSize
            move.w      #$140,PageSize
            move.w      #$190,PicSize+2
            move.w      #$190,PageSize+2
            move.l      #$fa00,BodyLen
            move.l      #$fa00,PicSizeSV
            move.l      #39,PicWSV
            move.l      #399,PicHSV

            tst.l       MyScreen2
            beq         skipm3x4cs
            move.l      MyScreen2,a0
            LINKLIB     _LVOCloseScreen,intuitionbase

skipm3x4cs:

                move.l      #NewScreenStructure4,a0
                LINKLIB     _LVOOpenScreen,intuitionbase
                move.l      d0,MyScreen2
                beq         m3x2

                move.l      MyScreen2,a0
                lea.l       sc_ViewPort(a0),a0
                move.l      #Palette2,a1
                move.l      #PaletteColorCount2,d0
                LINKLIB     _LVOLoadRGB4,gfxbase

                move.l      MyScreen2,a0
                lea.l       sc_BitMap(a0),a0
                move.l      bm_Planes(a0),a1
                move.l      a1,bp1
                adda.l      #4,a0
                move.l      bm_Planes(a0),a2
                move.l      a2,bp2
                adda.l      #4,a0
                move.l      bm_Planes(a0),a3
                move.l      a3,bp3
                adda.l      #4,a0
                move.l      bm_Planes(a0),a4
                move.l      a4,bp4

                move.l      MyScreen,a0
                LINKLIB     _LVOScreenToFront,intuitionbase

                jmp         Main

m6x2:
                move.w      #$03,ZapMode

            move.l      #$fa60,IFFFormLen
            move.w      #$280,PicSize
            move.w      #$280,PageSize
            move.w      #$c8,PicSize+2
            move.w      #$c8,PageSize+2
            move.l      #$fa00,BodyLen
            move.l      #$fa00,PicSizeSV
            move.l      #79,PicWSV
            move.l      #199,PicHSV

            tst.l       MyScreen2
            beq         skipm6x2cs
            move.l      MyScreen2,a0
            LINKLIB     _LVOCloseScreen,intuitionbase

skipm6x2cs:

                move.l      #NewScreenStructure5,a0
                LINKLIB     _LVOOpenScreen,intuitionbase
                move.l      d0,MyScreen2
                beq         m3x4

                move.l      MyScreen2,a0
                lea.l       sc_ViewPort(a0),a0
                move.l      #Palette2,a1
                move.l      #PaletteColorCount2,d0
                LINKLIB     _LVOLoadRGB4,gfxbase

                move.l      MyScreen2,a0
                lea.l       sc_BitMap(a0),a0
                move.l      bm_Planes(a0),a1
                move.l      a1,bp1
                adda.l      #4,a0
                move.l      bm_Planes(a0),a2
                move.l      a2,bp2
                adda.l      #4,a0
                move.l      bm_Planes(a0),a3
                move.l      a3,bp3
                adda.l      #4,a0
                move.l      bm_Planes(a0),a4
                move.l      a4,bp4

                move.l      MyScreen,a0
                LINKLIB     _LVOScreenToFront,intuitionbase

                jmp         Main

m6x4:
            move.w      #$04,ZapMode

            move.l      #$1f460,IFFFormLen
            move.w      #$280,PicSize
            move.w      #$280,PageSize
            move.w      #$190,PicSize+2
            move.w      #$190,PageSize+2
            move.l      #$1f400,BodyLen
            move.l      #$1f400,PicSizeSV
            move.l      #79,PicWSV
            move.l      #399,PicHSV

            tst.l       MyScreen2
            beq         skipm6x4cs
            move.l      MyScreen2,a0
            LINKLIB     _LVOCloseScreen,intuitionbase

skipm6x4cs:
                move.l      #NewScreenStructure6,a0
                LINKLIB     _LVOOpenScreen,intuitionbase
                move.l      d0,MyScreen2
                beq         m6x2

                move.l      MyScreen2,a0
                lea.l       sc_ViewPort(a0),a0
                move.l      #Palette2,a1
                move.l      #PaletteColorCount2,d0
                LINKLIB     _LVOLoadRGB4,gfxbase

                move.l      MyScreen2,a0
                lea.l       sc_BitMap(a0),a0
                move.l      bm_Planes(a0),a1
                move.l      a1,bp1
                adda.l      #4,a0
                move.l      bm_Planes(a0),a2
                move.l      a2,bp2
                adda.l      #4,a0
                move.l      bm_Planes(a0),a3
                move.l      a3,bp3
                adda.l      #4,a0
                move.l      bm_Planes(a0),a4
                move.l      a4,bp4

                move.l      MyScreen,a0
                LINKLIB     _LVOScreenToFront,intuitionbase


                jmp         Main

ColorRed:
                move.l      MyScreen2,a0
                lea.l       sc_ViewPort(a0),a0
                move.l      #PaletteR,a1
                move.l      #PaletteColorCountR,d0
                LINKLIB     _LVOLoadRGB4,gfxbase
                jmp         Main

ColorGrn:
                move.l      MyScreen2,a0
                lea.l       sc_ViewPort(a0),a0
                move.l      #PaletteG,a1
                move.l      #PaletteColorCountG,d0
                LINKLIB     _LVOLoadRGB4,gfxbase
                jmp         Main
ColorMon:
                move.l      MyScreen2,a0
                lea.l       sc_ViewPort(a0),a0
                move.l      #Palette2,a1
                move.l      #PaletteColorCount2,d0
                LINKLIB     _LVOLoadRGB4,gfxbase
                jmp         Main

ColorBlu:
                move.l      MyScreen2,a0
                lea.l       sc_ViewPort(a0),a0
                move.l      #PaletteB,a1
                move.l      #PaletteColorCountB,d0
                LINKLIB     _LVOLoadRGB4,gfxbase
                jmp         Main

ColorPseudo:
                move.l      MyScreen2,a0
                lea.l       sc_ViewPort(a0),a0
                move.l      #PaletteP,a1
                move.l      #PaletteColorCountP,d0
                LINKLIB     _LVOLoadRGB4,gfxbase
                jmp         Main



ChangeTitle:
                LINKLIB     _LVOWaitTOF,gfxbase

                move.l      MyScreen,a0
                move.l      #1,d0
                LINKLIB     _LVOShowTitle,intuitionbase
                rts

waitmsgWB:
                move.l      _AbsExecBase,a6
                lea         pr_MsgPort(a4),a0
                jsr         _LVOWaitPort(a6)
                lea         pr_MsgPort(a4),a0
                jsr         _LVOGetMsg(a6)
                rts

;*************************************************************

Quit:
Abort:
                move.l      #0,d0
                move.l      initialSP,a7
                move.l      d0,-(a7)

                cmpi.l      #0,clicode
                bne         skipcli

                move.l      returnMsg,d0
                beq         skipcli

                move.l      _AbsExecBase,a6
                jsr         _LVOForbid(a6)
                move.l      returnMsg,a1
                jsr         _LVOReplyMsg(a6)
skipcli:
                move.l      (a7)+,d0


                move.l      #MyIOStdReq,a0
                move.w      #IND_REMHANDLER,IO_COMMAND(a0)
                move.l      #MyInterrupt,IO_DATA(a0)

                movea.l     _AbsExecBase,a6
                move.l      #MyIOStdReq,a1
                jsr         _LVODoIO(a6)


            move.l      MyWindow,a0
            tst.l       MyWindow
            beq         AB2
            LINKLIB     _LVOClearMenuStrip,intuitionbase

AB2:
            move.l      MyWindow,a0
            tst.l       MyWindow
            beq         AB3
            LINKLIB     _LVOCloseWindow,intuitionbase

AB3:
            move.l      MyScreen,a0
            tst.l       MyScreen
            beq         AB4
            LINKLIB     _LVOCloseScreen,intuitionbase

AB4:
            move.l      MyScreen2,a0
            tst.l       MyScreen2
            beq         AB5
            LINKLIB     _LVOCloseScreen,intuitionbase


AB5:
            move.l      tempscr,a1
            move.l      #256000,d0
            tst.l       tempscr
            beq         AB6
            CALLLIB     _LVOFreeMem

AB6:
            move.l      tempscr2,a1
            move.l      #256000,d0
            tst.l       tempscr2
            beq         xit
            CALLLIB     _LVOFreeMem


xit:
            tst.l       mathbase
            beq         xit1
            move.l      mathbase,a1
            CALLLIB     _LVOCloseLibrary
xit1:
            tst.l       intuitionbase
            beq         xit2
            move.l      intuitionbase,a1
            CALLLIB     _LVOCloseLibrary

xit2:
            tst.l       gfxbase
            beq         xit3
            move.l      gfxbase,a1
            CALLLIB     _LVOCloseLibrary

xit3:
            tst.l       dosbase
            beq         xit4
            move.l      dosbase,a1
            CALLLIB     _LVOCloseLibrary

xit4:
            tst.l       FileIO
            beq         xit5
            move.l      requesterbase,a6
            move.l      FileIO,a1
            jsr         _LVOReleaseFileIO(a6)

xit5:
            LINKLIB     _LVOOpenWorkBench,intuitionbase

            clr.l       d0
            rts


;***************************************************

dosname:
            dc.b        'dos.library',0
            cnop        0,2

gfxname:
            dc.b        'graphics.library',0
            cnop        0,2

intuiname:
            dc.b        'intuition.library',0
            cnop        0,2

mathname:
            dc.b        'mathffp.library',0
            cnop        0,2

requestername:
            dc.b        'requester.library',0
            cnop        0,2


initialSP:
                ds.l        1
returnMsg:
                ds.l        1
clicode         dc.l        0


intuitionbase:  dc.l        0
gfxbase:        dc.l        0
dosbase:        dc.l        0
mathbase:       dc.l        0
requesterbase:  dc.l        0

MyScreen        dc.l        0
MyScreen2       dc.l        0
MyWindow        dc.l        0
MyView          dc.l        0

Class           dc.l        0
Code            dc.w        0
IAddress        dc.l        0

GadgetID        dc.w        0

Userport        dc.l        0

bp1             dc.l        0
bp2             dc.l        0
bp3             dc.l        0
bp4             dc.l        0

tempscr         dc.l        0
tempscr2        dc.l        0

smoothflg       dc.w        0

BrightVal       dc.w        $7fff
OldBrightVal    dc.w        $7fff

ContrastVal     dc.w        $7fff
OldContrastVal  dc.w        $7fff

ThreshHold      dc.w        $7fff
OldThreshHold   dc.w        $7fff

BandWFlg        dc.w        0

GadAdd1         dc.l        $00000000
GadAdd2         dc.l        $00000000
GadAdd3         dc.l        $00000000
GadAdd4         dc.l        $00000000
GadAdd5         dc.l        $00000000
GadAdd6         dc.l        $00000000
GadAdd7         dc.l        $00000000
GadAdd8         dc.l        $00000000
GadAdd9         dc.l        $00000000
GadAdd10        dc.l        $00000000
GadAdd11        dc.l        $00000000
GadAdd12        dc.l        $00000000

MVal1           dc.l        0
MVal2           dc.l        0

ControlPanel:
                dc.l        0

FileIO:
                dc.l        0

Buffer:
                dcb.b       250,0


MyInterrupt:    dcb.b       IS_SIZE,0
MyInputEvent:   dcb.b       ie_SIZEOF,0
MyIOStdReq:     dcb.b       IOSTD_SIZE,0
MyMsgPort:      dcb.b       MP_SIZE,0
MyMessage:      dcb.b       MN_SIZE,0
MyData:         ds.l        512


DevName:        dc.b        'input.device',0
                cnop        0,2

EV              ds.l        1
MyTask          ds.l        1
MySigBit        ds.l        1


ZapMode:
                dc.w        3
;********************************************

NewScreenStructure2:
        dc.w    0,0     ;screen XY origin relative to View
        dc.w    640,200 ;screen width and height
        dc.w    4       ;screen depth (number of bitplanes)
        dc.b    0,1     ;detail and block pens
        dc.w    V_HIRES       ;display modes for this screen
        dc.w    CUSTOMSCREEN    ;screen type
        dc.l    NULL    ;pointer to default screen font
        dc.l    NULL    ;screen title
        dc.l    NULL    ;first in list of custom screen gadgets
        dc.l    NULL    ;pointer to custom BitMap structure


NewScreenStructure3:
        dc.w    0,0     ;screen XY origin relative to View
        dc.w    320,200 ;screen width and height
        dc.w    4       ;screen depth (number of bitplanes)
        dc.b    0,1     ;detail and block pens
        dc.w    0     ;display modes for this screen
        dc.w    CUSTOMSCREEN    ;screen type
        dc.l    NULL    ;pointer to default screen font
        dc.l    NULL    ;screen title
        dc.l    NULL    ;first in list of custom screen gadgets
        dc.l    NULL    ;pointer to custom BitMap structure

NewScreenStructure4:
        dc.w    0,0     ;screen XY origin relative to View
        dc.w    320,400 ;screen width and height
        dc.w    4       ;screen depth (number of bitplanes)
        dc.b    0,1     ;detail and block pens
        dc.w    V_LACE     ;display modes for this screen
        dc.w    CUSTOMSCREEN    ;screen type
        dc.l    NULL    ;pointer to default screen font
        dc.l    NULL    ;screen title
        dc.l    NULL    ;first in list of custom screen gadgets
        dc.l    NULL    ;pointer to custom BitMap structure

NewScreenStructure5:
        dc.w    0,0     ;screen XY origin relative to View
        dc.w    640,200 ;screen width and height
        dc.w    4       ;screen depth (number of bitplanes)
        dc.b    0,1     ;detail and block pens
        dc.w    V_HIRES   ;display modes for this screen
        dc.w    CUSTOMSCREEN    ;screen type
        dc.l    NULL    ;pointer to default screen font
        dc.l    NULL    ;screen title
        dc.l    NULL    ;first in list of custom screen gadgets
        dc.l    NULL    ;pointer to custom BitMap structure

NewScreenStructure6:
        dc.w    0,0     ;screen XY origin relative to View
        dc.w    640,400 ;screen width and height
        dc.w    4       ;screen depth (number of bitplanes)
        dc.b    0,1     ;detail and block pens
        dc.w    V_HIRES+V_LACE   ;display modes for this screen
        dc.w    CUSTOMSCREEN    ;screen type
        dc.l    NULL    ;pointer to default screen font
        dc.l    NULL    ;screen title
        dc.l    NULL    ;first in list of custom screen gadgets
        dc.l    NULL    ;pointer to custom BitMap structure


Palette2:
        dc.w    $0000   ;color #0
        dc.w    $0111   ;color #1
        dc.w    $0222   ;color #2
        dc.w    $0333   ;color #3
        dc.w    $0444   ;color #4
        dc.w    $0555   ;color #5
        dc.w    $0666   ;color #6
        dc.w    $0777   ;color #7
        dc.w    $0888   ;color #8
        dc.w    $0999   ;color #9
        dc.w    $0AAA   ;color #10
        dc.w    $0BBB   ;color #11
        dc.w    $0CCC   ;color #12
        dc.w    $0DDD   ;color #13
        dc.w    $0EEE   ;color #14
        dc.w    $0FFF   ;color #15
PaletteColorCount2 equ (*-Palette2)/2

PaletteR:
        dc.w    $0000   ;color #0
        dc.w    $0100   ;color #1
        dc.w    $0200   ;color #2
        dc.w    $0300   ;color #3
        dc.w    $0400   ;color #4
        dc.w    $0500   ;color #5
        dc.w    $0600   ;color #6
        dc.w    $0700   ;color #7
        dc.w    $0800   ;color #8
        dc.w    $0900   ;color #9
        dc.w    $0A00   ;color #10
        dc.w    $0B00   ;color #11
        dc.w    $0C00   ;color #12
        dc.w    $0D00   ;color #13
        dc.w    $0E00   ;color #14
        dc.w    $0F00   ;color #15
PaletteColorCountR equ (*-PaletteR)/2

PaletteG:
        dc.w    $0000   ;color #0
        dc.w    $0010   ;color #1
        dc.w    $0020   ;color #2
        dc.w    $0030   ;color #3
        dc.w    $0040   ;color #4
        dc.w    $0050   ;color #5
        dc.w    $0060   ;color #6
        dc.w    $0070   ;color #7
        dc.w    $0080   ;color #8
        dc.w    $0090   ;color #9
        dc.w    $00A0   ;color #10
        dc.w    $00B0   ;color #11
        dc.w    $00C0   ;color #12
        dc.w    $00D0   ;color #13
        dc.w    $00E0   ;color #14
        dc.w    $00F0   ;color #15
PaletteColorCountG equ (*-PaletteG)/2

PaletteB:
        dc.w    $0000   ;color #0
        dc.w    $0001   ;color #1
        dc.w    $0002   ;color #2
        dc.w    $0003   ;color #3
        dc.w    $0004   ;color #4
        dc.w    $0005   ;color #5
        dc.w    $0006   ;color #6
        dc.w    $0007   ;color #7
        dc.w    $0008   ;color #8
        dc.w    $0009   ;color #9
        dc.w    $000A   ;color #10
        dc.w    $000B   ;color #11
        dc.w    $000C   ;color #12
        dc.w    $000D   ;color #13
        dc.w    $000E   ;color #14
        dc.w    $000F   ;color #15
PaletteColorCountB equ (*-PaletteB)/2

PaletteP:
        dc.w    $0000   ;color #0
        dc.w    $0009   ;color #1
        dc.w    $000c   ;color #2
        dc.w    $000f   ;color #3
        dc.w    $0900   ;color #4
        dc.w    $0d00   ;color #5
        dc.w    $0f00   ;color #6
        dc.w    $0080   ;color #7
        dc.w    $00d0   ;color #8
        dc.w    $00f0   ;color #9
        dc.w    $0bd0   ;color #10
        dc.w    $0cf0   ;color #11
        dc.w    $0ff0   ;color #12
        dc.w    $0ffb   ;color #13
        dc.w    $0efc   ;color #14
        dc.w    $0fff   ;color #15
PaletteColorCountP equ (*-PaletteP)/2


NewScreenStructure:
        dc.w    0,140     ;screen XY origin relative to View
        dc.w    640,200 ;screen width and height
        dc.w    1       ;screen depth (number of bitplanes)
        dc.b    0,1     ;detail and block pens
        dc.w    V_HIRES ;display modes for this screen
        dc.w    CUSTOMSCREEN    ;screen type
        dc.l    NULL    ;pointer to default screen font
        dc.l    NewScreenName   ;screen title
        dc.l    NULL    ;first in list of custom screen gadgets
        dc.l    NULL    ;pointer to custom BitMap structure
NewScreenName:
sc_Function:
        dc.b    '                '
sc_Value:
        dc.b    '        '
        dc.b    ' '
        dc.b    'I '
sc_IVal:
        dc.b    ' 000%'
        dc.b    '    '
        dc.b    'C '
sc_CVal:
        dc.b    ' 000%'
        dc.b    '    '
        dc.b    'T '
sc_TVal:
        dc.b    ' 000%'
        dc.b    0

        cnop 0,2


Palette:
        dc.w    $0000   ;color #0
        dc.w    $0FFF   ;color #1
PaletteColorCount equ (*-Palette)/2

NewWindowStructure1:
        dc.w    0,10    ;window XY origin relative to TopLeft of screen
        dc.w    640,54  ;window width and height
        dc.b    0,1     ;detail and block pens
        dc.l    MOUSEBUTTONS+GADGETDOWN+GADGETUP+MENUPICK+RAWKEY        ;IDCMP flags
        dc.l    WINDOWDRAG+BACKDROP+BORDERLESS+ACTIVATE+NOCAREREFRESH   ;other window flags
        dc.l    GadgetList1     ;first gadget in gadget list
        dc.l    NULL    ;custom CHECKMARK imagery
        dc.l    NULL    ;window title

CS1:
        dc.l    NULL    ;custom screen pointer
        dc.l    NULL    ;custom bitmap
        dc.w    5,5     ;minimum width and height
        dc.w    -1,-1   ;maximum width and height
        dc.w    CUSTOMSCREEN    ;destination screen type
GadgetList1:
Gadget1:
        dc.l    Gadget2 ;next gadget
        dc.w    524,23  ;origin XY of hit box relative to window TopLeft
        dc.w    71,27   ;hit box width and height
        dc.w    NULL    ;gadget flags
        dc.w    RELVERIFY+GADGIMMEDIATE ;activation flags
        dc.w    PROPGADGET      ;gadget type flags
        dc.l    Image1  ;gadget border or image to be rendered
        dc.l    NULL    ;alternate imagery for selection
        dc.l    IText1  ;first IntuiText structure
        dc.l    NULL    ;gadget mutual-exclude long word
        dc.l    Gadget1SInfo    ;SpecialInfo structure
        dc.w    1       ;user-definable data
        dc.l    NULL    ;pointer to user-definable data
Gadget1SInfo:
        dc.w    AUTOKNOB+FREEHORIZ+FREEVERT     ;PropInfo flags
        dc.w    32193,32193    ;horizontal and vertical pot values
        dc.w    39321,39321 ;horizontal and vertical body values
        dc.w    0,0,0,0,0,0     ;Intuition initialized and maintained variables
Image1:
        dc.w    28,10   ;XY origin relative to container TopLeft
        dc.w    6,4     ;Image width and height in pixels
        dc.w    0       ;number of bitplanes in Image
        dc.l    NULL    ;pointer to ImageData
        dc.b    $0000,$0000     ;PlanePick and PlaneOnOff
        dc.l    NULL    ;next Image structure
IText1:
        dc.b    1,0,RP_JAM2,0   ;front and back text pens, drawmode and fill byte
        dc.w    -25,-10 ;XY origin relative to container TopLeft
        dc.l    NULL    ;font pointer or NULL for default
        dc.l    ITextText1      ;pointer to text
        dc.l    NULL    ;next IntuiText structure
ITextText1:
        dc.b    'Screen Position',0
        cnop 0,2
Gadget2:
        dc.l    Gadget3 ;next gadget
        dc.w    376,21  ;origin XY of hit box relative to window TopLeft
        dc.w    111,7   ;hit box width and height
        dc.w    NULL    ;gadget flags
        dc.w    RELVERIFY+GADGIMMEDIATE ;activation flags
        dc.w    PROPGADGET      ;gadget type flags
        dc.l    Image2  ;gadget border or image to be rendered
        dc.l    NULL    ;alternate imagery for selection
        dc.l    IText2  ;first IntuiText structure
        dc.l    NULL    ;gadget mutual-exclude long word
        dc.l    Gadget2SInfo    ;SpecialInfo structure
        dc.w    2       ;user-definable data
        dc.l    NULL    ;pointer to user-definable data
Gadget2SInfo:
        dc.w    AUTOKNOB+FREEHORIZ      ;PropInfo flags
        dc.w    0,-1    ;horizontal and vertical pot values
        dc.w    10922,-1 ;horizontal and vertical body values
        dc.w    0,0,0,0,0,0     ;Intuition initialized and maintained variables
Image2:
        dc.w    0,0     ;XY origin relative to container TopLeft
        dc.w    6,3     ;Image width and height in pixels
        dc.w    0       ;number of bitplanes in Image
        dc.l    NULL    ;pointer to ImageData
        dc.b    $0000,$0000     ;PlanePick and PlaneOnOff
        dc.l    NULL    ;next Image structure
IText2:
        dc.b    1,0,RP_JAM2,0   ;front and back text pens, drawmode and fill byte
        dc.w    17,-10  ;XY origin relative to container TopLeft
        dc.l    NULL    ;font pointer or NULL for default
        dc.l    ITextText2      ;pointer to text
        dc.l    NULL    ;next IntuiText structure
ITextText2:
        dc.b    'Dithering',0
        cnop 0,2
Gadget3:
        dc.l    Gadget4 ;next gadget
        dc.w    417,40  ;origin XY of hit box relative to window TopLeft
        dc.w    24,9    ;hit box width and height
        dc.w    NULL    ;gadget flags
        dc.w    RELVERIFY+GADGIMMEDIATE+TOGGLESELECT    ;activation flags
        dc.w    BOOLGADGET      ;gadget type flags
        dc.l    Border1 ;gadget border or image to be rendered
        dc.l    NULL    ;alternate imagery for selection
        dc.l    IText3  ;first IntuiText structure
        dc.l    NULL    ;gadget mutual-exclude long word
        dc.l    NULL    ;SpecialInfo structure
        dc.w    3       ;user-definable data
        dc.l    NULL    ;pointer to user-definable data
Border1:
        dc.w    -1,-1   ;XY origin relative to container TopLeft
        dc.b    3,0,RP_JAM1     ;front pen, back pen and drawmode
        dc.b    5       ;number of XY vectors
        dc.l    BorderVectors1  ;pointer to XY vectors
        dc.l    NULL    ;next border in list
BorderVectors1:
        dc.w    0,0
        dc.w    25,0
        dc.w    25,10
        dc.w    0,10
        dc.w    0,0
IText3:
        dc.b    1,0,RP_JAM2,0   ;front and back text pens, drawmode and fill byte
        dc.w    -23,-10 ;XY origin relative to container TopLeft
        dc.l    NULL    ;font pointer or NULL for default
        dc.l    ITextText3      ;pointer to text
        dc.l    NULL    ;next IntuiText structure
ITextText3:
        dc.b    'Smoothing',0
        cnop 0,2
Gadget4:
        dc.l    Gadget5 ;next gadget
        dc.w    259,15  ;origin XY of hit box relative to window TopLeft
        dc.w    102,8   ;hit box width and height
        dc.w    NULL    ;gadget flags
        dc.w    RELVERIFY+GADGIMMEDIATE ;activation flags
        dc.w    BOOLGADGET      ;gadget type flags
        dc.l    Border2 ;gadget border or image to be rendered
        dc.l    NULL    ;alternate imagery for selection
        dc.l    IText4  ;first IntuiText structure
        dc.l    NULL    ;gadget mutual-exclude long word
        dc.l    NULL    ;SpecialInfo structure
        dc.w    4       ;user-definable data
        dc.l    NULL    ;pointer to user-definable data
Border2:
        dc.w    -1,-1   ;XY origin relative to container TopLeft
        dc.b    3,0,RP_JAM1     ;front pen, back pen and drawmode
        dc.b    5       ;number of XY vectors
        dc.l    BorderVectors2  ;pointer to XY vectors
        dc.l    NULL    ;next border in list
BorderVectors2:
        dc.w    0,0
        dc.w    103,0
        dc.w    103,9
        dc.w    0,9
        dc.w    0,0
IText4:
        dc.b    1,0,RP_JAM2,0   ;front and back text pens, drawmode and fill byte
        dc.w    18,0    ;XY origin relative to container TopLeft
        dc.l    NULL    ;font pointer or NULL for default
        dc.l    ITextText4      ;pointer to text
        dc.l    NULL    ;next IntuiText structure
ITextText4:
        dc.b    'NEGATIVE',0
        cnop 0,2
Gadget5:
        dc.l    Gadget6 ;next gadget
        dc.w    258,27  ;origin XY of hit box relative to window TopLeft
        dc.w    102,8   ;hit box width and height
        dc.w    NULL    ;gadget flags
        dc.w    RELVERIFY+GADGIMMEDIATE ;activation flags
        dc.w    BOOLGADGET      ;gadget type flags
        dc.l    Border3 ;gadget border or image to be rendered
        dc.l    NULL    ;alternate imagery for selection
        dc.l    IText5  ;first IntuiText structure
        dc.l    NULL    ;gadget mutual-exclude long word
        dc.l    NULL    ;SpecialInfo structure
        dc.w    5       ;user-definable data
        dc.l    NULL    ;pointer to user-definable data
Border3:
        dc.w    -1,-1   ;XY origin relative to container TopLeft
        dc.b    3,0,RP_JAM1     ;front pen, back pen and drawmode
        dc.b    5       ;number of XY vectors
        dc.l    BorderVectors3  ;pointer to XY vectors
        dc.l    NULL    ;next border in list
BorderVectors3:
        dc.w    0,0
        dc.w    103,0
        dc.w    103,9
        dc.w    0,9
        dc.w    0,0
IText5:
        dc.b    1,0,RP_JAM2,0   ;front and back text pens, drawmode and fill byte
        dc.w    3,0     ;XY origin relative to container TopLeft
        dc.l    NULL    ;font pointer or NULL for default
        dc.l    ITextText5      ;pointer to text
        dc.l    NULL    ;next IntuiText structure
ITextText5:
        dc.b    'CLEAR SCREEN',0
        cnop 0,2
Gadget6:
        dc.l    Gadget7 ;next gadget
        dc.w    258,39  ;origin XY of hit box relative to window TopLeft
        dc.w    102,8   ;hit box width and height
        dc.w    NULL    ;gadget flags
        dc.w    RELVERIFY+GADGIMMEDIATE ;activation flags
        dc.w    BOOLGADGET      ;gadget type flags
        dc.l    Border4 ;gadget border or image to be rendered
        dc.l    NULL    ;alternate imagery for selection
        dc.l    IText6  ;first IntuiText structure
        dc.l    NULL    ;gadget mutual-exclude long word
        dc.l    NULL    ;SpecialInfo structure
        dc.w    6       ;user-definable data
        dc.l    NULL    ;pointer to user-definable data
Border4:
        dc.w    -1,-1   ;XY origin relative to container TopLeft
        dc.b    3,0,RP_JAM1     ;front pen, back pen and drawmode
        dc.b    5       ;number of XY vectors
        dc.l    BorderVectors4  ;pointer to XY vectors
        dc.l    NULL    ;next border in list
BorderVectors4:
        dc.w    0,0
        dc.w    103,0
        dc.w    103,9
        dc.w    0,9
        dc.w    0,0
IText6:
        dc.b    1,0,RP_JAM2,0   ;front and back text pens, drawmode and fill byte
        dc.w    31,0    ;XY origin relative to container TopLeft
        dc.l    NULL    ;font pointer or NULL for default
        dc.l    ITextText6      ;pointer to text
        dc.l    NULL    ;next IntuiText structure
ITextText6:
        dc.b    'REMAP',0
        cnop 0,2
Gadget7:
        dc.l    Gadget8 ;next gadget
        dc.w    121,15  ;origin XY of hit box relative to window TopLeft
        dc.w    102,8   ;hit box width and height
        dc.w    NULL    ;gadget flags
        dc.w    RELVERIFY+GADGIMMEDIATE ;activation flags
        dc.w    BOOLGADGET      ;gadget type flags
        dc.l    Border5 ;gadget border or image to be rendered
        dc.l    NULL    ;alternate imagery for selection
        dc.l    IText7  ;first IntuiText structure
        dc.l    NULL    ;gadget mutual-exclude long word
        dc.l    NULL    ;SpecialInfo structure
        dc.w    7       ;user-definable data
        dc.l    NULL    ;pointer to user-definable data
Border5:
        dc.w    -1,-1   ;XY origin relative to container TopLeft
        dc.b    3,0,RP_JAM1     ;front pen, back pen and drawmode
        dc.b    5       ;number of XY vectors
        dc.l    BorderVectors5  ;pointer to XY vectors
        dc.l    NULL    ;next border in list
BorderVectors5:
        dc.w    0,0
        dc.w    103,0
        dc.w    103,9
        dc.w    0,9
        dc.w    0,0
IText7:
        dc.b    1,0,RP_JAM2,0   ;front and back text pens, drawmode and fill byte
        dc.w    12,0    ;XY origin relative to container TopLeft
        dc.l    NULL    ;font pointer or NULL for default
        dc.l    ITextText7      ;pointer to text
        dc.l    NULL    ;next IntuiText structure
ITextText7:
        dc.b    'GRAB FRAME',0
        cnop 0,2
Gadget8:
        dc.l    Gadget9 ;next gadget
        dc.w    120,27  ;origin XY of hit box relative to window TopLeft
        dc.w    102,8   ;hit box width and height
        dc.w    NULL    ;gadget flags
        dc.w    RELVERIFY+GADGIMMEDIATE ;activation flags
        dc.w    BOOLGADGET      ;gadget type flags
        dc.l    Border6 ;gadget border or image to be rendered
        dc.l    NULL    ;alternate imagery for selection
        dc.l    IText8  ;first IntuiText structure
        dc.l    NULL    ;gadget mutual-exclude long word
        dc.l    NULL    ;SpecialInfo structure
        dc.w    8       ;user-definable data
        dc.l    NULL    ;pointer to user-definable data
Border6:
        dc.w    -1,-1   ;XY origin relative to container TopLeft
        dc.b    3,0,RP_JAM1     ;front pen, back pen and drawmode
        dc.b    5       ;number of XY vectors
        dc.l    BorderVectors6  ;pointer to XY vectors
        dc.l    NULL    ;next border in list
BorderVectors6:
        dc.w    0,0
        dc.w    103,0
        dc.w    103,9
        dc.w    0,9
        dc.w    0,0
IText8:
        dc.b    1,0,RP_JAM2,0   ;front and back text pens, drawmode and fill byte
        dc.w    15,0    ;XY origin relative to container TopLeft
        dc.l    NULL    ;font pointer or NULL for default
        dc.l    ITextText8      ;pointer to text
        dc.l    NULL    ;next IntuiText structure
ITextText8:
        dc.b    '*********',0
        cnop 0,2
Gadget9:
        dc.l    Gadget10        ;next gadget
        dc.w    120,39  ;origin XY of hit box relative to window TopLeft
        dc.w    102,8   ;hit box width and height
        dc.w    NULL    ;gadget flags
        dc.w    RELVERIFY+GADGIMMEDIATE ;activation flags
        dc.w    BOOLGADGET      ;gadget type flags
        dc.l    Border7 ;gadget border or image to be rendered
        dc.l    NULL    ;alternate imagery for selection
        dc.l    IText9  ;first IntuiText structure
        dc.l    NULL    ;gadget mutual-exclude long word
        dc.l    NULL    ;SpecialInfo structure
        dc.w    9       ;user-definable data
        dc.l    NULL    ;pointer to user-definable data
Border7:
        dc.w    -1,-1   ;XY origin relative to container TopLeft
        dc.b    3,0,RP_JAM1     ;front pen, back pen and drawmode
        dc.b    5       ;number of XY vectors
        dc.l    BorderVectors7  ;pointer to XY vectors
        dc.l    NULL    ;next border in list
BorderVectors7:
        dc.w    0,0
        dc.w    103,0
        dc.w    103,9
        dc.w    0,9
        dc.w    0,0
IText9:
        dc.b    1,0,RP_JAM2,0   ;front and back text pens, drawmode and fill byte
        dc.w    32,0    ;XY origin relative to container TopLeft
        dc.l    NULL    ;font pointer or NULL for default
        dc.l    ITextText9      ;pointer to text
        dc.l    NULL    ;next IntuiText structure
ITextText9:
        dc.b    'RESET',0
        cnop 0,2
Gadget10:
        dc.l    Gadget11        ;next gadget
        dc.w    63,19   ;origin XY of hit box relative to window TopLeft
        dc.w    13,29   ;hit box width and height
        dc.w    NULL    ;gadget flags
        dc.w    RELVERIFY+GADGIMMEDIATE ;activation flags
        dc.w    PROPGADGET      ;gadget type flags
        dc.l    Image3  ;gadget border or image to be rendered
        dc.l    NULL    ;alternate imagery for selection
        dc.l    IText10 ;first IntuiText structure
        dc.l    NULL    ;gadget mutual-exclude long word
        dc.l    Gadget10SInfo   ;SpecialInfo structure
        dc.w    10      ;user-definable data
        dc.l    NULL    ;pointer to user-definable data
Gadget10SInfo:
        dc.w    AUTOKNOB+FREEVERT       ;PropInfo flags
POT10:
        dc.w    -1,-32768       ;horizontal and vertical pot values
        dc.w    -1,682 ;horizontal and vertical body values
        dc.w    0,0,0,0,0,0     ;Intuition initialized and maintained variables
Image3:
        dc.w    0,10    ;XY origin relative to container TopLeft
        dc.w    5,4     ;Image width and height in pixels
        dc.w    0       ;number of bitplanes in Image
        dc.l    NULL    ;pointer to ImageData
        dc.b    $0000,$0000     ;PlanePick and PlaneOnOff
        dc.l    NULL    ;next Image structure
IText10:
        dc.b    1,0,RP_JAM2,0   ;front and back text pens, drawmode and fill byte
        dc.w    3,-8    ;XY origin relative to container TopLeft
        dc.l    NULL    ;font pointer or NULL for default
        dc.l    ITextText10     ;pointer to text
        dc.l    NULL    ;next IntuiText structure
ITextText10:
        dc.b    'T',0
        cnop 0,2
Gadget11:
        dc.l    Gadget12        ;next gadget
        dc.w    36,19   ;origin XY of hit box relative to window TopLeft
        dc.w    13,29   ;hit box width and height
        dc.w    NULL    ;gadget flags
        dc.w    RELVERIFY+GADGIMMEDIATE ;activation flags
        dc.w    PROPGADGET      ;gadget type flags
        dc.l    Image4  ;gadget border or image to be rendered
        dc.l    NULL    ;alternate imagery for selection
        dc.l    IText11 ;first IntuiText structure
        dc.l    NULL    ;gadget mutual-exclude long word
        dc.l    Gadget11SInfo   ;SpecialInfo structure
        dc.w    11      ;user-definable data
        dc.l    NULL    ;pointer to user-definable data
Gadget11SInfo:
        dc.w    AUTOKNOB+FREEVERT       ;PropInfo flags
POT11:
        dc.w    -1,65535        ;horizontal and vertical pot values
        dc.w    -1,257  ;horizontal and vertical body values
        dc.w    0,0,0,0,0,0     ;Intuition initialized and maintained variables
Image4:
        dc.w    0,10    ;XY origin relative to container TopLeft
        dc.w    5,4     ;Image width and height in pixels
        dc.w    0       ;number of bitplanes in Image
        dc.l    NULL    ;pointer to ImageData
        dc.b    $0000,$0000     ;PlanePick and PlaneOnOff
        dc.l    NULL    ;next Image structure
IText11:
        dc.b    1,0,RP_JAM2,0   ;front and back text pens, drawmode and fill byte
        dc.w    3,-8    ;XY origin relative to container TopLeft
        dc.l    NULL    ;font pointer or NULL for default
        dc.l    ITextText11     ;pointer to text
        dc.l    NULL    ;next IntuiText structure
ITextText11:
        dc.b    'C',0
        cnop 0,2
Gadget12:
        dc.l    NULL    ;next gadget
        dc.w    10,19   ;origin XY of hit box relative to window TopLeft
        dc.w    13,29   ;hit box width and height
        dc.w    NULL    ;gadget flags
        dc.w    RELVERIFY+GADGIMMEDIATE ;activation flags
        dc.w    PROPGADGET      ;gadget type flags
        dc.l    Image5  ;gadget border or image to be rendered
        dc.l    NULL    ;alternate imagery for selection
        dc.l    IText12 ;first IntuiText structure
        dc.l    NULL    ;gadget mutual-exclude long word
        dc.l    Gadget12SInfo   ;SpecialInfo structure
        dc.w    12      ;user-definable data
        dc.l    NULL    ;pointer to user-definable data
Gadget12SInfo:
        dc.w    AUTOKNOB+FREEVERT       ;PropInfo flags
POT12:
        dc.w    -1,32768        ;horizontal and vertical pot values
        dc.w    -1,257 ;horizontal and vertical body values
        dc.w    0,0,0,0,0,0     ;Intuition initialized and maintained variables
Image5:
        dc.w    0,10    ;XY origin relative to container TopLeft
        dc.w    5,4     ;Image width and height in pixels
        dc.w    0       ;number of bitplanes in Image
        dc.l    NULL    ;pointer to ImageData
        dc.b    $0000,$0000     ;PlanePick and PlaneOnOff
        dc.l    NULL    ;next Image structure
IText12:
        dc.b    1,0,RP_JAM2,0   ;front and back text pens, drawmode and fill byte
        dc.w    3,-8    ;XY origin relative to container TopLeft
        dc.l    NULL    ;font pointer or NULL for default
        dc.l    ITextText12     ;pointer to text
        dc.l    NULL    ;next IntuiText structure
ITextText12:
        dc.b    'I',0
        cnop 0,2
MenuList1:
Menu1:
        dc.l    Menu2   ;next Menu structure
        dc.w    0,0     ;XY origin of Menu hit box relative to screen TopLeft
        dc.w    63,0    ;Menu hit box width and height
        dc.w    MENUENABLED     ;Menu flags
        dc.l    Menu1Name       ;text of Menu name
        dc.l    MenuItem1       ;MenuItem linked list pointer
        dc.w    0,0,0,0 ;Intuition mystery variables
Menu1Name:
        dc.b    'PROJECT',0
        cnop 0,2
MenuItem1:
        dc.l    MenuItem2       ;next MenuItem structure
        dc.w    0,0     ;XY of Item hitbox relative to TopLeft of parent hitbox
        dc.w    64,8    ;hit box width and height
        dc.w    ITEMTEXT+ITEMENABLED+HIGHCOMP   ;Item flags
        dc.l    0       ;each bit mutually-excludes a same-level Item
        dc.l    IText13 ;Item render  (IntuiText or Image or NULL)
        dc.l    NULL    ;Select render
        dc.b    NULL    ;alternate command-key
        dc.b    NULL    ;fill byte
        dc.l    NULL    ;SubItem list
        dc.w    MENUNULL        ;filled in by Intuition for drag selections
IText13:
        dc.b    1,0,RP_COMPLEMENT,0     ;front and back text pens, drawmode and fill byte
        dc.w    0,0     ;XY origin relative to container TopLeft
        dc.l    NULL    ;font pointer or NULL for default
        dc.l    ITextText13     ;pointer to text
        dc.l    NULL    ;next IntuiText structure
ITextText13:
        dc.b    'Load',0
        cnop 0,2
MenuItem2:
        dc.l    MenuItem4       ;next MenuItem structure
        dc.w    0,8     ;XY of Item hitbox relative to TopLeft of parent hitbox
        dc.w    64,8    ;hit box width and height
        dc.w    ITEMTEXT+ITEMENABLED+HIGHCOMP   ;Item flags
        dc.l    0       ;each bit mutually-excludes a same-level Item
        dc.l    IText14 ;Item render  (IntuiText or Image or NULL)
        dc.l    NULL    ;Select render
        dc.b    NULL    ;alternate command-key
        dc.b    NULL    ;fill byte
        dc.l    SubItem1        ;SubItem list
        dc.w    MENUNULL        ;filled in by Intuition for drag selections
IText14:
        dc.b    1,0,RP_COMPLEMENT,0     ;front and back text pens, drawmode and fill byte
        dc.w    0,0     ;XY origin relative to container TopLeft
        dc.l    NULL    ;font pointer or NULL for default
        dc.l    ITextText14     ;pointer to text
        dc.l    NULL    ;next IntuiText structure
ITextText14:
        dc.b    'Save',0
        cnop 0,2
SubItem1:
        dc.l    SubItem2        ;next SubItem structure
        dc.w    49,-1   ;XY of Item hitbox relative to TopLeft of parent hitbox
        dc.w    35,8    ;hit box width and height
        dc.w    ITEMTEXT+ITEMENABLED+HIGHCOMP   ;Item flags
        dc.l    0       ;each bit mutually-excludes a same-level Item
        dc.l    IText15 ;Item render  (IntuiText or Image or NULL)
        dc.l    NULL    ;Select render
        dc.b    NULL    ;alternate command-key
        dc.b    NULL    ;fill byte
        dc.l    NULL    ;no SubItem list for SubItems
        dc.w    MENUNULL        ;filled in by Intuition for drag selections
IText15:
        dc.b    1,0,RP_COMPLEMENT,0     ;front and back text pens, drawmode and fill byte
        dc.w    0,0     ;XY origin relative to container TopLeft
        dc.l    NULL    ;font pointer or NULL for default
        dc.l    ITextText15     ;pointer to text
        dc.l    NULL    ;next IntuiText structure
ITextText15:
        dc.b    'Raw',0
        cnop 0,2
SubItem2:
        dc.l    NULL    ;next SubItem structure
        dc.w    49,7    ;XY of Item hitbox relative to TopLeft of parent hitbox
        dc.w    35,8    ;hit box width and height
        dc.w    ITEMTEXT+ITEMENABLED+HIGHCOMP   ;Item flags
        dc.l    0       ;each bit mutually-excludes a same-level Item
        dc.l    IText16 ;Item render  (IntuiText or Image or NULL)
        dc.l    NULL    ;Select render
        dc.b    NULL    ;alternate command-key
        dc.b    NULL    ;fill byte
        dc.l    NULL    ;no SubItem list for SubItems
        dc.w    MENUNULL        ;filled in by Intuition for drag selections
IText16:
        dc.b    1,0,RP_COMPLEMENT,0     ;front and back text pens, drawmode and fill byte
        dc.w    0,0     ;XY origin relative to container TopLeft
        dc.l    NULL    ;font pointer or NULL for default
        dc.l    ITextText16     ;pointer to text
        dc.l    NULL    ;next IntuiText structure
ITextText16:
        dc.b    'IFF',0
        cnop 0,2
MenuItem4:
        dc.l    NULL    ;next MenuItem structure
        dc.w    0,16    ;XY of Item hitbox relative to TopLeft of parent hitbox
        dc.w    64,8    ;hit box width and height
        dc.w    ITEMTEXT+ITEMENABLED+HIGHCOMP   ;Item flags
        dc.l    0       ;each bit mutually-excludes a same-level Item
        dc.l    IText21 ;Item render  (IntuiText or Image or NULL)
        dc.l    NULL    ;Select render
        dc.b    NULL    ;alternate command-key
        dc.b    NULL    ;fill byte
        dc.l    NULL    ;SubItem list
        dc.w    MENUNULL        ;filled in by Intuition for drag selections
IText21:
        dc.b    1,0,RP_COMPLEMENT,0     ;front and back text pens, drawmode and fill byte
        dc.w    0,0     ;XY origin relative to container TopLeft
        dc.l    NULL    ;font pointer or NULL for default
        dc.l    ITextText21     ;pointer to text
        dc.l    NULL    ;next IntuiText structure
ITextText21:
        dc.b    'Quit',0
        cnop 0,2
Menu2:
        dc.l    NULL   ;next Menu structure
        dc.w    70,0    ;XY origin of Menu hit box relative to screen TopLeft
        dc.w    47,0    ;Menu hit box width and height
        dc.w    MENUENABLED     ;Menu flags
        dc.l    Menu2Name       ;text of Menu name
        dc.l    MenuItem5       ;MenuItem linked list pointer
        dc.w    0,0,0,0 ;Intuition mystery variables
Menu2Name:
        dc.b    'MODES',0
        cnop 0,2
MenuItem5:
        dc.l    MenuItem6       ;next MenuItem structure
        dc.w    0,0     ;XY of Item hitbox relative to TopLeft of parent hitbox
        dc.w    139,8   ;hit box width and height
        dc.w    ITEMTEXT+ITEMENABLED+HIGHCOMP   ;Item flags
        dc.l    0       ;each bit mutually-excludes a same-level Item
        dc.l    IText22 ;Item render  (IntuiText or Image or NULL)
        dc.l    NULL    ;Select render
        dc.b    NULL    ;alternate command-key
        dc.b    NULL    ;fill byte
        dc.l    SubItem6        ;SubItem list
        dc.w    MENUNULL        ;filled in by Intuition for drag selections
IText22:
        dc.b    1,0,RP_COMPLEMENT,0     ;front and back text pens, drawmode and fill byte
        dc.w    0,0     ;XY origin relative to container TopLeft
        dc.l    NULL    ;font pointer or NULL for default
        dc.l    ITextText22     ;pointer to text
        dc.l    NULL    ;next IntuiText structure
ITextText22:
        dc.b    'Color',0
        cnop 0,2
SubItem6:
        dc.l    SubItem7        ;next SubItem structure
        dc.w    124,-1  ;XY of Item hitbox relative to TopLeft of parent hitbox
        dc.w    99,8    ;hit box width and height
        dc.w    CHECKIT+ITEMTEXT+ITEMENABLED+HIGHCOMP  ;Item flags
        dc.l    30      ;each bit mutually-excludes a same-level Item
        dc.l    IText23 ;Item render  (IntuiText or Image or NULL)
        dc.l    NULL    ;Select render
        dc.b    NULL    ;alternate command-key
        dc.b    NULL    ;fill byte
        dc.l    NULL    ;no SubItem list for SubItems
        dc.w    MENUNULL        ;filled in by Intuition for drag selections
IText23:
        dc.b    1,0,RP_COMPLEMENT,0     ;front and back text pens, drawmode and fill byte
        dc.w    19,0    ;XY origin relative to container TopLeft
        dc.l    NULL    ;font pointer or NULL for default
        dc.l    ITextText23     ;pointer to text
        dc.l    NULL    ;next IntuiText structure
ITextText23:
        dc.b    'Red',0
        cnop 0,2
SubItem7:
        dc.l    SubItem8        ;next SubItem structure
        dc.w    124,7   ;XY of Item hitbox relative to TopLeft of parent hitbox
        dc.w    99,8    ;hit box width and height
        dc.w    CHECKIT+ITEMTEXT+ITEMENABLED+HIGHCOMP   ;Item flags
        dc.l    29      ;each bit mutually-excludes a same-level Item
        dc.l    IText24 ;Item render  (IntuiText or Image or NULL)
        dc.l    NULL    ;Select render
        dc.b    NULL    ;alternate command-key
        dc.b    NULL    ;fill byte
        dc.l    NULL    ;no SubItem list for SubItems
        dc.w    MENUNULL        ;filled in by Intuition for drag selections
IText24:
        dc.b    1,0,RP_COMPLEMENT,0     ;front and back text pens, drawmode and fill byte
        dc.w    19,0    ;XY origin relative to container TopLeft
        dc.l    NULL    ;font pointer or NULL for default
        dc.l    ITextText24     ;pointer to text
        dc.l    NULL    ;next IntuiText structure
ITextText24:
        dc.b    'Green',0
        cnop 0,2
SubItem8:
        dc.l    SubItem9        ;next SubItem structure
        dc.w    124,15  ;XY of Item hitbox relative to TopLeft of parent hitbox
        dc.w    99,8    ;hit box width and height
        dc.w    CHECKIT+ITEMTEXT+ITEMENABLED+HIGHCOMP   ;Item flags
        dc.l    27      ;each bit mutually-excludes a same-level Item
        dc.l    IText25 ;Item render  (IntuiText or Image or NULL)
        dc.l    NULL    ;Select render
        dc.b    NULL    ;alternate command-key
        dc.b    NULL    ;fill byte
        dc.l    NULL    ;no SubItem list for SubItems
        dc.w    MENUNULL        ;filled in by Intuition for drag selections
IText25:
        dc.b    1,0,RP_COMPLEMENT,0     ;front and back text pens, drawmode and fill byte
        dc.w    19,0    ;XY origin relative to container TopLeft
        dc.l    NULL    ;font pointer or NULL for default
        dc.l    ITextText25     ;pointer to text
        dc.l    NULL    ;next IntuiText structure
ITextText25:
        dc.b    'Blue',0
        cnop 0,2
SubItem9:
        dc.l    SubItem9add    ;next SubItem structure
        dc.w    124,23  ;XY of Item hitbox relative to TopLeft of parent hitbox
        dc.w    99,8    ;hit box width and height
        dc.w    CHECKIT+ITEMTEXT+ITEMENABLED+HIGHCOMP+CHECKED   ;Item flags
        dc.l    23       ;each bit mutually-excludes a same-level Item
        dc.l    IText26 ;Item render  (IntuiText or Image or NULL)
        dc.l    NULL    ;Select render
        dc.b    NULL    ;alternate command-key
        dc.b    NULL    ;fill byte
        dc.l    NULL    ;no SubItem list for SubItems
        dc.w    MENUNULL        ;filled in by Intuition for drag selections
IText26:
        dc.b    1,0,RP_COMPLEMENT,0     ;front and back text pens, drawmode and fill byte
        dc.w    19,0    ;XY origin relative to container TopLeft
        dc.l    NULL    ;font pointer or NULL for default
        dc.l    ITextText26     ;pointer to text
        dc.l    NULL    ;next IntuiText structure
ITextText26:
        dc.b    'Monochrome',0
        cnop 0,2

SubItem9add:
        dc.l    NULL    ;next SubItem structure
        dc.w    124,31  ;XY of Item hitbox relative to TopLeft of parent hitbox
        dc.w    110,8    ;hit box width and height
        dc.w    CHECKIT+ITEMTEXT+ITEMENABLED+HIGHCOMP   ;Item flags
        dc.l    15       ;each bit mutually-excludes a same-level Item
        dc.l    IText26add ;Item render  (IntuiText or Image or NULL)
        dc.l    NULL    ;Select render
        dc.b    NULL    ;alternate command-key
        dc.b    NULL    ;fill byte
        dc.l    NULL    ;no SubItem list for SubItems
        dc.w    MENUNULL        ;filled in by Intuition for drag selections
IText26add:
        dc.b    3,1,RP_COMPLEMENT,0     ;front and back text pens, drawmode and fill byte
        dc.w    19,0    ;XY origin relative to container TopLeft
        dc.l    NULL    ;font pointer or NULL for default
        dc.l    ITextText26add     ;pointer to text
        dc.l    NULL    ;next IntuiText structure
ITextText26add:
        dc.b    'Pseudo Color',0
        cnop 0,2


MenuItem6:
        dc.l    MenuItem7       ;next MenuItem structure
        dc.w    0,8     ;XY of Item hitbox relative to TopLeft of parent hitbox
        dc.w    139,8   ;hit box width and height
        dc.w    ITEMTEXT+ITEMENABLED+HIGHCOMP   ;Item flags
        dc.l    0       ;each bit mutually-excludes a same-level Item
        dc.l    IText27 ;Item render  (IntuiText or Image or NULL)
        dc.l    NULL    ;Select render
        dc.b    NULL    ;alternate command-key
        dc.b    NULL    ;fill byte
        dc.l    SubItem10       ;SubItem list
        dc.w    MENUNULL        ;filled in by Intuition for drag selections
IText27:
        dc.b    1,0,RP_COMPLEMENT,0     ;front and back text pens, drawmode and fill byte
        dc.w    0,0     ;XY origin relative to container TopLeft
        dc.l    NULL    ;font pointer or NULL for default
        dc.l    ITextText27     ;pointer to text
        dc.l    NULL    ;next IntuiText structure
ITextText27:
        dc.b    'Screen Size',0
        cnop 0,2
SubItem10:
        dc.l    SubItem11       ;next SubItem structure
        dc.w    124,-1  ;XY of Item hitbox relative to TopLeft of parent hitbox
        dc.w    83,8    ;hit box width and height
        dc.w    CHECKIT+ITEMTEXT+ITEMENABLED+HIGHCOMP   ;Item flags
        dc.l    30      ;each bit mutually-excludes a same-level Item
        dc.l    IText28 ;Item render  (IntuiText or Image or NULL)
        dc.l    NULL    ;Select render
        dc.b    NULL    ;alternate command-key
        dc.b    NULL    ;fill byte
        dc.l    NULL    ;no SubItem list for SubItems
        dc.w    MENUNULL        ;filled in by Intuition for drag selections
IText28:
        dc.b    1,0,RP_COMPLEMENT,0     ;front and back text pens, drawmode and fill byte
        dc.w    19,0    ;XY origin relative to container TopLeft
        dc.l    NULL    ;font pointer or NULL for default
        dc.l    ITextText28     ;pointer to text
        dc.l    NULL    ;next IntuiText structure
ITextText28:
        dc.b    '320x200',0
        cnop 0,2
SubItem11:
        dc.l    SubItem12       ;next SubItem structure
        dc.w    124,7   ;XY of Item hitbox relative to TopLeft of parent hitbox
        dc.w    83,8    ;hit box width and height
        dc.w    CHECKIT+ITEMTEXT+ITEMENABLED+HIGHCOMP   ;Item flags
        dc.l    29      ;each bit mutually-excludes a same-level Item
        dc.l    IText29 ;Item render  (IntuiText or Image or NULL)
        dc.l    NULL    ;Select render
        dc.b    NULL    ;alternate command-key
        dc.b    NULL    ;fill byte
        dc.l    NULL    ;no SubItem list for SubItems
        dc.w    MENUNULL        ;filled in by Intuition for drag selections
IText29:
        dc.b    1,0,RP_COMPLEMENT,0     ;front and back text pens, drawmode and fill byte
        dc.w    19,0    ;XY origin relative to container TopLeft
        dc.l    NULL    ;font pointer or NULL for default
        dc.l    ITextText29     ;pointer to text
        dc.l    NULL    ;next IntuiText structure
ITextText29:
        dc.b    '320x400',0
        cnop 0,2
SubItem12:
        dc.l    SubItem13       ;next SubItem structure
        dc.w    124,15  ;XY of Item hitbox relative to TopLeft of parent hitbox
        dc.w    83,8    ;hit box width and height
        dc.w    CHECKIT+ITEMTEXT+ITEMENABLED+HIGHCOMP+CHECKED   ;Item flags
        dc.l    27      ;each bit mutually-excludes a same-level Item
        dc.l    IText30 ;Item render  (IntuiText or Image or NULL)
        dc.l    NULL    ;Select render
        dc.b    NULL    ;alternate command-key
        dc.b    NULL    ;fill byte
        dc.l    NULL    ;no SubItem list for SubItems
        dc.w    MENUNULL        ;filled in by Intuition for drag selections
IText30:
        dc.b    1,0,RP_COMPLEMENT,0     ;front and back text pens, drawmode and fill byte
        dc.w    19,0    ;XY origin relative to container TopLeft
        dc.l    NULL    ;font pointer or NULL for default
        dc.l    ITextText30     ;pointer to text
        dc.l    NULL    ;next IntuiText structure
ITextText30:
        dc.b    '640x200',0
        cnop 0,2
SubItem13:
        dc.l    NULL      ;next SubItem structure
        dc.w    124,23  ;XY of Item hitbox relative to TopLeft of parent hitbox
        dc.w    83,8    ;hit box width and height
        dc.w    CHECKIT+ITEMTEXT+ITEMENABLED+HIGHCOMP   ;Item flags
        dc.l    23      ;each bit mutually-excludes a same-level Item
        dc.l    IText31 ;Item render  (IntuiText or Image or NULL)
        dc.l    NULL    ;Select render
        dc.b    NULL    ;alternate command-key
        dc.b    NULL    ;fill byte
        dc.l    NULL    ;no SubItem list for SubItems
        dc.w    MENUNULL        ;filled in by Intuition for drag selections
IText31:
        dc.b    1,0,RP_COMPLEMENT,0     ;front and back text pens, drawmode and fill byte
        dc.w    19,0    ;XY origin relative to container TopLeft
        dc.l    NULL    ;font pointer or NULL for default
        dc.l    ITextText31     ;pointer to text
        dc.l    NULL    ;next IntuiText structure
ITextText31:
        dc.b    '640x400',0
        cnop 0,2
MenuItem7:
        dc.l    MenuItem8       ;next MenuItem structure
        dc.w    0,16    ;XY of Item hitbox relative to TopLeft of parent hitbox
        dc.w    139,8   ;hit box width and height
        dc.w    ITEMTEXT+ITEMENABLED+HIGHCOMP   ;Item flags
        dc.l    0       ;each bit mutually-excludes a same-level Item
        dc.l    IText33 ;Item render  (IntuiText or Image or NULL)
        dc.l    NULL    ;Select render
        dc.b    NULL    ;alternate command-key
        dc.b    NULL    ;fill byte
        dc.l    SubItem15       ;SubItem list
        dc.w    MENUNULL        ;filled in by Intuition for drag selections
IText33:
        dc.b    1,0,RP_COMPLEMENT,0     ;front and back text pens, drawmode and fill byte
        dc.w    0,0     ;XY origin relative to container TopLeft
        dc.l    NULL    ;font pointer or NULL for default
        dc.l    ITextText33     ;pointer to text
        dc.l    NULL    ;next IntuiText structure
ITextText33:
        dc.b    'Planes',0
        cnop 0,2
SubItem15:
        dc.l    SubItem16       ;next SubItem structure
        dc.w    124,-1  ;XY of Item hitbox relative to TopLeft of parent hitbox
        dc.w    43,8    ;hit box width and height
        dc.w    CHECKIT+ITEMTEXT+ITEMENABLED+HIGHCOMP+CHECKED  ;Item flags
        dc.l    510     ;each bit mutually-excludes a same-level Item
        dc.l    IText34 ;Item render  (IntuiText or Image or NULL)
        dc.l    NULL    ;Select render
        dc.b    NULL    ;alternate command-key
        dc.b    NULL    ;fill byte
        dc.l    NULL    ;no SubItem list for SubItems
        dc.w    MENUNULL        ;filled in by Intuition for drag selections
IText34:
        dc.b    1,0,RP_COMPLEMENT,0     ;front and back text pens, drawmode and fill byte
        dc.w    19,0    ;XY origin relative to container TopLeft
        dc.l    NULL    ;font pointer or NULL for default
        dc.l    ITextText34     ;pointer to text
        dc.l    NULL    ;next IntuiText structure
ITextText34:
        dc.b    '4',0
        cnop 0,2
SubItem16:
        dc.l    NULL       ;next SubItem structure
        dc.w    124,7   ;XY of Item hitbox relative to TopLeft of parent hitbox
        dc.w    43,8    ;hit box width and height
        dc.w    CHECKIT+ITEMTEXT+ITEMENABLED+HIGHCOMP   ;Item flags
        dc.l    509     ;each bit mutually-excludes a same-level Item
        dc.l    IText35 ;Item render  (IntuiText or Image or NULL)
        dc.l    NULL    ;Select render
        dc.b    NULL    ;alternate command-key
        dc.b    NULL    ;fill byte
        dc.l    NULL    ;no SubItem list for SubItems
        dc.w    MENUNULL        ;filled in by Intuition for drag selections
IText35:
        dc.b    1,0,RP_COMPLEMENT,0     ;front and back text pens, drawmode and fill byte
        dc.w    19,0    ;XY origin relative to container TopLeft
        dc.l    NULL    ;font pointer or NULL for default
        dc.l    ITextText35     ;pointer to text
        dc.l    NULL    ;next IntuiText structure
ITextText35:
        dc.b    '8',0
        cnop 0,2
MenuItem8:
        dc.l    MenuItem9       ;next MenuItem structure
        dc.w    0,24    ;XY of Item hitbox relative to TopLeft of parent hitbox
        dc.w    139,8   ;hit box width and height
        dc.w    CHECKIT+ITEMTEXT+ITEMENABLED+HIGHCOMP+CHECKED   ;Item flags
        dc.l    16      ;each bit mutually-excludes a same-level Item
        dc.l    IText43 ;Item render  (IntuiText or Image or NULL)
        dc.l    NULL    ;Select render
        dc.b    NULL    ;alternate command-key
        dc.b    NULL    ;fill byte
        dc.l    NULL    ;SubItem list
        dc.w    MENUNULL        ;filled in by Intuition for drag selections
IText43:
        dc.b    1,0,RP_COMPLEMENT,0     ;front and back text pens, drawmode and fill byte
        dc.w    19,0    ;XY origin relative to container TopLeft
        dc.l    NULL    ;font pointer or NULL for default
        dc.l    ITextText43     ;pointer to text
        dc.l    NULL    ;next IntuiText structure
ITextText43:
        dc.b    'GrayScale',0
        cnop 0,2
MenuItem9:
        dc.l    NULL    ;next MenuItem structure
        dc.w    0,32    ;XY of Item hitbox relative to TopLeft of parent hitbox
        dc.w    139,8   ;hit box width and height
        dc.w    CHECKIT+ITEMTEXT+ITEMENABLED+HIGHCOMP   ;Item flags
        dc.l    8       ;each bit mutually-excludes a same-level Item
        dc.l    IText44 ;Item render  (IntuiText or Image or NULL)
        dc.l    NULL    ;Select render
        dc.b    NULL    ;alternate command-key
        dc.b    NULL    ;fill byte
        dc.l    NULL    ;SubItem list
        dc.w    MENUNULL        ;filled in by Intuition for drag selections
IText44:
        dc.b    1,0,RP_COMPLEMENT,0     ;front and back text pens, drawmode and fill byte
        dc.w    19,0    ;XY origin relative to container TopLeft
        dc.l    NULL    ;font pointer or NULL for default
        dc.l    ITextText44     ;pointer to text
        dc.l    NULL    ;next IntuiText structure
ITextText44:
        dc.b    'Black and White',0
        cnop 0,2

NewWindowStructure2:
        dc.w    75,85   ;window XY origin relative to TopLeft of screen
        dc.w    150,50  ;window width and height
        dc.b    0,1     ;detail and block pens
        dc.l    CLOSEWINDOW     ;IDCMP flags
        dc.l    WINDOWSIZING+WINDOWDRAG+WINDOWDEPTH+WINDOWCLOSE+ACTIVATE+NOCAREREFRESH  ;other window flags
        dc.l    NULL    ;first gadget in gadget list
        dc.l    NULL    ;custom CHECKMARK imagery
        dc.l    NewWindowName2  ;window title
        dc.l    NULL    ;custom screen pointer
        dc.l    NULL    ;custom bitmap
        dc.w    5,5     ;minimum width and height
        dc.w    -1,-1   ;maximum width and height
        dc.w    CUSTOMSCREEN    ;destination screen type
NewWindowName2:
        dc.b    'Your new window',0
        cnop 0,2



