Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- case 0x24: //SUB A-B - Regsiter subtracted to Accumulator with Carry - completed during week 1
- //Subtracts registers to accumulator
- temp_word = (WORD)Registers[REGISTER_A] - (WORD)Registers[REGISTER_B];
- if ((Flags & FLAG_C) != 0)
- {
- temp_word--;
- }
- if (temp_word >= 0x100)
- {
- Flags = Flags | FLAG_C; // set carry flag
- }
- else
- {
- Flags = Flags & (0xff - FLAG_C); //Clear carry flag
- }
- //Sets flags
- set_flag_n(temp_word);
- set_flag_z(temp_word);
- set_flag_v(Registers[REGISTER_A], -Registers[REGISTER_B], temp_word);
- //Stores into accumulator
- Registers[REGISTER_A] = temp_word;
- break;
- case 0x34: //SUB A-C - Regsiter subtracted to Accumulator with Carry - completed during week 1
- //Subtracts registers to accumulator
- temp_word = (WORD)Registers[REGISTER_A] - (WORD)Registers[REGISTER_C];
- if ((Flags & FLAG_C) != 0)
- {
- temp_word--;
- }
- if (temp_word >= 0x100)
- {
- Flags = Flags | FLAG_C; // set carry flag
- }
- else
- {
- Flags = Flags & (0xff - FLAG_C); //Clear carry flag
- }
- //Sets flags
- set_flag_n(temp_word);
- set_flag_z(temp_word);
- set_flag_v(Registers[REGISTER_A], -Registers[REGISTER_C], temp_word);
- //Stores into accumulator
- Registers[REGISTER_A] = temp_word;
- break;
- case 0x44: //SUB A-D - Regsiter subtracted to Accumulator with Carry - completed during week 1
- //Subtracts registers to accumulator
- temp_word = (WORD)Registers[REGISTER_A] - (WORD)Registers[REGISTER_D];
- if ((Flags & FLAG_C) != 0)
- {
- temp_word--;
- }
- if (temp_word >= 0x100)
- {
- Flags = Flags | FLAG_C; // set carry flag
- }
- else
- {
- Flags = Flags & (0xff - FLAG_C); //Clear carry flag
- }
- //Sets flags
- set_flag_n(temp_word);
- set_flag_z(temp_word);
- set_flag_v(Registers[REGISTER_A], -Registers[REGISTER_D], temp_word);
- //Stores into accumulator
- Registers[REGISTER_A] = temp_word;
- break;
- case 0x54: //SUB A-E - Regsiter subtracted to Accumulator with Carry - completed during week 1
- //Subtracts registers to accumulator
- temp_word = (WORD)Registers[REGISTER_A] - (WORD)Registers[REGISTER_E];
- if ((Flags & FLAG_C) != 0)
- {
- temp_word--;
- }
- if (temp_word >= 0x100)
- {
- Flags = Flags | FLAG_C; // set carry flag
- }
- else
- {
- Flags = Flags & (0xff - FLAG_C); //Clear carry flag
- }
- //Sets flags
- set_flag_n(temp_word);
- set_flag_z(temp_word);
- set_flag_v(Registers[REGISTER_A], -Registers[REGISTER_E], temp_word);
- //Stores into accumulator
- Registers[REGISTER_A] = temp_word;
- break;
- case 0x64: //SUB A-F - Regsiter subtracted to Accumulator with Carry - completed during week 1
- //Subtracts registers to accumulator
- temp_word = (WORD)Registers[REGISTER_A] - (WORD)Registers[REGISTER_F];
- if ((Flags & FLAG_C) != 0)
- {
- temp_word--;
- }
- if (temp_word >= 0x100)
- {
- Flags = Flags | FLAG_C; // set carry flag
- }
- else
- {
- Flags = Flags & (0xff - FLAG_C); //Clear carry flag
- }
- //Sets flags
- set_flag_n(temp_word);
- set_flag_z(temp_word);
- set_flag_v(Registers[REGISTER_A], -Registers[REGISTER_F], temp_word);
- //Stores into accumulator
- Registers[REGISTER_A] = temp_word;
- break;
- ///////////END SUB///////////
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement