| 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 0xe8;
|
| 19 |
|
|
read_immed, jmp calle8, ra_sel SP;
|
| 20 |
|
|
.auto_address;
|
| 21 |
|
|
calle8:
|
| 22 |
|
|
a_sel RA, b_sel IMMEDIATE, immediate 0x2, alu_op SUB, rd_sel SP,
|
| 23 |
|
|
rd_sel_source MICROCODE_RD_SEL, mar_write,
|
| 24 |
|
|
mar_wr_sel Q;
|
| 25 |
|
|
a_sel IP, alu_op SELA, mdr_write, ra_sel SP, segment SS, segment_force;
|
| 26 |
|
|
segment SS, segment_force, mem_write, a_sel IP, b_sel IMMEDIATE,
|
| 27 |
|
|
alu_op ADD, load_ip, next_instruction;
|
| 28 |
|
|
|
| 29 |
|
|
callff_indirect_intra_reg:
|
| 30 |
|
|
a_sel RA, alu_op SELA, load_ip, jmp callff_indirect_intra_save,
|
| 31 |
|
|
ra_sel SP;
|
| 32 |
|
|
callff_indirect_intra_mem:
|
| 33 |
|
|
segment DS, mem_read;
|
| 34 |
|
|
a_sel MDR, alu_op SELA, load_ip, jmp callff_indirect_intra_save,
|
| 35 |
|
|
ra_sel SP;
|
| 36 |
|
|
callff_indirect_intra_save:
|
| 37 |
|
|
a_sel RA, b_sel IMMEDIATE, immediate 0x2, alu_op SUB, rd_sel SP,
|
| 38 |
|
|
rd_sel_source MICROCODE_RD_SEL, mar_write,
|
| 39 |
|
|
mar_wr_sel Q;
|
| 40 |
|
|
a_sel IP, alu_op SELA, mdr_write, ra_sel SP, segment SS, segment_force;
|
| 41 |
|
|
segment SS, segment_force, mem_write, next_instruction;
|
| 42 |
|
|
|
| 43 |
|
|
.at 0x9a;
|
| 44 |
|
|
jmp call9a, read_immed, mdr_write, b_sel IMMEDIATE, alu_op SELB;
|
| 45 |
|
|
.auto_address;
|
| 46 |
|
|
call9a:
|
| 47 |
|
|
read_immed;
|
| 48 |
|
|
// New IP is now in MDR, new CS is in the immediate reader.
|
| 49 |
|
|
//
|
| 50 |
|
|
// This instruction implementation is very subtle - it's important to read
|
| 51 |
|
|
// both immediates before performing any stack accesses so that IP is
|
| 52 |
|
|
// correct in case of any kind of fault rather than being in the middle of
|
| 53 |
|
|
// the instruction stream.
|
| 54 |
|
|
a_sel MDR, alu_op SELA, load_ip, segment CS;
|
| 55 |
|
|
b_sel SR, alu_op SELB, mdr_write, ra_sel SP;
|
| 56 |
|
|
a_sel RA, b_sel IMMEDIATE, immediate 0x2, alu_op SUB, rd_sel SP,
|
| 57 |
|
|
rd_sel_source MICROCODE_RD_SEL, mar_write,
|
| 58 |
|
|
mar_wr_sel Q, segment_force, segment SS;
|
| 59 |
|
|
segment_force, segment SS, mem_write, ra_sel SP;
|
| 60 |
|
|
a_sel RA, b_sel IMMEDIATE, immediate 0x2, alu_op SUB, rd_sel SP,
|
| 61 |
|
|
rd_sel_source MICROCODE_RD_SEL, mar_write,
|
| 62 |
|
|
mar_wr_sel Q;
|
| 63 |
|
|
a_sel IP, alu_op SELA, mdr_write, segment_force, segment SS;
|
| 64 |
|
|
segment_force, segment SS, mem_write;
|
| 65 |
|
|
b_sel IMMEDIATE, alu_op SELB, segment_force, segment CS,
|
| 66 |
|
|
segment_wr_en, next_instruction;
|
| 67 |
|
|
|
| 68 |
|
|
callff_indirect_inter_reg:
|
| 69 |
|
|
next_instruction;
|
| 70 |
|
|
callff_indirect_inter_mem:
|
| 71 |
|
|
b_sel SR, alu_op SELB, mdr_write, ra_sel SP;
|
| 72 |
|
|
a_sel RA, b_sel IMMEDIATE, immediate 0x2, alu_op SUB, rd_sel SP,
|
| 73 |
|
|
rd_sel_source MICROCODE_RD_SEL, mar_write,
|
| 74 |
|
|
mar_wr_sel Q, segment_force, segment SS;
|
| 75 |
|
|
segment_force, segment SS, mem_write, ra_sel SP;
|
| 76 |
|
|
a_sel RA, b_sel IMMEDIATE, immediate 0x2, alu_op SUB, rd_sel SP,
|
| 77 |
|
|
rd_sel_source MICROCODE_RD_SEL, mar_write,
|
| 78 |
|
|
mar_wr_sel Q;
|
| 79 |
|
|
a_sel IP, alu_op SELA, mdr_write, segment_force, segment SS;
|
| 80 |
|
|
segment_force, segment SS, mem_write;
|
| 81 |
|
|
mar_wr_sel EA, mar_write, segment DS;
|
| 82 |
|
|
segment DS, mem_read;
|
| 83 |
|
|
a_sel MDR, alu_op SELA, load_ip;
|
| 84 |
|
|
a_sel MAR, b_sel IMMEDIATE, immediate 0x2, alu_op ADD,
|
| 85 |
|
|
mar_wr_sel Q, mar_write, segment DS;
|
| 86 |
|
|
segment DS, mem_read;
|
| 87 |
|
|
a_sel MDR, alu_op SELA, segment_wr_en,
|
| 88 |
|
|
segment_force, segment CS, next_instruction;
|