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 0xae;
|
19 |
|
|
jmp scasb, ra_sel DI;
|
20 |
|
|
|
21 |
|
|
.auto_address;
|
22 |
|
|
scasb:
|
23 |
|
|
ra_sel DI, a_sel RA, alu_op SELA, mar_wr_sel Q, mar_write, rb_cl,
|
24 |
|
|
jmp_if_not_rep scasb_no_rep;
|
25 |
|
|
scasb_rep_loop:
|
26 |
|
|
ra_sel CX, jmp_rb_zero scasb_done;
|
27 |
|
|
ra_sel DI, a_sel RA, b_sel IMMEDIATE, immediate 0x1, alu_op SUB,
|
28 |
|
|
rd_sel_source MICROCODE_RD_SEL, rd_sel CX, segment ES, segment_force;
|
29 |
|
|
scasb_no_rep:
|
30 |
|
|
width W8, segment ES, segment_force, mem_read, ra_sel AL,
|
31 |
|
|
a_sel RA, alu_op SELA, tmp_wr_en;
|
32 |
|
|
width W8, a_sel MDR, b_sel TEMP, alu_op SUBREV,
|
33 |
|
|
update_flags OF SF ZF CF PF AF, jmp_if_not_rep scasb_done_no_rep;
|
34 |
|
|
a_sel MAR, b_sel IMMEDIATE, immediate 0x1, alu_op NEXT,
|
35 |
|
|
rd_sel_source MICROCODE_RD_SEL, rd_sel DI, mar_write, mar_wr_sel Q,
|
36 |
|
|
rb_cl, ext_int_yield, jmp_if_rep_not_complete scasb_rep_loop,
|
37 |
|
|
segment ES, segment_force;
|
38 |
|
|
scasb_done:
|
39 |
|
|
next_instruction;
|
40 |
|
|
scasb_done_no_rep:
|
41 |
|
|
a_sel MAR, b_sel IMMEDIATE, immediate 0x1, alu_op NEXT,
|
42 |
|
|
rd_sel_source MICROCODE_RD_SEL, rd_sel DI, next_instruction;
|
43 |
|
|
|
44 |
|
|
.at 0xaf;
|
45 |
|
|
jmp scasw, ra_sel DI;
|
46 |
|
|
|
47 |
|
|
.auto_address;
|
48 |
|
|
scasw:
|
49 |
|
|
ra_sel DI, a_sel RA, alu_op SELA, mar_wr_sel Q, mar_write,
|
50 |
|
|
rb_cl, jmp_if_not_rep scasw_no_rep;
|
51 |
|
|
scasw_rep_loop:
|
52 |
|
|
ra_sel CX, jmp_rb_zero scasw_done;
|
53 |
|
|
ra_sel DI, a_sel RA, b_sel IMMEDIATE, immediate 0x1, alu_op SUB,
|
54 |
|
|
rd_sel_source MICROCODE_RD_SEL, rd_sel CX, segment ES, segment_force;
|
55 |
|
|
scasw_no_rep:
|
56 |
|
|
segment ES, segment_force, mem_read, ra_sel AX, a_sel RA, alu_op SELA,
|
57 |
|
|
tmp_wr_en;
|
58 |
|
|
a_sel MDR, b_sel TEMP, alu_op SUBREV, update_flags OF SF ZF CF PF AF,
|
59 |
|
|
jmp_if_not_rep scasw_done_no_rep;
|
60 |
|
|
a_sel MAR, b_sel IMMEDIATE, immediate 0x2, alu_op NEXT,
|
61 |
|
|
rd_sel_source MICROCODE_RD_SEL, rd_sel DI, mar_write, mar_wr_sel Q,
|
62 |
|
|
rb_cl, ext_int_yield, jmp_if_rep_not_complete scasw_rep_loop,
|
63 |
|
|
segment ES, segment_force;
|
64 |
|
|
scasw_done:
|
65 |
|
|
next_instruction;
|
66 |
|
|
scasw_done_no_rep:
|
67 |
|
|
a_sel MAR, b_sel IMMEDIATE, immediate 0x2, alu_op NEXT,
|
68 |
|
|
rd_sel_source MICROCODE_RD_SEL, rd_sel DI, next_instruction;
|