flat assembler
Message board for the users of flat assembler.

Index > Main > x86 CPU bug!

Author
Thread Post new topic Reply to topic
lazer1



Joined: 24 Jan 2006
Posts: 185
lazer1 23 Jun 2006, 11:54
after days trying to get some code to function
I have found a bug with Intel and AMD 16 bit real:

"rep insw"

fails if es:di is outside the first segment of memory,

ie if 0 <= es:di <= 0ffffh

rep insw

is fine, but if say 20000h <= es:di <= 2ffffh

instead of reading the IO port "rep insw" will just read 0's, Razz

what happened was my code was in 20000h to 2ffffh and
rep insw
was just reading 0's
eventually I used "in ax,dx" and it now functioned correctly,

I then took the malfunctioning code and just replaced
the buffer by 0f000h and immediately the code functioned,

Rolling Eyes
Post 23 Jun 2006, 11:54
View user's profile Send private message Reply with quote
MazeGen



Joined: 06 Oct 2003
Posts: 977
Location: Czechoslovakia
MazeGen 23 Jun 2006, 13:39
Did you take into account the following quote from the Intel manual?
Quote:
Use the REP INS and REP OUTS instructions with caution. Not all I/O ports can handle the rate at which these instructions execute.
Post 23 Jun 2006, 13:39
View user's profile Send private message Visit poster's website Reply with quote
lazer1



Joined: 24 Jan 2006
Posts: 185
lazer1 23 Jun 2006, 14:57
MazeGen wrote:
Did you take into account the following quote from the Intel manual?
Quote:
Use the REP INS and REP OUTS instructions with caution. Not all I/O ports can handle the rate at which these instructions execute.


that's not the problem here as

rep insw

does function if I use 0f000h as a buffer,
malfunction if I use 2????h as a buffer,
Post 23 Jun 2006, 14:57
View user's profile Send private message Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid 23 Jun 2006, 15:13
try to overlap it ofer 10000h boundary to see if that's the problem. like
Code:
push ff0h
pop es
xor di,di  ;es:di = ff00
mov cx, 200h
rep insb    

if first 100h bytes is okay and second 100h bytes isn't, then it IS bug (or limitation)
Post 23 Jun 2006, 15:13
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
lazer1



Joined: 24 Jan 2006
Posts: 185
lazer1 24 Jun 2006, 11:49
ok, I've found what the problem was,

it wasnt a bug, Embarassed
what happened was I was echoing via:

mov al,[ds:.buffer + ecx]

when I should have done:

mov al,[ds:.buffer and 0ffffh + ecx]

Smile
Post 24 Jun 2006, 11:49
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.