On Mon, 05 May 1997 23:26:05 -0700, "Paul D. DeRocco"
Wow, thanks for all these useful comments! Can I ask a few questions
about them?
Quote:
>> out dx,0
>Should be
> mov al, 0
> out dx, al
Is it better to do it that way? I read that there is an intruction to
output and input imediate ports and values to ports. Is it just
better, or did read it wrong?
Quote:
>> xor ax,ax //return 0
>> xor dx,dx
>Since it can't go wrong, why return an error code?
I can answer that: it's part of an overall coding standard. The
exceptions routines can return are define in the package's (or
modules, if you prefer) header file, and *all* functions return an
error code. This way, even if a function doesn't orgianly return an
error, if at some future date it needs does the error will always be
picked up by the next level, because it always checks for errors.
This may seem pointless, but the errors it catches and the
stability it offers far outweigh the time it occationally wastes.
Quote:
>Also, the fact that you disable interrupts while waiting for vertical
>retrace is a very {*filter*} thing to do in a multi-tasking environment. It
>can cause lost data if, for instance, another program is receiving from
>a serial port. My advice is just to loop until you're in a retrace, then
>disable interrupts while you output the palette. Once in a great while,
>you'll fall off the end of the retrace, and a little artifact may appear
>at the top of the screen, but only very rarely.
considering how long those loops have to weight for the next retrace,
can it still cause data loss?
Quote:
>By the way, there are BIOS functions that do these things.
umm.. good point. It's good practice, though :)