Time Related Interrupts Don't Work in Assembly

2019-07-19 23:11发布

I wanted to create a small program in Assembly language, that delays for several seconds.

I am using Windows XP SP3, and opened a DOS window, and ran debug.exe

I entered there this short Assembly program:

MOV CX,3D

MOV DX,0900

MOV AH,86

INT 15

Function 86h in Interrupt 15h, performs a delay, and the Duration for the delay is in CX,DX, in MicroSeconds.

So If for example I want to delay for 4 seconds, then it's 4,000,000microseconds = 3D0900h, and that's what I put in CX,DX.

Running this short program, unfortunately does not perform any delay, it exits immediately.

I then tried another interrupt function:

Function number 0, in Interrupt 1Ah, returns the PC's clock count, to CX,DX. Each tick is 1/18.2 seconds.

I then entered and ran this short program:

MOV AH,0

INT 1A

But unfortunately, CX and DX both equal 0000h after running it.

Is there a reason why 2 Time related interrupts don't work in Windows? It seems that other interrupts do work..

Is there anything I can do to make them work, so I can achieve the small delay program that I want to write?

Thank you

1条回答
Ridiculous、
2楼-- · 2019-07-19 23:36

Omer, there's an excellent solution to your delaying problem that I found on CodeReview.
It uses the BIOS timer tick variable at address 0040h:006Ch directly rather than asking it's value through function 00h on int 1Ah.

Please take a look at https://codereview.stackexchange.com/questions/101035/a-low-tech-approach-to-measuring-game-speed

查看更多
登录 后发表回答