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 0xaa;
|
19 |
|
|
width W8, ra_sel AL, jmp stosb;
|
20 |
|
|
|
21 |
|
|
.auto_address;
|
22 |
|
|
stosb:
|
23 |
|
|
width W8, a_sel RA, alu_op SELA, mdr_write;
|
24 |
|
|
ra_sel DI, rb_cl, jmp_if_not_rep stosb_no_rep;
|
25 |
|
|
stosb_rep_loop:
|
26 |
|
|
ra_sel CX, jmp_rb_zero stosb_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;
|
29 |
|
|
stosb_no_rep:
|
30 |
|
|
ra_sel DI, a_sel RA, alu_op SELA, mar_wr_sel Q, mar_write;
|
31 |
|
|
a_sel RA, b_sel IMMEDIATE, immediate 0x1, alu_op NEXT,
|
32 |
|
|
rd_sel_source MICROCODE_RD_SEL, rd_sel DI;
|
33 |
|
|
width W8, ra_sel AL;
|
34 |
|
|
width W8, alu_op SELA, mdr_write, segment ES, segment_force;
|
35 |
|
|
width W8, segment ES, segment_force, mem_write, jmp_if_not_rep stosb_done;
|
36 |
|
|
rb_cl, ext_int_yield, jmp stosb_rep_loop;
|
37 |
|
|
stosb_done:
|
38 |
|
|
next_instruction;
|
39 |
|
|
|
40 |
|
|
.at 0xab;
|
41 |
|
|
ra_sel AX, jmp stosw;
|
42 |
|
|
|
43 |
|
|
.auto_address;
|
44 |
|
|
stosw:
|
45 |
|
|
a_sel RA, alu_op SELA, mdr_write,
|
46 |
|
|
ra_sel DI, rb_cl, jmp_if_not_rep stosw_no_rep;
|
47 |
|
|
stosw_rep_loop:
|
48 |
|
|
ra_sel CX, jmp_rb_zero stosw_done;
|
49 |
|
|
ra_sel DI, a_sel RA, b_sel IMMEDIATE, immediate 0x1, alu_op SUB,
|
50 |
|
|
rd_sel_source MICROCODE_RD_SEL, rd_sel CX;
|
51 |
|
|
stosw_no_rep:
|
52 |
|
|
ra_sel DI, a_sel RA, alu_op SELA, mar_wr_sel Q, mar_write;
|
53 |
|
|
a_sel RA, b_sel IMMEDIATE, immediate 0x2, alu_op NEXT,
|
54 |
|
|
rd_sel_source MICROCODE_RD_SEL, rd_sel DI, segment ES, segment_force;
|
55 |
|
|
segment ES, segment_force, mem_write, jmp_if_not_rep stosw_done;
|
56 |
|
|
rb_cl, ext_int_yield, jmp stosw_rep_loop;
|
57 |
|
|
stosw_done:
|
58 |
|
|
next_instruction;
|