Interface types: Active interface and passive interface.
------------------------------------------------------------
Passive interface - connected using LatchStore array. Used for RAM modules, and everything
which may have latchstore.
Active interface - ReadCell and WriteCell functions - used for reading and writing data.
Used by all other devices, such as bus, hi-speed plug. Putting delays here will result in
halting CPU operation till end of delay (it will wait for data :D)
------------------------------------------------------------
Your HDD must use active interface.
Also do some check about previous address, so it wont do large delays each time you read
new address from near cell.
CPU can execute programs directly from HDD in this case, it will just fetch all data from
it.
------------------------------------------------------------
To use hi-speed link you must make single output "Memory" (call it whatever you like).
Nothing more needed, just declare either active method functions, or passive latchstore
array. Anything operating with hi-speed link will catch up your device if it has valid
hi-speed interface
------------------------------------------------------------
function ENT:ReadCell( Address, Segment )
Address - address to read from, can't be negative.
Segment - will always be zero
returns value if read success, else returns nil
------------------------------------------------------------
function ENT:WriteCell( Address, Segment, value )
Address - address to write to, can't be negative.
Segment - will always be zero
value - value to write
returns true if success, else false
------------------------------------------------------------
Note on memory usage:
You cant force memory size. Memory size is determined by memory bus (if there is any).
Values wont be read if address exceeds memory size set up on bus.
Values should not be read if address exceeds real memory, just return nil to cause CPU
memory error ^_^
The clever thing to do - make HDD control registers. Best way - make first RAM addresses
reserved for HDD registers, i.e. value at 0 shows HDD motor status, 1 shows HDD "angle", 2
shows speed, 3 shows size, 4 shows cylinders, etc. 7 shows model, 6 shows status. Use your
imagination, and make these useful. They can be non-writeable (in this case please always
return true, but dont store value in writecell)
------------------------------------------------------------
P.S. CPU has new way of handling errors:
PF flag - Protected mode
When PF is false:
All interrupts and errors work as they do in current CPU (the only output shows error
code/interrupt number)
When PF is true:
All pointers to interrupts are stored in interrupt table. If interrupt is invalid or
missing, then Int0 is called which equals to software reset (IP = 0; CS = 0)
IF flag - disable/enable interrupts. When IF is false then all errors are ignored, both in
protected and nonprotected modes