-- 
Steve Rosenbluth
Jim Henson's Creature Shop
2821 Burton St, Burbank CA
(818) 953-3030


Paolo Mantegazza wrote:
> If you disable the cache then things are more stable but you can be
> catched by the raptus to throw the PC out of the window.

Yes, I agree that a PC just isn't suitable for many jitter-free hard
real time tasks. I wrestled for a while trying to do some (not too
time-critical) PWM, and gave up.

Attached is some DOS code which disables the cache on an Intel processor
supporting these 486 instructions. My AMD586-133 machine ran terribly
slow, unable to keep up with 115200bps serial, after disabling the
cache.

-- 
Steve Rosenbluth
Jim Henson's Creature Shop
2821 Burton St, Burbank CA
; file: discache.asm
; sets sr0 bit 30 to disablef on-chip cache
; Steve Rosenbluth, JHCS 3-23-1999

.MODEL  large
.STACK  100h

.DATA
cache_still_used        DB 'Cache could not be disabled.',13,10,'$'
cache_disabled      DB 'Cache is DISABLED.',13,10,'$'

.CODE
    mov ax,@data
    mov ds,ax           ; set ds to point at data

P486                            ;allow 486 protected mode instuctions
    mov edx,cr0                 ;get cr0
    push edx                    ;save cr0 on stack so we can see it
    or edx,40000000H            ;set bit 30 high
    push edx                    ;save cr0 on stack so we can see it
    mov cr0,edx                 ; disable the cache
    mov edx,cr0                 ;get cr0
    push edx                    ;save cr0 on stack so we can see it
    and edx,40000000H           ;clear bits other than bit 30
    xor edx,40000000H           ;see if bit 30 high, zflag gets set if it is
    jz success                  ;go to "yes" if zero flag is set

failed:
    mov dx,OFFSET cache_still_used
    jmp print_string

success:
    mov dx,OFFSET cache_disabled

print_string:
    mov ah,9            ;dos print string func val
    int 21h             ;dos int

    mov al,0            ; normal return value
.EXIT

END


discache.exe



Reply via email to