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 0xa4;
|
19 |
|
|
jmp movsb;
|
20 |
|
|
|
21 |
|
|
.auto_address;
|
22 |
|
|
movsb:
|
23 |
|
|
ra_sel SI, rb_cl, jmp_if_not_rep movsb_no_rep;
|
24 |
|
|
movsb_rep_loop:
|
25 |
|
|
ra_sel CX, jmp_rb_zero movsb_done;
|
26 |
|
|
ra_sel SI, a_sel RA, b_sel IMMEDIATE, immediate 0x1, alu_op SUB,
|
27 |
|
|
rd_sel_source MICROCODE_RD_SEL, rd_sel CX;
|
28 |
|
|
movsb_no_rep:
|
29 |
|
|
a_sel RA, alu_op SELA, mar_wr_sel Q, mar_write, ra_sel SI, segment DS;
|
30 |
|
|
width W8, segment DS, mem_read;
|
31 |
|
|
|
32 |
|
|
ra_sel DI, a_sel MAR, b_sel IMMEDIATE, immediate 0x1, alu_op NEXT,
|
33 |
|
|
rd_sel_source MICROCODE_RD_SEL, rd_sel SI;
|
34 |
|
|
ra_sel DI, a_sel RA, alu_op SELA, mar_wr_sel Q, mar_write,
|
35 |
|
|
segment ES, segment_force;
|
36 |
|
|
width W8, segment ES, segment_force, mem_write,
|
37 |
|
|
jmp_if_not_rep movsb_done_no_rep;
|
38 |
|
|
a_sel MAR, b_sel IMMEDIATE, immediate 0x1, alu_op NEXT,
|
39 |
|
|
rd_sel_source MICROCODE_RD_SEL, rd_sel DI, rb_cl, ext_int_yield,
|
40 |
|
|
jmp movsb_rep_loop;
|
41 |
|
|
movsb_done:
|
42 |
|
|
next_instruction;
|
43 |
|
|
movsb_done_no_rep:
|
44 |
|
|
a_sel MAR, b_sel IMMEDIATE, immediate 0x1, alu_op NEXT,
|
45 |
|
|
rd_sel_source MICROCODE_RD_SEL, rd_sel DI, next_instruction;
|
46 |
|
|
|
47 |
|
|
.at 0xa5;
|
48 |
|
|
jmp movsw;
|
49 |
|
|
|
50 |
|
|
.auto_address;
|
51 |
|
|
movsw:
|
52 |
|
|
ra_sel SI, rb_cl, jmp_if_not_rep movsw_no_rep;
|
53 |
|
|
movsw_rep_loop:
|
54 |
|
|
ra_sel CX, jmp_rb_zero movsw_done;
|
55 |
|
|
ra_sel SI, a_sel RA, b_sel IMMEDIATE, immediate 0x1, alu_op SUB,
|
56 |
|
|
rd_sel_source MICROCODE_RD_SEL, rd_sel CX;
|
57 |
|
|
movsw_no_rep:
|
58 |
|
|
a_sel RA, alu_op SELA, mar_wr_sel Q, mar_write, ra_sel SI;
|
59 |
|
|
a_sel RA, b_sel IMMEDIATE, immediate 0x2, alu_op NEXT,
|
60 |
|
|
rd_sel_source MICROCODE_RD_SEL, rd_sel SI,
|
61 |
|
|
segment DS;
|
62 |
|
|
segment DS, mem_read, ra_sel DI, a_sel RA, alu_op SELA, mar_wr_sel Q,
|
63 |
|
|
mar_write;
|
64 |
|
|
a_sel RA, b_sel IMMEDIATE, immediate 0x2, alu_op NEXT,
|
65 |
|
|
rd_sel_source MICROCODE_RD_SEL, rd_sel DI,
|
66 |
|
|
segment ES, segment_force;
|
67 |
|
|
segment ES, segment_force, mem_write, jmp_if_not_rep movsw_done;
|
68 |
|
|
|
69 |
|
|
rb_cl, ext_int_yield, jmp movsw_rep_loop;
|
70 |
|
|
movsw_done:
|
71 |
|
|
next_instruction;
|