OpenCores
URL https://opencores.org/ocsvn/s80186/s80186/trunk

Subversion Repositories s80186

[/] [s80186/] [trunk/] [rtl/] [microcode/] [enter.us] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
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 0xc8;
19
    read_immed, jmp enter;
20
.auto_address;
21
enter:
22
    b_sel IMMEDIATE, alu_op SELB, tmp_wr_en;
23
    width W8, read_immed;
24
    // Push BP
25
    ra_sel SP;
26
    a_sel RA, b_sel IMMEDIATE, immediate 0x2, alu_op SUB, mar_write,
27
        mar_wr_sel Q, ra_sel BP, rd_sel_source MICROCODE_RD_SEL, rd_sel SP;
28
    a_sel RA, alu_op SELA, mdr_write, segment_force, segment SS;
29
    segment_force, segment SS, mem_write, ra_sel SP,
30
        jmp_loop_done enter_out_nonest;
31
 
32
    // Push frame temp
33
    a_sel RA, b_sel IMMEDIATE, alu_op ENTER_FRAME_TEMP_ADDR, mar_write,
34
        mar_wr_sel Q, ra_sel SP;
35
    a_sel RA, alu_op SELA, mdr_write, segment_force, segment SS;
36
    segment_force, segment SS, mem_write;
37
 
38
enter_loop:
39
    jmp_loop_done enter_out, ra_sel BP;
40
    // BP := BP - 2
41
    a_sel RA, b_sel IMMEDIATE, immediate 0x2, alu_op SUB, rd_sel BP,
42
        rd_sel_source MICROCODE_RD_SEL, segment_force, segment SS,
43
        mar_write, mar_wr_sel Q;
44
    // push [BP]
45
    segment_force, segment SS, mem_read, ra_sel SP;
46
    a_sel RA, b_sel IMMEDIATE, immediate 0x2, alu_op SUB, rd_sel SP,
47
        rd_sel_source MICROCODE_RD_SEL, segment_force, segment SS,
48
        mar_write, mar_wr_sel Q;
49
    segment_force, segment SS, mem_write;
50
    jmp enter_loop;
51
 
52
enter_out:
53
    // Reload frame_temp
54
    ra_sel SP;
55
    a_sel RA, b_sel IMMEDIATE, immediate 0x2, alu_op SUB, rd_sel SP,
56
        rd_sel_source MICROCODE_RD_SEL, segment_force, segment SS,
57
        mar_write, mar_wr_sel Q;
58
    segment_force, segment SS, mem_read, ra_sel SP;
59
    a_sel MDR, alu_op SELA, rd_sel BP, rd_sel_source MICROCODE_RD_SEL,
60
        ra_sel SP;
61
    // SP := SP - size
62
    a_sel RA, b_sel TEMP, alu_op SUB, rd_sel SP, rd_sel_source MICROCODE_RD_SEL,
63
        next_instruction;
64
 
65
enter_out_nonest:
66
    a_sel RA, alu_op SELA, rd_sel BP, rd_sel_source MICROCODE_RD_SEL,
67
        ra_sel SP;
68
    a_sel RA, b_sel TEMP, alu_op SUB, rd_sel SP, rd_sel_source MICROCODE_RD_SEL,
69
        next_instruction;

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.