// Copyright Jamie Iles, 2017 // // This file is part of s80x86. // // s80x86 is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // s80x86 is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with s80x86. If not, see . #ifndef COMPARISON_US #define COMPARISON_US #define COMP_REGMEM_REG(opcode1, opcode2, alufunc, flags) \ .at opcode1; \ mar_write, mar_wr_sel EA, width WAUTO, segment DS, ra_modrm_rm_reg, \ jmp_rm_reg_mem comp ## alufunc ## opcode1 ##_reg; \ .at opcode2; \ mar_write, mar_wr_sel EA, width WAUTO, segment DS, ra_modrm_rm_reg, \ jmp_rm_reg_mem comp ## alufunc ## opcode1 ##_reg; \ .auto_address; \ comp ## alufunc ## opcode1 ## _reg: \ a_sel RA, b_sel RB, alu_op alufunc, \ update_flags flags, width WAUTO, next_instruction; \ comp ## alufunc ## opcode1 ## _mem: \ segment DS, mem_read, width WAUTO; \ a_sel MDR, b_sel RB, alu_op alufunc, update_flags flags, \ width WAUTO, next_instruction; #define COMP_REG_REGMEM(opcode1, opcode2, alufunc, flags) \ .at opcode1; \ mar_write, mar_wr_sel EA, width WAUTO, segment DS, ra_modrm_rm_reg, \ jmp_rm_reg_mem comp ## alufunc ## opcode1 ## _reg; \ .at opcode2; \ mar_write, mar_wr_sel EA, width WAUTO, segment DS, ra_modrm_rm_reg, \ jmp_rm_reg_mem comp ## alufunc ## opcode1 ## _reg; \ .auto_address; \ comp ## alufunc ## opcode1 ## _reg: \ a_sel RA, b_sel RB, alu_op alufunc, update_flags flags, width WAUTO, \ next_instruction; \ comp ## alufunc ## opcode1 ## _mem: \ segment DS, mem_read, width WAUTO; \ a_sel MDR, b_sel RB, alu_op alufunc, update_flags flags, \ width WAUTO, next_instruction; #define COMP_REGMEM_A(opcode1, opcode2, alufunc, flags) \ .at opcode1; \ width WAUTO, ra_sel AL, jmp comp ## alufunc ## opcode1; \ .at opcode2; \ width WAUTO, ra_sel AL, jmp comp ## alufunc ## opcode1; \ .auto_address; \ comp ## alufunc ## opcode1: \ a_sel RA, b_sel IMMEDIATE, alu_op alufunc, \ update_flags flags, width WAUTO, next_instruction; #define COMP_80_81(alufunc, flags) \ comp ## alufunc ## 80_81_reg: \ a_sel RA, b_sel IMMEDIATE, alu_op alufunc, \ update_flags flags, width WAUTO, next_instruction; \ comp ## alufunc ## 80_81_mem: \ segment DS, mem_read, width WAUTO; \ a_sel MDR, b_sel IMMEDIATE, alu_op alufunc, \ update_flags flags, width WAUTO, next_instruction; #define COMP_82(alufunc, flags) \ comp ## alufunc ## 82_reg: \ a_sel RA, b_sel IMMEDIATE, alu_op alufunc, \ width W8, update_flags flags, next_instruction; \ comp ## alufunc ## 82_mem: \ width W8, segment DS, mem_read; \ a_sel MDR, b_sel IMMEDIATE, alu_op alufunc, \ width W8, update_flags flags, next_instruction; #define COMP_83(alufunc, flags) \ comp ## alufunc ## 83_reg: \ ra_modrm_rm_reg, jmp comp ## alufunc ## 83_regwrite; \ comp ## alufunc ## 83_mem: \ ra_modrm_rm_reg, segment DS, jmp comp ## alufunc ## 83_memwrite; \ comp ## alufunc ## 83_regwrite: \ a_sel RA, b_sel IMMEDIATE, alu_op alufunc, \ update_flags flags, next_instruction; \ comp ## alufunc ## 83_memwrite: \ segment DS, mem_read; \ a_sel MDR, b_sel IMMEDIATE, alu_op alufunc, \ update_flags flags, next_instruction; #define COMP_F6(alufunc, flags) \ comp ## alufunc ## f6_reg: \ a_sel RA, b_sel IMMEDIATE, alu_op alufunc, \ update_flags flags, width W8, next_instruction; \ comp ## alufunc ## f6_mem: \ segment DS, mem_read, width W8; \ a_sel MDR, b_sel IMMEDIATE, alu_op alufunc, \ update_flags flags, width W8, next_instruction; #define COMP_F7(alufunc, flags) \ comp ## alufunc ## f7_reg: \ a_sel RA, b_sel IMMEDIATE, alu_op alufunc, \ update_flags flags, next_instruction; \ comp ## alufunc ## f7_mem: \ segment DS, mem_read; \ a_sel MDR, b_sel IMMEDIATE, alu_op alufunc, \ update_flags flags, next_instruction; #endif // COMPARISON_US