home *** CD-ROM | disk | FTP | other *** search
/ Enigma Amiga Life 109 / EnigmaAmiga109CD.iso / software / manutenzione / smartinfo / sfs / main.asm < prev    next >
Assembly Source File  |  1999-11-30  |  9KB  |  519 lines

  1.     MC68020
  2.  
  3. *    Project started ??-May-1999
  4.  
  5.     incdir    "hd2:ohjelmointi/lähdekoodit/sfs/"
  6.  
  7.     include    "lvos.i"
  8.     include    "lvo/mui_lib.i"
  9.     include    "devices/timer.i"
  10.     include    "dos/datetime.i"
  11.     include    "dos/dos.i"
  12.     include    "dos/dosasl.i"
  13.     include    "dos/dosextens.i"
  14.     include    "dos/dostags.i"
  15.     include    "exec/execbase.i"
  16.     include    "exec/memory.i"
  17.     include    "fs/nodes.i"
  18.     include    "fs/query.i"
  19.     include    "fs/packets.i"
  20.     include    "libraries/gadtools.i"
  21.     include    "libraries/locale.i"
  22.     include    "libraries/mui.i"
  23.     include    "utility/hooks.i"
  24.     include    "workbench/workbench.i"
  25.  
  26.     include    "MUI/NListview_mcc.i"
  27.  
  28.     include    "macros.i"
  29.  
  30. CH_Prefs_EmptyRecycled_ID    EQU    'CHK0'
  31. CH_Prefs_Serialize_ID        EQU    'CHK1'
  32.  
  33. CATCOMP_NUMBERS    SET    1
  34. CATCOMP_STRINGS    SET    1
  35.  
  36. MUIM_Oma_ReDraw    EQU    $7CF70000
  37. MUIM_Oma_Render    EQU    $7CF70001
  38.  
  39. step_bufsize    EQU    201
  40.  
  41. MIN_VERSION    EQU     1
  42. MIN_REVISION    EQU    80
  43.  
  44.     STRUCTURE Laite,0
  45.     APTR    ll_Seuraava
  46.     APTR    ll_MsgPort
  47.     ULONG    ll_TotalBlocks
  48.     ULONG    ll_Version
  49.     STRUCT    ll_DeviceName,16
  50.     STRUCT    ll_VolumeName,256
  51.     STRUCT    ll_CreationDate,16
  52.     STRUCT    ll_CreationTime,16
  53.     STRUCT    ll_DiskUsage,8
  54.     LABEL    Laite_SIZEOF
  55.  
  56.     STRUCTURE Muuttujat,0
  57.     STRUCT    buffer,260
  58.     STRUCT    VersionText,16
  59.     STRUCT    TimeText,16
  60.     STRUCT    StartTime,TV_SIZE
  61.     STRUCT    ElapsedTime,TV_SIZE
  62.     STRUCT    MyInfoData,id_SIZEOF
  63.     STRUCT    MyDateTime,dat_SIZEOF
  64.     STRUCT    PutkiTiedosto,32
  65.     STRUCT    LaiteLista,4
  66.     APTR    cliwin
  67.     APTR    exec
  68.     APTR    task
  69.     APTR    catalog
  70.     APTR    App
  71.     APTR    PerusLammikko
  72.     APTR    SystemLocale
  73.     APTR    ActiveEntry
  74.     APTR    timerport
  75.     APTR    timer_io
  76.     APTR    TimerBase
  77.  
  78.     ;    Defrag
  79.     APTR    DefragEntry        ; <- ActiveEntry
  80.     APTR    MsgPort
  81.     APTR    SFSport
  82.     APTR    SFSport_Abort
  83.  
  84.     APTR    TextBuffer        ; b+16
  85.     APTR    GeneralInfoFormat
  86.     APTR    GeneralInfoFormat2
  87.     APTR    GeneralInfoFormat3
  88.     APTR    StartEndOffsetText
  89.     APTR    CacheSizeText
  90.     APTR    CopyBackText
  91.     APTR    WriteThroughText
  92.     APTR    NoneText
  93.     APTR    CaseSensitiveText
  94.     APTR    RecycledText
  95.     APTR    NSDText
  96.     APTR    TD64Text
  97.     APTR    SCSIDirectText
  98.     APTR    StandardText
  99.  
  100.     APTR    Defrag_mcc
  101.     LABEL    WI_Defrag
  102.     APTR    WI_DefragWindow
  103.  
  104.     APTR    DeviceName
  105.     APTR    VolumeName
  106.     ULONG    DAddBufs
  107.  
  108.     ULONG    PacketError        ; dp_Res2
  109.  
  110.     APTR    PenSpec1        ; 32 tavua
  111.     APTR    PenSpec2
  112.     APTR    PenSpec3
  113.  
  114.     LABEL    MyPen
  115.     ULONG    UsedPen
  116.     ULONG    RemovedPen
  117.     ULONG    NewPen
  118.  
  119.     APTR    CurrPkt
  120.     APTR    CurrData
  121.     APTR    packet0
  122.     APTR    packet1
  123.     APTR    data0
  124.     APTR    data1
  125.     APTR    DefragBitMap
  126.     APTR    RenderData
  127.  
  128.     ULONG    LaiteLkm
  129.     ULONG    SignalMask
  130.     ULONG    PacketMask
  131.     ULONG    TimerMask
  132.  
  133.     APTR    RenderInfo
  134.     APTR    MUI_RastPort
  135.  
  136.     ULONG    lastread
  137.     ULONG    lastwritten
  138.     ULONG    lastblocks
  139.  
  140.     ULONG    MUI_TotalBlocks
  141.     ULONG    MUI_LeftOffset
  142.     ULONG    MUI_TopOffset
  143.     ULONG    MUI_Width
  144.     ULONG    MUI_Height
  145.  
  146.     ULONG    ppu
  147.     ULONG    bpu
  148.     ULONG    uw
  149.     ULONG    uh
  150.     ULONG    uhor
  151.     ULONG    uver
  152.     ULONG    endline
  153.     ULONG    btotal
  154.  
  155.         ULONG    lfWindowOpen
  156.         ULONG    lfEmptyRecycled
  157.         ULONG    lfSerialize
  158.  
  159.         UBYTE    bfStopDefrag    ; 0 = epätosi
  160.         UBYTE    bfQuitDefrag    ; 0 = epätosi
  161.         UBYTE    bfTimerActive    ; 0 = timer unactive
  162.         UBYTE    bfBitMapExists    ; 0 = ei ole
  163.  
  164.         UBYTE    bfUpdatePens
  165.         UBYTE    bfConfigExists    ; 0 = ei config-tiedostoa
  166.         UBYTE    bfInhibited    ; 0 = epätosi
  167.         STRUCT    UNUSED_BYTES,1
  168.  
  169.         LABEL    Kirjastot
  170.         APTR    muimaster
  171.         APTR    localebase
  172.         APTR    intui
  173.         APTR    gfxbase
  174.  
  175.         APTR    dos        ; jää viimeiseksi
  176.         LABEL    KirjastotLoppuu
  177.  
  178.     STRUCT    ConfigData,3*32
  179.  
  180.     LABEL    Muuttujat_SIZE
  181.  
  182. kirjastoja    EQU    (KirjastotLoppuu-Kirjastot)/4-1
  183.  
  184.  
  185. alku    move.l    4.w,a6
  186.     clr.l    -(sp)
  187.     sub.l    a1,a1
  188.     jsr    _LVOFindTask(a6)
  189.     move.l    d0,a2
  190.     tst.l    pr_CLI(a2)
  191.     bne.b    .cli
  192.     lea    pr_MsgPort(a2),a0
  193.     jsr    _LVOWaitPort(a6)
  194.     lea    pr_MsgPort(a2),a0
  195.     jsr    _LVOGetMsg(a6)
  196.     move.l    d0,(sp)
  197.  
  198. .cli    lea    t,a5
  199.     move.l    (a5),a4
  200.  
  201.     move.l    a2,task(a4)
  202.     move.l    a6,exec(a4)
  203.  
  204.     lea    dosname-t(a5),a1
  205.     moveq    #39,d0
  206.     jsr    _LVOOpenLibrary(a6)
  207.     move.l    d0,dos(a4)
  208.     beq    xt_Loppu
  209.  
  210.     bsr    AvaaKirjastot
  211.     bne    xt_SuljeKirjastot
  212.  
  213.     bsr    Initialize
  214.     beq    xt_UnInitialize
  215.  
  216.     bsr    LoadConfig
  217.  
  218.     move.l    exec(a4),a6
  219.     move.w    AttnFlags(a6),d0
  220.     btst    #AFF_68010,d0
  221.     bne.b    .68020
  222.     GETSTR    MSG_020_REQUIRED
  223.     move.l    d0,a2
  224.     GETSTR2    MSG_INTUI_OK_GAD
  225.     move.l    d0,a1
  226.     move.l    muimaster(a4),a6
  227.     moveq    #0,d0
  228.     moveq    #0,d1
  229.     moveq    #0,d2
  230.     lea    AppTitleText-t(a5),a0
  231.     suba.l    a3,a3
  232.     jsr    _LVOMUI_RequestA(a6)
  233.     bra    xt_SuljeKirjastot
  234.  
  235. .68020    bsr    CreateObjects
  236.     beq    xt_UnInitialize
  237.  
  238.     TEE_METODI    App(a4),LataaAsetukset_Metodit
  239.  
  240.     bsr    DoPostInit
  241.  
  242.     move.l    WI_Main-t(a5),a0
  243.     bsr    AvaaIkkuna
  244.     beq.b    xt_LopetaSovellus2
  245.  
  246.     clr.l    ErrorCode-t(a5)
  247.  
  248. .loop1    TEE_METODI    App(a4),OdotusMetodit
  249.     cmp.l    #MUIV_Application_ReturnID_Quit,d0
  250.     beq.b    xt_LopetaSovellus2
  251.  
  252.     tst.l    d0
  253.     beq.b    .skip1
  254.     move.l    d0,a0
  255.     jsr    (a0)
  256.  
  257. .skip1    move.l    Signal-t(a5),d0
  258.     beq.b    .loop1
  259.     move.l    exec(a4),a6
  260.     or.l    SignalMask(a4),d0
  261.     jsr    _LVOWait(a6)
  262.     move.l    d0,d1
  263.     move.l    d0,Signal-t(a5)
  264.     and.l    PacketMask(a4),d1
  265.     beq.b    .timer
  266.     move.l    d0,-(sp)
  267.     bsr    LueViesti
  268.     move.l    (sp)+,d0
  269.  
  270. .timer    and.l    TimerMask(a4),d0
  271.     beq.b    .loop1
  272.     bsr    GetTimerMsg
  273.     bra.b    .loop1
  274.  
  275. xt_LopetaSovellus:
  276.     addq.l    #4,sp
  277.  
  278. xt_LopetaSovellus2:
  279.     bsr    AbortPacket
  280.  
  281.     move.l    muimaster(a4),a6
  282.     move.l    App(a4),a0
  283.     jsr    _LVOMUI_DisposeObject(a6)
  284.     move.l    Defrag_mcc(a4),a0
  285.     jsr    _LVOMUI_DeleteCustomClass(a6)
  286.  
  287. xt_UnInitialize:
  288.     bsr    UnInitialize
  289.  
  290. xt_SuljeKirjastot:
  291.     bsr    SuljeKirjastot
  292.  
  293. xt_Loppu:
  294.     move.l    (sp)+,d2
  295.     beq.b    .x
  296.     jsr    _LVOForbid(a6)
  297.     move.l    d2,a1
  298.     jsr    _LVOReplyMsg(a6)
  299. .x    move.l    ErrorCode-t(a5),d0
  300.     rts
  301.  
  302.     include    "initializers.asm"
  303.     include    "CustomClass.asm"
  304.     include    "defrag.asm"
  305.     include    "timer.asm"
  306.     include    "dos.asm"
  307.     include    "gui.asm"
  308.     include    "sekalaiset.asm"
  309.     include    "ObjCreating.asm"
  310.     include    "requesters.asm"
  311.     include    "käsittelijät/muut.asm"
  312.     include    "käsittelijät/nappulat.asm"
  313.     include    "käsittelijät/valikot.asm"
  314.  
  315.     include    "käsittelijät/muut_abs.asm"
  316.     include    "käsittelijät/nappulat_abs.asm"
  317.     include    "käsittelijät/valikot_abs.asm"
  318.  
  319.     SECTION    Muuttujat,BSS
  320.  
  321. b:    ds.b    Muuttujat_SIZE
  322.  
  323.     SECTION    Vakiot,DATA
  324.  
  325. t:    dc.l    b
  326.  
  327. Signal    dc.l    0
  328.  
  329.     include    "mui/groups/defrag.asm"
  330.     include    "mui/groups/prefs.asm"
  331.     include    "mui/groups.asm"
  332.     include    "mui/metodit/defrag.asm"
  333.     include    "mui/metodit/prefs.asm"
  334.     include    "mui/metodit.asm"
  335.     include    "mui/tags.asm"
  336.     include    "mui/windows.asm"
  337.     include    "hooks.asm"
  338.     include    "menut.asm"
  339.  
  340. SFSQueryTags:
  341.     dc.l    ASQ_CACHE_ACCESSES
  342. sfs_cache_accesses:
  343.     dc.l    0
  344.     dc.l    ASQ_CACHE_MISSES
  345. sfs_cache_misses:
  346.     dc.l    0
  347.     dc.l    ASQ_START_BYTEH
  348. sfs_start_byteh:
  349.     dc.l    0
  350.     dc.l    ASQ_START_BYTEL
  351. sfs_start_bytel:
  352.     dc.l    0
  353.     dc.l    ASQ_END_BYTEH
  354. sfs_end_byteh:
  355.     dc.l    0
  356.     dc.l    ASQ_END_BYTEL
  357. sfs_end_bytel:
  358.     dc.l    0
  359.     dc.l    ASQ_DEVICE_API
  360. sfs_device_api:
  361.     dc.l    0
  362.     dc.l    ASQ_BLOCK_SIZE
  363. sfs_block_size:
  364.     dc.l    0
  365.     dc.l    ASQ_TOTAL_BLOCKS
  366. sfs_total_blocks:
  367.     dc.l    0
  368.     dc.l    ASQ_ROOTBLOCK
  369. sfs_rootblock:
  370.     dc.l    0
  371.     dc.l    ASQ_ROOTBLOCK_OBJECTNODES
  372. sfs_rootblock_objectnodes:
  373.     dc.l    0
  374.     dc.l    ASQ_ROOTBLOCK_EXTENTS
  375. sfs_rootblock_extents:
  376.     dc.l    0
  377.     dc.l    ASQ_FIRST_BITMAP_BLOCK
  378. sfs_first_bitmap_block:
  379.     dc.l    0
  380.     dc.l    ASQ_FIRST_ADMINSPACE
  381. sfs_first_adminspace:
  382.     dc.l    0
  383.     dc.l    ASQ_CACHE_LINES
  384. sfs_cache_lines:
  385.     dc.l    0
  386.     dc.l    ASQ_CACHE_READAHEADSIZE
  387. sfs_cache_readaheadsize:
  388.     dc.l    0
  389.     dc.l    ASQ_CACHE_MODE
  390. sfs_cache_mode:
  391.     dc.l    0
  392.     dc.l    ASQ_CACHE_BUFFERS
  393. sfs_cache_buffers:
  394.     dc.l    0
  395.     dc.l    ASQ_IS_CASESENSITIVE
  396. sfs_is_casesensitive:
  397.     dc.l    0
  398.     dc.l    ASQ_HAS_RECYCLED
  399. sfs_has_recycled:
  400.     dc.l    0
  401.     dc.l    ASQ_VERSION
  402. sfs_version:
  403.     dc.l    0
  404.     dc.l    TAG_DONE
  405.  
  406. ErrorCode:
  407.     dc.l    20
  408.  
  409. libnametable:
  410.     dc.l    muimastername
  411.     dc.l    localelibname
  412.     dc.l    intuiname
  413.     dc.l    gfxname
  414.     dc.l    0
  415.  
  416. localetags:
  417.     dc.l    OC_BuiltInLanguage,t_English
  418.     dc.l    TAG_DONE
  419.  
  420. PreParse:
  421.     dc.b  27,'c',0
  422. PreParse2:
  423.     dc.b  27,'r',0
  424.  
  425. pixw    dc.b    1,2,3,2,3,4,3,5,4,5,4,6,5,6,5,6,6
  426. pixh    dc.b    1,1,1,2,2,2,3,2,3,3,4,3,4,4,5,5,6
  427.  
  428. ;    dc.b    1,2,3,4,6,8,9,10,12,15,16,18,20,24,25,30,36
  429.  
  430. DoubleTxtHeight:
  431.     dc.b    10,0
  432.  
  433.     include    "tekstit/sfs.strings.asm"
  434.     include    "mui/classes.asm"
  435.  
  436. *-----------------------------------------------*
  437. *    @Formatointilausekkeet            *
  438. *-----------------------------------------------*
  439.  
  440. DeviceListFormat:
  441.     dc.b    ',,,',0
  442.  
  443. SFScheckFormat:
  444.     dc.b    'SFScheck %s >%s',0
  445.  
  446. PutkiFormaatti:
  447.     dc.b    'PIPE:%s.putki',0
  448.  
  449. CacheMissesFormat:
  450.     dc.b    '%lU (%d.%02.d%%)',0
  451. DoubleStringFormat:
  452.     dc.b    '%s%s',0
  453. NumberFormat:
  454.     dc.b    '%lU',0
  455. VersionNumberFormat:
  456.     dc.b    '%d.%d',0
  457. TimeFormat:
  458.     dc.b    '%02.d:%02.d:%02.d',0
  459. DiskUsageFormat:
  460.     dc.b    '%d%%',0
  461.  
  462. *-----------------------------------------------*
  463. *    @Init                    *
  464. *-----------------------------------------------*
  465.  
  466. catalogname:
  467.     dc.b    'smartinfo.catalog',0
  468.  
  469. t_English:
  470.     dc.b    'english',0
  471.  
  472. t_ERR_NO_LIBRARY:
  473.     dc.b    'Unable to open %s. Version %d or newer required.',10,0
  474.  
  475. *-----------------------------------------------*
  476. *    @Muut                    *
  477. *-----------------------------------------------*
  478.  
  479. t_DefStartTime:
  480.     dc.b    '00:00:00',0
  481.  
  482. HDImageSpec:
  483.     dc.b    27,'I[6:23,8]',0
  484.  
  485. EnvarcConfigName:
  486.     dc.b    'ENVARC:MUI/SmartInfo.config',0
  487. EnvConfigName:
  488.     dc.b    'ENV:MUI/SmartInfo.config',0
  489.  
  490. AppTitleText:
  491.     dc.b    'Smart Info v1.04',0
  492. t_AppBase:
  493.     dc.b    'SMARTINFO',0
  494. t_AppRights:
  495. t_AuthorInfo:
  496.     dc.b    'Ilkka Lehtoranta',0
  497. t_AppTitle:
  498.     dc.b    'Smart Info',0
  499. t_VerString:
  500.     dc.b    '$VER: Smart Info 1.04 (30.11.1999)',0
  501. t_AppDescription:
  502.     dc.b    'SmartFileSystem Info and Defragment Tool',0
  503.  
  504. Numerals:
  505.     dc.b    '01234567689',0
  506.  
  507. timername:
  508.     dc.b    'timer.device',0
  509. muimastername:
  510.     dc.b    11,'muimaster.library',0
  511. localelibname:
  512.     dc.b    38,'locale.library',0
  513. intuiname:
  514.     dc.b    39,'intuition.library',0
  515. gfxname    dc.b    36,'graphics.library',0
  516.  
  517. dosname    dc.b    'dos.library',0
  518.  
  519.     END