From: Hugo Villeneuve Date: Sun, 17 Nov 2013 22:03:19 +0000 (-0500) Subject: Fix error with ADD instruction and AC bit X-Git-Tag: v2.0.0~94 X-Git-Url: http://gitweb.hugovil.com/?a=commitdiff_plain;h=b7f56a8019a6ca79fc633c97e9f542388c5f2ed2;p=emu8051.git Fix error with ADD instruction and AC bit The overflow bit was written instead of the auxiliary carry bit. --- diff --git a/src/opcode2c.pl b/src/opcode2c.pl index 67c667f..dcb6894 100755 --- a/src/opcode2c.pl +++ b/src/opcode2c.pl @@ -468,7 +468,7 @@ for ($i=0 ; $i< 256; $i++) { print INST_IMP " cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) | 0x80 ) );\n"; print INST_IMP " if ( ( destination & 0x7F ) + ( source & 0x7F ) < 0x80 ) cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) | 0x04 ) );\n"; print INST_IMP "} else if ( ( destination & 0x7F ) + ( source & 0x7F ) > 0x7F ) cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) | 0x04 ) );\n"; - print INST_IMP "if ( ( destination & 0x0F ) + ( source & 0x0F ) > 0x0F ) cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) | 0x04 ) );\n"; + print INST_IMP "if ( ( destination & 0x0F ) + ( source & 0x0F ) > 0x0F ) cpu8051_WriteD( _PSW_, ( cpu8051_ReadD( _PSW_ ) | 0x40 ) );\n"; print INST_IMP "destination += source;\n"; }