class CPU
- CPU
- Reference
- Object
Defined in:
cpu.crConstant Summary
-
ADD =
StaticArray[F1, F2, MC::IO | MC::MI, MC::RO | MC::BI, (MC::EO | MC::AI) | MC::FI]
-
ADI =
StaticArray[F1, F2, MC::IO | MC::BI, (MC::EO | MC::AI) | MC::FI, MC::None]
-
CMP =
StaticArray[F1, F2, MC::IO | MC::MI, ((MC::RO | MC::BI) | MC::SU) | MC::FI, MC::None]
-
F1 =
MC::CO | MC::MI
-
Fetch instruction microcode
-
F2 =
(MC::RO | MC::II) | MC::CE
-
HLT =
StaticArray[F1, F2, MC::HLT, MC::None, MC::None]
-
JC =
StaticArray[F1, F2, MC::IO | MC::JC, MC::None, MC::None]
-
JMP =
StaticArray[F1, F2, MC::IO | MC::J, MC::None, MC::None]
-
JPA =
StaticArray[F1, F2, MC::AO | MC::J, MC::None, MC::None]
-
JZ =
StaticArray[F1, F2, MC::IO | MC::JZ, MC::None, MC::None]
-
LABEL_REGEX =
/^(?<label>[a-z\_\d]+)\:/i
-
LDA =
StaticArray[F1, F2, MC::IO | MC::MI, MC::RO | MC::AI, MC::None]
-
LDI =
StaticArray[F1, F2, MC::IO | MC::AI, MC::None, MC::None]
-
LSR =
StaticArray[F1, F2, MC::SR | MC::FI, MC::None, MC::None]
-
NOP =
StaticArray[F1, F2, MC::None, MC::None, MC::None]
-
Opcodes
-
OUT =
StaticArray[F1, F2, MC::AO | MC::OI, MC::None, MC::None]
-
ROM =
Slice[NOP, LDA, ADD, SUB, STA, LDI, JMP, JC, JZ, ADI, JPA, CMP, LSR, SBI, OUT, HLT]
-
Set opcodes in micro-code ROM
-
SBI =
StaticArray[F1, F2, MC::IO | MC::BI, ((MC::EO | MC::SU) | MC::AI) | MC::FI, MC::None]
-
STA =
StaticArray[F1, F2, MC::IO | MC::MI, MC::AO | MC::RI, MC::None]
-
SUB =
StaticArray[F1, F2, MC::IO | MC::MI, MC::RO | MC::BI, ((MC::EO | MC::AI) | MC::SU) | MC::FI]
-
SYM_REGEX =
/\:(?<label>[a-z\_\d]+)/i
Constructors
-
.new(prog : String, options : Options | Nil = nil)
Initialize from un-assembled program
-
.new(ram : Bytes, options : Options | Nil = nil)
Initialize from assembled program
Class Method Summary
-
.asm(line : String)
Assemble instruction
-
.assemble(prog : String)
Assemble a program
-
.dasm(instr : UInt8)
Disassemble instruction
Instance Method Summary
- #address : UInt8
- #address=(address : UInt8)
- #bus : UInt8
- #bus_receive
-
#bus_transfer
Based on the control word, transfer data onto the bus
- #control : MC
-
#flags
Get the current state of the flags Note: this is latched to
@reg_f
onMC::FI
- #mc_step : UInt8
- #options : Options
- #options=(options : Options)
- #print_state
- #program_counter : UInt8
- #ram : Bytes
- #ram=(ram : Bytes)
- #reg_a : UInt8
- #reg_b : UInt8
-
#reg_e
ALU
- #reg_f : Flags
- #reg_i : UInt8
- #reg_o : UInt8
-
#run(&)
Run the main loop
- #run
-
#set_instruction
Fetch an instruction and increment the micro-code step
- #step
Constructor Detail
Initialize from un-assembled program
Initialize from assembled program