Search code examples
assembly68000supervisor-mode

Already executing in supervisor mode; how to start user mode? (several scenarios)


I've been doing some extra homework from my textbook to prepare for my 68000 Assembly exam coming up in the next few weeks. There are currently 4 questions which ask how the user mode can be started while already being executed in supervisor mode. I know that the instructions EOR, ANDI, and MOVE will let me do this, but I was wondering if the following examples are valid to start user mode:

EOR D0,SR        ;SR is status register (is this the right way to address the SR?)

ANDI #1,SR       ;Starting user via ANDI

MOVEI, #1,SR     ;Starting user via MOVEI

Are the above three instructions valid to start the user mode while already in supervisor mode?

My final question has to do with the trace mode. I am completely lost with this one and I need a little guidance. Here is the question:

Illustrate how a user program at address $4000 can be started in trace mode with an interrupt mask level of 5.

If I could get any tips I would very much appreciate it. Thank you!


Solution

  • Oh, the good old days of 68000 programming. I remember typing move.w #$2700,sr like it was yesterday.

    You are on the right track. EORI, ANDI, and MOVEI can all modify the status register. Your attempt to use the immediate value #1 is wrong, however.

    One of these ought to work:

    eori #$2000,sr
    andi #$dfff,sr
    move #$2000,sr  ;Depends on what interrupt level you want.
    

    As for the second part of your question, a hint is:

    move #$8500,sr