When a task is restarted, it must see exactly the same context that it had when it was last executing. This implies several things: (1) The CPU registers must be restored exactly. This is usually done by having the kernel save the CPU registers in a Task Control Block (TCB) when the task is stopped; when the task is restarted later, the CPU registers are reloaded from the saved values in the TCB. (2) Other resouces that were being used by the task must also be protected from being altered. Memory that was allocated dynamically by the operating system should be safe since such memory is usually only given out to one task at a time. Other system resources, such as network connections, might be protected from being used by other tasks using semaphores. (However, care must be taken to avoid problems with deadlock if tasks can hold on to two or more resources, and there is no mechanism to force them to give up resources.)
The difference between soft and hard real-time constraints is qualitative. Soft real-time problems are computer applications where sufficiently fast and deterministic response times can be obtained using a conventional operating system such as Microsoft Windows or UNIX. Usually the operating system must be relatively lightly loaded. Hard real-time problems require faster and more deterministic response times than can be provided by a conventional operating system. Instead one must use a specially-designed operating system like MicroC/OS-II. (It is also possible to augment conventional operating systems with hard real-time subsystems that ensure fast response for some signals.)(a) A robot manipulator arm is hard real-time because its movements must be controlled over short time scales. Also, the consequences of overly slow real-time response could be catastrophic in a production line.
(b) An electronic poker game is a soft real-time application. It could be successfully run on a computer with a conventional operating system. However, if the game is to be portable, then one would not likely use Windows or UNIX as the operating system because of the limited memory. There is a reduced size version of Windows, called Windows CE, which might be used. Also, a scalable kernel such as Micro/OS-II might be appropriate.
(c) A building door lock control system is likely to be soft real-time. (Indeed, the card lock system in the ECERF building is controlled by a Macintosh PC.) The consequences of slower or slightly nondeterministic response time are going to be minor since humans are involved.
(d) As in example (a), the problem is likely to be hard real-time. A train needs to be control with great temporal precision to guarantee smooth operation and to avoid damage and possibly accidents.
(e) A video lottery terminal is likely to be soft real-time since the main interface is with humans involved in a recreational activity. Safety is not a factor. To reduce cost one might use a simpler operating system than Windows or UNIX, however.
In the 1970s and the early 1980s, microprocessors were generally programmed using assembly language. This was done because efficiency was a primary concern when pushing to use microprocessors in new and, at that time, rather demanding applications. There were relatively few software developers, and many of them could be assumed to be experts at designing very compact and efficient assembly language code. They could benefit from fancy address modes that permitted significant gains in efficiency and performance. Thus to make microprocessors more attractive to potential customers, it was important to provide the kinds of features (many instructions and many addressing modes) that allowed for efficient assembly language programming. It is also true that larger, mainframe computers tended to have CISC architectures, and microprocessor architectures tended to follow mainframe architectures.In the mid-1980s the RISC style of computer architecture became recognized as a useful way of increasing computer performance when the software was mostly compiled from high-level languages. The basic idea of RISC is to simplify the computer hardware by restricting the number of addressing modes and instructions; in return the computer hardware will be simpler and can be made to run faster. Improved compiler technology could be relied upon to produce code that made efficient use of the available addressing modes and instructions.
Modern microprocessors usually have aspects of both the CISC and RISC architectural styles. The most popular architectures tend to be a compromise between an older pre-existing architecture (which must stil be supported to keep customers happy) with new features that were added later. It is rare to have the luxury of designing a "clean" new architecture from scratch.
The main features that enhance the portability of MicroC/OS-II are:
(a) The kernel is written in ANSI C, which is probably the language that is
supported across the greatest number of different computer architectures.
(b) The features of MicroC/OS-II can be readily accessed by means of
subroutine calls from application programs written in C.
(c) The software architecture of MicroC/OS-II has been partitioned to hide
machine dependencies within a relatively small and well defined
"processor port". When migrating a system to a new machine architecture,
the changes will be mostly, if not entirely, restricted to this piece
of software.
(d) MicroC/OS-II makes relatively few assumptions about the underlying
hardware. There must be a CPU to execute compiled ANSI software.
There must be a hardware timer resource to provide software-independent
timing for use in functions with programmable real-time time delays.
The TBLU and TBLS instructions are intended to simplify the calculation of interpolated values based on tabular data. TBLU provides unsigned interpolation with rounding, while TBLS provides signed interpolation with rounding. (Note: There are two other similar instructions, TBLUN and TBLSN, which provide unsigned and signed interpolation with no rounding of the result.)The destination operand is always a data register, Dn, which contains the independent variable (the variable input for the interpolation). Bits 15:8 of Dn hold the integer value of the independent variable: in tables, this number gives the index of the first table value. Bits 7:0 of Dn are a fraction that determine the the interpolation factor between the first table value and next table value. The table values can be given in two ways: (1) as an effective address that points to the first long word, word or byte in a table of values located in memory; or (2) as two named data registers. An example of the first form is "TBLU.W (A0),D1" and of the second form is "TBLS.B D1:D2,D3". Note that the suffix of the instruction mnemonic (.L, .W or .B) gives the size of the table values. Note also that bits 15:9 in the destination data register Dn are ignored in the second form of the instructions because the two adjacent table values can be assumed to be preloaded in the first two data registers.
The unsigned and signed forms determine whether or not the most significant bit in the data values is a magnitude bit (unsigned form) or a sign bit (signed form).
The added capability was to support 32-bit displacements. Compared to instructions with 16-bit displacements, the new instructions with 32-bit displacements would require one more word to hold the additional 16 bits. 68000 instructions have one operand word followed by zero or more additional words that specify the addressing modes for the source and/or destination operands. The instructions affected by the change already support 16-bit displacements. To create the new instruction format, one could simply modify these instructions by adding a second 16-bit displacement word right after the 16-bit displacement word in the existing instruction format.
Your subrountine is to accept two input parameters: the base address of the list in A0.L and the record number in D0.W. The three record fields are to be returned in D1.B, D2.B and D3.B. Register D7.B is to be zero if the record was accessed successfully; otherwise, it is to contain the value one. Your routine is to calculate byte addresses, instead of doing a linear search through the packed list.
READ_DATA:
MOVEM.L A0/D0-D3,-(SP) // save CPU regs
MOVE.B #0x01,D7 // assume failure
CMP.W #MAX_RECORD_NUM,D0 // compare record number with maximum
BHI EXIT_READ_DATA // exit if number too bit
CLR.B D7 // now indicate success
MULU.W #11,D0 // compute bit offset to 11-bit record
MOVE.L D0,D4
LSR.L #3,D4 // form byte offset to record's 1st byte
ANDI.B #0x07,D0 // form bit offset into that byte
MOVE.L (0,A0,D4.W),D3 // fetch longword containing record
LSL.L D0,D3 // left justify record to bit #31
MOVE.L D3,D1
LSR.L #28,D1 // right justify the first field
ANDI.B #0x0F,D1 // trim 4-bit field as a precaution
MOVE.L D3,D2
LSR.L #23,D2 // right justify the second field
ANDI.B #0x1F,D2 // trim 5-bit field as a precaution
LSR.L #23,D3 // right justify the third field
ANDI.B #0x03,D3 // trim 2-bit field as a precaution
EXIT_READ_DATA:
MOVEM.L (SP)+,A0/D0-D3 // restore CPU regs
RTS