*****************************************************************************
*
*                     Hilbert (c) 1987 The Puzzle Factory
*
*  Program:  Hilbert.asm  V0.6                          Author: Jeff Lavin
*            Based on a recursive algorithm            Created: 10/28/87
*            by Michael Ackerman                   Last Update: 12/01/87
*            from BYTE - June 1986
*
*      Use:  1> [run] Hilbert
*
*     >> No warrantee of any kind whatsoever expressed or implied! <<
*
*       I can be reached at:     The Symposium
*                             Amiga Development BBS
*                        1 Meg Memory - 33 Meg Hard Drive
*                     300/1200, 8-N-1, 24 hr, (503) 935-7883
*                           Another Citadel-68K BBS
*
*****************************************************************************

*** Equates

SysBase       equ   4

TRUE          equ   1
FALSE         equ   0
NULL          equ   0

REV_num       equ   29

nw_Screen     equ   $1E
sc_ViewPort   equ   $2C
wd_RPort      equ   $32
wd_UserPort   equ   $56
MP_SIGBIT     equ   $0F
im_Class      equ   $14
im_Code       equ   $18
im_IAddress   equ   $1C

SMART_REFRESH equ   $000000
NOCAREREFRESH equ   $020000
ACTIVATE      equ   $001000
BACKDROP      equ   $000100
BORDERLESS    equ   $000800
V_HIRES       equ   $008000
V_LACE        equ   $000004
CUSTOMSCREEN  equ   $00000F

MENUENABLED   equ   $0001
MENUPICK      equ   $0100
REQCLEAR      equ   $1000

GADGHBOX      equ   $0001
SELECTED      equ   $0080
ENDGADGET     equ   $0004
REQGADGET     equ   $1000
BOOLGADGET    equ   $0001

RP_JAM1       equ   0
RP_JAM2       equ   1

TOPAZ_EIGHTY  equ   8
FS_NORMAL     equ   0
FPF_ROMFONT   equ   0

*** Macros

call          macro
              xref    _LVO\1             ;External reference
              jsr     _LVO\1(a6)         ;Call a system routine
              endm

MENU          macro
              dc.l    \1                 ;*NextMenu
              dc.w    \2                 ;LeftEdge
              dc.w    0                  ;TopEdge
              dc.w    \3                 ;Width
              dc.w    0                  ;Height
              dc.w    MENUENABLED        ;Flags
              dc.l    \4                 ;*MenuName
              dc.l    \5                 ;*FirstItem
              dc.l    0,0                ;Used by Intuition
              endm

ITEM          macro                      ;Make MenuItem
              dc.l    \1                 ;*NextItem
              dc.w    \2                 ;LeftEdge
              dc.w    \3                 ;TopEdge
              dc.w    \4                 ;Width
              dc.w    10                 ;Height
              dc.w    \5                 ;Flags
              dc.l    \6                 ;MutualExclude
              dc.l    \7                 ;*ItemFill
              dc.l    0                  ;*SelectFill
              dc.b    \8                 ;Command
              dc.b    0                  ;KludgeFill00
              dc.l    \9                 ;*SubItem
              dc.w    0                  ;NextSelect
              endm

*** Begin Mainline

Startup     movea.l SysBase,a6           ;Find exec library
            lea     IntName,a1           ;Ask for 'intuition.library'
            moveq.l #REV_num,d0          ;Any version
            call    OpenLibrary
            move.l  d0,IntBase
            beq     Cleanup

            lea     GfxName,a1           ;Ask for 'graphics.library'
            moveq.l #REV_num,d0          ;Any version
            call    OpenLibrary
            move.l  d0,GfxBase
            beq     Cleanup

            movea.l IntBase,a6           ;Open a CustomScreen
            lea     MyScreen,a0
            call    OpenScreen
            move.l  d0,ScreenPtr         ;Ptr to newly opened screen
            beq     Cleanup

            lea     MyWindow,a0          ;Ptr to window structure
            move.l  d0,nw_Screen(a0)     ;Link NewWindow to our screen

            addi.l  #sc_ViewPort,d0
            move.l  d0,ViewPtr           ;Screen -> ViewPort

            call    OpenWindow           ;Open Our Main Window
            move.l  d0,WindowPtr         ;Ptr to newly opened window
            beq     Cleanup

            movea.l d0,a0
            move.l  wd_RPort(a0),RastPtr ;Save ptr to RastPort
            movea.l wd_UserPort(a0),a0
            move.l  a0,PortPtr              ;Save ptr to UserPort
            move.b  MP_SIGBIT(a0),IntuiBits ;Save signal bits

            movea.l GfxBase,a6
            movea.l ViewPtr,a0           ;Screen's ViewPort
            movea.l #NewColors,a1        ;Our ColorTable
            move.l  #16,d0               ;How many colors
            call    LoadRGB4

            lea     MyFont,A0
            call    OpenFont             ;Open the 80 column font
            move.l  D0,FontPtr           ; for menus & requesters
            beq     Cleanup

            move.b  #0,CloseFlag         ;Else we can't escape
            move.b  #1,ColorFlag         ;Default to color
            move.b  #1,TitleFlag         ;Default to 'ON'

            movea.l IntBase,a6           ;Attach menus to existing window
            movea.l WindowPtr,a0         ;Which window?
            lea     Title0,a1            ;First menu in strip
            call    SetMenuStrip         ;Attach menus
            move.l  #1,MenuFlag          ;Indicate it

*****  Main Program Loop  -  Event Driven  *****

Main        move.b  CloseFlag,d0         ;Have we received a Quit request?
            bne     Cleanup              ;Yes, Bye!
            moveq.l #0,d1
            move.b  IntuiBits,d1
            moveq.l #1,d0
            lsl.l   d1,d0                ;Shift to use as a bit mask
            movea.l SysBase,a6           ;Exec Library ptr
            call    Wait                 ;Now wait for something to happen

IntuEvent   bsr     GetIMsg              ;Get an Intuition msg
            tst.l   d0                   ;Did we get a msg?
            beq     Main                 ;No

            move.l  MsgClass,d0          ;Type of event
            cmpi.l  #MENUPICK,d0         ;Menu choice?
            beq     MenuEvent
            bra     EventDone            ;Reply to msg

MenuEvent   clr.l   d2
            move.w  MsgCode,d2           ;Get all Menu codes
            beq     EventDone            ;User backed out before choosing

            move.l  d2,d0                 ;Save the code
            andi.l  #%0000000000011111,d0 ;Get Menu number
            move.b  d0,MenuNum

            move.l  d2,d1
            andi.l  #%0000011111100000,d1 ;Get Item number
            lsr.w   #5,d1                 ;Shift into the lower byte
            move.b  d1,ItemNum

            andi.l  #%1111100000000000,d2 ;Get SubItem number
            moveq.l #11,d4
            lsr.w   d4,d2                ;Shift into the lower byte
            move.b  d2,SubINum

*** Check for Menu Items

Menu0_Chk   cmpi.b  #0,d0                ;'Project' menu
            bne     Menu1_Chk
Item00_Ck   cmpi.b  #0,d1                ;'Save IFF' item
            bne.s   Item01_Ck
            bra     EventDone
Item01_Ck   cmpi.b  #1,d1                ;'Dump' item
            bne.s   Item02_Ck
            bra     EventDone

Item02_Ck   cmpi.b  #2,d1                ;'Title' item
            bne.s   Item03_Ck
            movea.l IntBase,a6
            movea.l ScreenPtr,a0
            tst.b   TitleFlag
            beq.s   TitleOn
TitleOff    move.l  #FALSE,d0            ;Hide title
            move.b  #0,TitleFlag
            bra.s   TitleFlip
TitleOn     move.l  #TRUE,d0
            move.b  #1,TitleFlag
TitleFlip   call    ShowTitle
            bra     EventDone

Item03_Ck   cmpi.b  #3,d1                ;'About' item
            bne.s   Item04_Ck
            movea.l IntBase,a6
            movea.l WindowPtr,a1
            lea     AboutReq,a0
            call    Request              ;Put up the AboutReq
            bra     EventDone

Item04_Ck   cmpi.b  #4,d1                ;'Quit' item
            bne     EventDone            ;Last item in this menu
            move.b  #1,CloseFlag         ;Set flag so we will exit
            bra.s   EventDone

Menu1_Chk   cmpi.b  #1,d0                ;'Action' munu
            bne.s   EventDone            ;Last menu in list
Item10_Ck   cmpi.b  #0,d1                ;'Order' item
            bne.s   Item11_Ck
GetOrder    addq.b  #1,d2                ;1 >= Order >= 7
            cmpi.b  #1,d2
            blt     EventDone
            cmpi.b  #7,d2
            bgt     EventDone
            ext.w   d2
            move    d2,Order             ;SubItem number+1 = Order
            move    d2,Store             ;Save for Replay
Replay      movea.l MsgPtr,a1
            bsr     RepMsg
            bsr     SetCoords
            bra     Main                 ;Last item in this menu

Item11_Ck   cmpi.b  #1,d1                ;'Color' item
            bne.s   Item12_Ck
Sub110_Ck   cmpi.b  #0,d2                ;'Color' subitem
            bne.s   Sub111_Ck
            move.b  #1,ColorFlag
            bra.s   EventDone
Sub111_Ck   cmpi.b  #1,d2                ;'B & W' subitem
            bne.s   EventDone            ;Last item in this menu
            move.b  #0,ColorFlag
            bra.s   EventDone

Item12_Ck   cmpi.b  #2,d1                ;'Replay' item
            bne.s   EventDone            ;Last item in this menu
            move    Store,Order
            bra.s   Replay

EventDone   movea.l MsgPtr,a1            ;Return msg
            bsr     RepMsg
            bra     Main

*****  Termination Section  *****

Cleanup     movea.l GfxBase,a6
            move.l  FontPtr,d0           ;Close Font
            beq.s   NoFont
            movea.l d0,a1
            call    CloseFont

NoFont      movea.l IntBase,a6           ;Detach the Menus
            move.l  MenuFlag,d0
            beq.s   NoMenu
            movea.l WindowPtr,a0         ;Which window?
            call    ClearMenuStrip

NoMenu      move.l  WindowPtr,d0         ;Close the Window
            beq.s   NoWindow
            movea.l d0,a0
            call    CloseWindow

NoWindow    movea.l IntBase,a6           ;Close the Screen
            move.l  ScreenPtr,d0
            beq.s   NoScreen
            movea.l d0,a0
            call    CloseScreen

NoScreen    movea.l SysBase,a6           ;Close Intuition Library
            move.l  GfxBase,d0
            beq.s   NoGfx
            movea.l d0,a1
            call    CloseLibrary

NoGfx       move.l  IntBase,d0           ;Close Intuition Library
            beq.s   NoInt
            movea.l d0,a1
            call    CloseLibrary

NoInt       clr.l   d0
            rts                          ;Return to CLI

*****  Subroutines  *****

GetIMsg     clr.l   d0                   ;Clr return reg
            movea.l SysBase,a6
            movea.l PortPtr,a0
            call    GetMsg               ;Get a message
            tst.l   d0                   ;Got one?
            beq.s   1$                   ;No
            move.l  d0,a1                ;Ptr to msg
            move.l  d0,MsgPtr            ;Save some stuff
            move.l  im_Class(a1),MsgClass
            move.l  im_Code(a1),MsgCode
            move.l  im_IAddress(a1),MsgAddr
1$          rts

RepMsg      movea.l SysBase,a6           ;Ptr to msg in a1
            call    ReplyMsg             ;Done with it
            rts

SetCoords   movea.l GfxBase,a6
            movea.l RastPtr,a1
            moveq.l #0,d0                ;Color #0
            call    SetBPen
            movea.l RastPtr,a1
            moveq.l #RP_JAM2,d0          ;Drawing mode
            call    SetDrMd
            movea.l RastPtr,a1
            moveq.l #0,d0                ;Clear drawing area
            call    SetRast              ; to Color #0
            moveq.l #0,d2
            move    Order,d2
            moveq   #2,d4                ;dy = 768 / 2 ^ Order
            lsl     d2,d4
            move.l  #768,d5
            divu    d4,d5
            move    d5,dy
            move    #-1,Turn             ;Turn = -1
            move    #0,x                 ;x = 0
            move    #12,y                ;y = 0
            move    #0,dx                ;dx = 0
            movea.l RastPtr,a1           ;Set pen point x,y
            moveq.l #0,d0
            moveq.l #12,d1
            call    Move
            bsr.s   Hilbert
            rts

* Based on a recursive algorithm by Michael Ackerman - BYTE June 1986

Hilbert     subq    #1,Order             ;Order = Order - 1
            neg     Turn                 ;Turn = -Turn
            move    dy,temp              ;temp = dy
            move    Turn,d2              ;dy = -Turn * dx
            neg     d2
            mulu    dx,d2
            move    d2,dy
            move    Turn,d2              ;dx = Turn * temp
            mulu    temp,d2
            move    d2,dx
            move    Order,d0             ;If Order > 0 call Hilbert
            beq.s   1$
            bmi.s   1$
            bsr.s   Hilbert
1$          move    x,d0                 ;x = x + dx
            move    dx,d2
            add     d2,d0
            move    d0,x
            move    y,d1                 ;y = y + dy
            move    dy,d2
            add     d2,d1
            move    d1,y
            bsr     PickColor
            movea.l RastPtr,a1           ;Line relative x,y
            ext.l   d0
            ext.l   d1
            call    Draw
            neg     Turn                 ;Turn = -Turn
            move    dy,temp              ;temp = dy
            move    Turn,d2              ;dy = -Turn * dx
            neg     d2
            mulu    dx,d2
            move    d2,dy
            move    Turn,d2              ;dx = Turn * temp
            mulu    temp,d2
            move    d2,dx
            move    Order,d0             ;If Order > 0 call Hilbert
            beq.s   2$
            bmi.s   2$
            bsr     Hilbert
2$          move    x,d0                 ;x = x + dx
            move    dx,d2
            add     d2,d0
            move    d0,x
            move    y,d1                 ;y = y + dy
            move    dy,d2
            add     d2,d1
            move    d1,y
            bsr     PickColor
            movea.l RastPtr,a1           ;Line relative x,y
            ext.l   d0
            ext.l   d1
            call    Draw
            move    Order,d0             ;If Order > 0 call Hilbert
            beq.s   3$
            bmi.s   3$
            bsr     Hilbert
3$          move    dy,temp              ;temp = dy
            move    Turn,d2              ;dy = -Turn * dx
            neg     d2
            mulu    dx,d2
            move    d2,dy
            move    Turn,d2              ;dx = Turn * temp
            mulu    temp,d2
            move    d2,dx
            neg     Turn                 ;Turn = -Turn
            move    x,d0                 ;x = x + dx
            move    dx,d2
            add     d2,d0
            move    d0,x
            move    y,d1                 ;y = y + dy
            move    dy,d2
            add     d2,d1
            move    d1,y
            bsr     PickColor
            movea.l RastPtr,a1           ;Line relative x,y
            ext.l   d0
            ext.l   d1
            call    Draw
            move    Order,d0             ;If Order > 0 call Hilbert
            beq.s   4$
            bmi.s   4$
            bsr     Hilbert
4$          move    dy,temp              ;temp = dy
            move    Turn,d2              ;dy = -Turn * dx
            neg     d2
            mulu    dx,d2
            move    d2,dy
            move    Turn,d2              ;dx = Turn * temp
            mulu    temp,d2
            move    d2,dx
            neg     Turn                 ;Turn = -Turn
            addq    #1,Order             ;Order = Order + 1
            rts

PickColor   move.w  #14,d3
            bsr.s   Random               ;Get ramdom number 0-14
            addq    #2,d2                ;Make 2-16
            ext.l   d2                   ;Need LONG
            movem.l d0/d1,-(sp)          ;Save regs
            movea.l RastPtr,a1
            moveq.l #2,d0                ;Color #2 for B/W
            tst.b   ColorFlag            ;If = 0, use Color #2
            beq.s   1$
            move.l  d2,d0                ;Random color: 2-16
1$          call    SetAPen
            movem.l (sp)+,d0/d1
            rts

* Another random number generator.  By Leo Schwab.
* Calling convention:  Random (range)
*               Word:    d2     d3

Random      lea     RndSeed,a0           ;Get address of seed
            tst.w   d3
            ble.s   SetSeed              ;Go reset seed

            move.l  (a0),d2              ;Get seed
            add.l   d2,d2
            bhi.s   Over
            eori.l  #$1D872B41,d2
Over        move.l  d2,(a0)              ;Save new seed
            andi.l  #$ffff,d2            ;Coerce into word
            divu    d3,d2                ;Divide by range
            swap    d2                   ; and get remainder (modulus)
            rts

SetSeed     neg.w   d3                   ;Probably don't need this
            move.l  d3,(a0)
            rts

            SECTION data,DATA

IntBase     dc.l    0                    ;Keep address of Intuition here
GfxBase     dc.l    0                    ;Address of Graphics library
ScreenPtr   dc.l    0                    ;Addr of structure describing screen
CMapPtr     dc.l    0                    ;Addr of ColorMap structure
WindowPtr   dc.l    0                    ;Addr of structure describing window
FontPtr     dc.l    0                    ;Addr of Font
MenuFlag    dc.l    0                    ;Set if we call SetMenuStrip

RndSeed     dc.l    0

Order       dc.w    0                    ;Order of curve to draw
Store       dc.w    0                    ;Last order, for replay
Turn        dc.w    0
dx          dc.w    0
dy          dc.w    0
x           dc.w    0
y           dc.w    0
temp        dc.w    0

IntName     dc.b    'intuition.library',0
GfxName     dc.b    'graphics.library',0
FontName    dc.b    'topaz.font',0

ScreenTitle dc.b    'HILBERT CURVES V0.6  -  by Jeff Lavin',0
            cnop    0,4

MyScreen    dc.w    0,0,640,400,4        ;LeftEdge,TopEdge,Width,Height,Depth
            dc.b    10,13                ;DetailPen,BlockPen
            dc.w    V_HIRES!V_LACE       ;ViewModes
            dc.w    CUSTOMSCREEN         ;Type
            dc.l    MyFont               ;*Font
            dc.l    ScreenTitle          ;*Title
            dc.l    0,0                  ;*Gadgets,*CustomBitMap

NewColors   dc.w    $000,$D0D,$7AF,$FFF,$F00,$F09,$F80,$FD0
            dc.w    $BF0,$0F0,$0FF,$00F,$12B,$C0F,$941,$888

            ;Black,Purple,SkyBlue,White,Red,Cherry,Orange,Yellow
            ;LtGreen,Green,Aqua,Blue,DkBlue,Violet,Brown,Grey

MyIDCMP     equ     MENUPICK!REQCLEAR
MyForm      equ     SMART_REFRESH!NOCAREREFRESH!ACTIVATE
MyFeatures  equ     BACKDROP!BORDERLESS

MyWindow    dc.w    0,0,640,400          ;LeftEdge,TopEdge,Width,Height
            dc.b    10,13                ;DetailPen,BlockPen
            dc.l    MyIDCMP
            dc.l    MyForm!MyFeatures
            dc.l    0,0                  ;*FirstGadget,*CheckMark
            dc.l    0                    ;*Title
            dc.l    0                    ;*Screen
            dc.l    0                    ;*BitMap
            dc.w    0,0,0,0              ;MinWidth,Height,MaxWidth,Height
            dc.w    CUSTOMSCREEN         ;Type

MyFont      dc.l    FontName             ;Font for Menus
            dc.w    TOPAZ_EIGHTY         ;Height
            dc.b    FS_NORMAL            ;Style
            dc.b    FPF_ROMFONT          ;Flags

*** Text Strings

TtlText0    dc.b    ' Project',0
ItemText00  dc.b       'Save IFF',0
ItemText01  dc.b       'Screen Dump',0
ItemText02  dc.b       'Hide Title',0
ItemText03  dc.b       'About',0
ItemText04  dc.b       'Quit',0

TtlText1    dc.b    ' Action',0
ItemText10  dc.b       'Order',0
SubText100  dc.b       '   1',0
SubText101  dc.b       '   2',0
SubText102  dc.b       '   3',0
SubText103  dc.b       '   4',0
SubText104  dc.b       '   5',0
SubText105  dc.b       '   6',0
SubText106  dc.b       '   7',0
ItemText11  dc.b       'Color',0
SubText110  dc.b       '   Color',0
SubText111  dc.b       '   B & W',0
ItemText12  dc.b       'Replay',0

*** Other Text Strings

AboutText1  dc.b    '*Amiga* Hilbert Curves!',0
AboutText2  dc.b    'by Jeff Lavin',0
AboutText3  dc.b    'Freely Distributable Grafix Software',0
AboutText4  dc.b    'for the Amiga',0
AboutText5  dc.b    '© 1987 The Puzzle Factory',0
AGadText    dc.b    'OK',0

            cnop    0,4

*** IntuiText Structures

ItemITxt00  dc.l    $A0D0000,$10001,MyFont,ItemText00,0  ;"Save IFF"
ItemITxt01  dc.l    $A0D0000,$10001,MyFont,ItemText01,0  ;"Screen Dump"
ItemITxt02  dc.l    $A0D0000,$10001,MyFont,ItemText02,0  ;"Hide Title"
ItemITxt03  dc.l    $A0D0000,$10001,MyFont,ItemText03,0  ;"About"
ItemITxt04  dc.l    $A0D0000,$10001,MyFont,ItemText04,0  ;"Quit"

ItemITxt10  dc.l    $A0D0000,$10001,MyFont,ItemText10,0  ;"Order"
SubITxt100  dc.l    $A0D0000,$10001,MyFont,SubText100,0  ;  "1"
SubITxt101  dc.l    $A0D0000,$10001,MyFont,SubText101,0  ;  "2"
SubITxt102  dc.l    $A0D0000,$10001,MyFont,SubText102,0  ;  "3"
SubITxt103  dc.l    $A0D0000,$10001,MyFont,SubText103,0  ;  "4"
SubITxt104  dc.l    $A0D0000,$10001,MyFont,SubText104,0  ;  "5"
SubITxt105  dc.l    $A0D0000,$10001,MyFont,SubText105,0  ;  "6"
SubITxt106  dc.l    $A0D0000,$10001,MyFont,SubText106,0  ;  "7"
ItemITxt11  dc.l    $A0D0000,$10001,MyFont,ItemText11,0  ;"Color"
SubITxt110  dc.l    $A0D0000,$10001,MyFont,SubText110,0  ;  "Color"
SubITxt111  dc.l    $A0D0000,$10001,MyFont,SubText111,0  ;  "B & W"
ItemITxt12  dc.l    $A0D0000,$10001,MyFont,ItemText12,0  ;"Replay"

*** MenuItem Structures

* Action Menu
MenuItem12  ITEM          NULL,00,20,64,$052,000,ItemITxt12,0,NULL
SubItem111  ITEM          NULL,52,10,80,$053,001,SubITxt111,0,NULL
SubItem110  ITEM    SubItem111,52,00,80,$153,002,SubITxt110,0,NULL
MenuItem11  ITEM    MenuItem12,00,10,64,$052,000,ItemITxt11,0,SubItem110
SubItem106  ITEM          NULL,52,60,40,$053,063,SubITxt106,0,NULL
SubItem105  ITEM    SubItem106,52,50,40,$053,095,SubITxt105,0,NULL
SubItem104  ITEM    SubItem105,52,40,40,$053,111,SubITxt104,0,NULL
SubItem103  ITEM    SubItem104,52,30,40,$053,119,SubITxt103,0,NULL
SubItem102  ITEM    SubItem103,52,20,40,$053,123,SubITxt102,0,NULL
SubItem101  ITEM    SubItem102,52,10,40,$053,125,SubITxt101,0,NULL
SubItem100  ITEM    SubItem101,52,00,40,$153,126,SubITxt100,0,NULL
MenuItem10  ITEM    MenuItem11,00,00,64,$052,000,ItemITxt10,0,SubItem100

* Project Menu
MenuItem04  ITEM          NULL,00,40,130,$56,0,ItemITxt04,'Q',NULL
MenuItem03  ITEM    MenuItem04,00,30,130,$56,0,ItemITxt03,'A',NULL
MenuItem02  ITEM    MenuItem03,00,20,130,$56,0,ItemITxt02,'T',NULL
MenuItem01  ITEM    MenuItem02,00,10,130,$46,0,ItemITxt01,'D',NULL
MenuItem00  ITEM    MenuItem01,00,00,130,$46,0,ItemITxt00,'S',NULL

Title1      MENU      NULL,133,064,TtlText1,MenuItem10         ;Action Menu
Title0      MENU    Title1,003,130,TtlText0,MenuItem00         ;Project Menu

*** IntuiText for AboutReq

AboutITxt1    dc.l    $D0000,$3C0014,MyFont,AboutText1,AboutITxt2
AboutITxt2    dc.l    $D0000,$640028,MyFont,AboutText2,AboutITxt3
AboutITxt3    dc.l    $D0000,$0F003C,MyFont,AboutText3,AboutITxt4
AboutITxt4    dc.l    $D0000,$640050,MyFont,AboutText4,AboutITxt5
AboutITxt5    dc.l    $D0000,$3C0064,MyFont,AboutText5,NULL
AGadITxt      dc.l    $D0000,$120001,MyFont,AGadText,NULL

*** Requester Structure

AboutReq    dc.l    0               ;*OlderRequest
            dc.w    160,25,320,150  ;LeftEdge,TopEdge,Width,Height
            dc.w    0,0             ;RelLeft,RelTop
            dc.l    AboutGad        ;*ReqGadget
            dc.l    AboutBord       ;*ReqBorder
            dc.l    AboutITxt1      ;*ReqText
            dc.w    0               ;Flags
            dc.b    13,0            ;BackFill,KludgeFill00
            dcb.l   20,0

*** Border Structure

AboutBord   dc.w    0,0             ;LeftEdge,TopEdge
            dc.b    0,1             ;FrontPen,BackPen
            dc.b    RP_JAM1,10      ;DrawMode,Count
            dc.l    AB_Coords       ;*XY
            dc.l    NULL            ;*NextBorder

AB_Coords   dc.w    5,5,315,5,315,145,5,145,5,5
            dc.w    4,4,314,4,314,144,4,144,4,4

*** Gadget Structure

AboutGad    dc.l    NULL            ;*NextGadget
            dc.w    245,125,50,10   ;LeftEdge,TopEdge,Width,Height
            dc.w    GADGHBOX!SELECTED ;Flags
            dc.w    ENDGADGET       ;Activation
            dc.w    REQGADGET!BOOLGADGET ;GadgetType
            dc.l    NULL            ;*GadgetRender
            dc.l    NULL            ;*SelectRender
            dc.l    AGadITxt        ;*GadgetText
            dc.l    0               ;MutualExclude
            dc.l    NULL            ;*SpecialInfo
            dc.w    1               ;GadgetID
            dc.l    0               ;*UserData

            SECTION mem,BSS

RastPtr     ds.l    1                    ;Addr of Window's RastPort
PortPtr     ds.l    1                    ;Addr of Window's UserPort
ViewPtr     ds.l    1                    ;Addr of Screen's ViewPort

MsgClass    ds.l    1                    ;Class of msg
MsgCode     ds.w    1                    ;Returned value
MsgAddr     ds.l    1                    ;Ptr to an Intuition function
MsgPtr      ds.l    1                    ;Ptr to received msg structure
IntuiBits   ds.b    1

MenuNum     ds.b    1                    ;Menu number
ItemNum     ds.b    1                    ;MenuItem number
SubINum     ds.b    1                    ;SubItem number

CloseFlag   ds.b    1                    ;Flag to exit Main loop
ColorFlag   ds.b    1                    ;0 = B/W, 1 = Color (default)
TitleFlag   ds.b    1                    ;0 = NO,  1 = Title (default)

            END
