1

タイトルが言うように、私は間欠的な連鎖をしようとしています。私が探しているのは、タイマー割り込み(IRQ 0)が呼び出され、割り込みハンドラー(ISR)が終了すると、コードが実行されることです。私はそれをアセンブリ、C、またはそれを可能にする任意の言語で実行しようとしています。このページで例を見つけましたが、TASMでは機能しません。これについて教えていただけますか、またはこれに関する情報をどこで見つけることができますか?ありがとうございました。:D

4

1 に答える 1

4

もう使用していませんが、アセンブリの最初のステップで使用したアセンブラでもう一度プレイしたかっただけです。

.186
.MODEL TINY, C

.code
ORG 100h

Entry:
; Install handler
   push   ds
   xor    cx, cx
   mov    ds, cx
   mov    ax, ds:[8*4]
   mov    dx, ds:[8*4+2]
   cli
   mov    ds:[8*4], OFFSET InterruptHandler
   mov    ds:[8*4+2], cs
   pop    ds
   mov    word ptr [OldIntVect], ax
   mov    word ptr [OldIntVect+2], dx
   sti

; Wait for the user to press a key. In the meantime you should see lots of wildcards!
   xor   ax, ax
   int   16h

; Restore original handler
   mov    ax, word ptr [OldIntVect]
   mov    dx, word ptr [OldIntVect+2]
   push   ds
   xor    cx, cx
   mov    ds, cx
   cli
   mov    ds:[8*4], ax
   mov    ds:[8*4+2], dx
   sti
   pop    ds

; Exit to DOS
   int   20h

PROC MyHandler

   mov   ah, 0Eh
   mov   al, '*'
   int   10h
   ret
ENDP


InterruptHandler:
   pushf
   call  cs:[OldIntVect]
   cmp   [busy], 0
   jne   ExitHandler ; If jumps then the timer was faster than the time it takes for MyHandler to complete

   mov   cs:[busy], 1
   pusha
   call  MyHandler ; Other options are using a pointer to function or just inlining the code here.
   popa
   mov   cs:[busy], 0

ExitHandler:
   iret

OldIntVect dd ?
busy       db ?

END Entry

WinXP (32 ビット) でテスト:

>tasm timer.asm
Turbo Assembler  Version 1.01  Copyright (c) 1988, 1989 Borland International

Assembling file:   TIMER.ASM
Error messages:    None
Warning messages:  None
Remaining memory:  481k


>tlink /t timer.obj
Turbo Link  Version 3.0 Copyright (c) 1987, 1990 Borland International

>timer
***************************

しかし、もちろん、これは DOS 環境 (DOSBox、Windows 32 ビット バージョンなど) でのみ有効であり、多くてもブートローダー用にいくつかの調整が行われています。

とにかく、あなたが私に与えてくれたこのすべてを復活させてくれた美しい時間をありがとう:P

于 2011-02-25T03:07:54.293 に答える