I was thinking what a bummer benchmarking is without CLI/STI and while looking through the docs found POPF & PUSHF... hmmm I thought... Could I? A simple test seemed to show I could... But I am at work, and so cannot (and will not) test this properly. I will not be able to test & post results until Monday... If someone else can try this, I would be most grateful, the implications for benchmarking windows stuff is quite clear!

PUSHF
POP ax
AND ax, 0FDFFh
PUSH ax
POPF
;CLI in long form

PUSHF
POP ax
OR ax, 200h
PUSH ax
POPF
;STI in long form
Heres the code I used to test it:

.data?
buffer1    db 64 dup (?)
buffer2    db 64 dup (?)

.code
start:
    pushf
    pop ax
    and ax, 0FDFFh
    push ax
    popf

    mov ecx, 16
    .WHILE cl > 0
        xor edx, edx
        shl ax, 1
        adc dl, 48
        mov buffer1,dl
        dec cl
    .ENDW

    mov buffer1[0], " "
    mov buffer1[17],"b"
    mov buffer1[18],0

    pushf
    pop ax
    or ax, 200h
    push ax
    popf

    mov ecx, 16
    .WHILE cl > 0
        xor edx, edx
        shl ax, 1
        adc dl, 48
        mov buffer2,dl
        dec cl
    .ENDW

    mov buffer2[0], " "
    mov buffer2[17],"b"
    mov buffer2[18],0

    invoke MessageBox, NULL, ADDR buffer1, NULL, MB_OK
    invoke MessageBox, NULL, ADDR buffer2, NULL, MB_OK
    invoke ExitProcess, NULL
end start
Mirno
Posted on 2001-03-23 09:43:00 by Mirno
The only problem i see... is that i have tried the cli/sti stuff on a win95 and wim98 OS on vary machines... and got just very little speed boost...up to none....but sure got GPF on Win2k and NT and some sloopy / chunky mouse move.... I also thought it will improve my benchmatk speed...but it did not...so i got cli/sti out of my game :(
Posted on 2001-03-23 18:07:00 by BogdanOntanu