Time Related Interrupts Don't Work in Assembly, in Windows?

為{幸葍}努か 提交于 2019-12-24 04:40:05

问题


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:


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



来源:https://stackoverflow.com/questions/29037461/time-related-interrupts-dont-work-in-assembly-in-windows

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!