开发者

Delay On Assembler?

开发者 https://www.devze.com 2023-01-03 13:46 出处:网络
I want to know how i can do delay (Timer) on assembler 16 bit on PC. Thank You for helping, Norm. OS: Windows

I want to know how i can do delay (Timer) on assembler 16 bit on PC. Thank You for helping, Norm.

OS: Windows

CODE:

 delay:
     inc bx
     cmp bx,WORD ptr[time]
     开发者_StackOverflow社区je delay2
     jmp delay
 delay2:
     inc dx
     cmp dx,WORD ptr[time2]
     je delay3
     jmp delay
     mov bx,0
 delay3:
     inc cx
     cmp cx,WORD ptr[time3]
     je Finish_delay
     jmp delay

its not work good i need less complicated code


Why don't you insert special NO-OP instructions? Or you can calculate a delay by inserting a branch instruction that is always mispredicted a certain number of times and multiplying that with the branch penalty of your architecture. That can be accurate +- 1 cycle.

0

精彩评论

暂无评论...
验证码 换一张
取 消