home *** CD-ROM | disk | FTP | other *** search
/ FreeWare Collection 3 / FreeSoftwareCollection3pd199x-jp.img / pao / ms_dos / wild / src / int24.asm < prev    next >
Assembly Source File  |  1980-01-02  |  4KB  |  176 lines

  1. ;==============================================================================
  2. ;    << MASM V5.1 >>  for  FM TOWNS
  3. ;==============================================================================
  4.     page        60,132
  5.     name        INT24
  6.     title        INT24 Proc
  7. ;==============================================================================
  8. ;    致命的エラーハンドリング
  9. ;
  10. ;    CREATE : 1990.12.17
  11. ;    FINISH : 1990.12.17  V0.50
  12. ;
  13. ;    MSC 用 関数(スモールモデル)
  14. ;    INT24_init(void) ;
  15. ;    INT24_release(void) ;
  16. ;
  17. ;    < HISTORY >
  18. ;    1990.12.17 : CREATE
  19. ;
  20. ;    All Rights Reserved, Copyright (C) Y.Hirata 1990.
  21. ;
  22. ;    Programed by Y.Hirata ( NIFTY-ID : NAB03321 )
  23. ;==============================================================================
  24. ;
  25.             .MODEL    SMALL,C                    ;
  26. ;
  27. ;
  28. ;********************************************
  29. ;            データ領域
  30. ;********************************************
  31.             .DATA                            ;
  32. ;
  33.             public    INT24errno                ;
  34. INT24errno    dw        ?                        ; 致命的エラーコード
  35. ;
  36. ErrorBlock    struc                            ; 致命的エラー情報
  37.     extcode    dw        ?                        ; 拡張エラーコード
  38.     class    db        ?                        ; エラークラス
  39.     action    db        ?                        ; エラー対処
  40.     locus    db        ?                        ; エラー発生場所
  41. ErrorBlock    ends                            ;
  42. ;
  43.             public    INT24err                ;
  44. INT24err    ErrorBlock    <>                    ; 致命的エラー情報格納領域
  45. ;
  46. Regs_CX        dw        ?                        ; レジスタ退避用
  47. Regs_DX        dw        ?                        ; レジスタ退避用
  48. Regs_SI        dw        ?                        ; レジスタ退避用
  49. Regs_DI        dw        ?                        ; レジスタ退避用
  50. Regs_BP        dw        ?                        ; レジスタ退避用
  51. Regs_DS        dw        ?                        ; レジスタ退避用
  52. Regs_ES        dw        ?                        ; レジスタ退避用
  53. ;
  54. ;********************************************
  55. ;            コード領域
  56. ;********************************************
  57.             .CODE                            ;
  58. ;
  59. COPYRIGHT    db            0Dh
  60.             db            '     ',0Dh,0Ah,07h
  61.             db            0Dh,0Ah,'        '
  62.             db            'INT24 ハンドラー V0.50   1990-12-17',0Dh,0Ah
  63.             db            0Dh,0Ah,'        '
  64.             db            'Copyright (C) Y.Hirata 1990.'
  65.             db            0Dh,0Ah,0Dh,0Ah,1Ah
  66. ;
  67. TITLE_name    db            'INT24 handring'
  68. TITLE_len    EQU            $-TITLE_name
  69. ;
  70. ;********************************************
  71. ;            定数定義
  72. ;********************************************
  73. ;
  74. TRUE        EQU            1
  75. FALSE        EQU            0
  76. ;
  77. ZERO        EQU            0
  78. ;
  79. ;********************************************
  80. ;            データ領域
  81. ;********************************************
  82. vct_24h        dd        far                        ; 致命的エラー割り込みベクタ
  83. ;
  84. ;********************************************
  85. ;            致命的エラー ハンドラ
  86. ;********************************************
  87. int24_abort        proc    far                    ;
  88.             push    ds                        ;
  89. ;
  90.             mov        ax,@data                ; load ds
  91.             mov        ds,ax                    ;
  92.             mov        ax,di                    ;
  93.             and        ax,00FFh                ; 下位バイトのみ
  94.             mov        INT24errno,ax            ;
  95. ;
  96.             mov        Regs_CX,cx                ; レジスタ 退避
  97.             mov        Regs_DX,dx                ;
  98.             mov        Regs_SI,si                ;
  99.             mov        Regs_DI,di                ;
  100.             mov        Regs_BP,bp                ;
  101.             mov        Regs_DS,ds                ;
  102.             mov        Regs_ES,es                ;
  103. ;
  104.             mov        ah,59h                    ;
  105.             mov        bx,ZERO                    ;
  106.             int        21h                        ; 拡張エラーコードの取得
  107. ;
  108.             mov        es,Regs_ES                ; レジスタ 復元
  109.             mov        ds,Regs_DS                ;
  110. ;
  111.             mov        dx,bx                    ;
  112.             mov        bx,offset INT24err        ; 致命的エラー情報格納領域 : [BX]
  113.             mov        [bx].extcode,ax            ; 拡張エラーコード
  114.             mov        [bx].class,dh            ; エラークラス
  115.             mov        [bx].action,dl            ; 可能な対処
  116.             mov        [bx].locus,ch            ; エラー発生場所
  117. ;
  118.             mov        bp,Regs_BP                ; レジスタ 復元
  119.             mov        di,Regs_DI                ;
  120.             mov        si,Regs_SI                ;
  121.             mov        dx,Regs_DX                ;
  122.             mov        cx,Regs_CX                ;
  123. ;
  124.             pop        ds                        ;
  125.             mov        ax,0003h                ; システムコール失敗でリターン
  126.             iret                            ;
  127. int24_abort        endp                        ;
  128. ;
  129. ;********************************************
  130. ;            致命的エラー ハンドラのセット
  131. ;********************************************
  132. INT24_init        proc                        ;
  133.             push    es                        ;
  134.             push    ds                        ;
  135.             push    dx                        ;
  136.             push    bx                        ;
  137.             push    cs                        ;
  138.             pop        ds                        ; ds = cs
  139. ;
  140.             mov        ax,3524h                ;
  141.             int        21h                        ;
  142.             mov        WORD ptr cs:vct_24h,bx    ;
  143.             mov        WORD ptr cs:vct_24h+2,es    ;
  144. ;
  145.             mov        dx,offset cs:int24_abort    ; 致命的エラー ハンドラのベクタセット
  146.             mov        ax,2524h                ;
  147.             int        21h                        ;
  148. ;
  149.             pop        bx                        ;
  150.             pop        dx                        ;
  151.             pop        ds                        ;
  152.             pop        es                        ;
  153.             ret                                ;
  154. INT24_init        endp                        ;
  155. ;
  156. ;********************************************
  157. ;            致命的エラー ハンドラのリセット
  158. ;********************************************
  159. INT24_release    proc                        ;
  160.             push    ds                        ;
  161.             push    dx                        ;
  162.             push    cs                        ;
  163.             pop        ds                        ; ds = cs
  164. ;
  165.             lds        dx,DWORD ptr cs:vct_24h    ;
  166.             mov        ax,2524h                ;
  167.             int        21h                        ;
  168. ;
  169.             pop        dx                        ;
  170.             pop        ds                        ;
  171.             ret                                ;
  172. INT24_release    endp                        ;
  173. ;
  174.             end
  175.  
  176.