| 1 |
2 |
jamieiles |
// Copyright Jamie Iles, 2017
|
| 2 |
|
|
//
|
| 3 |
|
|
// This file is part of s80x86.
|
| 4 |
|
|
//
|
| 5 |
|
|
// s80x86 is free software: you can redistribute it and/or modify
|
| 6 |
|
|
// it under the terms of the GNU General Public License as published by
|
| 7 |
|
|
// the Free Software Foundation, either version 3 of the License, or
|
| 8 |
|
|
// (at your option) any later version.
|
| 9 |
|
|
//
|
| 10 |
|
|
// s80x86 is distributed in the hope that it will be useful,
|
| 11 |
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 12 |
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
| 13 |
|
|
// GNU General Public License for more details.
|
| 14 |
|
|
//
|
| 15 |
|
|
// You should have received a copy of the GNU General Public License
|
| 16 |
|
|
// along with s80x86. If not, see .
|
| 17 |
|
|
|
| 18 |
|
|
.at 0xa6;
|
| 19 |
|
|
jmp cmpsb;
|
| 20 |
|
|
|
| 21 |
|
|
.auto_address;
|
| 22 |
|
|
cmpsb:
|
| 23 |
|
|
ra_sel DI, rb_cl, jmp_if_not_rep cmpsb_no_rep;
|
| 24 |
|
|
cmpsb_rep_loop:
|
| 25 |
|
|
ra_sel CX, jmp_rb_zero cmpsb_done;
|
| 26 |
|
|
ra_sel DI, a_sel RA, b_sel IMMEDIATE, immediate 0x1, alu_op SUB,
|
| 27 |
|
|
rd_sel_source MICROCODE_RD_SEL, rd_sel CX;
|
| 28 |
|
|
cmpsb_no_rep:
|
| 29 |
|
|
ra_sel DI, a_sel RA, alu_op SELA, mar_wr_sel Q, mar_write, segment ES,
|
| 30 |
|
|
segment_force;
|
| 31 |
|
|
width W8, segment ES, segment_force, mem_read,
|
| 32 |
|
|
a_sel MDR, alu_op SELA, tmp_wr_en;
|
| 33 |
|
|
a_sel MAR, b_sel IMMEDIATE, immediate 0x1, alu_op NEXT,
|
| 34 |
|
|
rd_sel_source MICROCODE_RD_SEL, rd_sel DI,
|
| 35 |
|
|
ra_sel SI;
|
| 36 |
|
|
a_sel RA, alu_op SELA, mar_wr_sel Q, mar_write, segment DS, ra_sel SI;
|
| 37 |
|
|
a_sel RA, b_sel IMMEDIATE, immediate 0x1, alu_op NEXT,
|
| 38 |
|
|
rd_sel_source MICROCODE_RD_SEL, rd_sel SI,
|
| 39 |
|
|
segment DS;
|
| 40 |
|
|
width W8, segment DS, mem_read;
|
| 41 |
|
|
width W8, a_sel MDR, b_sel TEMP, alu_op SUB,
|
| 42 |
|
|
update_flags OF SF ZF CF PF AF, jmp_if_not_rep cmpsb_done;
|
| 43 |
|
|
rb_cl, alu_op GETFLAGS, ext_int_yield,
|
| 44 |
|
|
jmp_if_rep_not_complete cmpsb_rep_loop;
|
| 45 |
|
|
cmpsb_done:
|
| 46 |
|
|
next_instruction;
|
| 47 |
|
|
|
| 48 |
|
|
.at 0xa7;
|
| 49 |
|
|
jmp cmpsw;
|
| 50 |
|
|
|
| 51 |
|
|
.auto_address;
|
| 52 |
|
|
cmpsw:
|
| 53 |
|
|
ra_sel DI, rb_cl, jmp_if_not_rep cmpsw_no_rep;
|
| 54 |
|
|
cmpsw_rep_loop:
|
| 55 |
|
|
ra_sel CX, jmp_rb_zero cmpsw_done;
|
| 56 |
|
|
ra_sel DI, a_sel RA, b_sel IMMEDIATE, immediate 0x1, alu_op SUB,
|
| 57 |
|
|
rd_sel_source MICROCODE_RD_SEL, rd_sel CX;
|
| 58 |
|
|
cmpsw_no_rep:
|
| 59 |
|
|
ra_sel DI, a_sel RA, alu_op SELA, mar_wr_sel Q, mar_write, segment ES,
|
| 60 |
|
|
segment_force;
|
| 61 |
|
|
segment ES, segment_force, mem_read, a_sel MDR, alu_op SELA, tmp_wr_en,
|
| 62 |
|
|
ra_sel DI;
|
| 63 |
|
|
a_sel RA, b_sel IMMEDIATE, immediate 0x2, alu_op NEXT,
|
| 64 |
|
|
rd_sel_source MICROCODE_RD_SEL, rd_sel DI,
|
| 65 |
|
|
ra_sel SI;
|
| 66 |
|
|
a_sel RA, alu_op SELA, mar_wr_sel Q, mar_write, segment DS, ra_sel SI;
|
| 67 |
|
|
a_sel RA, b_sel IMMEDIATE, immediate 0x2, alu_op NEXT,
|
| 68 |
|
|
rd_sel_source MICROCODE_RD_SEL, rd_sel SI, segment DS;
|
| 69 |
|
|
segment DS, mem_read, a_sel MDR, b_sel TEMP, alu_op SUB,
|
| 70 |
|
|
update_flags OF SF ZF CF PF AF, jmp_if_not_rep cmpsw_done;
|
| 71 |
|
|
rb_cl, alu_op GETFLAGS, ext_int_yield,
|
| 72 |
|
|
jmp_if_rep_not_complete cmpsw_rep_loop;
|
| 73 |
|
|
cmpsw_done:
|
| 74 |
|
|
next_instruction;
|