scotws wrote:
Quote:
The abort interrupt is used in systems that have specialized memory management logic to cope with unusual hardware conditions that may arise during program execution.
At the risk of exposing even more of my happy ignorance in these matters -- I had always assumed, though without thinking about, that ABORT would be used in a multitasking context, not so much for memory management: A clock signal asserts ABT in regular intervals, and the CPU tears the process away from what it is doing with a cry of (insert Soup Nazi accent) "No cycles for you!"
Given the high priority of ABORT (just below RESET, but above IRQ), would this still be possibility?
The high priority of ABORTB, which is a non-maskable interrupt, would create intractable problems if used as a task switching mechanism. Suppose the following code (an excerpt from the DUART driver code in POC V1.1's interrupt handler) is being executed:
Code:
.iirq070 bit #u92atirq ;transmitter interrupting?
beq .iirq110 ;no, goto next channel
;
ldx e32tixga ;buffer "get" index
;
.iirq080 cpx e32tixpa ;buffer "put" index
beq .iirq090 ;no data in buffer
;
lda sr_92a ;channel A status
bit #u92txdr ;FIFO full? <————————————— ABORTB IS ASSERTED HERE
beq .iirq100 ;yes, defer next datum
;
lda e32bufta,x ;no, get datum from buffer &...
sta txd_92a ;write to FIFO
txa ;current buffer position
ina ;new buffer position
and #e32xmask ;deal with wrap
sta e32tixga ;set next position
tax
bra .iirq080 ;send another byte
and let's suppose that just as the
bit #u92txdr instruction is being executed ABORTB is toggled because it's time to switch tasks. What do you think would happen when the MPU resumed execution at that instruction? Consider that "aborting" an instruction causes the 65C816 to discard computational results.
Quote:
I know the 65816 is not really made for serious multitasking -- no protected mode, for one -- but whereas memory stuff would need a MMU ("the required hardware logic" as I understand from the text), what else would you need for preemptive multitasking, however primitive?
In that paragraph in my article, "required hardware logic" actually refers to whatever is needed to create a protected mode environment, not just the logic needed to generate the A16-A23 address component.
Oddly enough, preemptive multitasking doesn't required a protected environment. The first generation Commodore Amiga, which was powered by the MC68000, had no memory protection whatsoever, yet was a preemptive multitasking machine. However, the MC68000 does have "user" and "supervisor" modes. Therefore, as long as a user-written program wasn't allowed to wedge into the interrupt system, supervisor mode instructions could not be executed, which made it difficult, but not impossible, for one program to step on something that it shouldn't.
Later Amigas made use of the MC68851 MMU and then the 68030 and 68040 MPUs to implement a virtual memory system that created a true protected environment.
It can be done with the 65C816 by using complex logic to police memory accesses, instruction fetches and such. It's not simple.
Quote:
Thanks again for the text, I learned a lot. The second computer will definitely be a '816.
The ability to do 16 bit loads, stores and arithmetic with a single instruction is compelling in itself. The stack functions however, are the icing on the cake.