| 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 0xac;
|
| 19 |
|
|
jmp lodsb;
|
| 20 |
|
|
|
| 21 |
|
|
.auto_address;
|
| 22 |
|
|
lodsb:
|
| 23 |
|
|
ra_sel SI, rb_cl, jmp_if_not_rep lodsb_no_rep;
|
| 24 |
|
|
lodsb_rep_loop:
|
| 25 |
|
|
ra_sel CX, jmp_rb_zero lodsb_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 |
|
|
lodsb_no_rep:
|
| 29 |
|
|
ra_sel SI, a_sel RA, alu_op SELA, mar_wr_sel Q, mar_write, segment DS;
|
| 30 |
|
|
a_sel RA, b_sel IMMEDIATE, immediate 0x1, alu_op NEXT,
|
| 31 |
|
|
rd_sel_source MICROCODE_RD_SEL, rd_sel SI, segment DS;
|
| 32 |
|
|
width W8, segment DS, mem_read, a_sel MDR, alu_op SELA,
|
| 33 |
|
|
rd_sel_source MICROCODE_RD_SEL, rd_sel AL, jmp_if_not_rep lodsb_done;
|
| 34 |
|
|
rb_cl, ext_int_yield, jmp lodsb_rep_loop;
|
| 35 |
|
|
lodsb_done:
|
| 36 |
|
|
next_instruction;
|
| 37 |
|
|
|
| 38 |
|
|
.at 0xad;
|
| 39 |
|
|
jmp lodsw;
|
| 40 |
|
|
|
| 41 |
|
|
.auto_address;
|
| 42 |
|
|
lodsw:
|
| 43 |
|
|
ra_sel SI, rb_cl, jmp_if_not_rep lodsw_no_rep;
|
| 44 |
|
|
lodsw_rep_loop:
|
| 45 |
|
|
ra_sel CX, jmp_rb_zero lodsw_done;
|
| 46 |
|
|
ra_sel SI, a_sel RA, b_sel IMMEDIATE, immediate 0x1, alu_op SUB,
|
| 47 |
|
|
rd_sel_source MICROCODE_RD_SEL, rd_sel CX;
|
| 48 |
|
|
lodsw_no_rep:
|
| 49 |
|
|
ra_sel SI, a_sel RA, alu_op SELA, mar_wr_sel Q, mar_write, segment DS;
|
| 50 |
|
|
a_sel RA, b_sel IMMEDIATE, immediate 0x2, alu_op NEXT,
|
| 51 |
|
|
rd_sel_source MICROCODE_RD_SEL, rd_sel SI, segment DS;
|
| 52 |
|
|
segment DS, mem_read, a_sel MDR, alu_op SELA,
|
| 53 |
|
|
rd_sel_source MICROCODE_RD_SEL, rd_sel AX, jmp_if_not_rep lodsw_done;
|
| 54 |
|
|
rb_cl, ext_int_yield, jmp lodsw_rep_loop;
|
| 55 |
|
|
lodsw_done:
|
| 56 |
|
|
next_instruction;
|