File tree Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -117,6 +117,8 @@ void MC6809Init(void)
117117 xfreg16 [3 ]= & U_REG ;
118118 xfreg16 [4 ]= & S_REG ;
119119 xfreg16 [5 ]= & PC_REG ;
120+ xfreg16 [6 ] = 0 ;
121+ xfreg16 [7 ] = 0 ;
120122
121123 ureg8 [0 ]= (unsigned char * )& A_REG ;
122124 ureg8 [1 ]= (unsigned char * )& B_REG ;
@@ -490,9 +492,15 @@ void Do_Opcode(int CycleFor)
490492 }
491493 else // 16 bit EXG
492494 {
493- temp16 = (* xfreg16 [((postbyte & 0x70 ) >> 4 )]);
494- (* xfreg16 [((postbyte & 0x70 ) >> 4 )])= (* xfreg16 [postbyte & 0x07 ]);
495- (* xfreg16 [postbyte & 0x07 ])= temp16 ;
495+ uint16_t * src = xfreg16 [((postbyte & 0x70 ) >> 4 )];
496+ uint16_t * dest = xfreg16 [postbyte & 0x07 ];
497+ // todo: find out which program triggers it
498+ assert (src );
499+ assert (dest );
500+ uint16_t srcValue = src ? * src : 0xFFFF ;
501+ uint16_t destValue = dest ? * dest : 0xFFFF ;
502+ if (src ) * src = destValue ;
503+ if (dest ) * dest = srcValue ;
496504 }
497505 }
498506 setcc (ccbits );
You can’t perform that action at this time.
0 commit comments