From b7f56a8019a6ca79fc633c97e9f542388c5f2ed2 Mon Sep 17 00:00:00 2001 From: Hugo Villeneuve <hugo@hugovil.com> Date: Sun, 17 Nov 2013 17:03:19 -0500 Subject: [PATCH] Fix error with ADD instruction and AC bit The overflow bit was written instead of the auxiliary carry bit. --- src/opcode2c.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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"; } -- 2.20.1