Advertisement
Guest User

jake smells

a guest
Feb 21st, 2018
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.43 KB | None | 0 0
  1. case 0x82: // ADI #
  2.  
  3. data = fetch();
  4. temp_word = (WORD)Registers[REGISTER_A] + (WORD)data;
  5.  
  6. if ((Flags & FLAG_C) != 0)
  7. {
  8. temp_word++;
  9. }
  10. if (temp_word >= 0x100)
  11. {
  12. Flags = Flags | FLAG_C; // set carry flag
  13. }
  14. else
  15. {
  16. Flags = Flags & (0xFF - FLAG_C);
  17. }
  18.  
  19. set_flag_n((BYTE)temp_word);
  20. set_flag_z((BYTE)temp_word);
  21. set_flag_v(Registers[REGISTER_A], data, (BYTE)temp_word);
  22. Registers[REGISTER_A] = (BYTE)temp_word;
  23.  
  24. break;
  25.  
  26. case 0x83: // SBI #
  27.  
  28. data = fetch();
  29. temp_word = (WORD)Registers[REGISTER_A] - (WORD)data;
  30.  
  31. if ((Flags & FLAG_C) != 0)
  32. {
  33. temp_word--;
  34. }
  35. if (temp_word >= 0x100)
  36. {
  37. Flags = Flags | FLAG_C; // set carry flag
  38. }
  39. else
  40. {
  41. Flags = Flags & (0xFF - FLAG_C);
  42. }
  43.  
  44. set_flag_n((BYTE)temp_word);
  45. set_flag_z((BYTE)temp_word);
  46. set_flag_v(Registers[REGISTER_A], -data, (BYTE)temp_word);
  47. Registers[REGISTER_A] = (BYTE)temp_word;
  48.  
  49. break;
  50.  
  51. case 0x84: // CPI #
  52.  
  53.  
  54. data = fetch();
  55. temp_word = (WORD)Registers[REGISTER_A] - (WORD)data;
  56.  
  57. if ((Flags & FLAG_C) != 0)
  58. {
  59. temp_word++;
  60. }
  61. if (temp_word >= 0x100)
  62. {
  63. Flags = Flags | FLAG_C; // set carry flag
  64. }
  65. else
  66. {
  67. Flags = Flags & (0xFF - FLAG_C);
  68. }
  69.  
  70. set_flag_n((BYTE)temp_word);
  71. set_flag_z((BYTE)temp_word);
  72. set_flag_v(Registers[REGISTER_A], -data, (BYTE)temp_word);
  73.  
  74. break;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement