home *** CD-ROM | disk | FTP | other *** search
/ Club Amiga de Montreal - CAM / CAM_CD_1.iso / files / 477.lha / SystemTracer_v1.0 / SystemTracer.c < prev    next >
C/C++ Source or Header  |  1991-02-12  |  81KB  |  2,350 lines

  1.            
  2. /* SYSTEM TRACER V1.0   written by Guido Burkard */
  3. /* --------------------------------------------- */
  4.  
  5. #define        UP        65        /* Special Editor Codes     */
  6. #define        DOWN        66
  7. #define        RIGHT        67
  8. #define        LEFT        68
  9.  
  10. #define        CR        13
  11. #define        SPACE        32
  12. #define        DEL        127
  13. #define        BS        8
  14. #define        ESC        27
  15. #define        HELP        63
  16. #define        LF        10
  17. #define        FF        12
  18. #define        FKEYS        47
  19. #define        TAB        9
  20.  
  21. #define        TOP        20
  22. #define        BOTTOM        2
  23. #define        PGUP        17
  24. #define        PGDOWN        26
  25. #define        DELIN        24
  26. #define        BOL        1
  27. #define        EOL        19
  28.  
  29. char spaces[80] = "                                                                              ";
  30. char back[80];
  31. char string[320];
  32. char buffer[320];
  33. char execname[9] = "ExecBase";
  34. char gfxname[8] = "GfxBase";
  35. char intuitionname[14] = "IntuitionBase";
  36. char mode;
  37. char tag[25] = "SYSTEM TRACER STRUCTURE ";
  38. char adrquest[11] = "Address: $";
  39. char insert_string[27] = "/* insert own data here */";
  40. char insert_string2[23] = "; insert own data here";
  41. char save_structure[17] = "Save structure: ";
  42. char no_such_structure[20] = "No such structure.\n";
  43. char filename_quest[11] = "Filename: ";
  44. char even_string[6] = "\neven";
  45. char comma[3] = ", ";
  46. char ioname[]= "raw:0/0/640/200/SystemTracer V1.0   written by Guido Burkard";
  47. char title[]="\n    **** SYSTEM TRACER ****\nwritten in 1990 by Guido Burkard\n\n";
  48. char user_break[]="*** user break\n";
  49. char help_text1[]="Command help:\nn new(next) structure\np previous structure\nc close window(hit HELP to re-open)\no open library\ns system (hex/dec)\nl list structure\nw write structure to memory\nr read structure from mem\n";
  50. char help_text2[]="e edit structure entry\nm monitor mem\nd disk operations\nf free structure mem\nt type string to mem\nu untype(free) string mem\nh,? help\nx,q exit\nuse CTRL to pause, SHIFT to break output\n\n";
  51.  
  52. struct IntuitionBase *IntuitionBase;
  53.  
  54. unsigned int file,io;
  55.  
  56. #define    DECIMAL        10            /* Modes    */
  57. #define    HEXADECIMAL    16
  58.  
  59. #define    BYTE        1            /* Types    */
  60. #define    UBYTE        2
  61. #define    WORD        3
  62. #define    UWORD        4
  63. #define    LONG        5
  64. #define    ULONG        6
  65. #define    STRING        7
  66. #define    STRINGPTR    8
  67. #define    STRUCTURE    9
  68. #define    STRUCTUREPTR    10
  69.  
  70. #define    STACKSIZE    64            /* Stack    */
  71.  
  72. struct
  73. {
  74.     unsigned int nr;
  75.     long address;
  76.     char *name;
  77.     int index;
  78. } stack[STACKSIZE];
  79.  
  80. #define ENTRYSIZE    825
  81.  
  82. struct                        /* Structure-entries    */
  83. {
  84.     unsigned char type;
  85.     unsigned int dimension;
  86.     char name[16];
  87.     unsigned int pointer;
  88. } entry[ENTRYSIZE] =
  89.  
  90. {
  91.     STRUCTURE,    1,    "LibNode        ",1,    /* 0 ExecBase    */
  92.     UWORD,        1,    "SoftVer        ",0,
  93.     WORD,        1,    "LowMemChkSum   ",0,
  94.     ULONG,        1,    "ChkBase        ",0,
  95.     LONG,        1,    "ColdCapture    ",0,
  96.     LONG,        1,    "CoolCapture    ",0,
  97.     LONG,        1,    "WarmCapture    ",0,
  98.     LONG,        1,    "SysStkUpper    ",0,
  99.     LONG,        1,    "SysStkLower    ",0,
  100.     ULONG,        1,    "MaxLocMem      ",0,
  101.     LONG,        1,    "DebugEntry     ",0,
  102.     LONG,        1,    "DebugData      ",0,
  103.     LONG,        1,    "AlertData      ",0,
  104.     LONG,        1,    "MaxExtMem      ",0,
  105.     UWORD,        1,    "ChkSum         ",0,
  106.     STRUCTURE,    16,    "IntVects       ",4,
  107.     STRUCTUREPTR,    1,    "ThisTask       ",5,
  108.     ULONG,        1,    "IdleCount      ",0,
  109.     ULONG,        1,    "DispCount      ",0,
  110.     UWORD,        1,    "Quantum        ",0,
  111.     UWORD,        1,    "Elapsed        ",0,
  112.     UWORD,        1,    "SysFlags       ",0,
  113.     BYTE,        1,    "IDNestCnt      ",0,
  114.     BYTE,        1,    "TDNestCnt      ",0,
  115.     UWORD,        1,    "AttnFlags      ",0,
  116.     UWORD,        1,    "AttnResched    ",0,
  117.     LONG,        1,    "ResModules     ",0,
  118.     LONG,        1,    "TaskTrapCode   ",0,
  119.     LONG,        1,    "TaskExceptCode ",0,
  120.     LONG,        1,    "TaskExitCode   ",0,
  121.     ULONG,        1,    "TaskSigAlloc   ",0,
  122.     UWORD,        1,    "TaskTrapAlloc  ",0,
  123.     STRUCTURE,    1,    "MemList        ",3,
  124.     STRUCTURE,    1,    "ResourceList   ",3,
  125.     STRUCTURE,    1,    "DeviceList     ",3,
  126.     STRUCTURE,    1,    "IntrList       ",3,
  127.     STRUCTURE,    1,    "LibList        ",3,
  128.     STRUCTURE,    1,    "PortList       ",3,
  129.     STRUCTURE,    1,    "TaskReady      ",3,
  130.     STRUCTURE,    1,    "TaskWait       ",3,
  131.     STRUCTURE,    5,    "SoftInts       ",6,
  132.     LONG,        4,    "LastAlert      ",0,
  133.     UBYTE,        1,    "VBlankFrequency",0,
  134.     UBYTE,        1,    "PowerSupplyFreq",0,
  135.     STRUCTURE,    1,    "SemaphoreList  ",3,
  136.     LONG,        1,    "KickMemPtr     ",0,
  137.     LONG,        1,    "KickTagPtr     ",0,
  138.     LONG,        1,    "KickCheckSum   ",0,
  139.     UBYTE,        5,    "ExecBaseReserve",0,
  140.     UBYTE,        20,    "ExecBaseNewRese",0,
  141.  
  142.     STRUCTURE,    1,    "lib_Node       ",2,    /* 1 Library    */
  143.     UBYTE,        1,    "lib_Flags      ",0,
  144.     UBYTE,        1,    "lib_pag        ",0,
  145.     UWORD,        1,    "lib_NegSize    ",0,
  146.     UWORD,         1,    "lib_PosSize    ",0,
  147.     UWORD,         1,    "lib_Version    ",0,
  148.     UWORD,         1,    "lib_Revision   ",0,
  149.     STRINGPTR,    1,    "lib_IdString   ",0,
  150.     ULONG,         1,    "lib_Sum        ",0,
  151.     UWORD,         1,    "lib_OpenCnt    ",0,
  152.  
  153.     STRUCTUREPTR,    1,    "ln_Succ        ",1,    /* 2 Node    */
  154.     STRUCTUREPTR,    1,    "ln_Pred        ",1,
  155.     UBYTE,        1,    "ln_Type        ",0,
  156.     BYTE,        1,    "ln_Pri         ",0,
  157.     STRINGPTR,    1,    "ln_Name        ",0,
  158.  
  159.     STRUCTUREPTR,    1,    "lh_Head        ",2,    /* 3 List    */
  160.     STRUCTUREPTR,    1,    "lh_Tail        ",2,
  161.     STRUCTUREPTR,    1,    "lh_TailPred    ",2,
  162.     UBYTE,        1,    "lh_Type        ",0,
  163.     UBYTE,        1,    "l_pad          ",0,
  164.  
  165.     LONG,        1,    "iv_Data        ",0,    /* 4 IntVector    */
  166.     LONG,        1,    "iv_Code        ",0,
  167.     STRUCTUREPTR,    1,    "iv_Node        ",2,
  168.  
  169.     STRUCTURE,    1,    "tc_Node        ",2,    /* 5 Task    */
  170.     UBYTE,        1,    "tc_Flags       ",0,
  171.     UBYTE,        1,    "tc_State       ",0,
  172.     BYTE,        1,    "tc_IDNestCnt   ",0,
  173.     BYTE,        1,    "tc_TDNestCnt   ",0,
  174.     ULONG,        1,    "tc_SigAlloc    ",0,
  175.     ULONG,        1,    "tc_SigWait     ",0,
  176.     ULONG,        1,    "tc_SigRecvd    ",0,
  177.     ULONG,        1,    "tc_SigExcept   ",0,
  178.     UWORD,        1,    "tc_TrapAlloc   ",0,
  179.     UWORD,        1,    "tc_TrapAble    ",0,
  180.     LONG,        1,    "tc_ExceptData  ",0,
  181.     LONG,        1,    "tc_ExceptCode  ",0,
  182.     LONG,        1,    "tc_TrapData    ",0,
  183.     LONG,        1,    "tc_TrapCode    ",0,
  184.     LONG,        1,    "tc_SPReg       ",0,
  185.     LONG,        1,    "tc_SPLower     ",0,
  186.     LONG,        1,    "tc_SPUpper     ",0,
  187.     LONG,        1,    "tc_Switch      ",0,
  188.     LONG,        1,    "tc_Launch      ",0,
  189.     STRUCTURE,    1,    "tc_MemEntry    ",3,
  190.     LONG,        1,    "tc_UserData    ",0,
  191.     
  192.     STRUCTURE,    1,    "sh_List        ",3,    /* 6 SoftIntList*/
  193.     UWORD,        1,    "sh_pad         ",0,
  194.  
  195.     STRUCTURE,    1,    "LibNode        ",1,    /* 7 IntuitionBase*/
  196.     STRUCTURE,    1,    "ViewLord       ",8,
  197.     STRUCTUREPTR,    1,    "ActiveWindow   ",9,
  198.     STRUCTUREPTR,    1,    "ActiveScreen   ",10,
  199.     STRUCTUREPTR,    1,    "FirstScreen    ",10,
  200.     ULONG,        1,    "Flags          ",0,
  201.     WORD,        1,    "MouseY         ",0,
  202.     WORD,        1,    "MouseX         ",0,
  203.     ULONG,        1,    "Seconds        ",0,
  204.     ULONG,        1,    "Micros         ",0,
  205.     WORD,        1,    "MinXMouse      ",0,
  206.     WORD,        1,    "MaxXMouse      ",0,
  207.     WORD,        1,    "MinYMouse      ",0,
  208.     WORD,        1,    "MaxYMouse      ",0,
  209.     ULONG,        1,    "StartSecs      ",0,
  210.     ULONG,        1,    "StartMicros    ",0,
  211.     STRUCTUREPTR,    1,    "SysBase        ",0,
  212.     STRUCTUREPTR,    1,    "GfxBase        ",11,
  213.     LONG,        1,    "LayersBase     ",0,
  214.     LONG,        1,    "ConsoleDevice  ",0,
  215.     LONG,        1,    "APointer       ",0,
  216.     BYTE,        1,    "APtrHeight     ",0,
  217.     BYTE,        1,    "APtrWidth      ",0,
  218.     BYTE,        1,    "AXOffset       ",0,
  219.     BYTE,        1,    "AYOffset       ",0,
  220.     UWORD,        1,    "MenuDrawn      ",0,
  221.     UWORD,        1,    "MenuSelected   ",0,
  222.     UWORD,        1,    "OptionList     ",0,
  223.     STRUCTURE,    1,    "MenuRPort      ",12,
  224.     STRUCTURE,    1,    "MenuTmpRas     ",13,
  225.     STRUCTURE,    1,    "ItemCRect      ",14,
  226.     STRUCTURE,    1,    "SubCRect       ",14,
  227.     STRUCTURE,    1,    "IBitMap        ",15,
  228.     STRUCTURE,    1,    "SBitMap        ",15,
  229.     STRUCTURE,    1,    "InputRequest   ",16,
  230.     STRUCTURE,    1,    "InputInterrupt ",17,
  231.     STRUCTUREPTR,    1,    "EventKey       ",18,
  232.     STRUCTUREPTR,    1,    "IEvents        ",19,
  233.     WORD,        1,    "EventCount     ",0,
  234.     STRUCTURE,    4,    "IEBuffer       ",19,
  235.     STRUCTUREPTR,    1,    "ActiveGadget   ",20,
  236.     STRUCTUREPTR,    1,    "ActivePInfo    ",21,
  237.     STRUCTUREPTR,    1,    "ActiveImage    ",22,
  238.     STRUCTURE,    1,    "GadgetEnv      ",23,
  239.     STRUCTURE,    1,    "GadgetInfo     ",24,
  240.     STRUCTURE,    1,    "KnobOffset     ",25,
  241.     STRUCTUREPTR,    1,    "getOKWindow    ",9,
  242.     STRUCTUREPTR,    1,    "getOKMessage   ",26,
  243.     UWORD,        1,    "setWExcept     ",0,
  244.     UWORD,        1,    "GadgetReturn   ",0,
  245.     UWORD,        1,    "StateReturn    ",0,
  246.     STRUCTUREPTR,    1,    "RP             ",12,
  247.     STRUCTURE,    1,    "ITmpRas        ",13,
  248.     STRUCTUREPTR,    1,    "OldClipRegion  ",27,
  249.     STRUCTURE,    1,    "OldScroll      ",25,
  250.     STRUCTURE,    1,    "IFrame         ",29,
  251.     WORD,        1,    "hthick         ",0,
  252.     WORD,        1,    "vthick         ",0,
  253.     LONG,        1,    "frameChange    ",0,
  254.     LONG,        1,    "sizeDrag       ",0,
  255.     STRUCTURE,    1,    "FirstPt        ",25,
  256.     STRUCTURE,    1,    "OldPt          ",25,
  257.     STRUCTUREPTR,    16,    "SysGadgets     ",20,
  258.     STRUCTUREPTR,    2,    "CheckImage     ",22,
  259.     STRUCTUREPTR,    2,    "AmigaIcon      ",22,
  260.     UWORD,        8,    "apattern       ",0,
  261.     UWORD,        4,    "bpattern       ",0,
  262.     LONG,        1,    "IPointer       ",0,
  263.     BYTE,        1,    "IPtrHeight     ",0,
  264.     BYTE,        1,    "IPtrWidth      ",0,
  265.     BYTE,        1,    "IXOffset       ",0,
  266.     BYTE,        1,    "IYOffset       ",0,
  267.     LONG,        1,    "DoubleSeconds  ",0,
  268.     LONG,        1,    "DoubleMicros   ",0,
  269.     BYTE,        2,    "WBorLeft       ",0,
  270.     BYTE,        2,    "WBorTop        ",0,
  271.     BYTE,        2,    "WBorRight      ",0,
  272.     BYTE,        2,    "WBorBottom     ",0,
  273.     BYTE,        2,    "BarVBorder     ",0,
  274.     BYTE,        2,    "BarHBorder     ",0,
  275.     BYTE,        2,    "MenuVBorder    ",0,
  276.     BYTE,        2,    "MenuHBorder    ",0,
  277.     UWORD,        1,    "color0         ",0,
  278.     UWORD,        1,    "color1         ",0,
  279.     UWORD,        1,    "color2         ",0,
  280.     UWORD,        1,    "color3         ",0,
  281.     UWORD,        1,    "color17        ",0,
  282.     UWORD,        1,    "color18        ",0,
  283.     UWORD,        1,    "color19        ",0,
  284.     STRUCTURE,    1,    "SysFont        ",30,
  285.     STRUCTUREPTR,    1,    "Preferences    ",31,
  286.     LONG,        1,    "Echoes         ",0,
  287.     WORD,        1,    "ViewInitX      ",0,
  288.     WORD,        1,    "ViewInitY      ",0,
  289.     WORD,        1,    "CursorDX       ",0,
  290.     WORD,        1,    "CursorDY       ",0,
  291.     STRUCTUREPTR,    1,    "KeyMap         ",32,
  292.     WORD,        1,    "MouseYMinimum  ",0,
  293.     WORD,        1,    "ErrorX         ",0,
  294.     WORD,        1,    "ErrorY         ",0,
  295.     STRUCTURE,    1,    "IOExcess       ",33,
  296.     WORD,        1,    "HoldMinYMouse  ",0,
  297.     STRUCTUREPTR,    1,    "WBPort         ",35,
  298.     STRUCTUREPTR,    1,    "iqd_FNKUHDPort ",35,
  299.     STRUCTURE,    1,    "WBMessage      ",26,
  300.     STRUCTUREPTR,    1,    "HitScreen      ",10,
  301.     STRUCTUREPTR,    1,    "SimpleSprite   ",36,
  302.     STRUCTUREPTR,    1,    "AttachedSSprite",36,
  303.     BYTE,        1,    "GotSprite1     ",0,
  304.     STRUCTURE,    1,    "SemaphoreList  ",3,
  305.     STRUCTURE,    7,    "ISemaphore     ",37,
  306.     WORD,        1,    "MaxDisplayH.ght",0,
  307.     WORD,        1,    "MaxDisplayRow  ",0,
  308.     WORD,        1,    "MaxDisplayWidth",0,
  309.     ULONG,        7,    "Reserved       ",0,
  310.  
  311.     STRUCTUREPTR,    1,    "ViewPort       ",38,    /* 8 View */
  312.     STRUCTUREPTR,    1,    "LOFCprList     ",40,
  313.     STRUCTUREPTR,    1,    "SHFCprList     ",40,
  314.     WORD,         1,    "DyOffset       ",0,
  315.     WORD,         1,    "DxOffset       ",0,
  316.     UWORD,        1,    "Modes          ",0,
  317.  
  318.     STRUCTUREPTR,    1,    "NextWindow     ",9,    /* 9 Window */
  319.     WORD,        1,    "LeftEdge       ",0,
  320.     WORD,        1,    "TopEdge        ",0,
  321.     WORD,        1,    "Width          ",0,
  322.     WORD,        1,    "Height         ",0,
  323.     WORD,        1,    "MouseY         ",0,
  324.     WORD,        1,    "MouseX         ",0,
  325.     WORD,        1,    "MinWidth       ",0,
  326.     WORD,        1,    "MinHeight      ",0,
  327.     UWORD,        1,    "MaxWidth       ",0,
  328.     UWORD,        1,    "MaxHeight      ",0,
  329.     ULONG,        1,    "Flags          ",0,
  330.     STRUCTUREPTR,    1,    "MenuStrip      ",41,
  331.     STRINGPTR,     1,    "Title          ",0,
  332.     STRUCTUREPTR,    1,    "FirstRequest   ",43,
  333.     STRUCTUREPTR,    1,    "DMRequest      ",43,
  334.     WORD,        1,    "ReqCount       ",0,
  335.     STRUCTUREPTR,    1,    "WScreen        ",10,
  336.     STRUCTUREPTR,    1,    "RPort          ",12,
  337.     BYTE,        1,    "BorderLeft     ",0,
  338.     BYTE,        1,    "BorderTop      ",0,
  339.     BYTE,        1,    "BorderRight    ",0,
  340.     BYTE,        1,    "BorderBottom   ",0,
  341.     STRUCTUREPTR,    1,    "BorderRPort    ",12,
  342.     STRUCTUREPTR,    1,    "FirstGadget    ",20,
  343.     STRUCTUREPTR,    1,    "Parent         ",9,
  344.     STRUCTUREPTR,    1,    "Descendant     ",9,
  345.     LONG,        1,    "Pointer        ",0,
  346.     BYTE,        1,    "PtrHeight    ",0,
  347.     BYTE,        1,    "PtrWidth       ",0,
  348.     BYTE,        1,    "XOffset        ",0,
  349.     BYTE,        1,    "YOffset        ",0,
  350.     ULONG,        1,    "IDCMPFlags     ",0,
  351.     STRUCTUREPTR,    1,    "UserPort       ",35,
  352.     STRUCTUREPTR,    1,    "WindowPort     ",35,
  353.     STRUCTUREPTR,    1,    "MessageKey     ",26,
  354.     UBYTE,        1,    "DetailPen      ",0,
  355.     UBYTE,        1,    "BlockPen       ",0,
  356.     STRUCTUREPTR,    1,    "CheckMark      ",22,
  357.     STRINGPTR,    1,    "ScreenTitle    ",0,
  358.     WORD,        1,    "GZZMouseX      ",0,
  359.     WORD,        1,    "GZZMouseY      ",0,
  360.     WORD,        1,    "GZZWidth       ",0,
  361.     WORD,        1,    "GZZHeight      ",0,
  362.     LONG,        1,    "ExtData        ",0,
  363.     LONG,        1,    "UserData       ",0,
  364.     STRUCTUREPTR,    1,    "WLayer         ",44,
  365.     STRUCTUREPTR,    1,    "IFont          ",45,
  366.  
  367.     STRUCTUREPTR,    1,    "NextScreen     ",10,    /* 10 Screen */
  368.     STRUCTUREPTR,    1,    "FirstWindow    ",9,
  369.     WORD,        1,    "LeftEdge       ",0,
  370.     WORD,        1,    "TopEdge        ",0,
  371.     WORD,        1,    "Width          ",0,
  372.     WORD,        1,    "Height         ",0,
  373.     WORD,        1,    "MouseY         ",0,
  374.     WORD,        1,    "MouseX         ",0,
  375.     UWORD,        1,    "Flags          ",0,
  376.     STRINGPTR,    1,    "Title        ",0,
  377.     STRINGPTR,    1,    "DefaultTitle   ",0,
  378.     BYTE,        1,    "BarHeight      ",0,
  379.     BYTE,        1,    "BarVBorder     ",0,
  380.     BYTE,        1,    "BarHBorder     ",0,
  381.     BYTE,        1,    "MenuVBorder    ",0,
  382.     BYTE,        1,    "MenuHBorder    ",0,
  383.     BYTE,        1,    "WBorTop        ",0,
  384.     BYTE,        1,    "WBorLeft       ",0,
  385.     BYTE,        1,    "WBorRight      ",0,
  386.     BYTE,        1,    "WBorBottom     ",0,
  387.     STRUCTUREPTR,    1,    "Font           ",30,
  388.     STRUCTURE,    1,    "ViewPort       ",38,
  389.     STRUCTURE,    1,    "RastPort       ",12,
  390.     STRUCTURE,    1,    "BitMap         ",15,
  391.     STRUCTURE,    1,    "LayerInfo      ",46,
  392.     STRUCTUREPTR,    1,    "FirstGadget    ",20,
  393.     UBYTE,        1,    "DetailPen      ",0,
  394.     UBYTE,        1,    "BlockPen       ",0,
  395.     UWORD,        1,    "SaveColor0     ",0,
  396.     STRUCTUREPTR,    1,    "BarLayer       ",44,
  397.     LONG,        1,    "ExtData        ",0,
  398.     LONG,        1,    "UserData       ",0,
  399.  
  400.     STRUCTURE,    1,    "LibNode        ",1,    /* 11 GfxBase */
  401.     STRUCTUREPTR,    1,    "ActiView       ",8,
  402.     STRUCTUREPTR,    1,    "copinit        ",47,
  403.     LONG,        1,    "cia            ",0,
  404.     LONG,        1,    "blitter        ",0,
  405.     LONG,        1,    "LOFlist        ",0,
  406.     LONG,        1,    "SHFlist        ",0,
  407.     LONG,        1,    "blthd          ",0,
  408.     LONG,        1,    "blttl          ",0,
  409.     LONG,        1,    "bsblthd        ",0,
  410.     LONG,        1,    "bsblttl        ",0,
  411.     STRUCTURE,    1,    "vbsrv          ",17,
  412.     STRUCTURE,    1,    "timsrv         ",17,
  413.     STRUCTURE,    1,    "bltsrv         ",17,
  414.     STRUCTURE,    1,    "TextFonts      ",3,
  415.     STRUCTUREPTR,    1,    "DefaultFont    ",45,
  416.     UWORD,        1,    "Modes          ",0,
  417.     BYTE,        1,    "VBlank         ",0,
  418.     BYTE,        1,    "Debug          ",0,
  419.     WORD,        1,    "BeamSync       ",0,
  420.     WORD,        1,    "system_bplcon0 ",0,
  421.     UBYTE,        1,    "SpriteReserved ",0,
  422.     UBYTE,        1,    "bytereserved   ",0,
  423.     UWORD,        1,    "Flags          ",0,
  424.     WORD,        1,    "BlitLock       ",0,
  425.     WORD,        1,    "BlitNest       ",0,
  426.     STRUCTURE,    1,    "BlitWaitQ      ",3,
  427.     STRUCTUREPTR,    1,    "BlitOwner      ",5,
  428.     STRUCTURE,    1,    "TOF_WaitQ      ",3,
  429.     UWORD,        1,    "DisplayFlags   ",0,
  430.     STRUCTUREPTR,    1,    "SimpleSprites  ",36,
  431.     UWORD,        1,    "MaxDisplayRow  ",0,
  432.     UWORD,        1,    "MaxDisplayCol  ",0,
  433.     UWORD,        1,    "NormalDisplayRs",0,
  434.     UWORD,        1,    "NormalDisplayCs",0,
  435.     UWORD,        1,    "NormalDPMX     ",0,
  436.     UWORD,        1,    "NormalDPMY     ",0,
  437.     STRUCTUREPTR,    1,    "LastChanceMem  ",37,
  438.     UWORD,        1,    "LCMptr         ",0,
  439.     UWORD,        1,    "MicrosPerLine  ",0,
  440.     ULONG,        2,    "reserved       ",0,
  441.  
  442.     STRUCTUREPTR,    1,    "Layer          ",44,   /* 12 RastPort */
  443.     STRUCTUREPTR,    1,    "BitMap         ",15,
  444.     LONG,        1,    "AreaPtrn       ",0,
  445.     STRUCTUREPTR,    1,    "TmpRas         ",13,
  446.     STRUCTUREPTR,    1,    "AreaInfo       ",48,
  447.     STRUCTUREPTR,    1,    "GelsInfo       ",49,
  448.     UBYTE,        1,    "Mask           ",0,
  449.     BYTE,        1,    "FgPen          ",0,
  450.     BYTE,        1,    "BgPen          ",0,
  451.     BYTE,        1,    "AOlPen         ",0,
  452.     BYTE,        1,    "DrawMode       ",0,
  453.     BYTE,        1,    "AreaPtSz       ",0,
  454.     BYTE,        1,    "linpatcnt      ",0,
  455.     BYTE,        1,    "dummy          ",0,
  456.     UWORD,        1,    "Flags          ",0,
  457.     UWORD,        1,    "LinePtrn       ",0,
  458.     WORD,        1,    "cp_x           ",0,
  459.     WORD,        1,    "cp_y           ",0,
  460.     UBYTE,        8,    "minterms    ",0,
  461.     WORD,        1,    "PenWidth       ",0,
  462.     WORD,        1,    "PenHeight      ",0,
  463.     STRUCTUREPTR,    1,    "Font           ",45,
  464.     UBYTE,        1,    "AlgoStyle      ",0,
  465.     UBYTE,        1,    "TxFlags        ",0,
  466.     UWORD,        1,    "TxHeight       ",0,
  467.     UWORD,        1,    "TxWidth        ",0,
  468.     UWORD,        1,    "TxBaseline     ",0,
  469.     WORD,        1,    "TxSpacing      ",0,
  470.     LONG,        1,    "RP_User        ",0,
  471.     ULONG,        2,    "longreserved   ",0,
  472.     UWORD,        7,    "wordreserved   ",0,
  473.     UBYTE,        8,    "reserved       ",0,
  474.  
  475.     LONG,        1,    "RasPtr         ",0,    /* 13 TmpRas */
  476.     LONG,        1,    "Size           ",0,
  477.  
  478.     STRUCTUREPTR,    1,    "Next           ",14,    /* 14 ClipRect */
  479.     STRUCTUREPTR,    1,    "prev           ",14,
  480.     STRUCTUREPTR,    1,    "lobs           ",44,
  481.     STRUCTUREPTR,    1,    "BitMap         ",15,
  482.     STRUCTURE,    1,    "bounds         ",50,
  483.     STRUCTUREPTR,    1,    "_p1            ",14,
  484.     STRUCTUREPTR,    1,    "_p2            ",14,
  485.     LONG,        1,    "reserved       ",0,
  486.     LONG,        1,    "Flags          ",0, /* only V1.1 */
  487.  
  488.     UWORD,        1,    "BytesPerRow    ",0,    /* 15 BitMap    */
  489.     UWORD,        1,    "Rows           ",0,
  490.     UBYTE,        1,    "Flags          ",0,
  491.     UBYTE,        1,    "Depth          ",0,
  492.     UWORD,        1,    "pad            ",0,
  493.     LONG,        8,    "Planes         ",0,
  494.  
  495.     STRUCTURE,    1,    "io_Message     ",51, /* 16 IOStdReq */
  496.     STRUCTUREPTR,    1,    "io_Device      ",52,
  497.     STRUCTUREPTR,    1,    "io_Unit        ",53,
  498.     UWORD,        1,    "io_Command     ",0,
  499.     UBYTE,        1,    "io_Flags       ",0,
  500.     BYTE,        1,    "io_Error       ",0,    
  501.     ULONG,        1,    "io_Actual      ",0,
  502.     ULONG,        1,    "io_Length      ",0,
  503.     LONG,        1,    "io_Data        ",0,
  504.     ULONG,        1,    "io_Offset      ",0,
  505.  
  506.     STRUCTURE,    1,    "is_Node        ",2,    /* 17 Interrupt    */
  507.     LONG,        1,    "is_Data        ",0,
  508.     LONG,        1,    "is_Code        ",0,
  509.  
  510.     STRUCTUREPTR,    1,    "NextRemember   ",18,   /* 18 Remember */
  511.     ULONG,        1,    "RememberSize   ",0,
  512.     LONG,        1,    "Memory         ",0,
  513.  
  514.     STRUCTUREPTR,    1,    "ie_NextEvent   ",19,   /* 19 InputEvent */
  515.     UBYTE,        1,    "ie_Class       ",0,
  516.     UBYTE,        1,    "ie_SubClass    ",0,
  517.     UWORD,        1,    "ie_Code        ",0,
  518.     UWORD,        1,    "ie_Qualifier   ",0,    
  519.     WORD,        1,    "ie_x(ie_addrhi)",0,
  520.     WORD,        1,    "ie_y(ie_addrlo)",0,
  521.     STRUCTURE,    1,    "ie_TimeStamp   ",34,
  522.  
  523.     STRUCTUREPTR,    1,    "NextGadget     ",20,    /* 20 Gadget */
  524.     WORD,        1,    "LeftEdge       ",0,
  525.     WORD,        1,    "TopEdge        ",0,
  526.     WORD,        1,    "Width          ",0,
  527.     WORD,        1,    "Height         ",0,
  528.     UWORD,        1,    "Flags          ",0,
  529.     UWORD,        1,    "Activation     ",0,
  530.     UWORD,        1,    "GadgetType     ",0,
  531.     LONG,        1,    "GadgetRender   ",0,
  532.     LONG,        1,    "SelectRender   ",0,
  533.     STRUCTUREPTR,    1,    "GadgetText     ",54,    
  534.     LONG,        1,    "MutualExclude  ",0,
  535.     LONG,        1,    "SpecialInfo    ",0,
  536.     UWORD,        1,    "GadgetID       ",0,
  537.     LONG,        1,    "UserData       ",0,
  538.  
  539.     UWORD,        1,    "Flags          ",0,    /* 21 PropInfo */
  540.     UWORD,        1,    "HorizPot       ",0,
  541.     UWORD,        1,    "VertPot        ",0,
  542.     UWORD,        1,    "HorizBody      ",0,
  543.     UWORD,        1,    "VertBody       ",0,
  544.     UWORD,        1,    "CWidth         ",0,
  545.     UWORD,        1,    "CHeight        ",0,
  546.     UWORD,        1,      "HPotRes        ",0,
  547.     UWORD,        1,      "VPotRes        ",0,
  548.     UWORD,        1,    "LeftBorder     ",0,
  549.     UWORD,        1,    "TopBorder      ",0,
  550.  
  551.     WORD,        1,    "LeftEdge       ",0,    /* 22 Image  */    
  552.     WORD,        1,    "TopEdge        ",0,
  553.     WORD,        1,    "Width          ",0,
  554.     WORD,        1,    "Height         ",0,
  555.     WORD,        1,    "Depth          ",0,
  556.     LONG,        1,    "ImageData      ",0,
  557.     UBYTE,        1,    "PlanePick      ",0,
  558.     UBYTE,        1,    "PlaneOnOff     ",0,
  559.     STRUCTUREPTR,    1,    "NextImage      ",22,
  560.  
  561.     STRUCTUREPTR,    1,    "ge_Screen      ",10,    /* 23 GListEnv */
  562.     STRUCTUREPTR,    1,     "ge_Window      ",9,
  563.     STRUCTUREPTR,    1,    "ge_Requester   ",43,
  564.     STRUCTUREPTR,    1,    "ge_RastPort    ",12,
  565.     STRUCTUREPTR,    1,    "ge_Layer       ",44,
  566.     STRUCTUREPTR,    1,    "ge_GZZLayer    ",44,
  567.     STRUCTURE,    1,    "ge_Pens        ",55,
  568.     STRUCTURE,    1,    "ge_Domain      ",29,
  569.     STRUCTURE,    1,    "ge_GZZdims     ",29,
  570.  
  571.     STRUCTUREPTR,    1,    "gi_Environ     ",23,   /* 24 GadgetInfo */
  572.     STRUCTUREPTR,    1,    "gi_Gadget      ",20,
  573.     STRUCTURE,    1,    "gi_Box         ",29,
  574.     STRUCTURE,    1,    "gi_Container    ",29,
  575.     STRUCTUREPTR,    1,    "gi_Layer       ",44,
  576.     STRUCTURE,    1,    "gi_NewKnob     ",29,
  577.  
  578.     WORD,        1,    "X              ",0,    /* 25 Point */
  579.     WORD,        1,    "Y              ",0,
  580.  
  581.     STRUCTURE,    1,    "ExecMessage    ",51, /* 26 IntuiMessage*/
  582.     ULONG,        1,    "Class          ",0,
  583.     UWORD,        1,    "Code           ",0,
  584.     UWORD,        1,    "Qualifier      ",0,
  585.     LONG,        1,    "IAddress       ",0,
  586.     WORD,        1,    "MouseX         ",0,
  587.     WORD,        1,    "MouseY         ",0,
  588.     ULONG,        1,    "Seconds        ",0,
  589.     ULONG,        1,    "Micros         ",0,
  590.     STRUCTUREPTR,    1,    "IDCMPWindow    ",9,
  591.     STRUCTUREPTR,    1,    "SpecialLink    ",26,
  592.  
  593.     STRUCTURE,    1,    "bounds         ",50, /* 27 Region */
  594.     STRUCTUREPTR,    1,    "RegionRectangle",28,
  595.  
  596.     STRUCTUREPTR,    1,    "Next           ",28,    /* 28 RegionRectangle*/
  597.     STRUCTUREPTR,    1,    "Prev           ",28,
  598.     STRUCTURE,    1,    "bounds         ",50,
  599.  
  600.     WORD,        1,    "Left           ",0,    /* 29 IBox */
  601.     WORD,        1,    "Top            ",0,
  602.     WORD,        1,    "Width          ",0,
  603.     WORD,        1,    "Height         ",0,
  604.  
  605.     STRINGPTR,    1,    "ta_Name        ",0,    /* 30 TextAttr    */
  606.     UWORD,        1,    "ta_YSize       ",0,
  607.     UBYTE,        1,    "ta_Style       ",0,
  608.     UBYTE,        1,    "ta_Flags    ",0,
  609.  
  610.     BYTE,        1,    "FontHeight     ",0,    /* 31 Preferences */
  611.     UBYTE,        1,    "PrinterPort    ",0,
  612.     UWORD,        1,    "BaudRate       ",0,
  613.     STRUCTURE,    1,    "KeyRptSpeed    ",34,
  614.     STRUCTURE,    1,    "KeyRptDelay    ",34,
  615.     STRUCTURE,    1,    "DoubleClick    ",34,
  616.     UWORD,        36,    "PointerMatrix  ",0,
  617.     BYTE,        1,    "XOffset        ",0,
  618.     BYTE,        1,    "YOffset        ",0,
  619.     UWORD,        1,    "color17        ",0,
  620.     UWORD,        1,    "color18        ",0,
  621.     UWORD,        1,    "color19        ",0,
  622.     UWORD,        1,    "PointerTicks   ",0,
  623.     UWORD,        1,    "color0         ",0,
  624.     UWORD,        1,    "color1         ",0,
  625.     UWORD,        1,    "color2         ",0,
  626.     UWORD,        1,    "color3         ",0,
  627.     BYTE,        1,    "ViewXOffset    ",0,
  628.     BYTE,        1,    "ViewYOffset    ",0,
  629.     WORD,        1,    "ViewInitX      ",0,
  630.     WORD,        1,    "ViewInitY      ",0,
  631.     WORD,        1,    "EnableCLI      ",0,
  632.     UWORD,        1,    "PrinterType    ",0,
  633.     STRING,        1,    "PrinterFilename",30,
  634.     UWORD,        1,    "PrintPitch     ",0,
  635.     UWORD,        1,    "PrintQuality   ",0,
  636.     UWORD,        1,    "PrintSpacing   ",0,
  637.     UWORD,        1,    "PrintLeftMargin",0,
  638.     UWORD,        1,    "PrintRightMarg.",0,
  639.     UWORD,        1,    "PrintImage     ",0,
  640.     UWORD,        1,    "PrintAspect    ",0,
  641.     UWORD,        1,    "PrintShade     ",0,
  642.     WORD,        1,    "PrintThreshold ",0,
  643.     UWORD,        1,    "PaperSize      ",0,
  644.     UWORD,        1,    "PaperLength    ",0,
  645.     UWORD,        1,    "PaperType      ",0,
  646.     UBYTE,        1,    "SerRWBits      ",0,
  647.     UBYTE,        1,    "SerStopBuf     ",0,
  648.     UBYTE,        1,    "SerParShk      ",0,
  649.     UBYTE,        1,    "LaceWB         ",0,
  650.     STRING,        1,    "WorkName       ",30,
  651.     BYTE,        1,    "RowSizeChange  ",0,
  652.     BYTE,        1,    "ColumnSizeChnge",0,
  653.     BYTE,        14,    "padding        ",0,
  654.  
  655.     LONG,        1,    "km_LoKeyMapTps ",0,    /* 32 KeyMap */
  656.     LONG,        1,    "km_LoKeyMap    ",0,
  657.     LONG,        1,    "km_LoCapsable  ",0,
  658.     LONG,        1,    "km_LoRepeatable",0,
  659.     LONG,        1,    "km_HiKeyMapTps ",0,
  660.     LONG,        1,    "km_HiKeyMap    ",0,
  661.     LONG,        1,    "km_HiCapsable  ",0,
  662.     LONG,        1,    "km_HiRepeatable",0,
  663.  
  664.     STRUCTURE,    1,    "tr_node        ",56,    /* 33 timerequest*/
  665.     STRUCTURE,    1,    "tr_time        ",34,
  666.  
  667.     ULONG,        1,    "tv_secs        ",0,    /* 34 timeval    */
  668.     ULONG,        1,    "tv_micro       ",0,
  669.  
  670.     STRUCTURE,    1,    "mp_Node        ",2,    /* 35 MsgPort    */
  671.     UBYTE,        1,    "mp_Flags       ",0,
  672.     UBYTE,        1,    "mp_SigBit      ",0,
  673.     STRUCTUREPTR,    1,    "mp_SigTask     ",5,
  674.     STRUCTURE,    1,    "mp_MsgList     ",3,
  675.  
  676.     LONG,        1,    "posctldata     ",0,    /* 36 SimpleSprite    */
  677.     UWORD,        1,    "height         ",0,
  678.     UWORD,        1,    "x              ",0,
  679.     UWORD,        1,    "y              ",0,
  680.     UWORD,        1,    "num            ",0,
  681.  
  682.     STRUCTURE,    1,    "ss_Link        ",2,    /* 37 SignalSemaphore */
  683.     WORD,        1,    "ss_NestCount   ",0,
  684.     STRUCTURE,    1,    "ss_WaitQueue   ",57,
  685.     STRUCTURE,    1,    "ss_MultipleLink",38,
  686.     STRUCTUREPTR,    1,    "ss_Owner       ",5,
  687.     WORD,        1,    "ss_QueueCount  ",0,
  688.  
  689.     STRUCTURE,    1,    "sr_Link        ",58, /* 38 SemaphoreRequest */
  690.     STRUCTUREPTR,    1,    "sr_Waiter      ",5,
  691.  
  692.     STRUCTUREPTR,    1,    "Next           ",39,    /* 39 ViewPort */
  693.     STRUCTUREPTR,    1,    "ColorMap       ",63,
  694.     STRUCTUREPTR,    1,    "DspIns         ",59,
  695.     STRUCTUREPTR,    1,    "SprIns         ",59,
  696.     STRUCTUREPTR,    1,    "ClrIns         ",59,
  697.     STRUCTUREPTR,    1,    "UCopIns        ",60,
  698.     WORD,        1,    "DWidth         ",0,
  699.     WORD,        1,    "DHeight        ",0,
  700.     WORD,        1,    "DxOffset       ",0,
  701.     WORD,        1,    "DyOffset       ",0,
  702.     UWORD,        1,    "Modes          ",0,
  703.     UBYTE,        1,    "SpritePri      ",0,
  704.     UBYTE,        1,    "reserved       ",0,
  705.     STRUCTUREPTR,    1,    "RasInfo        ",62,
  706.  
  707.     STRUCTUREPTR,    1,    "Next           ",40,    /* 40 cprlist */
  708.     LONG,        1,    "start          ",0,
  709.     WORD,        1,    "MaxCount       ",0,
  710.  
  711.     STRUCTUREPTR,    1,    "NextMenu       ",41,    /* 41 Menu    */
  712.     WORD,        1,    "LeftEdge       ",0,
  713.     WORD,        1,    "TopEdge        ",0,
  714.     WORD,        1,    "Width          ",0,
  715.     WORD,        1,    "Height         ",0,
  716.     UWORD,        1,    "Flags          ",0,
  717.     STRINGPTR,    1,    "MenuName       ",0,
  718.     STRUCTUREPTR,    1,    "FirstItem      ",42,
  719.     WORD,        1,    "JazzX          ",0,
  720.     WORD,        1,    "JazzY          ",0,
  721.     WORD,        1,    "BeatX          ",0,
  722.     WORD,        1,    "BeatY          ",0,
  723.  
  724.     WORD,        1,    "LeftEdge       ",0,    /* 42 MenuItem    */
  725.     WORD,        1,    "TopEdge        ",0,
  726.     WORD,        1,    "Width          ",0,
  727.     WORD,        1,    "Height         ",0,
  728.     UWORD,        1,    "Flags          ",0,
  729.     LONG,        1,    "MutualExclude  ",0,
  730.     LONG,        1,    "ItemFill       ",54,
  731.     LONG,        1,    "SelectFill     ",54,
  732.     BYTE,        1,    "Command        ",0,
  733.     STRUCTUREPTR,    1,    "SubItem        ",42,
  734.     UWORD,        1,    "NextSelect     ",0,
  735.  
  736.     STRUCTUREPTR,    1,    "OlderRequest   ",43,    /* 43 Requester */
  737.     WORD,        1,    "LeftEdge       ",0,
  738.     WORD,        1,    "TopEdge        ",0,
  739.     WORD,        1,    "Width          ",0,
  740.     WORD,        1,    "Height         ",0,
  741.     WORD,        1,    "RelLeft        ",0,
  742.     WORD,        1,    "RelTop         ",0,
  743.     STRUCTUREPTR,    1,    "ReqGadget      ",20,
  744.     STRUCTUREPTR,    1,    "ReqBorder      ",64,
  745.     STRUCTUREPTR,    1,    "ReqText        ",54,
  746.     UWORD,        1,    "Flags          ",0,
  747.     UBYTE,        1,    "BackFill       ",0,
  748.     STRUCTUREPTR,    1,    "ReqLayer       ",44,
  749.     UBYTE,        32,    "ReqPad1        ",0,
  750.     STRUCTUREPTR,    1,    "ImageBMap      ",15,
  751.     STRUCTUREPTR,    1,    "RWindow        ",9,
  752.     UBYTE,        36,    "ReqPad2        ",0,
  753.  
  754.     STRUCTUREPTR,    1,    "front          ",44,    /* 44 Layer */
  755.     STRUCTUREPTR,    1,    "back           ",44,
  756.     STRUCTUREPTR,    1,    "ClipRect       ",14,
  757.     STRUCTUREPTR,    1,    "rp             ",12,
  758.     STRUCTURE,    1,    "bounds         ",50,
  759.     UBYTE,        4,    "reserved       ",0,
  760.     UWORD,        1,    "priority       ",0,
  761.     UWORD,        1,    "Flags          ",0,
  762.     STRUCTUREPTR,    1,    "SuperBitMap    ",15,
  763.     STRUCTUREPTR,    1,    "SuperClipRect  ",14,
  764.     STRUCTUREPTR,    1,    "Window         ",9,
  765.     WORD,        1,    "Scroll_X       ",0,
  766.     WORD,        1,    "Scroll_Y       ",0,
  767.     STRUCTUREPTR,    1,    "cr             ",14,
  768.     STRUCTUREPTR,    1,    "cr2            ",14,
  769.     STRUCTUREPTR,    1,    "crnew          ",14,
  770.     STRUCTUREPTR,    1,    "SuprSavClpRects",14,
  771.     STRUCTUREPTR,    1,    "_cliprects     ",14,
  772.     STRUCTUREPTR,    1,    "LayerInfo      ",46,
  773.     STRUCTURE,    1,    "Lock           ",37,
  774.     UBYTE,        8,    "reserved3      ",0,
  775.     STRUCTUREPTR,    1,    "ClipRegion     ",27,
  776.     STRUCTUREPTR,    1,    "saveClipRects  ",27,
  777.     UBYTE,        22,    "reserved2      ",0,
  778.     STRUCTUREPTR,    1,    "DamageList     ",27,
  779.  
  780.     STRUCTURE,    1,    "tf_Message     ",51,    /* 45 TextFont*/
  781.     UWORD,        1,    "tf_YSize       ",0,
  782.     UBYTE,        1,    "tf_Style       ",0,
  783.     UBYTE,        1,    "tf_Flags       ",0,
  784.     UWORD,        1,    "tf_XSize       ",0,
  785.     UWORD,        1,    "tf_Baseline    ",0,
  786.     UWORD,        1,    "tf_BoldSmear   ",0,
  787.     UWORD,        1,    "tf_Accessors   ",0,
  788.     UBYTE,        1,    "tf_LoChar      ",0,
  789.     UBYTE ,        1,    "tf_HiChar      ",0,
  790.     LONG,        1,    "tf_CharData    ",0,
  791.     UWORD,        1,    "tf_Modulo      ",0,
  792.     LONG,        1,    "tf_CharLoc     ",0,
  793.     LONG,        1,    "tf_CharSpace   ",0,
  794.     LONG,        1,    "tf_CharKern    ",0,
  795.  
  796.     STRUCTUREPTR,    1,    "top_layer      ",44,    /* 46 Layer_Info */
  797.     STRUCTUREPTR,    1,    "check_lp       ",44,
  798.     STRUCTUREPTR,    1,    "obs            ",44,
  799.     STRUCTURE,    1,    "FreeClipRects  ",57,
  800.     STRUCTURE,    1,    "Lock           ",37,
  801.     STRUCTURE,    1,    "gs_Head        ",3,
  802.     LONG,        1,    "longreserved   ",0,
  803.     UWORD,        1,    "Flags          ",0,
  804.     BYTE,        1,    "fatten_count   ",0,
  805.     BYTE,        1,    "LockLayersCount",0,
  806.     UWORD,        1,    "Lay.I_xtra_size",0,
  807.     LONG,        1,    "blitbuff       ",0,
  808.     LONG,        1,    "LayerInfo_extra",0,
  809.  
  810.     UWORD,        4,    "diagstrt       ",0,    /* 47 copinit    */
  811.     UWORD,        40,    "sprstrtup      ",0,
  812.     UWORD,        2,    "sprstop        ",0,
  813.  
  814.     LONG,        1,    "VctrTbl        ",0,    /* 48 AreaInfo */
  815.     LONG,        1,    "VctrPtr        ",0,
  816.     LONG,        1,    "FlagTbl        ",0,
  817.     LONG,        1,    "FlagPtr        ",0,
  818.     WORD,        1,    "Count          ",0,
  819.     WORD,        1,    "MaxCount       ",0,
  820.     WORD,        1,    "FirstX         ",0,
  821.     WORD,        1,    "FirstY         ",0,
  822.  
  823.     BYTE,        1,    "sprRsrvd       ",0,    /* 49 GelsInfo */
  824.     UBYTE,        1,    "Flags          ",0,
  825.     STRUCTUREPTR,    1,    "gelHead        ",65,
  826.     STRUCTUREPTR,    1,    "gelTail        ",65,
  827.     LONG,        1,    "nextLine       ",0,
  828.     LONG,        1,    "lastColor      ",0,
  829.     LONG,        1,    "collHandler    ",0,
  830.     WORD,        1,    "leftmost       ",0,
  831.     WORD,        1,    "rightmost      ",0,
  832.     WORD,        1,    "topmost        ",0,
  833.     WORD,        1,    "bottommost     ",0,
  834.     LONG,        1,    "firstBlissObj  ",0,
  835.     LONG,        1,    "lastBlissObj   ",0,
  836.  
  837.     WORD,        1,    "MinX           ",0,    /* 50 Rectangle */
  838.     WORD,        1,    "MinY           ",0,
  839.     WORD,        1,    "MaxX           ",0,
  840.     WORD,        1,    "MaxY           ",0,
  841.     
  842.     STRUCTURE,    1,    "mn_Node        ",2,    /* 51 Message */
  843.     STRUCTUREPTR,    1,    "mn_ReplyPort   ",35,
  844.     UWORD,        1,    "mn_Length      ",0,
  845.  
  846.     STRUCTURE,    1,    "dd_Library     ",2,    /* 52 Device */
  847.  
  848.     STRUCTUREPTR,    1,    "unit_MsgPort   ",35,    /* 53 Unit */
  849.     UBYTE,        1,    "unit_flags     ",0,
  850.     UBYTE,        1,    "unit_pad       ",0,
  851.     UWORD,        1,    "unit_OpenCnt   ",0,
  852.  
  853.     UBYTE,        1,    "FrontPen       ",0,    /* 54 IntuiText */
  854.     UBYTE,        1,    "BackPen        ",0,    
  855.     UBYTE,        1,    "DrawMode       ",0,
  856.     WORD,        1,    "LeftEdge       ",0,
  857.     WORD,        1,    "TopEdge        ",0,
  858.     STRUCTUREPTR,    1,    "ITextFont      ",30,
  859.     STRINGPTR,    1,    "IText          ",0,
  860.     STRUCTUREPTR,    1,    "NextText       ",54,
  861.  
  862.     UBYTE,        1,    "DetailPen      ",0,    /* 55 PenPair */
  863.     UBYTE,        1,    "BlockPen       ",0,
  864.  
  865.     STRUCTURE,    1,    "io_Message     ",51,    /* 56 IORequest */
  866.     STRUCTUREPTR,    1,    "io_Device      ",52,
  867.     STRUCTUREPTR,    1,    "io_Unit        ",53,
  868.     UWORD,        1,    "io_Command     ",0,
  869.     UBYTE,        1,    "io_Flags       ",0,
  870.     BYTE,        1,    "io_Error       ",0,
  871.  
  872.     STRUCTUREPTR,    1,    "mlh_Head       ",58,    /* 57 MinList    */
  873.     STRUCTUREPTR,    1,    "mlh_Tail       ",58,
  874.     STRUCTUREPTR,    1,    "mlh_TailPred   ",58,
  875.  
  876.     STRUCTUREPTR,    1,    "mln_Succ       ",58,    /* 58 MinNode    */
  877.     STRUCTUREPTR,    1,    "mln_Pred       ",58,
  878.  
  879.     STRUCTUREPTR,    1,    "Next           ",59,    /* 59 CopList     */
  880.     STRUCTUREPTR,    1,    "_CopList       ",59,
  881.     STRUCTUREPTR,    1,    "_ViewPort      ",39,
  882.     STRUCTUREPTR,    1,    "CopIns         ",61,
  883.     STRUCTUREPTR,    1,    "CopPtr         ",61,
  884.     LONG,        1,    "CopLStart      ",0,
  885.     LONG,        1,    "CopSStart      ",0,
  886.     WORD,        1,    "Count          ",0,
  887.     WORD,        1,    "MaxCount       ",0,
  888.     WORD,        1,    "DyOffset       ",0,
  889.  
  890.     STRUCTUREPTR,    1,    "Next           ",60,    /* 60 UCopList    */
  891.     STRUCTUREPTR,    1,    "FirstCopList   ",59,
  892.     STRUCTUREPTR,    1,    "CopList        ",59,
  893.  
  894.     WORD,        1,    "OpCode         ",0,    /* 61 CopIns    */
  895.     WORD,        1,    "VWaitPos_DstAdr",0,
  896.     WORD,        1,    "HWaitPos_DstDat",0,
  897.  
  898.     STRUCTUREPTR,    1,    "Next           ",62,    /* 62 RasInfo    */
  899.     STRUCTUREPTR,    1,    "BitMap         ",15,
  900.     WORD,        1,    "RxOffset       ",0,
  901.     WORD,        1,    "RyOffset       ",0,
  902.  
  903.     UBYTE,        1,    "Flags          ",0,    /* 63 ColorMap    */
  904.     UBYTE,        1,    "Type           ",0,
  905.     UWORD,        1,    "Count          ",0,
  906.     LONG,        1,    "ColorTable     ",0,
  907.  
  908.     WORD,        1,    "LeftEdge       ",0,    /* 64 Border    */
  909.     WORD,        1,    "TopEdge        ",0,
  910.     UBYTE,        1,    "FrontPen       ",0,
  911.     UBYTE,        1,    "BackPen        ",0,
  912.     UBYTE,        1,    "DrawMode       ",0,
  913.     BYTE,        1,    "Count          ",0,
  914.     LONG,        1,    "XY             ",0,
  915.     STRUCTUREPTR,    1,    "NextBorder     ",64,
  916.  
  917.     STRUCTUREPTR,    1,    "NextVSprite    ",65,    /* 65 VSprite    */
  918.     STRUCTUREPTR,    1,    "PrevVSprite    ",65,
  919.     STRUCTUREPTR,    1,    "DrawPath       ",65,
  920.     STRUCTUREPTR,    1,    "ClearPath      ",65,
  921.     WORD,        1,    "OldY           ",0,
  922.     WORD,        1,    "OldX           ",0,
  923.     WORD,        1,    "Flags          ",0,
  924.     WORD,        1,    "Y              ",0,
  925.     WORD,        1,    "X              ",0,
  926.     WORD,        1,    "Height         ",0,
  927.     WORD,        1,    "Width          ",0,
  928.     WORD,        1,    "Depth          ",0,
  929.     WORD,        1,    "MeMask         ",0,
  930.     WORD,        1,    "HitMask        ",0,
  931.     LONG,        1,    "ImageData      ",0,
  932.     LONG,        1,    "BorderLine     ",0,
  933.     LONG,        1,    "CollMask       ",0,
  934.     LONG,        1,    "SprColors      ",0,
  935.     STRUCTUREPTR,    1,    "VSBob          ",66,
  936.     BYTE,        1,    "PlanePick      ",0,
  937.     BYTE,        1,    "PlaneOnOff     ",0,
  938.     WORD,        1,    "VUserExt       ",0,
  939.  
  940.     WORD,        1,    "Flags          ",0,    /* 66 Bob    */
  941.     LONG,        1,    "SaveBuffer     ",0,
  942.     LONG,        1,    "ImageShadow    ",0,
  943.     STRUCTUREPTR,    1,    "Before         ",66,
  944.     STRUCTUREPTR,    1,    "After          ",66,
  945.     STRUCTUREPTR,    1,    "BobVSprite     ",65,
  946.     STRUCTUREPTR,    1,    "BobComp        ",67,
  947.     STRUCTUREPTR,    1,    "DBuffer        ",68,
  948.     WORD,        1,    "BUserExt       ",0,
  949.  
  950.     WORD,        1,    "Flags          ",0,    /* 67 AnimComp    */
  951.     WORD,        1,    "Timer          ",0,
  952.     WORD,        1,    "TimeSet        ",0,
  953.     STRUCTUREPTR,    1,    "NextComp       ",67,
  954.     STRUCTUREPTR,    1,    "PrevComp       ",67,
  955.     STRUCTUREPTR,    1,    "NextSeq        ",67,
  956.     STRUCTUREPTR,    1,    "PrevSeq        ",67,
  957.     LONG,        1,    "AnimCRoutine   ",0,
  958.     WORD,        1,    "YTrans         ",0,
  959.     WORD,        1,    "XTrans         ",0,
  960.     STRUCTUREPTR,    1,    "HeadOb         ",69,
  961.     STRUCTUREPTR,    1,    "AnimBob        ",66,
  962.  
  963.     WORD,        1,    "BufY           ",0,    /* 68 DBufPacket*/
  964.     WORD,        1,    "BufX           ",0,    
  965.     STRUCTUREPTR,    1,    "BufPath        ",65,
  966.     LONG,        1,    "BufBuffer      ",0,
  967.  
  968.     STRUCTUREPTR,    1,    "NextOb         ",69,    /* 69 AnimOb    */
  969.     STRUCTUREPTR,    1,    "PrevOb         ",69,
  970.     LONG,        1,    "Clock          ",0,
  971.     WORD,        1,    "AnOldY         ",0,
  972.     WORD,        1,    "AnOldX         ",0,
  973.     WORD,        1,    "AnY            ",0, 
  974.     WORD,        1,    "AnX            ",0, 
  975.     WORD,        1,    "YVel           ",0,
  976.     WORD,        1,    "XVel           ",0,
  977.     WORD,        1,    "YAccel         ",0,
  978.     WORD,        1,    "XAccel         ",0,
  979.     WORD,        1,    "RingYTrans     ",0,
  980.     WORD,        1,    "RingXTrans     ",0,
  981.     LONG,        1,    "AnimORoutine   ",0,
  982.     STRUCTUREPTR,    1,    "HeadComp       ",67,
  983.     WORD,        1,    "AUserExt       ",0
  984.  
  985. };
  986.     
  987. #define        STRUCTURESIZE    70
  988.  
  989. struct            /* Structures    */
  990. {
  991.     char name[16];
  992.     unsigned int entries;
  993.     unsigned int first_entry;
  994. } structure[STRUCTURESIZE] =
  995.  
  996. {
  997.     "ExecBase       ",50,0,
  998.     "Library        ",10,50,
  999.     "Node           ",5,60,
  1000.     "List           ",5,65,
  1001.     "IntVector      ",3,70,
  1002.     "Task           ",22,73,
  1003.     "SoftIntList    ",2,95,
  1004.     "IntuitionBase  ",115,97,
  1005.     "View           ",6,212,
  1006.     "Window         ",48,218,
  1007.     "Screen         ",32,266,
  1008.     "GfxBase        ",41,298,
  1009.     "RastPort       ",32,339,
  1010.     "TmpRas         ",2,371,
  1011.     "ClipRect       ",8,373,    /* 9 for V1.1 ! */
  1012.     "BitMap         ",6,382,
  1013.     "IOStdReq       ",10,388,
  1014.         "Interrupt      ",3,398,
  1015.     "Remember       ",3,401,
  1016.         "InputEvent     ",8,404,
  1017.     "Gadget         ",15,412,
  1018.     "PropInfo       ",11,427,
  1019.     "Image          ",9,438,
  1020.     "GListEnv       ",9,447,
  1021.     "GadgetInfo     ",6,456,
  1022.     "Point          ",2,462,
  1023.     "IntuiMessage   ",11,464,
  1024.     "Region         ",2,475,
  1025.     "RegionRectangle",3,477,
  1026.     "IBox           ",4,480,
  1027.     "TextAttr       ",4,484,
  1028.     "Preferences    ",44,488,
  1029.     "KeyMap         ",8,532,
  1030.     "timerequest    ",2,540,
  1031.     "timeval        ",2,542,
  1032.     "MsgPort        ",5,544,
  1033.     "SimpleSprite   ",5,549,
  1034.     "SignalSemaphore",6,554,
  1035.     "SemaphoreReq.st",2,560,
  1036.     "ViewPort       ",14,562,
  1037.     "cprlist        ",3,576,
  1038.     "Menu           ",12,579,
  1039.     "MenuItem       ",11,591,
  1040.     "Requester      ",17,602,
  1041.     "Layer          ",25,619,
  1042.     "TextFont       ",15,644,
  1043.     "Layer_Info     ",13,659,
  1044.     "copinit        ",3,672,
  1045.     "AreaInfo       ",8,675,
  1046.     "GelsInfo       ",13,683,
  1047.     "Rectangle      ",4,696,
  1048.     "Message        ",3,700,
  1049.     "Device         ",1,703,
  1050.     "Unit           ",4,704,
  1051.     "IntuiText      ",8,708,
  1052.     "PenPair        ",2,716,
  1053.     "IORequest      ",6,718,
  1054.     "MinList        ",3,724,
  1055.     "MinNode        ",2,727,
  1056.     "CopList        ",10,729,
  1057.     "UCopList       ",3,739,
  1058.     "CopIns         ",3,742,
  1059.     "RasInfo        ",4,745,
  1060.     "ColorMap       ",4,749,
  1061.     "Border         ",8,753,
  1062.     "VSprite        ",22,761,
  1063.     "Bob            ",9,783,
  1064.     "AnimComp       ",12,792,
  1065.     "DBufPacket     ",4,804,
  1066.     "AnimOb         ",16,808
  1067. };
  1068.  
  1069. void print()
  1070. {
  1071.     write(io,buffer,strlen(buffer));
  1072. }
  1073.  
  1074. int InputStr(max,lln,edit)            /* Input Routine:        */                    
  1075. int max;                    /* max chars            */
  1076. int lln;                    /* lln: chrs yet existing   */
  1077. int edit;
  1078. {    
  1079.     char buf,dummy;
  1080.     int pos=0;
  1081.  
  1082.     if (lln) { write(io,string,lln); write(io,back,lln-pos); }    
  1083.  
  1084.     while(1)        
  1085.     {
  1086.         read(io,&buf,1);        /* Read one Character        */
  1087.  
  1088.         if (buf < 32)        /* Command Keys 1  (<32)    */
  1089.         {
  1090.             if (buf == CR) 
  1091.             {
  1092.                 write(io,"\n",1);
  1093.                 string[lln] = 0;
  1094.                 return(lln);    /* Return        */
  1095.             }
  1096.             if (buf == BS)    /* Backspace Routine        */
  1097.             {
  1098.                 int i;
  1099.     
  1100.                 if (pos == 0)
  1101.                 {
  1102.                     if (edit==0) continue;
  1103.                     buf = BS;
  1104.                     return(lln);
  1105.                 }
  1106.  
  1107.                 pos--;
  1108.                 lln--;
  1109.                 for(i=pos;i<=lln;i++) string[i]=string[i+1];
  1110.                 write(io,back,1);
  1111.                 write(io,&string[pos],lln-pos);
  1112.                 write(io,spaces,1);
  1113.                 write(io,back,lln-pos+1);
  1114.                 continue;
  1115.             }
  1116.             if (buf == ESC)
  1117.             {    
  1118.                 if ((edit==0)&&((pos)||(lln))) continue;
  1119.                 return(lln);
  1120.             }
  1121.             if (edit == 0) continue;
  1122.             if ((buf == TAB)&&(pos+5<max))
  1123.             {
  1124.                 int i,newpos;
  1125.  
  1126.                 newpos = pos+5-pos%5;
  1127.  
  1128.                 if (newpos>lln) 
  1129.                 {
  1130.                     for(i=lln;i<=newpos;i++) string[i]=SPACE;
  1131.                     lln = newpos;
  1132.                 }
  1133.                 write(io,&string[pos],newpos-pos);
  1134.                 pos = newpos;
  1135.                 continue;
  1136.             }
  1137.             if (buf == DELIN) return(lln);
  1138.             if (buf == BOL) return(lln);
  1139.             if (buf == EOL) return(lln);
  1140.             if (buf == TOP) return(lln);
  1141.             if (buf == BOTTOM) return(lln);
  1142.             if (buf == PGUP) return(lln);
  1143.             if (buf == PGDOWN) return(lln);
  1144.             continue;        /* Read next character        */
  1145.         }
  1146.         if (buf > 126)        /* Command Keys    2 (>126)    */
  1147.         {
  1148.             if (buf == DEL)    /* Delete        */
  1149.             {
  1150.                 int i;
  1151.                 
  1152.                 if (pos==lln) return(lln);
  1153.                 lln--;
  1154.                 for(i=pos;i<=lln;i++) string[i]=string[i+1];
  1155.                 write(io,&string[pos],lln-pos);
  1156.                 write(io,spaces,1);
  1157.                 write(io,back,lln-pos+1);
  1158.                 continue;
  1159.             }
  1160.             if (buf == 155)    /* Special Code            */
  1161.             {
  1162.                 read(io,&buf,1);    /* Read again(part2)*/
  1163.                 if(buf == LEFT)    /* Cursor left        */
  1164.                 {
  1165.                     if (pos<1) 
  1166.                     {
  1167.                         if (edit) return(lln);
  1168.                         continue;
  1169.                     }
  1170.                     pos--;
  1171.                     buf = BS;
  1172.                     write(io,&buf,1);
  1173.                     continue;
  1174.                 }    
  1175.                 if(buf == RIGHT)    /* Cursor right        */
  1176.                 {
  1177.                     if (pos == lln) 
  1178.                     {
  1179.                         if (edit) return(lln);
  1180.                         continue;
  1181.                     }
  1182.                     write(io,&string[pos],1);
  1183.                     pos++;
  1184.                     continue;
  1185.                 }
  1186.                 if(buf == UP)         /* CRSR up  */
  1187.                 {
  1188.                     if (edit) return(lln);
  1189.                     continue;
  1190.                 }
  1191.                 if(buf == DOWN)         /* CRSR down*/
  1192.                 {
  1193.                     if (edit) return(lln);
  1194.                     continue;
  1195.                 }
  1196.                 read(io,&dummy,1);    /* F-Keys & HELP    */
  1197.                 if (((pos)||(lln))&&(edit==0)) continue;
  1198.                 return(lln);
  1199.             }
  1200.             continue;
  1201.         }
  1202.  
  1203.         if (lln<max)
  1204.         {
  1205.         if (pos==lln)            /* Append                */
  1206.         {
  1207.             string[pos] = buf;
  1208.             pos++;
  1209.             lln++;
  1210.             write(io,&buf,1);
  1211.         }
  1212.         else                     /* Insert        */
  1213.         {
  1214.             int i;
  1215.  
  1216.             pos++;
  1217.             lln++;
  1218.             for (i=lln;i>=pos;i--) string[i]=string[i-1];
  1219.             string[pos-1] = buf;
  1220.             write(io,&string[pos-1],lln-pos+1);
  1221.             buf = BS;
  1222.             for (i=1;i<=lln-pos;i++) write(io,&buf,1);
  1223.         }
  1224.         }
  1225.     }
  1226. }
  1227.  
  1228. long AddUpAddress(nr,address,entries,index)
  1229. unsigned int nr;
  1230. long address;
  1231. unsigned int entries;
  1232. int index;
  1233. {
  1234.     unsigned int endx,x,y,i;
  1235.  
  1236.     if (index<0) index=0;
  1237.     for(x=structure[nr].first_entry,y=0;y<=entries;x++,y++)
  1238.     {
  1239.         endx = (y==entries) ? index : entry[x].dimension;
  1240.         for(i=0;i<endx;i++) 
  1241.         {
  1242.             switch(entry[x].type)
  1243.             {
  1244.                 case BYTE:
  1245.                 case UBYTE:    address += 1;
  1246.                         break;
  1247.                 case WORD:
  1248.                 case UWORD:    address += 2;
  1249.                         break;
  1250.                 case LONG:
  1251.                 case ULONG:
  1252.                 case STRUCTUREPTR:
  1253.                 case STRINGPTR:    address += 4;
  1254.                         break;
  1255.                 case STRING:    address += entry[x].pointer;
  1256.                         break;
  1257.                 case STRUCTURE:    address = AddUpAddress(entry[x].pointer,address,structure[entry[x].pointer].entries,0);
  1258.                         break;
  1259.             }
  1260.         }
  1261.     }
  1262.     return(address);
  1263. }
  1264.  
  1265. long DisplayStructure(nr,address,name,index)
  1266. unsigned int nr;
  1267. long address;
  1268. char *name;
  1269. int index;
  1270. {
  1271.     int c,e,i,l,error=0;
  1272.     long iaddress,k;
  1273.  
  1274.     iaddress = address;
  1275.  
  1276.     if (index == -1) sprintf(buffer,"\nSTRUCT %s %s\n",structure[nr].name,name);
  1277.     if (index != -1) sprintf(buffer,"\nSTRUCT %s %s[%02d]\n",structure[nr].name,name,index);
  1278.     print();
  1279.     for(e=structure[nr].first_entry,c=0; c<structure[nr].entries; c++,e++)
  1280.     {
  1281.         if (entry[e].dimension==1)
  1282.         {
  1283.             while(peek(0xbfec01) == 57);    /* CTRL-> wait    */
  1284.             if ((peek(0xbfec01) == 63)||(peek(0xbfec01) == 62))
  1285.             {
  1286.                 write(io,user_break,strlen(user_break));
  1287.                 error=1;
  1288.                 break;
  1289.             }
  1290.             switch(entry[e].type)
  1291.             {
  1292.                 case BYTE:    if (mode == HEXADECIMAL)sprintf(buffer,"$%08x $%04x %02d BYTE    %s     = $%02x\n",address,address-iaddress,c,entry[e].name,peek(address));
  1293.                         if (mode == DECIMAL)    sprintf(buffer,"$%08x $%04x %02d BYTE    %s     = %03d\n",address,address-iaddress,c,entry[e].name,peek(address));
  1294.                         print();
  1295.                         address += 1;
  1296.                         break;
  1297.                 case UBYTE:    if (mode == HEXADECIMAL)sprintf(buffer,"$%08x $%04x %02d UBYTE   %s     = $%02x\n",address,address-iaddress,c,entry[e].name,peek(address));
  1298.                         if (mode == DECIMAL)    sprintf(buffer,"$%08x $%04x %02d UBYTE   %s     = %03u\n",address,address-iaddress,c,entry[e].name,(unsigned char)peek(address));
  1299.                         print();
  1300.                         address += 1;
  1301.                         break;
  1302.                 case WORD:    if (mode == HEXADECIMAL)sprintf(buffer,"$%08x $%04x %02d WORD    %s     = $%04x\n",address,address-iaddress,c,entry[e].name,peekw(address));
  1303.                         if (mode == DECIMAL)    sprintf(buffer,"$%08x $%04x %02d WORD    %s     = %05d\n",address,address-iaddress,c,entry[e].name,peekw(address));
  1304.                         print();
  1305.                         address += 2;
  1306.                         break;
  1307.                 case UWORD:    if (mode == HEXADECIMAL)sprintf(buffer,"$%08x $%04x %02d UWORD   %s     = $%04x\n",address,address-iaddress,c,entry[e].name,peekw(address));
  1308.                         if (mode == DECIMAL)    sprintf(buffer,"$%08x $%04x %02d UWORD   %s     = %05u\n",address,address-iaddress,c,entry[e].name,(unsigned int)peekw(address));
  1309.                         print();
  1310.                         address += 2;
  1311.                         break;
  1312.                 case LONG:    if (mode == HEXADECIMAL)sprintf(buffer,"$%08x $%04x %02d LONG    %s     = $%08x\n",address,address-iaddress,c,entry[e].name,peekl(address));
  1313.                         if (mode == DECIMAL)    sprintf(buffer,"$%08x $%04x %02d LONG    %s     = %010d\n",address,address-iaddress,c,entry[e].name,peekl(address));
  1314.                         print();
  1315.                         address += 4;
  1316.                         break;
  1317.                 case ULONG:    if (mode == HEXADECIMAL)sprintf(buffer,"$%08x $%04x %02d ULONG   %s     = $%08x\n",address,address-iaddress,c,entry[e].name,peekl(address));
  1318.                         if (mode == DECIMAL)    sprintf(buffer,"$%08x $%04x %02d ULONG   %s     = %010u\n",address,address-iaddress,c,entry[e].name,(unsigned long)peekl(address));
  1319.                         print();
  1320.                         address += 4;
  1321.                         break;
  1322.                 case STRUCTURE:    sprintf(buffer,"$%08x $%04x %02d STRUCT  %s  %s\n",address,address-iaddress,c,structure[entry[e].pointer].name,entry[e].name);print();
  1323.                         address = AddUpAddress(entry[e].pointer,address,structure[entry[e].pointer].entries,0);
  1324.                         break;
  1325.                 case STRINGPTR: for(k=peekl(address),l=0;(l<320)&&(peek(k));k++,l++);
  1326.                         strncpy(string,peekl(address),l);
  1327.                         string[l] = 0;
  1328.                         sprintf(buffer,"$%08x $%04x %02d STRING *%s     = $%08x \"%s\"\n",address,address-iaddress,c,entry[e].name,peekl(address),string);print();
  1329.                         address += 4;
  1330.                         break;
  1331.                 case STRUCTUREPTR: 
  1332.                         sprintf(buffer,"$%08x $%04x %02d STRUCT  %s *%s     = $%08x\n",address,address-iaddress,c,structure[entry[e].pointer].name,entry[e].name,peekl(address));print();
  1333.                         address += 4;
  1334.                         break;
  1335.                 case STRING:    strncpy(string,address,entry[e].pointer);
  1336.                         poke(string+(entry[e].pointer),0);
  1337.                         sprintf(buffer,"$%08x $%04x %02d STRING  %s     = \"%s\"\n",address,address-iaddress,c,entry[e].name,string);print();
  1338.                         address += entry[e].pointer;
  1339.                         break;
  1340.  
  1341.             }
  1342.         }
  1343.         if (entry[e].dimension>1) for(i=0;i<entry[e].dimension;i++)
  1344.         {
  1345.             while(peek(0xbfec01) == 57);    /* CTRL-> wait    */
  1346.             if ((peek(0xbfec01) == 63)||(peek(0xbfec01) == 62))
  1347.             {
  1348.                 write(io,user_break,strlen(user_break));
  1349.                 error=1;
  1350.                 break;
  1351.             }
  1352.             switch(entry[e].type)
  1353.             {
  1354.                 case BYTE:    if (mode == HEXADECIMAL)sprintf(buffer,"$%08x $%04x %02d BYTE    %s[%02d] = $%02x\n",address,address-iaddress,c,entry[e].name,i,peek(address));
  1355.                         if (mode == DECIMAL)    sprintf(buffer,"$%08x $%04x %02d BYTE    %s[%02d] = %03d\n",address,address-iaddress,c,entry[e].name,i,peek(address));
  1356.                         print();
  1357.                         address += 1;
  1358.                         break;
  1359.                 case UBYTE:    if (mode == HEXADECIMAL)sprintf(buffer,"$%08x $%04x %02d UBYTE   %s[%02d] = $%02x\n",address,address-iaddress,c,entry[e].name,i,peek(address));
  1360.                         if (mode == DECIMAL)    sprintf(buffer,"$%08x $%04x %02d UBYTE   %s[%02d] = %03u\n",address,address-iaddress,c,entry[e].name,i,(unsigned char)peek(address));
  1361.                         print();
  1362.                         address += 1;
  1363.                         break;
  1364.                 case WORD:    if (mode == HEXADECIMAL)sprintf(buffer,"$%08x $%04x %02d WORD    %s[%02d] = $%04x\n",address,address-iaddress,c,entry[e].name,i,peekw(address));
  1365.                         if (mode == DECIMAL)    sprintf(buffer,"$%08x $%04x %02d WORD    %s[%02d] = %05d\n",address,address-iaddress,c,entry[e].name,i,peekw(address));
  1366.                         print();
  1367.                         address += 2;
  1368.                         break;
  1369.                 case UWORD:    if (mode == HEXADECIMAL)sprintf(buffer,"$%08x $%04x %02d UWORD   %s[%02d] = $%04x\n",address,address-iaddress,c,entry[e].name,i,peekw(address));
  1370.                         if (mode == DECIMAL)    sprintf(buffer,"$%08x $%04x %02d UWORD    %s[%02d] = %05u\n",address,address-iaddress,c,entry[e].name,i,(unsigned int)peekw(address));
  1371.                         print();
  1372.                         address += 2;
  1373.                         break;
  1374.                 case LONG:    if (mode == HEXADECIMAL)sprintf(buffer,"$%08x $%04x %02d LONG    %s[%02d] = $%08x\n",address,address-iaddress,c,entry[e].name,i,peekl(address));
  1375.                         if (mode == DECIMAL)    sprintf(buffer,"$%08x $%04x %02d LONG    %s[%02d] = %010d\n",address,address-iaddress,c,entry[e].name,i,peekl(address));
  1376.                         print();
  1377.                         address += 4;
  1378.                         break;
  1379.                 case ULONG:    if (mode == HEXADECIMAL)sprintf(buffer,"$%08x $%04x %02d ULONG   %s[%02d] = $%08x\n",address,address-iaddress,c,entry[e].name,i,peekl(address));
  1380.                         if (mode == DECIMAL)    sprintf(buffer,"$%08x $%04x %02d ULONG   %s[%02d] = %010u\n",address,address-iaddress,c,entry[e].name,i,(unsigned long)peekl(address));
  1381.                         print();
  1382.                         address += 4;
  1383.                         break;
  1384.                 case STRUCTURE:    sprintf(buffer,"$%08x $%04x %02d STRUCT  %s  %s[%02d]\n",address,address-iaddress,c,structure[entry[e].pointer].name,entry[e].name,i);print();
  1385.                         address = AddUpAddress(entry[e].pointer,address,structure[entry[e].pointer].entries,0);
  1386.                         break;
  1387.                 case STRINGPTR:    for(k=address,l=0;(l<320)&&(peek(k));k++,l++);
  1388.                         strncpy(string,peekl(address),l);
  1389.                         string[l] = 0;
  1390.                         sprintf(buffer,"$%08x $%04x %02d STRING *%s[%02d] = $%08x \"%s\"\n",address,address-iaddress,c,entry[e].name,i,peekl(address),string);print();
  1391.                         address += 4;
  1392.                         break;
  1393.                 case STRUCTUREPTR: 
  1394.                         sprintf(buffer,"$%08x $%04x %02d STRUCT  %s *%s[%02d] = $%08x\n",address,address-iaddress,c,structure[entry[e].pointer].name,entry[e].name,i,peekl(address));print();
  1395.                         address += 4;
  1396.                         break;
  1397.                 case STRING:    strncpy(string,address,entry[e].pointer);
  1398.                         poke(string+entry[e].pointer,0);
  1399.                         sprintf(buffer,"$%08x $%04x %02d STRING  %s[%02d] = \"%s\"\n",address,address-iaddress,c,entry[e].name,i,string);print();
  1400.                         address += entry[e].pointer;
  1401.                         break;
  1402.  
  1403.             }
  1404.         }
  1405.         if (error) break;
  1406.     }
  1407.     return(address);
  1408. }
  1409.  
  1410. void Entry(address,e,nr,idx)
  1411. long address;
  1412. unsigned int e;
  1413. unsigned int nr;
  1414. int idx;
  1415. {
  1416.     long e_long,len;
  1417.     unsigned long e_ulong;
  1418.     int e_word;
  1419.     unsigned int e_uword;
  1420.     int e_byte;            /* has to be int (for hex use) */
  1421.     unsigned int e_ubyte;
  1422.  
  1423.     switch(mode)
  1424.     {
  1425.         case DECIMAL: switch(entry[structure[nr].first_entry+e].type)
  1426.         {
  1427.             case BYTE:    if (idx>=0) sprintf(buffer,"$%08x BYTE %s[%d] = ",address,entry[structure[nr].first_entry+e].name,idx);
  1428.                     if (idx<0) sprintf(buffer,"$%08x BYTE %s = ",address,entry[structure[nr].first_entry+e].name);
  1429.                     print();
  1430.                     InputStr(80,0,0); sscanf(string,"%d",&e_byte);
  1431.                     poke(address,e_byte);
  1432.                     break;
  1433.             case UBYTE:    if (idx>=0) sprintf(buffer,"$%08x UBYTE %s[%d] = ",address,entry[structure[nr].first_entry+e].name,idx);
  1434.                     if (idx<0) sprintf(buffer,"$%08x UBYTE %s = ",address,entry[structure[nr].first_entry+e].name);
  1435.                     print();
  1436.                     InputStr(80,0,0); sscanf(string,"%d",&e_ubyte);
  1437.                     poke(address,e_ubyte);
  1438.                     break;
  1439.             case WORD:    if (idx>=0) sprintf(buffer,"$%08x WORD %s[%d] = ",address,entry[structure[nr].first_entry+e].name,idx);
  1440.                     if (idx<0) sprintf(buffer,"$%08x WORD %s = ",address,entry[structure[nr].first_entry+e].name);
  1441.                     print();
  1442.                     InputStr(80,0,0); sscanf(string,"%d",&e_word);
  1443.                     pokew(address,e_word);
  1444.                     break;
  1445.             case UWORD:    if (idx>=0) sprintf(buffer,"$%08x UWORD %s[%d] = ",address,entry[structure[nr].first_entry+e].name,idx);
  1446.                     if (idx<0) sprintf(buffer,"$%08x UWORD %s = ",address,entry[structure[nr].first_entry+e].name);
  1447.                     print();
  1448.                     InputStr(80,0,0); sscanf(string,"%d",&e_uword);
  1449.                     pokew(address,e_uword);
  1450.                     break;
  1451.             case LONG:    if (idx>=0) sprintf(buffer,"$%08x LONG %s[%d] = ",address,entry[structure[nr].first_entry+e].name,idx);
  1452.                     if (idx<0) sprintf(buffer,"$%08x LONG %s = ",address,entry[structure[nr].first_entry+e].name);
  1453.                     print();
  1454.                     InputStr(80,0,0); sscanf(string,"%ld",&e_long);
  1455.                     pokel(address,e_long);
  1456.                     break;
  1457.             case ULONG:    if (idx>=0) sprintf(buffer,"$%08x ULONG %s[%d] = ",address,entry[structure[nr].first_entry+e].name,idx);
  1458.                     if (idx<0) sprintf(buffer,"$%08x ULONG %s = ",address,entry[structure[nr].first_entry+e].name);
  1459.                     print();
  1460.                     InputStr(80,0,0); sscanf(string,"%ld",&e_ulong);
  1461.                     pokel(address,e_ulong);
  1462.                     break;
  1463.             case STRUCTURE: if (idx>=0) sprintf(buffer,"$%08x STRUCTURE %s %s[%d] =\n",address,structure[entry[structure[nr].first_entry+e].pointer].name,entry[structure[nr].first_entry+e].name,idx);
  1464.                     if (idx<0) sprintf(buffer,"$%08x STRUCTURE %s %s =\n",address,structure[entry[structure[nr].first_entry+e].pointer].name,entry[structure[nr].first_entry+e].name);
  1465.                     print();
  1466.                     WriteStructure(entry[structure[nr].first_entry+e].pointer,address);
  1467.                     sprintf(buffer,"          STRUCTURE END.\n");print();
  1468.                     break;
  1469.             case STRING:    if (idx>=0) sprintf(buffer,"$%08x STRING %s[%d] (%d chars) = ",address,entry[structure[nr].first_entry+e].name,idx,entry[structure[nr].first_entry+e].pointer);
  1470.                     if (idx<0) sprintf(buffer,"$%08x STRING %s (%d chars) = ",address,entry[structure[nr].first_entry+e].name,entry[structure[nr].first_entry+e].pointer);
  1471.                     print();
  1472.                     InputStr(80,0,0); sscanf(string,"%320s",string);
  1473.                     strncpy(address,string,entry[structure[nr].first_entry+e].pointer);
  1474.                     break;    
  1475.             case STRUCTUREPTR: 
  1476.                     if (idx>=0) sprintf(buffer,"$%08x STRUCTURE %s *%s[%d] =\n",address,structure[entry[structure[nr].first_entry+e].pointer].name,entry[structure[nr].first_entry+e].name,idx);
  1477.                     if (idx<0) sprintf(buffer,"$%08x STRUCTURE %s *%s =\n",address,structure[entry[structure[nr].first_entry+e].pointer].name,entry[structure[nr].first_entry+e].name);
  1478.                     print();
  1479.                     sprintf(buffer,"Mode (a)llocate/(o)verwrite/(p)oint: ");print();
  1480.                     while(1)
  1481.                     {
  1482.                         InputStr(80,0,0); sscanf(string,"%c",&string[310]);
  1483.                         if((string[310]=='a')||(string[310]=='o')||(string[310]=='p'))break;
  1484.                     }
  1485.                     switch(string[310])
  1486.                     {
  1487.                         case 'a':    sprintf(buffer,"Memory parameters= $");print();
  1488.                                 InputStr(80,0,0); sscanf(string,"%lx",&e_ulong);
  1489.                                 if (!(e_long=AllocMem(AddUpAddress(nr,0l,structure[nr].entries,-1),e_ulong)))
  1490.                                 {
  1491.                                     sprintf(buffer,"Sorry, out of memory.\n");print();
  1492.                                     break;
  1493.                                 }
  1494.                                 WriteStructure(nr,e_long);
  1495.                                 sprintf(buffer,"          STRUCTURE END.\n");print();
  1496.                                 pokel(address,e_long);
  1497.                                 break;
  1498.                         case 'o':    sprintf(buffer,adrquest);print();
  1499.                                 InputStr(80,0,0); sscanf(string,"%lx",&e_long);
  1500.                                 WriteStructure(nr,e_long);
  1501.                                 sprintf(buffer,"          STRUCTURE END.\n");print();
  1502.                                 pokel(address,e_long);
  1503.                                 break;
  1504.                         case 'p':    sprintf(buffer,adrquest);print();
  1505.                                 InputStr(80,0,0); sscanf(string,"%lx",&e_long);
  1506.                                 pokel(address,e_long);
  1507.                                 break;
  1508.                     }
  1509.                     break;
  1510.             case STRINGPTR:
  1511.                     if (idx>=0) sprintf(buffer,"$%08x STRING *%s[%d] =\n",address,entry[structure[nr].first_entry+e].name,idx);
  1512.                     if (idx<0) sprintf(buffer,"$%08x STRING *%s =\n",address,entry[structure[nr].first_entry+e].name);
  1513.                     print();
  1514.                     sprintf(buffer,"Mode (a)llocate/(o)verwrite/(p)oint: ");print();
  1515.                     while(1)
  1516.                     {
  1517.                         InputStr(80,0,0); sscanf(string,"%c",&string[310]);
  1518.                         if((string[310]=='a')||(string[310]=='o')||(string[310]=='p'))break;
  1519.                     }
  1520.                     switch(string[310])
  1521.                     {
  1522.                         case 'a':    sprintf(buffer,"Memory parameters= $");print();
  1523.                                 InputStr(80,0,0); sscanf(string,"%lx",&e_ulong);
  1524.                                 sprintf(buffer,"String length= ");print();
  1525.                                 InputStr(80,0,0); sscanf(string,"%ld",&len);
  1526.                                 if (!(e_long=AllocMem(len,e_ulong)))
  1527.                                 {
  1528.                                     sprintf(buffer,"Sorry, out of memory.\n");print();
  1529.                                     break;
  1530.                                 }
  1531.                                 WriteString(len,e_long);
  1532.                                 pokel(address,e_long);
  1533.                                 break;
  1534.                         case 'o':    sprintf(buffer,adrquest);print();
  1535.                                 InputStr(80,0,0); sscanf(string,"%lx",&e_long);
  1536.                                 WriteString(strlen(e_long),e_long);
  1537.                                 pokel(address,e_long);
  1538.                                 break;
  1539.                         case 'p':    sprintf(buffer,adrquest);print();
  1540.                                 InputStr(80,0,0); sscanf(string,"%lx",&e_long);
  1541.                                 pokel(address,e_long);
  1542.                                 break;
  1543.                     }
  1544.                     break;
  1545.         }
  1546.         break;
  1547.         case HEXADECIMAL: switch(entry[structure[nr].first_entry+e].type)
  1548.         {
  1549.             case BYTE:    if (idx>=0) sprintf(buffer,"$%08x BYTE %s[%d] = $",address,entry[structure[nr].first_entry+e].name,idx);
  1550.                     if (idx<0) sprintf(buffer,"$%08x BYTE %s = $",address,entry[structure[nr].first_entry+e].name);
  1551.                     print();
  1552.                     InputStr(80,0,0); sscanf(string,"%x",&e_byte);
  1553.                     poke(address,e_byte);
  1554.                     break;
  1555.             case UBYTE:    if (idx>=0) sprintf(buffer,"$%08x UBYTE %s[%d] = $",address,entry[structure[nr].first_entry+e].name,idx);
  1556.                     if (idx<0) sprintf(buffer,"$%08x UBYTE %s = $",address,entry[structure[nr].first_entry+e].name);
  1557.                     print();
  1558.                     InputStr(80,0,0); sscanf(string,"%x",&e_ubyte);
  1559.                     poke(address,e_ubyte);
  1560.                     break ;
  1561.             case WORD:    if (idx>=0) sprintf(buffer,"$%08x WORD %s[%d] = $",address,entry[structure[nr].first_entry+e].name,idx);
  1562.                     if (idx<0) sprintf(buffer,"$%08x WORD %s = $",address,entry[structure[nr].first_entry+e].name);
  1563.                     print();
  1564.                     InputStr(80,0,0); sscanf(string,"%x",&e_word);
  1565.                     pokew(address,e_word);
  1566.                     break;
  1567.             case UWORD:    if (idx>=0) sprintf(buffer,"$%08x UWORD %s[%d] = $",address,entry[structure[nr].first_entry+e].name,idx);
  1568.                     if (idx<0) sprintf(buffer,"$%08x UWORD %s = $",address,entry[structure[nr].first_entry+e].name);
  1569.                     print();
  1570.                     InputStr(80,0,0); sscanf(string,"%x",&e_uword);
  1571.                     pokew(address,e_uword);
  1572.                     break;
  1573.             case LONG:    if (idx>=0) sprintf(buffer,"$%08x LONG %s[%d] = $",address,entry[structure[nr].first_entry+e].name,idx);
  1574.                     if (idx<0) sprintf(buffer,"$%08x LONG %s = $",address,entry[structure[nr].first_entry+e].name);
  1575.                     print();
  1576.                     InputStr(80,0,0); sscanf(string,"%lx",&e_long);
  1577.                     pokel(address,e_long);
  1578.                     break;
  1579.             case ULONG:    if (idx>=0) sprintf(buffer,"$%08x ULONG %s[%d] = $",address,entry[structure[nr].first_entry+e].name,idx);
  1580.                     if (idx<0) sprintf(buffer,"$%08x ULONG %s = $",address,entry[structure[nr].first_entry+e].name);
  1581.                     print();
  1582.                     InputStr(80,0,0); sscanf(string,"%lx",&e_ulong);
  1583.                     pokel(address,e_ulong);
  1584.                     break;
  1585.             case STRUCTURE: if (idx>=0) sprintf(buffer,"$%08x STRUCTURE %s %s[%d] =\n",address,structure[entry[structure[nr].first_entry+e].pointer].name,entry[structure[nr].first_entry+e].name,idx);
  1586.                     if (idx<0) sprintf(buffer,"$%08x STRUCTURE %s %s =\n",address,structure[entry[structure[nr].first_entry+e].pointer].name,entry[structure[nr].first_entry+e].name);
  1587.                     print();
  1588.                     WriteStructure(entry[structure[nr].first_entry+e].pointer,address);
  1589.                     sprintf(buffer,"          STRUCTURE END.\n");print();
  1590.                     break;
  1591.             case STRING:    if (idx>=0) sprintf(buffer,"$%08x STRING %s[%d] (%d chars) = ",address,entry[structure[nr].first_entry+e].name,idx,entry[structure[nr].first_entry+e].pointer);
  1592.                     if (idx<0) sprintf(buffer,"$%08x STRING %s (%d chars) = ",address,entry[structure[nr].first_entry+e].name,entry[structure[nr].first_entry+e].pointer);
  1593.                     print();
  1594.                     InputStr(80,0,0); sscanf(string,"%320s",string);
  1595.                     strncpy(address,string,entry[structure[nr].first_entry+e].pointer);
  1596.                     break;    
  1597.             case STRUCTUREPTR: 
  1598.                     if (idx>=0) sprintf(buffer,"$%08x STRUCTURE %s *%s[%d] =\n",address,structure[entry[structure[nr].first_entry+e].pointer].name,entry[structure[nr].first_entry+e].name,idx);
  1599.                     if (idx<0) sprintf(buffer,"$%08x STRUCTURE %s *%s =\n",address,structure[entry[structure[nr].first_entry+e].pointer].name,entry[structure[nr].first_entry+e].name);
  1600.                     print();
  1601.                     sprintf(buffer,"Mode (a)llocate/(o)verwrite/(p)oint: ");print();
  1602.                     while(1)
  1603.                     {
  1604.                         InputStr(80,0,0); sscanf(string,"%c",&string[310]);
  1605.                         if((string[310]=='a')||(string[310]=='o')||(string[310]=='p'))break;
  1606.                     }
  1607.                     switch(string[310])
  1608.                     {
  1609.                         case 'a':    sprintf(buffer,"Memory parameters= $");print();
  1610.                                 InputStr(80,0,0); sscanf(string,"%lx",&e_ulong);
  1611.                                 if (!(e_long=AllocMem(AddUpAddress(nr,0l,structure[nr].entries,-1),e_ulong)))
  1612.                                 {
  1613.                                     sprintf(buffer,"Sorry, out of memory.\n");print();
  1614.                                     break;
  1615.                                 }
  1616.                                 WriteStructure(nr,e_long);
  1617.                                 sprintf(buffer,"          STRUCTURE END.\n");print();
  1618.                                 pokel(address,e_long);
  1619.                                 break;
  1620.                         case 'o':    sprintf(buffer,adrquest);print();
  1621.                                 InputStr(80,0,0); sscanf(string,"%lx",&e_long);
  1622.                                 WriteStructure(nr,e_long);
  1623.                                 sprintf(buffer,"          STRUCTURE END.\n");print();
  1624.                                 pokel(address,e_long);
  1625.                                 break;
  1626.                         case 'p':    sprintf(buffer,adrquest);print();
  1627.                                 InputStr(80,0,0); sscanf(string,"%lx",&e_long);
  1628.                                 pokel(address,e_long);
  1629.                                 break;
  1630.                     }
  1631.                     break;
  1632.             case STRINGPTR:
  1633.                     if (idx>=0) sprintf(buffer,"$%08x STRING *%s[%d] =\n",address,entry[structure[nr].first_entry+e].name,idx);
  1634.                     if (idx<0) sprintf(buffer,"$%08x STRING *%s =\n",address,entry[structure[nr].first_entry+e].name);
  1635.                     print();
  1636.                     sprintf(buffer,"Mode (a)llocate/(o)verwrite/(p)oint: ");print();
  1637.                     while(1)
  1638.                     {
  1639.                         InputStr(80,0,0); sscanf(string,"%c",&string[310]);
  1640.                         if((string[310]=='a')||(string[310]=='o')||(string[310]=='p'))break;
  1641.                     }
  1642.                     switch(string[310])
  1643.                     {
  1644.                         case 'a':    sprintf(buffer,"Memory parameters= $");print();
  1645.                                 InputStr(80,0,0); sscanf(string,"%lx",&e_ulong);
  1646.                                 sprintf(buffer,"String length= ");print();
  1647.                                 InputStr(80,0,0); sscanf(string,"%ld",&len);
  1648.                                 if (!(e_long=AllocMem(len+1,e_ulong)))
  1649.                                 {
  1650.                                     sprintf(buffer,"Sorry, out of memory.\n");print();
  1651.                                     break;
  1652.                                 }
  1653.                                 WriteString(len,e_long);
  1654.                                 pokel(address,e_long);
  1655.                                 break;
  1656.                         case 'o':    sprintf(buffer,adrquest);print();
  1657.                                 InputStr(80,0,0); sscanf(string,"%lx",&e_long);
  1658.                                 WriteString(strlen(e_long),e_long);
  1659.                                 pokel(address,e_long);
  1660.                                 break;
  1661.                         case 'p':    sprintf(buffer,adrquest);print();
  1662.                                 InputStr(80,0,0); sscanf(string,"%lx",&e_long);
  1663.                                 pokel(address,e_long);
  1664.                                 break;
  1665.                     }
  1666.                     break;
  1667.         }
  1668.     }    
  1669. }
  1670.  
  1671. WriteString(len,address)
  1672. {
  1673.     sprintf(buffer,"String (max. %d chars) =",len);print();
  1674.     InputStr(80,0,0); sscanf(string,"%s",string);
  1675.     strncpy(address,string,strlen(string)>len ? len : strlen(string));
  1676.     poke(address+(strlen(string)>len ? len : strlen(string)),0);
  1677. }
  1678.  
  1679. WriteStructure(nr,address)
  1680. unsigned int nr;
  1681. long address;
  1682. {
  1683.     int i,j;
  1684.  
  1685.     for (i=0;i<structure[nr].entries;i++)
  1686.     {
  1687.         switch(entry[structure[nr].first_entry+i].dimension)
  1688.         {
  1689.             case 1:    Entry(AddUpAddress(nr,address,i,-1),i,nr,-1);
  1690.                 break;
  1691.             default:for(j=0;j<entry[structure[nr].first_entry+i].dimension;j++) Entry(AddUpAddress(nr,address,i,j),i,nr,j);
  1692.                 break;
  1693.         }
  1694.     }
  1695. }
  1696.  
  1697. main(argc,argv)
  1698. int argc;
  1699. char *argv[];
  1700. {
  1701.     long address,newaddress,gfxbase,intuitionbase,execbase,para,len;
  1702.     unsigned int nr,e,stackptr;
  1703.     int index,idx,i,j,k,xit;
  1704.     char c[80];
  1705.     char *name;
  1706.  
  1707.     mode = HEXADECIMAL;
  1708.     stackptr = 0;
  1709.  
  1710.     for(i=0;i<80;i++) back[i]=BS;
  1711.  
  1712.     nr = 0;                    /* Init for Exec    */
  1713.     address = execbase = peekl(4);
  1714.     name = execname;
  1715.     index = -1;
  1716.  
  1717.     execbase = peekl(4);
  1718.     IntuitionBase = (struct IntuitionBase *)(intuitionbase = OpenLibrary("intuition.library",0L));
  1719.     gfxbase = OpenLibrary("graphics.library",0L);
  1720.  
  1721.     for(i=1;i<argc;i++)
  1722.     {
  1723.         if (!strcmp(argv[i],"-bg")) 
  1724.         {
  1725.             while(peek(0xbfec01)>>1 != 32) Delay(60);
  1726.             break;
  1727.         }
  1728.         printf("Use the -bg option to start SystemTracer in the background.\n");
  1729.         exit(1);
  1730.     }
  1731.     
  1732.     if (peekw(peekl(intuitionbase+0x38)+0xe)==256L)    /* PAL Res. ?    */
  1733.     {
  1734.         ioname[13] = '5';
  1735.         ioname[14] = '6';
  1736.     }
  1737.  
  1738.     io = open(ioname,2);
  1739.     if (io<3)
  1740.     {
  1741.         printf ("Unable to open window.\n");
  1742.         exit(1);
  1743.     }
  1744.     
  1745.     write(io,title,strlen(title));
  1746.  
  1747.     xit=0;
  1748.     while(xit==0)
  1749.     {
  1750.         sprintf(buffer,">> ");print();
  1751.         InputStr(10,0,0);
  1752.         switch(string[0])
  1753.         {
  1754.             case 'l':    DisplayStructure(nr,address,name,index);
  1755.                     break;
  1756.             case 'n':    sprintf(buffer,"Entry number: ");print();
  1757.                     InputStr(80,0,0); sscanf(string,"%d",&e);
  1758.                     if(e>=structure[nr].entries)
  1759.                     {
  1760.                         sprintf(buffer,"Non-existent entry.\n");print();
  1761.                         break;
  1762.                     }
  1763.                     stack[stackptr].index = index;
  1764.                     index = -1;
  1765.                     if(entry[structure[nr].first_entry+e].dimension > 1)
  1766.                     {
  1767.                         index=0;
  1768.                         sprintf(buffer,"Index: ");print();
  1769.                         InputStr(80,0,0); sscanf(string,"%d",&index);
  1770.                         if(index>entry[structure[nr].first_entry+e].dimension-1)
  1771.                         {
  1772.                             sprintf(buffer,"Non-existent index.\n");print();
  1773.                             break;
  1774.                         }
  1775.                     }
  1776.                     switch(entry[structure[nr].first_entry+e].type)
  1777.                     {
  1778.                         case STRUCTUREPTR:    newaddress = peekl(AddUpAddress(nr,address,e,index));
  1779.                                     if (newaddress == 0)
  1780.                                     {
  1781.                                         sprintf(buffer,"Structure pointer is NULL.\n");print();
  1782.                                         break;
  1783.                                     }
  1784.                                     stack[stackptr].address = address;
  1785.                                     stack[stackptr].name=name;
  1786.                                     stack[stackptr].nr=nr;
  1787.                                     if(++stackptr>=STACKSIZE)
  1788.                                     {
  1789.                                         sprintf(buffer,"stack lost.\n");print();
  1790.                                         stackptr=0;
  1791.                                     }
  1792.                                     address = newaddress;
  1793.                                     name = entry[structure[nr].first_entry+e].name;
  1794.                                     nr = entry[structure[nr].first_entry+e].pointer;
  1795.                                     DisplayStructure(nr,address,name,index);
  1796.                                     break;
  1797.                         case STRUCTURE:        stack[stackptr].address = address;
  1798.                                     stack[stackptr].name=name;
  1799.                                     stack[stackptr].nr=nr;
  1800.                                     if(++stackptr>=STACKSIZE)
  1801.                                     {
  1802.                                         sprintf(buffer,"stack lost.\n");print();
  1803.                                         stackptr=0;
  1804.                                     }
  1805.                                     address = AddUpAddress(nr,address,e,index);
  1806.                                     name = entry[structure[nr].first_entry+e].name;
  1807.                                     nr = entry[structure[nr].first_entry+e].pointer;
  1808.                                     DisplayStructure(nr,address,name,index);
  1809.                                     break;
  1810.                         default:        sprintf(buffer,"Not a structure.\n");print();
  1811.                                     break;
  1812.                     }
  1813.                     break;
  1814.             case 'o':    sprintf(buffer,"\n");print();
  1815.                     sprintf(buffer," -0- exec.library\n");print();
  1816.                     sprintf(buffer," -1- intuition.library\n");print();
  1817.                     sprintf(buffer," -2- graphics.library\n");print();
  1818.                     sprintf(buffer,"\n Open which ? ");print();
  1819.                     InputStr(80,0,0); sscanf(string,"%d",&newaddress);
  1820.                     switch(newaddress)
  1821.                     {
  1822.                         case 0:        nr = 0;
  1823.                                 address = execbase;
  1824.                                 name = execname;
  1825.                                 index = -1;
  1826.                                 DisplayStructure(nr,address,name,index);
  1827.                                 break;
  1828.                         case 1:        address = intuitionbase;
  1829.                                 nr = 7;
  1830.                                 name = intuitionname;
  1831.                                 index = -1;
  1832.                                 DisplayStructure(nr,address,name,index);
  1833.                                 break;
  1834.                         case 2:        address = gfxbase;
  1835.                                 nr = 11;
  1836.                                 name = gfxname;
  1837.                                 index = -1;
  1838.                                 DisplayStructure(nr,address,name,index);
  1839.                                 break;
  1840.                         default:    sprintf(buffer,"Non-existent choice.\n");print();
  1841.                     }
  1842.                     break;
  1843.             case 's':    if (mode == DECIMAL)
  1844.                     {
  1845.                         mode=HEXADECIMAL;
  1846.                         sprintf(buffer,"mode is now hexadecimal.\n");print();
  1847.                         break;
  1848.                     }
  1849.                     if (mode == HEXADECIMAL)
  1850.                     {
  1851.                         mode=DECIMAL;
  1852.                         sprintf(buffer,"mode is now decimal.\n");print();
  1853.                         break;
  1854.                     }
  1855.             case 'p':    if (stackptr == 0)
  1856.                     {
  1857.                         sprintf(buffer,"There is nothing on the stack.\n");print();
  1858.                         break;
  1859.                     }
  1860.                     stackptr--;
  1861.                     address=stack[stackptr].address;
  1862.                     nr=stack[stackptr].nr;
  1863.                     name=stack[stackptr].name;
  1864.                     index=stack[stackptr].index;
  1865.                     DisplayStructure(nr,address,name,index);
  1866.                     break;
  1867.  
  1868.             case 'e':    sprintf(buffer,"Entry number: ");print();
  1869.                     InputStr(80,0,0); sscanf(string,"%d",&e);
  1870.                     if(e>=structure[nr].entries)
  1871.                     {
  1872.                         sprintf(buffer,"Non-existent entry.\n");print();
  1873.                         break;
  1874.                     }
  1875.                     idx = -1;
  1876.                     if(entry[structure[nr].first_entry+e].dimension > 1)
  1877.                     {
  1878.                         idx=0;
  1879.                         sprintf(buffer,"Index: ");print();
  1880.                         InputStr(80,0,0); sscanf(string,"%d",&idx);
  1881.                         if(idx>entry[structure[nr].first_entry+e].dimension-1)
  1882.                         {
  1883.                             sprintf(buffer,"Non-existent index.\n");print();
  1884.                             break;
  1885.                         }
  1886.                     }
  1887.                     Entry(AddUpAddress(nr,address,e,idx),e,nr,idx);
  1888.                     break;
  1889.             case 'r':    sprintf(buffer,"Structure: ");print();
  1890.                     InputStr(80,0,0); sscanf(string,"%16s",c);
  1891.                     for(i=0;i<STRUCTURESIZE;i++) if(!(strncmp(c,structure[i].name,strlen(c)))) break;
  1892.                     if (i==STRUCTURESIZE)
  1893.                     {
  1894.                         sprintf(buffer,no_such_structure);print();
  1895.                         break;
  1896.                     }
  1897.                     sprintf(buffer,adrquest);print();
  1898.                     InputStr(80,0,0); sscanf(string,"%lx",&newaddress);
  1899.                     DisplayStructure(i,newaddress,"",-1);
  1900.                     break;
  1901.             case 'w':
  1902.                     sprintf(buffer,"Mode (a)llocate/(o)verwrite: ");print();
  1903.                     while(1)
  1904.                     {
  1905.                         InputStr(80,0,0); sscanf(string,"%c",&c[70]);
  1906.                         if((c[70]=='a')||(c[70]=='o'))break;
  1907.                     }
  1908.                     sprintf(buffer,"Structure: ");print();
  1909.                     InputStr(80,0,0); sscanf(string,"%16s",c);
  1910.                     for(i=0;i<STRUCTURESIZE;i++) if(!(strncmp(c,structure[i].name,strlen(c)))) break;
  1911.                     if (i==STRUCTURESIZE)
  1912.                     {
  1913.                         sprintf(buffer,no_such_structure);print();
  1914.                         break;
  1915.                     }
  1916.                     switch(c[70])
  1917.                     {
  1918.                         case 'a':    sprintf(buffer,"Memory parameters= $");print();
  1919.                                 InputStr(80,0,0); sscanf(string,"%lx",¶);
  1920.                                 if (!(newaddress=AllocMem(AddUpAddress(i,0l,structure[i].entries,-1),para)))
  1921.                                 {
  1922.                                     sprintf(buffer,"Sorry, out of memory.\n");print();
  1923.                                     break;
  1924.                                 }
  1925.                                 WriteStructure(i,newaddress);
  1926.                                 sprintf(buffer,"Your structure is at $%08x.\n",newaddress);print();
  1927.                                 break;
  1928.                         case 'o':    sprintf(buffer,adrquest);print();
  1929.                                 InputStr(80,0,0); sscanf(string,"%lx",&newaddress);
  1930.                                 WriteStructure(i,newaddress);
  1931.                                 break;
  1932.                     }
  1933.                     break;
  1934.             case 'f':    sprintf(buffer,"Free structure: ");print();
  1935.                     InputStr(80,0,0); sscanf(string,"%16s",c);
  1936.                     for(i=0;i<STRUCTURESIZE;i++) if(!(strncmp(c,structure[i].name,strlen(c)))) break;
  1937.                     if (i==STRUCTURESIZE)
  1938.                     {
  1939.                         sprintf(buffer,no_such_structure);print();
  1940.                         break;
  1941.                     }
  1942.                     sprintf(buffer,adrquest);print();
  1943.                     InputStr(80,0,0); sscanf(string,"%lx",&newaddress);
  1944.                     FreeMem(newaddress,AddUpAddress(i,0l,structure[i].entries),-1);
  1945.                     sprintf(buffer,"Memory is now free.\n");print();
  1946.                     break;
  1947.             case 'u':    sprintf(buffer,"Free string length: ");print();
  1948.                     InputStr(80,0,0); sscanf(string,"%ld",¶);
  1949.                     sprintf(buffer,adrquest);print();
  1950.                     InputStr(80,0,0); sscanf(string,"%lx",&newaddress);
  1951.                     FreeMem(newaddress,para);
  1952.                     sprintf(buffer,"Memory is now free.\n");print();
  1953.                     break;
  1954.             case 't':
  1955.                     sprintf(buffer,"Mode (a)llocate/(o)verwrite: ");print();
  1956.                     while(1)
  1957.                     {
  1958.                         InputStr(80,0,0); sscanf(string,"%c",&c[70]);
  1959.                         if((c[70]=='a')||(c[70]=='o'))break;
  1960.                     }
  1961.                     switch(c[70])
  1962.                     {
  1963.                         case 'a':    sprintf(buffer,"Memory parameters= $");print();
  1964.                                 InputStr(80,0,0); sscanf(string,"%lx",¶);
  1965.                                 sprintf(buffer,"Length= ");print();
  1966.                                 InputStr(80,0,0); sscanf(string,"%ld",&len);
  1967.                                 if (!(newaddress=AllocMem(len+1,para)))
  1968.                                 {
  1969.                                     sprintf(buffer,"Sorry, out of memory.\n");print();
  1970.                                     break;
  1971.                                 }
  1972.                                 WriteString(len,newaddress);
  1973.                                 sprintf(buffer,"Your string is at $%08x.\n",newaddress);print();
  1974.                                 break;
  1975.                         case 'o':    sprintf(buffer,adrquest);print();
  1976.                                 InputStr(80,0,0); sscanf(string,"%lx",&newaddress);
  1977.                                 WriteString(strlen(newaddress),newaddress);
  1978.                                 break;
  1979.                     }
  1980.                     break;
  1981.             case 'm':    sprintf(buffer,"Address= $");print();
  1982.                     InputStr(80,0,0); sscanf(string,"%x",&newaddress);
  1983.                     while(1)
  1984.                     {            
  1985.                         while(peek(0xbfec01) == 57);    /* CTRL-> wait    */
  1986.                         if ((peek(0xbfec01) == 63)||(peek(0xbfec01) == 62))
  1987.                         {
  1988.                             write(io,user_break,strlen(user_break));
  1989.                             break;
  1990.                         }
  1991.                         para=newaddress;
  1992.                         sprintf(buffer,"$%08x ",newaddress);
  1993.                         for (i=0;i<16;i++) sprintf(buffer,"%s %02x",buffer,peek(para++));
  1994.                         print();
  1995.                         for(para=newaddress,i=0;i<16;i++,para++)
  1996.                         {
  1997.                             if ((peek(para)>31)&&(peek(para)<127)) buffer[i]=peek(para);
  1998.                             if ((peek(para)<32)||(peek(para)>126)) buffer[i]='.';
  1999.                         }
  2000.                         buffer[16] = 10;
  2001.                         write(io,buffer,17);
  2002.                         newaddress+=16;
  2003.                     }
  2004.                     break;
  2005.             case 'd':    sprintf(buffer,"Disk operations: (l)oad structure\n");print();
  2006.                     sprintf(buffer,"                 (s)ave structure\n");print();
  2007.                     sprintf(buffer,"                 save structure as (a)ssembler code\n");print();
  2008.                     sprintf(buffer,"                 save structure as (c) code\n");print();
  2009.                     sprintf(buffer,"                 save (m)emory\n");print();
  2010.                     sprintf(buffer,"                 load m(e)mory\n");print();
  2011.                     sprintf(buffer,"\ndisk>> ");print();
  2012.                     InputStr(80,0,0); sscanf(string,"%s",c);
  2013.                     switch(c[0])
  2014.                     {
  2015.                         case 'l':
  2016.                                 sprintf(buffer,adrquest);print();
  2017.                                 InputStr(80,0,0); sscanf(string,"%lx",&newaddress);
  2018.                                 sprintf(buffer,filename_quest);print();
  2019.                                 InputStr(80,0,0); sscanf(string,"%s",string);
  2020.                                 file=open(string,2);
  2021.                                 if (file<3)
  2022.                                 {
  2023.                                     sprintf(buffer,"Error opening file.\n");print();
  2024.                                     break;
  2025.                                 }
  2026.                                 read(file,string,24);
  2027.                                 string[24]=0;
  2028.                                 if ( strcmp(tag,string) != 0)
  2029.                                 {
  2030.                                     sprintf(buffer,"No System Tracer structure file.\n");print();
  2031.                                     close(file);
  2032.                                     break;
  2033.                                 }
  2034.                                 read(file,c,16);
  2035.                                 c[16]=0;
  2036.                                 for(i=0;i<STRUCTURESIZE;i++) if(!(strcmp(c,structure[i].name))) break;
  2037.                                 if (i==STRUCTURESIZE)
  2038.                                 {
  2039.                                     sprintf(buffer,no_such_structure);print();
  2040.                                     break;
  2041.                                 }
  2042.                                 read(file,newaddress,AddUpAddress(i,0l,structure[i].entries,-1));
  2043.                                 close(file);
  2044.                                 sprintf(buffer,"Structure loaded.\n");print();
  2045.                                 break;
  2046.                         
  2047.                         case 's':    sprintf(buffer,save_structure);print();
  2048.                                 InputStr(80,0,0); sscanf(string,"%16s",c);
  2049.                                 for(i=0;i<STRUCTURESIZE;i++) if(!(strncmp(c,structure[i].name,strlen(c)))) break;
  2050.                                 if (i==STRUCTURESIZE)
  2051.                                 {
  2052.                                     sprintf(buffer,no_such_structure);print();
  2053.                                     break;
  2054.                                 }
  2055.                                 sprintf(buffer,adrquest);print();
  2056.                                 InputStr(80,0,0); sscanf(string,"%lx",&newaddress);
  2057.                                 sprintf(buffer,filename_quest);print();
  2058.                                 InputStr(80,0,0); sscanf(string,"%s",string);
  2059.                                 file=creat(string,0);
  2060.                                 if (file<3)
  2061.                                 {
  2062.                                     sprintf(buffer,"Error opening file.\n");print();
  2063.                                     break;
  2064.                                 }
  2065.                                 write(file,tag,24);
  2066.                                 write(file,structure[i].name,16);
  2067.                                 write(file,newaddress,AddUpAddress(i,0l,structure[i].entries,-1));
  2068.                                 close(file);
  2069.                                 sprintf(buffer,"Structure saved.\n");print();
  2070.                                 break;
  2071.                         case 'c':    sprintf(buffer,save_structure);print();
  2072.                                 InputStr(80,0,0); sscanf(string,"%16s",c);
  2073.                                 for(i=0;i<STRUCTURESIZE;i++) if(!(strncmp(c,structure[i].name,strlen(c)))) break;
  2074.                                 if (i==STRUCTURESIZE)
  2075.                                 {
  2076.                                     sprintf(buffer,no_such_structure);print();
  2077.                                     break;
  2078.                                 }
  2079.                                 sprintf(buffer,adrquest);print();
  2080.                                 InputStr(80,0,0); sscanf(string,"%lx",&newaddress);
  2081.                                 sprintf(buffer,filename_quest);print();
  2082.                                 InputStr(80,0,0); sscanf(string,"%s",string);
  2083.                                 file=creat(string,0);
  2084.                                 if (file<3)
  2085.                                 {
  2086.                                     sprintf(buffer,"Error opening file.\n");print();
  2087.                                     break;
  2088.                                 }
  2089.                                 write(file,"struct\n{\n",9);
  2090.                                 for(j=structure[i].first_entry;j<structure[i].first_entry+structure[i].entries;j++)
  2091.                                 {
  2092.                                     switch(entry[j].type)
  2093.                                     {
  2094.                                         case BYTE:
  2095.                                                 write(file,"\tchar ",6);
  2096.                                                 write(file,entry[j].name,strlen(entry[j].name));
  2097.                                                 break;
  2098.                                         case UBYTE:
  2099.                                                 write(file,"\tunsigned char ",15);
  2100.                                                 write(file,entry[j].name,strlen(entry[j].name));
  2101.                                                 break;
  2102.                                         case WORD:
  2103.                                                 write(file,"\tint ",5);
  2104.                                                 write(file,entry[j].name,strlen(entry[j].name));
  2105.                                                 break;
  2106.                                         case UWORD:    
  2107.                                                 write(file,"\tunsigned int ",14);
  2108.                                                 write(file,entry[j].name,strlen(entry[j].name));
  2109.                                                 break;
  2110.                                         case LONG:    
  2111.                                                 write(file,"\tlong ",6);
  2112.                                                 write(file,entry[j].name,strlen(entry[j].name));
  2113.                                                 break;
  2114.                                         case ULONG:    
  2115.                                                 write(file,"\tunsigned long ",15);
  2116.                                                 write(file,entry[j].name,strlen(entry[j].name));
  2117.                                                 break;
  2118.                                         case STRUCTURE:    
  2119.                                                 write(file,"\tstruct ",8);
  2120.                                                 write(file,entry[j].name,strlen(entry[j].name));
  2121.                                                 break;
  2122.                                         case STRING:    
  2123.                                                 write(file,"\tchar ",6);
  2124.                                                 write(file,entry[j].name,strlen(entry[j].name));
  2125.                                                 sprintf (string,"[%d]",entry[j].pointer);
  2126.                                                 write(file,string,strlen(string));
  2127.                                                 break;
  2128.                                         case STRUCTUREPTR:
  2129.                                                 write(file,"\tstruct *",9);
  2130.                                                 write(file,entry[j].name,strlen(entry[j].name));
  2131.                                                 break;
  2132.                                         case STRINGPTR:    
  2133.                                                 write(file,"\tchar *",7);
  2134.                                                 write(file,entry[j].name,strlen(entry[j].name));
  2135.                                                 break;
  2136.                                     }
  2137.                                     if (entry[j].dimension>1)
  2138.                                     {
  2139.                                         sprintf (string,"[%d]",entry[j].dimension);
  2140.                                         write(file,string,strlen(string));
  2141.                                     }
  2142.                                     write(file,";\n",2);    
  2143.                                 }
  2144.                                 write(file,"} ",2);
  2145.                                 write(file,structure[i].name,15);
  2146.                                 write(file," =\n{\n\t",6);
  2147.                                 for(j=structure[i].first_entry,k=0;k<structure[i].entries;j++,k++)
  2148.                                 {
  2149.                                     if (entry[j].dimension == 1) switch(entry[j].type)
  2150.                                     {
  2151.                                         case ULONG:
  2152.                                         case LONG:    sprintf (string,"0x%08lx",peekl(AddUpAddress(i,address,k,-1)));
  2153.                                                 write(file,string,strlen(string));
  2154.                                                 break;    
  2155.                                         case UWORD:    
  2156.                                         case WORD:    sprintf (string,"0x%04x",peekw(AddUpAddress(i,address,k,-1)));
  2157.                                                 write(file,string,strlen(string));
  2158.                                                 break;    
  2159.                                         case UBYTE:
  2160.                                         case BYTE:    sprintf (string,"0x%02x",peek(AddUpAddress(i,address,k,-1)));
  2161.                                                 write(file,string,strlen(string));
  2162.                                                 break;
  2163.                                         case STRUCTURE: write(file,insert_string,strlen(insert_string));
  2164.                                                 break;
  2165.                                         case STRUCTUREPTR:write(file,insert_string,strlen(insert_string));
  2166.                                                 sprintf (string,"  0x%08lx",peekl(AddUpAddress(i,address,k,-1)));
  2167.                                                 write(file,string,strlen(string));
  2168.                                                 break;
  2169.                                         case STRING:    sprintf (string,"\"%s\"",AddUpAddress(i,address,k,-1));
  2170.                                                 write(file,string,strlen(string));
  2171.                                                 break;
  2172.                                         case STRINGPTR:    sprintf (string,"\"%s\"",peekl(AddUpAddress(i,address,k,-1)));
  2173.                                                 write(file,string,strlen(string));
  2174.                                                 break;
  2175.                                     }
  2176.                                     if (entry[j].dimension > 1) for(idx=0;idx<entry[j].dimension;idx++)
  2177.                                     {
  2178.                                     switch(entry[j].type)
  2179.                                     {
  2180.                                         case ULONG:
  2181.                                         case LONG:    sprintf (string,"0x%08lx",peekl(AddUpAddress(i,address,k,idx)));
  2182.                                                 write(file,string,strlen(string));
  2183.                                                 break;    
  2184.                                         case UWORD:    
  2185.                                         case WORD:    sprintf (string,"0x%04x",peekw(AddUpAddress(i,address,k,idx)));
  2186.                                                 write(file,string,strlen(string));
  2187.                                                 break;    
  2188.                                         case UBYTE:
  2189.                                         case BYTE:    sprintf (string,"0x%02x",peek(AddUpAddress(i,address,k,idx)));
  2190.                                                 write(file,string,strlen(string));
  2191.                                                 break;
  2192.                                         case STRUCTURE: if (idx==0) write(file,insert_string,strlen(insert_string));
  2193.                                                 break;
  2194.                                         case STRUCTUREPTR:if (idx ==0) write(file,insert_string,strlen(insert_string));
  2195.                                                 sprintf (string,"  0x%08lx",peekl(AddUpAddress(i,address,k,idx)));
  2196.                                                 write(file,string,strlen(string));
  2197.                                                 break;
  2198.                                         case STRING:    sprintf (string,"\"%s\"",AddUpAddress(i,address,k,idx));
  2199.                                                 write(file,string,strlen(string));
  2200.                                                 break;
  2201.                                         case STRINGPTR:    sprintf (string,"\"%s\"",peekl(AddUpAddress(i,address,k,idx)));
  2202.                                                 write(file,string,strlen(string));
  2203.                                                 break;
  2204.                                     }
  2205.                                     if((idx+1)<entry[j].dimension) write(file,", ",2);
  2206.                                     }
  2207.                                     if((k+1)<structure[i].entries) write(file,",\n\t",3);
  2208.                                 }
  2209.                                 write(file,"\n}\n",3);
  2210.                                 close(file);
  2211.                                 sprintf(buffer,"Structure saved.\n");print();
  2212.                                 break;
  2213.                         case 'a':    sprintf(buffer,save_structure);print();
  2214.                                 InputStr(80,0,0); sscanf(string,"%16s",c);
  2215.                                 for(i=0;i<STRUCTURESIZE;i++) if(!(strncmp(c,structure[i].name,strlen(c)))) break;
  2216.                                 if (i==STRUCTURESIZE)
  2217.                                 {
  2218.                                     sprintf(buffer,no_such_structure);print();
  2219.                                     break;
  2220.                                 }
  2221.                                 sprintf(buffer,adrquest);print();
  2222.                                 InputStr(80,0,0); sscanf(string,"%lx",&newaddress);
  2223.                                 sprintf(buffer,filename_quest);print();
  2224.                                 InputStr(80,0,0); sscanf(string,"%s",string);
  2225.                                 file=creat(string,0);
  2226.                                 if (file<3)
  2227.                                 {
  2228.                                     sprintf(buffer,"Error opening file.\n");print();
  2229.                                     break;
  2230.                                 }
  2231.                                 strcpy(c,structure[i].name);
  2232.                                 if (c[14]=' ') poke(strchr(c,' '),0);
  2233.                                 write(file,c,strlen(c));
  2234.                                 write(file,":\n",2);
  2235.                                 for(j=structure[i].first_entry,k=0;k<structure[i].entries;j++,k++)
  2236.                                 {
  2237.                                     strcpy(c,entry[j].name);
  2238.                                     if (c[14]=' ') poke(strchr(c,' '),0);
  2239.  
  2240.                                     for (idx=0;idx<entry[j].dimension;idx++)
  2241.                                     {
  2242.                                     switch(entry[j].type)
  2243.                                     {
  2244.                                         case BYTE: case UBYTE:
  2245.                                                 if (idx==0) write(file,c,strlen(c));
  2246.                                                 if (idx==0) write(file,":\tdc.b ",7);
  2247.                                                 sprintf (string,"$%02x",peek(AddUpAddress(i,address,k,idx)));
  2248.                                                 write(file,string,strlen(string));
  2249.                                                 if (idx==entry[j].dimension-1) write(file,even_string,strlen(even_string));
  2250.                                                 break;
  2251.                                         case WORD: case UWORD:
  2252.                                                 
  2253.                                                 if (idx==0) write(file,c,strlen(c));
  2254.                                                 if (idx==0) write(file,":\tdc.w ",7);
  2255.                                                 sprintf (string,"$%04x",peekw(AddUpAddress(i,address,k,idx)));
  2256.                                                 write(file,string,strlen(string));
  2257.                                                 break;
  2258.                                         case LONG: case ULONG:    
  2259.                                                 if (idx==0) write(file,c,strlen(c));
  2260.                                                 if (idx==0) write(file,":\tdc.l ",7);
  2261.                                                 sprintf (string,"$%08lx",peekl(AddUpAddress(i,address,k,idx)));
  2262.                                                 write(file,string,strlen(string));
  2263.                                                 break;
  2264.                                         case STRUCTURE:    if (idx==0) write(file,c,strlen(c));
  2265.                                                 if (idx==0) write(file,":\t",2);
  2266.                                                 if (idx==entry[j].dimension-1)write(file,insert_string2,strlen(insert_string2));
  2267.                                                 break;
  2268.                                         case STRING:    
  2269.                                                 if (idx==0) write(file,c,strlen(c));
  2270.                                                 if (idx==0) write(file,":\tdc.b ",7);
  2271.                                                 sprintf (string,"'%s'",AddUpAddress(i,address,k,idx));
  2272.                                                 write(file,string,strlen(string));
  2273.                                                 if (idx==entry[j].dimension-1)write(file,even_string,strlen(even_string));
  2274.                                                 break;
  2275.                                         case STRUCTUREPTR:
  2276.                                                 if (idx==0) write(file,c,strlen(c));
  2277.                                                 if (idx==0) write(file,":\tdc.l ",7);
  2278.                                                 sprintf (string,"$%08lx",peekl(AddUpAddress(i,address,k,idx)));
  2279.                                                 write(file,string,strlen(string));
  2280.                                                 if (idx==entry[j].dimension-1) write(file,insert_string2,strlen(insert_string2));
  2281.                                                 break;
  2282.                                         case STRINGPTR:    
  2283.                                                 if (idx==0) write(file,c,strlen(c));
  2284.                                                 if (idx==0) write(file,":\tdc.l ",7);
  2285.                                                 sprintf (string,"$%08lx",peekl(AddUpAddress(i,address,k,idx)));
  2286.                                                 write(file,string,strlen(string));
  2287.                                                 if (idx==entry[j].dimension-1) write(file,insert_string2,strlen(insert_string2));
  2288.                                                 break;
  2289.                                     }
  2290.                                     if (idx==entry[j].dimension-1) write(file,"\n",1);
  2291.                                     if (idx<entry[j].dimension-1) write(file,comma,2);
  2292.                                     }
  2293.                                 }
  2294.                                 close(file);
  2295.                                 sprintf(buffer,"Structure saved.\n");print();
  2296.                                 break;
  2297.                         case 'e':    sprintf(buffer,adrquest);print();
  2298.                                 InputStr(80,0,0); sscanf(string,"%lx",&newaddress);
  2299.                                 sprintf(buffer,filename_quest);print();
  2300.                                 InputStr(80,0,0); sscanf(string,"%s",string);
  2301.                                 file=open(string,2);
  2302.                                 if (file<3)
  2303.                                 {
  2304.                                     sprintf(buffer,"Error opening file.\n");print();
  2305.                                     break;
  2306.                                 }
  2307.                                 for(para=0;read(file,newaddress++,1);para++);
  2308.                                 sprintf(buffer,"Loaded $%08lx bytes (%08lx-%08lx).\n",para,newaddress-para,newaddress);print();
  2309.                                 close(file);
  2310.                                 break;
  2311.                         case 'm':    sprintf(buffer,"Start address: $");print();
  2312.                                 InputStr(80,0,0); sscanf(string,"%lx",&newaddress);
  2313.                                 sprintf(buffer,"End address: $");print();
  2314.                                 InputStr(80,0,0); sscanf(string,"%lx",¶);
  2315.                                 sprintf(buffer,filename_quest);print();
  2316.                                 InputStr(80,0,0); sscanf(string,"%s",string);
  2317.                                 file=creat(string,0);
  2318.                                 if (file<3)
  2319.                                 {
  2320.                                     sprintf(buffer,"Error opening file.\n");print();
  2321.                                     break;
  2322.                                 }
  2323.                                 write(file,address,para-newaddress);
  2324.                                 sprintf(buffer,"Saved %08lx bytes.\n",para-newaddress);print();
  2325.                                 close(file);
  2326.                                 break;
  2327.                         default:    break;
  2328.                     }
  2329.                     break;
  2330.             case 'c':    close(io);
  2331.                     while(peek(0xbfec01)>>1 != 32) Delay(60);
  2332.                     WBenchToFront();
  2333.                     io=open(ioname,2);
  2334.                     write(io,title,strlen(title));
  2335.                     break;
  2336.             case 'h':
  2337.             case '?':    write(io,help_text1,strlen(help_text1));
  2338.                     write(io,help_text2,strlen(help_text2));
  2339.                     break;
  2340.             case 'x':    xit=1;break;
  2341.             case 'q':    xit=1;break;
  2342.             default:    sprintf(buffer,"???\n");print();
  2343.                     break;
  2344.         }
  2345.     }
  2346.     close(io);
  2347.     CloseLibrary(intuitionbase);
  2348.     CloseLibrary(gfxbase);
  2349. }
  2350.