case CF_CHAR:
                 if (Flags & CF_FORCECHAR) {
-                    if ((Val & 0xFF) != 0xFF) {
+                    if ((Val & 0xFF) == 0x00) {
+                        AddCodeLine ("lda #$00");
+                    } else if ((Val & 0xFF) != 0xFF) {
                         AddCodeLine ("and #$%02X", (unsigned char)Val);
                     }
                            return;
                            if (Val <= 0xFF) {
                                ldxconst (0);
                                if (Val == 0) {
-                                   ldaconst (0);
+                            AddCodeLine ("lda #$00");
                                } else if (Val != 0xFF) {
                                    AddCodeLine ("and #$%02X", (unsigned char)Val);
                                }
-                           } else if ((Val & 0xFF00) == 0xFF00) {
+                           } else if ((Val & 0xFFFF) == 0xFF00) {
+                        AddCodeLine ("lda #$00");
+                    } else if ((Val & 0xFF00) == 0xFF00) {
                                AddCodeLine ("and #$%02X", (unsigned char)Val);
                            } else if ((Val & 0x00FF) == 0x0000) {
                                AddCodeLine ("txa");
                                AddCodeLine ("and #$%02X", (unsigned char)(Val >> 8));
                        AddCodeLine ("tax");
-                       ldaconst (0);
+                       AddCodeLine ("lda #$00");
                     } else {
                        AddCodeLine ("tay");
                        AddCodeLine ("txa");
                        AddCodeLine ("and #$%02X", (unsigned char)(Val >> 8));
                        AddCodeLine ("tax");
                        AddCodeLine ("tya");
-                       if ((Val & 0x00FF) != 0x00FF) {
+                       if ((Val & 0x00FF) == 0x0000) {
+                            AddCodeLine ("lda #$00");
+                       } else if ((Val & 0x00FF) != 0x00FF) {
                                    AddCodeLine ("and #$%02X", (unsigned char)Val);
-                       }
+                        }
                     }
                 }
                 return;
 
        /* Get next entry */
                CodeEntry* E = CS_GetEntry (S, I);
 
-               /* Get a pointer to the output registers of the insn */
+               /* Get pointers to the input and output registers of the insn */
                const RegContents* Out = &E->RI->Out;
+        const RegContents* In  = &E->RI->In;
 
         /* Argument for LDn and flag */
         const char* Arg = 0;
                     /* AND with 0xFF, remove */
                     CS_DelEntry (S, I);
                     ++Changes;
+                } else if (CE_IsKnownImm (E, 0x00)) {
+                    /* AND with 0x00, replace by lda #$00 */
+                    Arg = MakeHexArg (0x00);
                 } else if (RegValIsKnown (Out->RegA)) {
                     /* Accu AND zp with known contents */
                     Arg = MakeHexArg (Out->RegA);
+                } else if (In->RegA == 0xFF) {
+                    /* AND but A contains 0xFF - replace by lda */
+                    CE_ReplaceOPC (E, OP65_LDA);
+                    ++Changes;
                 }
                 break;
 
                     /* ORA with zero, remove */
                     CS_DelEntry (S, I);
                     ++Changes;
+                } else if (CE_IsKnownImm (E, 0xFF)) {
+                    /* ORA with 0xFF, replace by lda #$ff */
+                    Arg = MakeHexArg (0xFF);
                 } else if (RegValIsKnown (Out->RegA)) {
                     /* Accu AND zp with known contents */
                     Arg = MakeHexArg (Out->RegA);
+                } else if (In->RegA == 0) {
+                    /* ORA but A contains 0x00 - replace by lda */
+                    CE_ReplaceOPC (E, OP65_LDA);
+                    ++Changes;
                 }
                 break;