*
*  Source machine generated by GadToolsBox V2.0
*  which is (c) Copyright 1991-1993 Jaba Development
*
*  GUI Designed by : Newtec
*

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
Forbid               EQU    -132
Permit               EQU    -138

GD_CModeGG                             EQU    0
GD_DriveGG                             EQU    1
GD_ModeGG                              EQU    2
GD_LoTrackGG                           EQU    3
GD_HiTrackGG                           EQU    4
GD_ArchiveNameGG                       EQU    5
GD_TextFNameGG                         EQU    6
GD_BitmapGG                            EQU    7
GD_ValidateGG                          EQU    8
GD_ShowTextGG                          EQU    9
GD_PauseGG                             EQU    10
GD_KeyGG                               EQU    11
GD_StartGG                             EQU    12
GD_GetArchiveNameGG                    EQU    13
GD_GetTextFNameGG                      EQU    14
GD_ViewFullGG                          EQU    15

DMSII_CNT    EQU    16

Scr:
    DC.L    0
VisualInfo:
    DC.L    0
PubScreenName:
    DC.L    0
DMSIIWnd:
    DC.L    0
DMSIIGList:
    DC.L    0
DMSIIMenus:
    DC.L    0
MTags0:
    DC.L    $80080032,0,$00000000
MTags1:
    DC.L    $80080031,topaz8,$00000000
DMSIIZoom:
    DC.W    0,0,0,0
DMSIIGadgets:
    DCB.L    16,0
BufNewGad:
    DC.W    0,0,0,0
    DC.L    0,0
    DC.W    0
    DC.L    0,0,0
TD:
    DC.L    $00000000
NR:
    DC.L    $80080034,$00000000,$00000000
IR:
    DC.L    $80080034,$00000000,$80080033,1,$00000000
DMSIILeft:
    DC.W    141
DMSIITop:
    DC.W    60
DMSIIWidth:
    DC.W    430
DMSIIHeight:
    DC.W    151

DMSIIGTypes:
    DC.W    5
    DC.W    4
    DC.W    5
    DC.W    11
    DC.W    11
    DC.W    12
    DC.W    12
    DC.W    2
    DC.W    2
    DC.W    2
    DC.W    2
    DC.W    12
    DC.W    1
    DC.W    1
    DC.W    1
    DC.W    2

DMSIINGads:
    DC.W    206,18,17,9
    DC.L    CModeGGText,0
    DC.W    GD_CModeGG
    DC.L    $0002,0,0
    DC.W    306,15,60,64
    DC.L    DriveGGText,0
    DC.W    GD_DriveGG
    DC.L    $0004,0,0
    DC.W    15,18,17,9
    DC.L    ModeGGText,0
    DC.W    GD_ModeGG
    DC.L    $0002,0,0
    DC.W    376,15,19,90
    DC.L    LoTrackGGText,0
    DC.W    GD_LoTrackGG
    DC.L    $0004,0,0
    DC.W    403,15,19,90
    DC.L    HiTrackGGText,0
    DC.W    GD_HiTrackGG
    DC.L    $0004,0,0
    DC.W    38,79,227,14
    DC.L    ArchiveNameGGText,0
    DC.W    GD_ArchiveNameGG
    DC.L    $0002,0,0
    DC.W    38,97,227,14
    DC.L    TextFNameGGText,0
    DC.W    GD_TextFNameGG
    DC.L    $0002,0,0
    DC.W    10,116,26,11
    DC.L    BitmapGGText,0
    DC.W    GD_BitmapGG
    DC.L    $0002,0,0
    DC.W    233,116,26,11
    DC.L    ValidateGGText,0
    DC.W    GD_ValidateGG
    DC.L    $0002,0,0
    DC.W    110,116,26,11
    DC.L    ShowTextGGText,0
    DC.W    GD_ShowTextGG
    DC.L    $0002,0,0
    DC.W    348,116,26,11
    DC.L    PauseGGText,0
    DC.W    GD_PauseGG
    DC.L    $0002,0,0
    DC.W    10,134,110,14
    DC.L    KeyGGText,0
    DC.W    GD_KeyGG
    DC.L    $0002,0,0
    DC.W    164,134,258,14
    DC.L    StartGGText,0
    DC.W    GD_StartGG
    DC.L    $0010,0,0
    DC.W    10,79,28,14
    DC.L    GetArchiveNameGGText,0
    DC.W    GD_GetArchiveNameGG
    DC.L    $0010,0,0
    DC.W    10,97,28,14
    DC.L    GetTextFNameGGText,0
    DC.W    GD_GetTextFNameGG
    DC.L    $0010,0,0
    DC.W    161,35,26,11
    DC.L    ViewFullGGText,0
    DC.W    GD_ViewFullGG
    DC.L    $0021,0,0

DMSIIGTags:
    DC.L    $80080009,CModeGGLabels
    DC.L    $8008003D,3
    DC.L    $8008000A,2
    DC.L    $00000000
    DC.L    $80080006,DriveGGList
    DC.L    $80080035,0
    DC.L    $00000000
    DC.L    $80080009,ModeGGLabels
    DC.L    $8008000A,1
    DC.L    $00000000
    DC.L    $80080027,79
    DC.L    $80080029,3
    DC.L    $8008002A,LoTrackGGFormat
    DC.L    $8008002B,$00000008
    DC.L    $80031001,$00000002
    DC.L    $80030016,1
    DC.L    $00000000
    DC.L    $80080027,79
    DC.L    $80080028,79
    DC.L    $80080029,10
    DC.L    $8008002A,HiTrackGGFormat
    DC.L    $8008002B,$00000008
    DC.L    $80031001,$00000002
    DC.L    $80030016,1
    DC.L    $00000000
    DC.L    $8008002E,108
    DC.L    $00000000
    DC.L    $8008002E,108
    DC.L    $00000000
    DC.L    $80080004,1
    DC.L    $00000000
    DC.L    $80080004,1
    DC.L    $00000000
    DC.L    $80080004,1
    DC.L    $00000000
    DC.L    $80080004,1
    DC.L    $00000000
    DC.L    $8008002E,108
    DC.L    $00000000
    DC.L    $00000000
    DC.L    $00000000
    DC.L    $00000000
    DC.L    $00000000


LoTrackGGFormat:
    DC.B    '%ld',0
    CNOP     0,2

HiTrackGGFormat:
    DC.B    '%ld',0
    CNOP     0,2

CModeGGText:
    DC.B    '',0

DriveGGText:
    DC.B    'Drive',0

ModeGGText:
    DC.B    '',0

LoTrackGGText:
    DC.B    'Lo',0

HiTrackGGText:
    DC.B    'Hi',0

ArchiveNameGGText:
    DC.B    'Archive Name',0

TextFNameGGText:
    DC.B    'Text Name',0

BitmapGGText:
    DC.B    'Bitmap',0

ValidateGGText:
    DC.B    'Validate',0

ShowTextGGText:
    DC.B    'Show Text',0

PauseGGText:
    DC.B    'Pause',0

KeyGGText:
    DC.B    'Key',0

StartGGText:
    DC.B    'START!',0

GetArchiveNameGGText:
    DC.B    'Get',0

GetTextFNameGGText:
    DC.B    'Get',0

ViewFullGGText:
    DC.B    'Full',0

    CNOP    0,2

    XDEF    CModeGGLabels

CModeGGLabels:
    DC.L    CModeGGLab0
    DC.L    CModeGGLab1
    DC.L    CModeGGLab2
    DC.L    CModeGGLab3
    DC.L    0

    XDEF    ModeGGLabels

ModeGGLabels:
    DC.L    ModeGGLab0
    DC.L    ModeGGLab1
    DC.L    ModeGGLab2
    DC.L    ModeGGLab3
    DC.L    ModeGGLab4
    DC.L    ModeGGLab5
    DC.L    0

CModeGGLab0:    DC.B    'None',0
CModeGGLab1:    DC.B    'Heavy1',0
CModeGGLab2:    DC.B    'Heavy2',0
CModeGGLab3:    DC.B    'Best',0

    CNOP    0,2

ModeGGLab0:    DC.B    'Read from Disk',0
ModeGGLab1:    DC.B    'Write to Disk',0
ModeGGLab2:    DC.B    'View Info',0
ModeGGLab3:    DC.B    'Repack Archive',0
ModeGGLab4:    DC.B    'Test Archive',0
ModeGGLab5:    DC.B    'Read DMSText',0

    CNOP    0,2

DriveGGNodes0:
    DC.L    DriveGGNodes1
    DC.L    DriveGGList
    DC.B    0,0
    DC.L    DriveGGName0

DriveGGName0:
    DC.B    'DF0:',0
    CNOP    0,2

DriveGGNodes1:
    DC.L    DriveGGNodes2
    DC.L    DriveGGNodes0
    DC.B    0,0
    DC.L    DriveGGName1

DriveGGName1:
    DC.B    'DF1:',0
    CNOP    0,2

DriveGGNodes2:
    DC.L    DriveGGNodes3
    DC.L    DriveGGNodes1
    DC.B    0,0
    DC.L    DriveGGName2

DriveGGName2:
    DC.B    'DF2:',0
    CNOP    0,2

DriveGGNodes3:
    DC.L    DriveGGNodes4
    DC.L    DriveGGNodes2
    DC.B    0,0
    DC.L    DriveGGName3

DriveGGName3:
    DC.B    'DF3:',0
    CNOP    0,2

DriveGGNodes4:
    DC.L    DriveGGNodes5
    DC.L    DriveGGNodes3
    DC.B    0,0
    DC.L    DriveGGName4

DriveGGName4:
    DC.B    'FF0:',0
    CNOP    0,2

DriveGGNodes5:
    DC.L    DriveGGNodes6
    DC.L    DriveGGNodes4
    DC.B    0,0
    DC.L    DriveGGName5

DriveGGName5:
    DC.B    'FF1:',0
    CNOP    0,2

DriveGGNodes6:
    DC.L    DriveGGList+4
    DC.L    DriveGGNodes5
    DC.B    0,0
    DC.L    DriveGGName6

DriveGGName6:
    DC.B    'RAD:',0
    CNOP    0,2

    XDEF    DriveGGList

DriveGGList:
    DC.L    DriveGGNodes0,0,DriveGGNodes6

    XDEF    topaz8

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

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

    XDEF    DMSIIWindowTags

DMSIIWindowTags:
DMSIIL:
    DC.L    $80000064,0
DMSIIT:
    DC.L    $80000065,0
DMSIIW:
    DC.L    $80000076,0
DMSIIH:
    DC.L    $80000077,0
    DC.L    $8000006A,$0040037C
    DC.L    $8000006B,$0000101E
DMSIIWG:
    DC.L    $8000006C,0
    DC.L    $8000006E,DMSIIWTitle
    DC.L    $8000006F,DMSIISTitle
DMSIISC:
    DC.L    $80000079,0
    DC.L    $8000007D,DMSIIZoom
    DC.L    $80000090,1
    DC.L    $00000000

DMSIIWTitle:
    DC.B    'DMS Intuition Interface V1.0  for DMS V1.11',0
    CNOP    0,2

DMSIISTitle:
    DC.B    'DMS Intuition Interface V1.0 for DMS V1.11     Copyright © 1993 by Newtec.',0
    CNOP    0,2

    XDEF    DMSIIText0

DMSIIText0:
    DC.B    1,0
    DC.B    $00
    DC.B    0
    DC.W    80,3
    DC.L    topaz8
    DC.L    DMSIIIText0
    DC.L    DMSIIText1

DMSIIText1:
    DC.B    1,0
    DC.B    $00
    DC.B    0
    DC.W    205,3
    DC.L    topaz8
    DC.L    DMSIIIText1
    DC.L    0

DMSIIIText0:
    DC.B    'Mode',0

DMSIIIText1:
    DC.B    'Crunch Mode',0

    CNOP    0,2

    XDEF    DMSIINewMenu0

DMSIINewMenu0:
    DC.B    1,0
    DC.L    DMSIIMName0
    DC.L    0
    DC.W    0
    DC.L    0,0

DMSIINewMenu1:
    DC.B    2,0
    DC.L    DMSIIMName1
    DC.L    DMSIIMComm1
    DC.W    0
    DC.L    0,0

DMSIINewMenu2:
    DC.B    2,0
    DC.L    DMSIIMName2
    DC.L    DMSIIMComm2
    DC.W    0
    DC.L    0,0

DMSIINewMenu3:
    DC.B    2,0
    DC.L    $FFFFFFFF,0
    DC.W    0
    DC.L    0,0

DMSIINewMenu4:
    DC.B    2,0
    DC.L    DMSIIMName4
    DC.L    DMSIIMComm4
    DC.W    0
    DC.L    0,0

DMSIINewMenu5:
    DC.B    1,0
    DC.L    DMSIIMName5
    DC.L    0
    DC.W    0
    DC.L    0,0

DMSIINewMenu6:
    DC.B    2,0
    DC.L    DMSIIMName6
    DC.L    DMSIIMComm6
    DC.W    0
    DC.L    0,0

DMSIINewMenu7:
    DC.B    2,0
    DC.L    DMSIIMName7
    DC.L    DMSIIMComm7
    DC.W    0
    DC.L    0,0

DMSIINewMenu8:
    DC.B    2,0
    DC.L    DMSIIMName8
    DC.L    0
    DC.W    $0109
    DC.L    0,0

DMSIINewMenu9:
    DC.B    2,0
    DC.L    $FFFFFFFF,0
    DC.W    0
    DC.L    0,0

DMSIINewMenu10:
    DC.B    2,0
    DC.L    DMSIIMName10
    DC.L    DMSIIMComm10
    DC.W    0
    DC.L    0,0

DMSIINewMenu11:
    DC.B    2,0
    DC.L    $FFFFFFFF,0
    DC.W    0
    DC.L    0,0

DMSIINewMenu12:
    DC.B    2,0
    DC.L    DMSIIMName12
    DC.L    0
    DC.W    $0009
    DC.L    0,0

DMSIINewMenu13:
    DC.B    2,0
    DC.L    $FFFFFFFF,0
    DC.W    0
    DC.L    0,0

DMSIINewMenu14:
    DC.B    2,0
    DC.L    DMSIIMName14
    DC.L    0
    DC.W    $0101
    DC.L    512,0

DMSIINewMenu15:
    DC.B    2,0
    DC.L    DMSIIMName15
    DC.L    0
    DC.W    $0001
    DC.L    256,0

DMSIINewMenu16:
    DC.B    2,0
    DC.L    DMSIIMName16
    DC.L    DMSIIMComm16
    DC.W    0
    DC.L    0,0

DMSIINewMenu17:
    DC.B    2,0
    DC.L    $FFFFFFFF,0
    DC.W    0
    DC.L    0,0

DMSIINewMenu18:
    DC.B    2,0
    DC.L    DMSIIMName18
    DC.L    0
    DC.W    $0101
    DC.L    8192,0

DMSIINewMenu19:
    DC.B    2,0
    DC.L    DMSIIMName19
    DC.L    0
    DC.W    $0001
    DC.L    4096,0

DMSIINewMenu20:
    DC.B    1,0
    DC.L    DMSIIMName20
    DC.L    0
    DC.W    0
    DC.L    0,0

DMSIINewMenu21:
    DC.B    2,0
    DC.L    DMSIIMName21
    DC.L    DMSIIMComm21
    DC.W    0
    DC.L    0,0

DMSIINewMenu22:
    DC.B    2,0
    DC.L    DMSIIMName22
    DC.L    DMSIIMComm22
    DC.W    0
    DC.L    0,0

DMSIINewMenu23:
    DC.B    2,0
    DC.L    $FFFFFFFF,0
    DC.W    0
    DC.L    0,0

DMSIINewMenu24:
    DC.B    2,0
    DC.L    DMSIIMName24
    DC.L    DMSIIMComm24
    DC.W    0
    DC.L    0,0

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

DMSIIMName0:
    DC.B    'Miscellaneous',0

DMSIIMName1:
    DC.B    'Restart Program',0

DMSIIMComm1:
    DC.B    'R',0

DMSIIMName2:
    DC.B    'About',0

DMSIIMComm2:
    DC.B    'A',0

DMSIIMName4:
    DC.B    'Quit',0

DMSIIMComm4:
    DC.B    'Q',0

DMSIIMName5:
    DC.B    'Preferences',0

DMSIIMName6:
    DC.B    'Load Preferences',0

DMSIIMComm6:
    DC.B    'L',0

DMSIIMName7:
    DC.B    'Save Preferences',0

DMSIIMComm7:
    DC.B    'S',0

DMSIIMName8:
    DC.B    'Save Prefs on Quit?',0

DMSIIMName10:
    DC.B    'Change DMS Path...',0

DMSIIMComm10:
    DC.B    'P',0

DMSIIMName12:
    DC.B    'Close Windows Immediately?',0

DMSIIMName14:
    DC.B    'Use DMS for testing?',0

DMSIIMName15:
    DC.B    'Use other tester?',0

DMSIIMName16:
    DC.B    'Select other tester',0

DMSIIMComm16:
    DC.B    'T',0

DMSIIMName18:
    DC.B    'Use Reqtools.library?',0

DMSIIMName19:
    DC.B    'Use ASL.library?',0

DMSIIMName20:
    DC.B    'Operations',0

DMSIIMName21:
    DC.B    'Delete Selected DMSFile',0

DMSIIMComm21:
    DC.B    'D',0

DMSIIMName22:
    DC.B    'Format Selected disk',0

DMSIIMComm22:
    DC.B    'F',0

DMSIIMName24:
    DC.B    'Diskcopy using selected Drive',0

DMSIIMComm24:
    DC.B    'C',0

    CNOP    0,2

    XDEF    SetupScreen

SetupScreen
    movem.l d1-d3/a0-a2/a6,-(sp)
    move.l  IntBase(pc),a6
    move.l  PubScreenName,a0
    jsr     LockPubScreen(a6)
    move.l  d0,Scr
    tst.l   d0
    beq     SError
    move.l  Scr,a0
    move.l  GTBase(pc),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  GTBase(pc),a6
    move.l  VisualInfo,a0
    cmpa.l  #0,a0
    beq.s   NoVis
    jsr     FreeVisualInfo(a6)
    move.l  #0,VisualInfo
NoVis:
    move.l  IntBase(pc),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    DMSIIRender

DMSIIRender:
    movem.l d0-d5/a0-a2/a6,-(sp)
    move.l  DMSIIWnd,a0
    move.b  54(a0),d4
    ext.w   d4
    move.b  55(a0),d5
    ext.w   d5
    move.l  VisualInfo,NR+4
    move.l  VisualInfo,IR+4
    move.l  GTBase(pc),a6
    move.l  DMSIIWnd,a0
    move.l  50(a0),a2
    move.l  a2,a0
    lea.l   NR,a1
    move.w  #161,d0
    add.w   d4,d0
    move.w  #132,d1
    add.w   d5,d1
    move.w  #264,d2
    move.w  #18,d3
    jsr     DrawBevelBoxA(a6)
    move.l  a2,a0
    lea.l   NR,a1
    move.w  #201,d0
    add.w   d4,d0
    move.w  #15,d1
    add.w   d5,d1
    move.w  #96,d2
    move.w  #60,d3
    jsr     DrawBevelBoxA(a6)
    move.l  a2,a0
    lea.l   NR,a1
    move.w  #10,d0
    add.w   d4,d0
    move.w  #15,d1
    add.w   d5,d1
    move.w  #181,d2
    move.w  #60,d3
    jsr     DrawBevelBoxA(a6)
    move.l  IntBase(pc),a6
    move.l  DMSIIWnd,a0
    move.l  50(a0),a0
    lea.l   DMSIIText0,a1
    move.l  d4,d0
    move.l  d5,d1
    jsr     PrintIText(a6)
    movem.l (sp)+,d0-d5/a0-a2/a6
    rts

    XDEF    OpenDMSIIWindow

OpenDMSIIWindow:
    movem.l d1-d4/a0-a4/a6,-(sp)
    move.l  Scr,a0
    moveq   #0,d3
    moveq   #0,d2
    move.b  36(a0),d2
    move.l  40(a0),a1
    move.w  4(a1),d3
    addq.w  #1,d3
    add.b   35(a0),d3
    move.l  GTBase(pc),a6
    lea.l   DMSIIGList,a0
    jsr     CreateContext(a6)
    move.l  d0,a3
    tst.l   d0
    beq     DMSIICError
    movem.w d2-d3,-(sp)
    moveq   #0,d3
    lea.l   DMSIIGTags,a4
DMSIIGL:
    move.l  4.w,a6
    lea.l   DMSIINGads,a0
    move.l  d3,d0
    mulu    #30,d0
    add.l   d0,a0
    lea.l   BufNewGad,a1
    moveq   #30,d0
    jsr     CopyMem(a6)
    lea.l   BufNewGad,a0
    move.l  VisualInfo,22(a0)
    move.l  #topaz8,12(a0)
    move.w  (a0),d0
    add.w   (sp),d0
    move.w  d0,(a0)
    move.w  2(a0),d0
    add.w   2(sp),d0
    move.w  d0,2(a0)
    move.l  GTBase(pc),a6
    lea.l   DMSIIGTypes,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
    bne.s    DMSIICOK
    movem.w (sp)+,d2-d3
    bra     DMSIICError
DMSIICOK:
    move.l  d0,a3
    move.l  d3,d0
    asl.l   #2,d0
    lea.l   DMSIIGadgets,a0
    add.l   d0,a0
    move.l  a3,(a0)
DMSIITL:
    tst.l   (a4)
    beq.s   DMSIIDN
    addq.w  #8,a4
    bra.s   DMSIITL
DMSIIDN:
    addq.w  #4,a4
    addq.w  #1,d3
    cmp.w   #DMSII_CNT,d3
    bmi     DMSIIGL
    movem.w (sp)+,d2-d3
    move.l  DMSIIGList,DMSIIWG+4
    move.l  GTBase(pc),a6
    lea.l   DMSIINewMenu0,a0
    lea.l   MTags0,a1
    jsr     CreateMenusA(a6)
    move.l  d0,DMSIIMenus
    tst.l   d0
    beq     DMSIIMError
    move.l  d0,a0
    move.l  VisualInfo,a1
    lea.l   MTags1,a2
    jsr     LayoutMenusA(a6)
    move.l  Scr,DMSIISC+4
    move.w  DMSIILeft,DMSIIZoom
    move.w  DMSIITop,DMSIIZoom+2
    move.l  GFXBase(pc),a6
    move.l  Scr,a1
    lea.l   84(a1),a1
    lea.l   DMSIIWTitle,a0
    move.l  #43,d0
    jsr     TextLength(a6)
    add.w   #80,d0
    move.w  d0,DMSIIZoom+4
    move.l  Scr,a0
    move.b  35(a0),d0
    ext.w   d0
    lea.l   84(a0),a0
    add.w   58(a0),d0
    addq.w  #1,d0
    move.w  d0,DMSIIZoom+6
    moveq   #0,d0
    move.w  DMSIILeft,d0
    move.l  d0,DMSIIL+4
    move.w  DMSIITop,d0
    move.l  d0,DMSIIT+4
    move.w  DMSIIWidth,d0
    move.l  d0,DMSIIW+4
    move.w  DMSIIHeight,d0
    move.l  d0,DMSIIH+4
    move.l  IntBase(pc),a6
    suba.l  a0,a0
    lea.l   DMSIIWindowTags,a1
    jsr     OpenWindowTagList(a6)
    move.l  d0,DMSIIWnd
    tst.l   d0
    beq     DMSIIWError
    move.l   DMSIIWnd,a0
    move.l   DMSIIMenus,a1
    jsr      SetMenuStrip(a6)
    move.l  GTBase(pc),a6
    move.l  DMSIIWnd,a0
    suba.l  a1,a1
    jsr     GT_RefreshWindow(a6)
    bsr     DMSIIRender
    moveq   #0,d0
DMSIIDone:
    movem.l (sp)+,d1-d4/a0-a4/a6
    rts
DMSIICError:
    moveq   #1,d0
    bra.s   DMSIIDone
DMSIIGError:
    moveq   #2,d0
    bra.s   DMSIIDone
DMSIIMError:
    moveq   #3,d0
    bra.s   DMSIIDone
DMSIIWError:
    moveq   #4,d0
    bra.s   DMSIIDone

    XDEF    CloseDMSIIWindow

CloseDMSIIWindow:
    movem.l d0-d1/a0-a2/a6,-(sp)
    move.l   IntBase(pc),a6
    move.l   DMSIIMenus,a0
    cmpa.l   #0,a0
    beq      DMSIINMenu
    move.l   DMSIIWnd,a0
    jsr      ClearMenuStrip(a6)
    move.l   GTBase(pc),a6
    move.l   DMSIIMenus,a0
    jsr      FreeMenus(a6)
    move.l   #0,DMSIIMenus
DMSIINMenu:
    move.l  IntBase(pc),a6
    move.l  DMSIIWnd,a0
    cmpa.l  #0,a0
    beq     DMSIINWnd
    jsr     CloseWindow(a6)
    move.l  #0,DMSIIWnd
DMSIINWnd:
    move.l  GTBase(pc),a6
    move.l  DMSIIGList,a0
    cmpa.l  #0,a0
    beq     DMSIINGad
    jsr     FreeGadgets(a6)
    move.l  #0,DMSIIGList
DMSIINGad:
    movem.l (sp)+,d0-d1/a0-a2/a6
    rts


    end
