Semi-OT: Interesting or unusual PC Compatibles?

Fred Cisin cisin at xenosoft.com
Sun Jul 1 15:28:42 CDT 2007


On Sun, 1 Jul 2007, Jim Leonard wrote:
> Wow -- prefetch buffer was only 2 bytes larger in 8086, what in your
> code was dependent on that??  Self-modifying code maybe?

Yep.
I already admitted how I screwed up:

On Fri, 29 Jun 2007, I wrote:
> How would you write a subroutine (for C) that would permit calling an
> INT that is defined at runtime?  (I didn't know any better ways at the
> time)

>       . . .
>       MOV BX, offset stepon3
>       INC BX
>       MOV [BX], AL   ; change the INT to the one specified in AL
>       . . .
> stepon3: INT 00h
>       . . .
>
> It is easily fixed to handle a different prefetch buffer size by:
>       . . .
>       . . .
>       MOV BX, offset stepon3
>       INC BX
>       MOV [BX], AL   ; change the INT to the one specified in AL
>       . . .
>       JMP SHORT $ +2     ; or JMP stepon3 ; clears the prefetch buffer
>                                           ; and does little else
> stepon3: INT 00h
>       . . .
>
>
> "Do NOT ever use self-modifying code.  It may not happen for a LONG
> time, but it WILL eventually come back to bite your foot off."



More information about the cctalk mailing list