home *** CD-ROM | disk | FTP | other *** search
/ FreeWare Collection 3 / FreeSoftwareCollection3pd199x-jp.img / pao / t_os / sound / src / int23.asm < prev    next >
Assembly Source File  |  1980-01-02  |  5KB  |  199 lines

  1. ;==============================================================================
  2. ;    << 386ASM V2.0 >>  for  FM TOWNS
  3. ;==============================================================================
  4.     page        60,132
  5.     name        INT23
  6.     title        INT23 INTERRUPT.
  7. ;==============================================================================
  8. ;    INT23(^C) 割り込み
  9. ;
  10. ;    CREATE : 1990.08.30
  11. ;    FINISH : 1990.08.30
  12. ;
  13. ;    < High C からの呼出形式 >
  14. ;    extern    void INT23_init(void) ;
  15. ;    extern    void INT23_end(void) ;
  16. ;
  17. ;    < HISTORY >
  18. ;    1990.08.30 : CREATE
  19. ;
  20. ;    <  note   >
  21. ;    TABS = 4
  22. ;
  23. ;    ★注意
  24. ;        このプログラムを呼ぶプログラムの
  25. ;        オブジェクトは、ネイティブの最初に
  26. ;        おいて下さい。(先頭から64K以内に入る
  27. ;        ようにするため。)
  28. ;
  29. ;    Programed by Y.Hirata ( Nifty-ID : NAB03321 )
  30. ;==============================================================================
  31. ;
  32. ;
  33. ;********************************************
  34. ;            外部宣言定義
  35. ;********************************************
  36. ;
  37.             public    INT23_init                ; INT23(^C) 割り込み登録
  38.             public    INT23_end                ; INT23(^C) 割り込み解除
  39. ;
  40. ;
  41. ;********************************************
  42. ;            定数定義
  43. ;********************************************
  44. ;
  45. DOS_INT        EQU            021h                ; MS-DOS Function
  46. ;
  47. ;
  48. ;////////////////////////////////////////////
  49. ;            リアル部
  50. ;////////////////////////////////////////////
  51. ;
  52. rmcode        segment WORD public 'rmcode' use16
  53.             assume    cs:rmcode                ;
  54. ;
  55. ;********************************************
  56. ;    INT23 リアルハンドラ内での使用データ領域
  57. ;********************************************
  58. ;
  59. vct_23h        dd        far                        ; ^C 割り込みベクタ
  60. ;
  61. ;********************************************
  62. ;            ^C ハンドラ
  63. ;********************************************
  64. int23_abort        proc    FAR                    ;
  65.             iret                            ;
  66. int23_abort        endp                        ;
  67. ;
  68. ;********************************************
  69. ;            ^C ハンドラのセット
  70. ;********************************************
  71. int23_setup        proc    FAR                    ;
  72.             push    es                        ;
  73.             push    ds                        ;
  74.             push    dx                        ;
  75.             push    bx                        ;
  76.             push    cs                        ;
  77.             pop        ds                        ; ds = cs
  78. ;
  79.             mov        ax,3523h                ;
  80.             int        DOS_INT                    ;
  81.             mov        WORD ptr cs:vct_23h,bx    ;
  82.             mov        WORD ptr cs:vct_23h+2,es    ;
  83. ;
  84.             mov        dx,offset cs:int23_abort    ; ^C ハンドラのベクタセット
  85.             mov        ax,2523h                ;
  86.             int        DOS_INT                    ;
  87. ;
  88.             pop        bx                        ;
  89.             pop        dx                        ;
  90.             pop        ds                        ;
  91.             pop        es                        ;
  92.             ret                                ;
  93. int23_setup        endp                        ;
  94. ;
  95. ;********************************************
  96. ;            ^C ハンドラのリセット
  97. ;********************************************
  98. int23_release    proc    FAR                    ;
  99.             push    ds                        ;
  100.             push    dx                        ;
  101.             push    cs                        ;
  102.             pop        ds                        ; ds = cs
  103. ;
  104.             lds        dx,DWORD ptr cs:vct_23h    ;
  105.             mov        ax,2523h                ;
  106.             int        DOS_INT                    ;
  107. ;
  108.             pop        dx                        ;
  109.             pop        ds                        ;
  110.             ret                                ;
  111. int23_release    endp                        ;
  112. ;
  113. real_end    label byte                        ; リアルの最終アドレス(リアルサイズ取得用)
  114. ;
  115. rmcode        ends                            ;
  116. ;
  117. ;
  118. ;
  119. ;////////////////////////////////////////////
  120. ;            ネイティブ部
  121. ;////////////////////////////////////////////
  122. ;
  123. ;********************************************
  124. ;    VSYNC ネイティブ処理
  125. ;********************************************
  126. ;
  127. pmcode        segment DWORD public 'CODE' use32    ;
  128.             assume    cs:pmcode,ds:rmcode        ;
  129. ;
  130. ;********************************************
  131. ;    INT23(^C) 割り込み登録
  132. ;********************************************
  133. INT23_init    proc    NEAR                    ;
  134.             enter    0,0                        ;
  135.             push    es                        ;
  136.             push    ds                        ;
  137.             push    ecx                        ;
  138.             push    ebx                        ;
  139. ;
  140.             mov        ax,ds                    ;
  141.             mov        es,ax                    ; es = ds
  142.             xor        ebx,ebx                    ;
  143.             lea        ecx,real_end            ;
  144.             mov        ax,0250fh                ;
  145.             int        DOS_INT                    ; ネイティブ->リアル の アドレス変換
  146. ;
  147.             mov        ebx,ecx                    ; セグメント
  148.             lea        bx,int23_setup            ; オフセット
  149.             xor        ecx,ecx                    ; ecx = 0
  150.             mov        ax,0250eh                ;
  151.             int        DOS_INT                    ; リアルモードプロシジャの呼出
  152. ;
  153.             pop        ebx                        ;
  154.             pop        ecx                        ;
  155.             pop        ds                        ;
  156.             pop        es                        ;
  157.             xor        eax,eax                    ; return code = 0
  158.             leave                            ;
  159.             ret                                ;
  160. INT23_init    endp                            ;
  161. ;
  162. ;
  163. ;********************************************
  164. ;    INT23(^C) 割り込み解除
  165. ;********************************************
  166. INT23_end    proc    NEAR                    ;
  167.             enter    0,0                        ;
  168.             push    es                        ;
  169.             push    ds                        ;
  170.             push    ecx                        ;
  171.             push    ebx                        ;
  172. ;
  173.             mov        ax,ds                    ;
  174.             mov        es,ax                    ; es = ds
  175.             xor        ebx,ebx                    ;
  176.             lea        ecx,real_end            ;
  177.             mov        ax,0250fh                ;
  178.             int        DOS_INT                    ; ネイティブ->リアル の アドレス変換
  179. ;
  180.             mov        ebx,ecx                    ; セグメント
  181.             lea        bx,int23_release        ; オフセット
  182.             xor        ecx,ecx                    ; ecx = 0
  183.             mov        ax,0250eh                ;
  184.             int        DOS_INT                    ; リアルモードプロシジャの呼出
  185. ;
  186.             pop        ebx                        ;
  187.             pop        ecx                        ;
  188.             pop        ds                        ;
  189.             pop        es                        ;
  190.             xor        eax,eax                    ; return code = 0
  191.             leave                            ;
  192.             ret                                ;
  193. INT23_end    endp                            ;
  194. ;
  195. pmcode        ends                            ;
  196. ;
  197.             end
  198.     
  199.