*
*  Source machine generated by GadToolsBox V1.4
*  which is (c) Copyright 1991,92 Jaba Development
*

    incdir  'sys:include/'
    include 'exec/types.i'
    include 'intuition/intuition.i'
    include 'intuition/classes.i'
    include 'intuition/classusr.i'
    include 'intuition/imageclass.i'
    include 'intuition/gadgetclass.i'
    include 'libraries/gadtools.i'
    include 'graphics/displayinfo.i'
    include 'graphics/gfxbase.i'

    XREF    _GadToolsBase
    XREF    _IntuitionBase
    XREF    _GfxBase
    XREF    _SysBase

OpenScreenTagList    EQU    -612
OpenWindowTagList    EQU    -606
CloseScreen          EQU    -66
CloseWindow          EQU    -72
PrintIText           EQU    -216
LockPubScreen        EQU    -510
UnlockPubScreen      EQU    -516
SetMenuStrip         EQU    -264
ClearMenuStrip       EQU    -54
GetVisualInfoA       EQU    -126
FreeVisualInfo       EQU    -132
CreateContext        EQU    -114
CreateGadgetA        EQU    -30
GT_RefreshWindow     EQU    -84
FreeGadgets          EQU    -36
CreateMenusA         EQU    -48
LayoutMenusA         EQU    -66
FreeMenus            EQU    -54
OpenDiskFont         EQU    -30
CloseFont            EQU    -78
DrawBevelBoxA        EQU    -120
FreeClass            EQU    -714
NewObjectA           EQU    -636
DisposeObject        EQU    -642
TextLength           EQU    -54
CopyMem              EQU    -624
FindTagItem          EQU    -30
IntuiTextLength      EQU    -330

GD_Gadget00                            EQU    0
GD_Gadget10                            EQU    1
GD_Gadget20                            EQU    2
GD_Gadget30                            EQU    3
GD_Gadget40                            EQU    4
GD_Gadget50                            EQU    5

Project0_CNT    EQU    6

    XDEF    Scr
    XDEF    VisualInfo
    XDEF    PubScreenName
    XDEF    Project0Wnd
    XDEF    Project0GList
    XDEF    Project0Menus
    XDEF    Project0Gadgets
    XDEF    Project0Left
    XDEF    Project0Top
    XDEF    Project0Width
    XDEF    Project0Height

Scr:
    DC.L    0
VisualInfo:
    DC.L    0
PubScreenName:
    DC.L    WBName
WBName:
    DC.B    'Workbench',0
    CNOP  0,2
Project0Wnd:
    DC.L    0
Project0GList:
    DC.L    0
Project0Menus:
    DC.L    0
MTags0:
    DC.L    GTMN_FrontPen,0,TAG_DONE
MTags1:
    DC.L    GTMN_TextAttr,topaz8,TAG_DONE
Project0Gadgets:
    DCB.L    6,0
BufNewGad:
    DC.W    0,0,0,0
    DC.L    0,0
    DC.W    0
    DC.L    0,0,0
TD:
    DC.L    TAG_DONE
Project0Left:
    DC.W    91
Project0Top:
    DC.W    38
Project0Width:
    DC.W    447
Project0Height:
    DC.W    110

Project0GTypes:
    DC.W    MX_KIND
    DC.W    STRING_KIND
    DC.W    TEXT_KIND
    DC.W    TEXT_KIND
    DC.W    TEXT_KIND
    DC.W    TEXT_KIND

Project0NGads:
    DC.W    335,13,17,9
    DC.L    0,0
    DC.W    GD_Gadget00
    DC.L    PLACETEXT_RIGHT,0,0
    DC.W    23,18,288,14
    DC.L    Gadget10Text,0
    DC.W    GD_Gadget10
    DC.L    PLACETEXT_ABOVE,0,0
    DC.W    83,57,333,11
    DC.L    Gadget20Text,0
    DC.W    GD_Gadget20
    DC.L    PLACETEXT_LEFT,0,0
    DC.W    83,68,333,11
    DC.L    Gadget30Text,0
    DC.W    GD_Gadget30
    DC.L    PLACETEXT_LEFT,0,0
    DC.W    83,79,333,11
    DC.L    Gadget40Text,0
    DC.W    GD_Gadget40
    DC.L    PLACETEXT_LEFT,0,0
    DC.W    83,90,333,11
    DC.L    Gadget50Text,0
    DC.W    GD_Gadget50
    DC.L    PLACETEXT_LEFT,0,0

Project0GTags:
    DC.L    GTMX_Labels,Gadget00Labels
    DC.L    TAG_DONE
    DC.L    GTST_String,Gadget10String
    DC.L    GTST_MaxChars,32
    DC.L    TAG_DONE
    DC.L    GTTX_Border,1
    DC.L    TAG_DONE
    DC.L    GTTX_Border,1
    DC.L    TAG_DONE
    DC.L    GTTX_Border,1
    DC.L    TAG_DONE
    DC.L    GTTX_Border,1
    DC.L    TAG_DONE


Gadget10String:
    DC.B    '',0
    CNOP    0,2

Gadget10Text:
    DC.B    'Input number to convert...',0

Gadget20Text:
    DC.B    'Decimal',0

Gadget30Text:
    DC.B    'Binary',0

Gadget40Text:
    DC.B    'Hex',0

Gadget50Text:
    DC.B    'Octal',0

    CNOP    0,2

    XDEF    Gadget00Labels

Gadget00Labels:
    DC.L    Gadget00Lab0
    DC.L    Gadget00Lab1
    DC.L    Gadget00Lab2
    DC.L    Gadget00Lab3
    DC.L    0

Gadget00Lab0:    DC.B    'Decimal',0
Gadget00Lab1:    DC.B    'Binary',0
Gadget00Lab2:    DC.B    'Hex',0
Gadget00Lab3:    DC.B    'Octal',0

    CNOP    0,2

    XDEF    topaz8

topaz8:
    DC.L    topazFName8
    DC.W    8
    DC.B    $00,$01

topazFName8:
    DC.B    'topaz.font',0
    CNOP    0,2

    XDEF    Project0WindowTags

Project0WindowTags:
Project0L:
    DC.L    WA_Left,0
Project0T:
    DC.L    WA_Top,0
Project0W:
    DC.L    WA_Width,0
Project0H:
    DC.L    WA_Height,0
    DC.L    WA_IDCMP,MXIDCMP!STRINGIDCMP!TEXTIDCMP!IDCMP_MENUPICK!IDCMP_CLOSEWINDOW!IDCMP_REFRESHWINDOW
    DC.L    WA_Flags,WFLG_DRAGBAR!WFLG_DEPTHGADGET!WFLG_CLOSEGADGET!WFLG_SMART_REFRESH!WFLG_ACTIVATE
Project0WG:
    DC.L    WA_Gadgets,0
    DC.L    WA_Title,Project0WTitle
    DC.L    WA_ScreenTitle,Project0STitle
    DC.L    TAG_DONE

Project0WTitle:
    DC.B    'Base Convertor V1.01  ©1993 Stuart Davis',0
    CNOP    0,2

Project0STitle:
    DC.B    'Another program ©1993 from Stuart Davis Software',0
    CNOP    0,2

    XDEF    Project0Text0

Project0Text0:
    DC.B    2,0
    DC.B    RP_JAM1
    DC.B    0
    DC.W    13,34
    DC.L    topaz8
    DC.L    Project0IText0
    DC.L    Project0Text1

Project0Text1:
    DC.B    2,0
    DC.B    RP_JAM1
    DC.B    0
    DC.W    23,43
    DC.L    topaz8
    DC.L    Project0IText1
    DC.L    Project0Text2

Project0Text2:
    DC.B    2,0
    DC.B    RP_JAM1
    DC.B    0
    DC.W    333,3
    DC.L    topaz8
    DC.L    Project0IText2
    DC.L    0

Project0IText0:
    DC.B    'Enter number above using selected base.',0

Project0IText1:
    DC.B    'Press <RET> to input and convert it.',0

Project0IText2:
    DC.B    'Input Base',0

    CNOP    0,2

    XDEF    Project0NewMenu0

Project0NewMenu0:
    DC.B    NM_TITLE,0
    DC.L    Project0MName0
    DC.L    0
    DC.W    0
    DC.L    0,0

Project0NewMenu1:
    DC.B    NM_ITEM,0
    DC.L    Project0MName1
    DC.L    Project0MComm1
    DC.W    0
    DC.L    0,0

Project0NewMenu2:
    DC.B    NM_ITEM,0
    DC.L    Project0MName2
    DC.L    Project0MComm2
    DC.W    0
    DC.L    0,0

    DC.B    NM_END,0
    DC.L    0,0
    DC.W    0
    DC.L    0,0

Project0MName0:
    DC.B    'Project',0

Project0MName1:
    DC.B    'About...',0

Project0MComm1:
    DC.B    'A',0

Project0MName2:
    DC.B    'Quit',0

Project0MComm2:
    DC.B    'Q',0

    CNOP    0,2

    XDEF    SetupScreen

SetupScreen
    movem.l d1-d3/a0-a2/a6,-(sp)
    move.l  _IntuitionBase,a6
    move.l  PubScreenName,a0
    jsr     LockPubScreen(a6)
    move.l  d0,Scr
    tst.l   d0
    beq     SError
    move.l  Scr,a0
    move.l  _GadToolsBase,a6
    lea.l   TD,a1
    jsr     GetVisualInfoA(a6)
    move.l  d0,VisualInfo
    tst.l   d0
    beq     VError
    moveq   #0,d0
SDone:
    movem.l (sp)+,d1-d3/a0-a2/a6
    rts
SError:
    moveq   #1,d0
    bra.s   SDone
VError:
    moveq   #2,d0
    bra.s   SDone

    XDEF    CloseDownScreen

CloseDownScreen:
    movem.l d0-d1/a0-a1/a6,-(sp)
    move.l  _GadToolsBase,a6
    move.l  VisualInfo,a0
    cmpa.l  #0,a0
    beq.s   NoVis
    jsr     FreeVisualInfo(a6)
    move.l  #0,VisualInfo
NoVis:
    move.l  _IntuitionBase,a6
    suba.l  a0,a0
    move.l  Scr,a1
    cmpa.l  #0,a1
    beq.s   NoScr
    jsr     UnlockPubScreen(a6)
    move.l  #0,Scr
NoScr:
    movem.l (sp)+,d0-d1/a0-a1/a6
    rts

    XDEF    Project0Render

Project0Render:
    movem.l d0-d5/a0-a2/a6,-(sp)
    move.l  Project0Wnd,a0
    move.b  wd_BorderLeft(a0),d4
    ext.w   d4
    move.b  wd_BorderTop(a0),d5
    ext.w   d5
    move.l  _IntuitionBase,a6
    move.l  Project0Wnd,a0
    move.l  wd_RPort(a0),a0
    lea.l   Project0Text0,a1
    move.l  d4,d0
    move.l  d5,d1
    jsr     PrintIText(a6)
    movem.l (sp)+,d0-d5/a0-a2/a6
    rts

    XDEF    OpenProject0Window

OpenProject0Window:
    movem.l d1-d4/a0-a4/a6,-(sp)
    move.l  Scr,a0
    moveq   #0,d3
    moveq   #0,d2
    move.b  sc_WBorLeft(a0),d2
    move.l  sc_Font(a0),a1
    move.w  ta_YSize(a1),d3
    addq.w  #1,d3
    add.b   sc_WBorTop(a0),d3
    move.l  _GadToolsBase,a6
    lea.l   Project0GList,a0
    jsr     CreateContext(a6)
    move.l  d0,a3
    tst.l   d0
    beq     Project0CError
    movem.w d2-d3,-(sp)
    moveq   #0,d3
    lea.l   Project0GTags,a4
Project0GL:
    move.l  _SysBase,a6
    lea.l   Project0NGads,a0
    move.l  d3,d0
    mulu    #gng_SIZEOF,d0
    add.l   d0,a0
    lea.l   BufNewGad,a1
    moveq   #gng_SIZEOF,d0
    jsr     CopyMem(a6)
    lea.l   BufNewGad,a0
    move.l  VisualInfo,gng_VisualInfo(a0)
    move.l  #topaz8,gng_TextAttr(a0)
    move.w  gng_LeftEdge(a0),d0
    add.w   (sp),d0
    move.w  d0,gng_LeftEdge(a0)
    move.w  gng_TopEdge(a0),d0
    add.w   2(sp),d0
    move.w  d0,gng_TopEdge(a0)
    move.l  _GadToolsBase,a6
    lea.l   Project0GTypes,a0
    moveq   #0,d0
    move.l  d3,d1
    asl.l   #1,d1
    add.l   d1,a0
    move.w  (a0),d0
    move.l  a3,a0
    lea.l   BufNewGad,a1
    move.l  a4,a2
    jsr     CreateGadgetA(a6)
    tst.l   d0
    beq     Project0CError
    move.l  d0,a3
    move.l  d3,d0
    asl.l   #2,d0
    lea.l   Project0Gadgets,a0
    add.l   d0,a0
    move.l  a3,(a0)
Project0TL:
    tst.l   (a4)
    beq.s   Project0DN
    addq.w  #8,a4
    bra.s   Project0TL
Project0DN:
    addq.w  #4,a4
    addq.w  #1,d3
    cmp.w   #Project0_CNT,d3
    bmi     Project0GL
    movem.w (sp)+,d2-d3
    move.l  Project0GList,Project0WG+4
    move.l  _GadToolsBase,a6
    lea.l   Project0NewMenu0,a0
    lea.l   MTags0,a1
    jsr     CreateMenusA(a6)
    move.l  d0,Project0Menus
    tst.l   d0
    beq     Project0MError
    move.l  d0,a0
    move.l  VisualInfo,a1
    lea.l   MTags1,a2
    jsr     LayoutMenusA(a6)
    moveq   #0,d0
    move.w  Project0Left,d0
    move.l  d0,Project0L+4
    move.w  Project0Top,d0
    move.l  d0,Project0T+4
    move.w  Project0Width,d0
    move.l  d0,Project0W+4
    move.w  Project0Height,d0
    add.w   d3,d0
    move.l  d0,Project0H+4
    move.l  _IntuitionBase,a6
    suba.l  a0,a0
    lea.l   Project0WindowTags,a1
    jsr     OpenWindowTagList(a6)
    move.l  d0,Project0Wnd
    tst.l   d0
    beq     Project0WError
    move.l   Project0Wnd,a0
    move.l   Project0Menus,a1
    jsr      SetMenuStrip(a6)
    move.l  _GadToolsBase,a6
    move.l  Project0Wnd,a0
    suba.l  a1,a1
    jsr     GT_RefreshWindow(a6)
    bsr     Project0Render
    moveq   #0,d0
Project0Done:
    movem.l (sp)+,d1-d4/a0-a4/a6
    rts
Project0CError:
    moveq   #1,d0
    bra.s   Project0Done
Project0GError:
    moveq   #2,d0
    bra.s   Project0Done
Project0MError:
    moveq   #3,d0
    bra.s   Project0Done
Project0WError:
    moveq   #4,d0
    bra.s   Project0Done

    XDEF    CloseProject0Window

CloseProject0Window:
    movem.l d0-d1/a0-a2/a6,-(sp)
    move.l   _IntuitionBase,a6
    move.l   Project0Menus,a0
    cmpa.l   #0,a0
    beq      Project0NMenu
    move.l   Project0Wnd,a0
    jsr      ClearMenuStrip(a6)
    move.l   _GadToolsBase,a6
    move.l   Project0Menus,a0
    jsr      FreeMenus(a6)
    move.l   #0,Project0Menus
Project0NMenu:
    move.l  _IntuitionBase,a6
    move.l  Project0Wnd,a0
    cmpa.l  #0,a0
    beq     Project0NWnd
    jsr     CloseWindow(a6)
    move.l  #0,Project0Wnd
Project0NWnd:
    move.l  _GadToolsBase,a6
    move.l  Project0GList,a0
    cmpa.l  #0,a0
    beq     Project0NGad
    jsr     FreeGadgets(a6)
    move.l  #0,Project0GList
Project0NGad:
    movem.l (sp)+,d0-d1/a0-a2/a6
    rts


    end
