BIT #imm using the VIC-20 BASIC ROM

Basic and Machine Language

Moderator: Moderators

User avatar
Mike
Herr VC
Posts: 4841
Joined: Wed Dec 01, 2004 1:57 pm
Location: Munich, Germany
Occupation: electrical engineer

Re: BIT #imm using the VIC-20 BASIC ROM

Post by Mike »

wimoos wrote:[...] setting N and V in BIT# wouldn't have been that inconsistent.
... but the 65C02 ultimately only sets Z with BIT #imm but not N and V, and that is what you get. It may be good or bad for what you want to code, but you can't change anything about that. At least, if you actually also wanted N and V set on a 65C02, you can use BIT ABS on a fixed value as suggested in the OP.

That being said - only a handful of users will be affected by this, the large majority use the original NMOS 6502 in their VIC-20, that one anyhow doesn't feature BIT #imm, so this point is rather moot ... the OP resulted from an application that needed to 're-implement' BIT #imm on the NMOS 6502 (at least the relevant function of setting the Z flag from an AND operation without altering the accumulator). That re-implementation with BIT ABS also has the side effect of altering N and V, but that was irrelevant for the application.
Post Reply