Date : Mon, 15 Aug 1994 08:58:28 WET DST
From : Bonfield James <jkb@...>
Subject: Re: Flags and BIT
Hello,
>1. Are the flags set on the result of *every* operation? Even things like
>LDA? And what about, for example, PHA? Just wondering. I've been setting
>them on most instructions, just to be on the safe side.
Setting them too often is just as bad as not setting them. I suggest you
either obtain the Advanced user guide for reference, or else look at one of
the currently available 6502 emulators around if that's easier.
>2. Is the 6502 BIT instruction directly equivalent to the 80x86 TEST?
I don't know about the TEST instrn.
BIT sets bit 7 of P (N) to be bit 7 of the operand, and bit 6 of P (V?) to be
bit 6 of operand. It also set Z (bit 0?) for whether the operand is 0 or not.
The '?' bits are because I can't remember the precise bit numbers off the top
of my head.
>Just for interest - how long are you relevant source codes? Mine is
>currently about 1800 lines; nearly 66Kb. Just wondering really. It's the
>largest program I've written in my life (by about 5 times!).
Mine's around 5000 (or so) lines of code, at somethine like 100K ish. From
this I deduce my code is obviously more spread out than yours ;-)
By the way, for those implementing the keyboard matrix, the column & row
numbers can be derived from the IK number (inkey number EOF &FF). The top
nibble is row, bottom nibble is column (I think). Note that the Advanced user
guide has the codes for 9 (should be 26) and I (should be 25) swapped around.
James