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.
精彩评论