Last change
on this file since 247 was
247,
checked in by aitotat@…, 12 years ago
|
Changes to Assembly Library:
- Delay functions are no longer required by reboot functions when building XTIDE Universal BIOS.
|
File size:
1.3 KB
|
Rev | Line | |
---|
[247] | 1 | ; Project name : Assembly Library |
---|
| 2 | ; Description : Delay macros. |
---|
| 3 | %ifndef DELAY_INC |
---|
| 4 | %define DELAY_INC |
---|
| 5 | |
---|
| 6 | ;-------------------------------------------------------------------- |
---|
| 7 | ; Clears prefetch queue by jumping to next instruction. |
---|
| 8 | ; This delays much more than nop instruction of fast systems. |
---|
| 9 | ; |
---|
| 10 | ; JMP_DELAY |
---|
| 11 | ; Parameters |
---|
| 12 | ; Nothing |
---|
| 13 | ; Returns: |
---|
| 14 | ; Nothing |
---|
| 15 | ; Corrupts registers: |
---|
| 16 | ; Nothing |
---|
| 17 | ;-------------------------------------------------------------------- |
---|
| 18 | %macro JMP_DELAY 0 |
---|
| 19 | jmp SHORT %%NextInstruction |
---|
| 20 | %%NextInstruction: |
---|
| 21 | %endmacro |
---|
| 22 | |
---|
| 23 | |
---|
| 24 | ;-------------------------------------------------------------------- |
---|
| 25 | ; Mimimun delays (without fetching) with some CPU architectures: |
---|
| 26 | ; 8088/8086: 17 cycles for jump + 5 cycles for last comparison |
---|
| 27 | ; 286: 10 cycles for jump + 4 cycles for last comparison |
---|
| 28 | ; 386: 13 cycles for jump + ? cycles for last comparison |
---|
| 29 | ; 486: 7 cycles for jump + 6 cycles for last comparison |
---|
| 30 | ; |
---|
| 31 | ; DELAY_WITH_LOOP_INSTRUCTION |
---|
| 32 | ; Parameters |
---|
| 33 | ; CX: Loop iterations (0 is maximum delay with 65536 iterations) |
---|
| 34 | ; Returns: |
---|
| 35 | ; Nothing |
---|
| 36 | ; Corrupts registers: |
---|
| 37 | ; CX |
---|
| 38 | ;-------------------------------------------------------------------- |
---|
| 39 | %macro DELAY_WITH_LOOP_INSTRUCTION 0 |
---|
| 40 | %%StartOfLoop: |
---|
| 41 | loop %%StartOfLoop |
---|
| 42 | %endmacro |
---|
| 43 | |
---|
| 44 | |
---|
| 45 | %endif ; DELAY_INC |
---|
Note: See
TracBrowser
for help on using the repository browser.