Hi all. I haven't fully developed this crazy idea of mine, but it has been buzzing around in my head for awhile, and I thought that I would enjoy hearing your input.
First of all this idea is split evenly between the topics of programming and hardware, so I just flipped a coin to decide which sub-forum to disturb, and the coin landed on "programming".
This plan is based on the idea of "smart" I/O, which basically acts as both I/O and as a type of supervisor. A potential memory map would be very simple, with RAM from $0080 all the way to $ff7f, and 128 bytes of I/O at each end. ROM would not appear in the "user" memory map.
I said "user" memory map, because my plan would allow one or more processes to exist, each with 64K as indicated. The 6502 vectors would be intercepted by the smart I/O system, the same as any other I/O access. It would provide the vector and the appropriate executable code to which it points, either from it's own private "supervisor" ROM paged into the small I/O space or whatever. I'm not a hardware guy, so I don't know how difficult or clumsy this would be in real life.
The benefit of this would be lots of RAM for each "user" process, which is a good thing. If a user needed to make a system request, it would either set up some registers and BRK, or tickle some smart I/O ports and proceed immediately. A couple of examples would be:
Code:
...
; first, a supervisor-style request ...
ldx #<message
ldy #>message
lda #1 ; (strout ID)
brk
...
; then, a memory-mapped port-style request ...
lda divisor
sta p ; zp data port
lda divisor+1
sta p+1
lda dividend
sta p+2
lda dividend+1
sta p+3
lda #3 ; udiv ID
sta cmd ; zp cmd port
nop ; give the magic a couple of user cycles to "happen"
lda p
sta quotient
lda p+1
sta quotient+1
lda p+2
sta remainder
lda p+3
sta remainder+1
With a sufficiently agile and smart I/O system, a "user" could concentrate more on being productive, and less on crashing the system with a wild jump or an inadvertent I/O access that could disable the entire system. An NMI-driven watchdog timer could even time-slice or time-out an infinitely looping process with a preemptive context switch or core dump.
This "smart I/O" idea probably isn't new, so I apologize ahead of time if I implied that it is, but I would like to see if any of you friendly wizards would like to help me build on this idea or change it ... or discard it, if it's just plain rubbish.
TIA
Mike B.
[EDIT: added a padding NOP to guarantee NMI intervention.]