{
File name write.mc
Description: Mesa Write op-codes
Author: don charnley
Created: February 16, 1980
Last edited: Charnley, March 28, 1980 5:09 PM
Last edited: R. Garner, April 2, 1980 10:34 PM
Last edited: Johnsson, January 14, 1981 11:04 AM
}
{The Write mesa op-codes consist of the following:
OPvalbytesstktime
W0106’b1—23
W1107’b1—23
W2110’b1—23
WB111’b2—23
WS0130’b1—23
WSB131’b2—23
WBL140’b2—33
WDBL142’b2—44
WD0117’b1—33
WDB116’b2—33
WDS0xxx1—34
WSDB133’b2—34
PS0xxx1—2+13
PSBxxx2—2+13
PDS0xxx1—3+14
PDSBxxx2—3+14
WILP126’b2—14
WILPL150’b2—16
WIGPL152’b2—16
WXLP123’b2—26
WXLPL144’b2—26
WXGPL146’b2—26
}
{——————————————————————————————————————————————————————
Wn{n:[0..2]} and WB
——————————————————————————————————————————————————————}
{@Wn} {@WB, alpha}
{Timing:2 clicks if no remap, + ? if fix map flags}
{entry:exit:
TOS =| ptr|| v|
STK =| ~|| ptr|
-->| data|| data|
| v|| v|
| u| -->| u|}
@W0:Map ← Q ← [rhMDS,TOS + 0], L1←L1w.DecOnly, GOTO[WnTail],c1, opcode[106’b];
@W1:Map ← Q ← [rhMDS,TOS + 1], L1←L1w.DecOnly, GOTO[WnTail],c1, opcode[107’b];
@W2:T ← 2, L1←L1w.DecOnly,c1, opcode[110’b];
Noop,c2;
WbMap:Noop,c3;
Map ← Q ← [rhMDS,TOS + T],c1;
WnTail:PC ← PC + PC16, push, L0←L0.RedoW,c2;
Rx ← rhRx ← MD, XDirtyDisp, STK ← TOS, pop, GOTO[RedoW],c3;
RedoW:MAR ← [rhRx, Q + 0], BRANCH[WxMapUD,$,1],c1, at[L0.RedoW,10,WMapFixCaller];
MDR ← STK{data}, pop, IBDisp, GOTO[SLTail],c2;
WxMapUD:CALL[WMapFix] {will return to RedoW },c2;
@WB:T ← ib, L1 ← L1w.DecDec,c1, opcode[111’b];
PC ← PC + PC16, GOTO[WbMap],c2;
{——————————————————————————————————————————————————————
WS0 and WSB
——————————————————————————————————————————————————————}
{@WS0} {@WSB, alpha}
{Timing:3 clicks if no remap, + 2 if fix map flags}
{entry:exit:
TOS =| data|| v|
STK =| ~|| data|
-->| ptr|| ptr|
| v|| v|
| u| -->| u|}
@WS0:TT ← STK{ptr}, push, L1 ← L1w.PushOnly,c1, opcode[130’b];
STK ← TOS{data}, pop,c2;
pop, GOTO[WSTail] ,c3;
@WSB:TT ← STK{ptr}, push, L1 ← L1w.PushDec,c1, opcode[131’b];
PC ← PC + PC16, STK ← TOS{data}, pop,c2;
TT ← ib + TT, pop,c3;
WSTail:Map ← Q ← [rhMDS,TT],c1;
T ← TOS, L0 ← L0.WriteGo,c2;
WriteGo:Rx ← rhRx ← MD, XDirtyDisp,c3;
WriteGox:MAR ← [rhRx,Q + 0], BRANCH[WMapUD,$,1],c1, at[L0.WriteGo,10,WMapFixCaller];
MDR ← T{data}, PC ← PC + PC16, IBDisp, GOTO[SLTail],c2;
WMapUD:CALL[WMapFix] {will return to WriteGo },c2;
{——————————————————————————————————————————————————————
WBL
——————————————————————————————————————————————————————}
{@WBL, alpha}
{Timing:3 clicks, + 1 if (ptr + ib) crosses 64K, + 2 if fix map flags}
{entry:exit:
TOS =| ptrH|| v|
STK =| ~|| ~|
-->| ptrL|| ptrL|
| data|| data|
| v|| v|
| u| -->| u|}
@WBL:TT ← STK{ptrL}, pop, L1 ← L1w.Push2Only,c1, opcode[140’b];
TT ← TT + ib, CarryBr, L2 ← L2.WBL,c2;
rhTT ← TOS{ptrH} LRot0, BRANCH[WLrhOK,$],c3;
WLrhFix:Q ← rhTT, CALL[rhTTIncx],c1;
WLrhOK:Map ← Q ← [rhTT,TT], L0 ← L0.RedoLW,c1, at[L2.WBL,10,rhTTIncRets];
T ← STK{data}, pop,c2;
RedoLWz:Rx ← rhRx ← MD, XDirtyDisp,c3;
RedoLW:MAR ← [rhRx, Q + 0], BRANCH[WLMapUD,$,1],c1, at[L0.RedoLW,10,WMapFixCaller];
MDR ← T{data}, IBDisp, PC ← PC + 1, GOTO[SLTail],c2;
WLMapUD:CALL[WLMapFix] {will return to RedoLW},c2;
{——————————————————————————————————————————————————————
WDBL
——————————————————————————————————————————————————————}
{@WDBL, alpha}
{Timing:4 clicks, + 1 if (ptr + ib + 1) crosses 64K, + 2 if fix map flags, + 2 if data on 2 pages, + 2 if 2 pages diff 64K}
{entry:exit:
TOS =| ptrH|| v|
STK =| ~|| ~|
-->| ptrL|| ptrL|
| data1|| data1|
| data0|| data0|
| v|| v|
| u| -->| u|}
@WDBL:TT ← STK{ptrL}, pop, L0 ← L0.wdblW1,c1, opcode[142’b];
TT ← TT + ib, CarryBr, L2 ← L2.WDBL0,c2;
rhTT ← TOS{ptrH} LRot0, BRANCH[wdblRhOK,$],c3;
Q ← rhTT, CALL[rhTTIncx],c1;
wdblRhOK:Map ← Q ← [rhTT,TT], L1 ← L1w.Push2Only,c1, at[L2.WDBL0,10,rhTTIncRets];
T ← STK{data1}, pop,c2;
Rx ← rhRx ← MD, XDirtyDisp,c3;
wdblW1:MAR ← [rhRx,Q + 0], BRANCH[wdblMapUD1,$,1],c1, at[L0.wdblW1,10,WMapFixCaller];
MDR ← STK{data0}, pop, L0 ← L0.RedoLW,c2;
Noop,c3;
wdblW0:MAR ← [rhRx,Q + 1],c1;
MDR ← T{data1}, PC ← PC + 1, IBDisp, BRANCH[$,wdblPgCr,1],c2;
TOS ← STK{v}, pop, DISPNI[OpTable],c3;
wdblPgCr:TT ← TT + 1, CarryBr, L2 ← L2.WDBL1,c3;
WDBL1:Map ← Q ← [rhTT,TT], L1 ← L1w.Push3Only, BRANCH[$,wdblFixrh],c1, at[L2.WDBL1,10,rhTTIncRets];
PC ← PC - 1, GOTO[RedoLWz],c2;
wdblFixrh:GOTO[FixrhTT]{in RDBL; calls rhTTInc},c2;
wdblMapUD1:CALL[WLMapFix] {will return to wdblW1 },c2;
{——————————————————————————————————————————————————————
WD0
——————————————————————————————————————————————————————}
{@WD0}
{Timing:3 clicks, + 2 if fix map flags, + 2 if data on 2 pages}
{entry:exit:
TOS =| ptr|| v|
STK =| ~|| ~|
-->| data1|| data1|
| data0|| data0|
| v|| v|
| u| -->| u|}
@WD0:Map ← Q ← [rhMDS,TOS],c1, opcode[117’b];
T ← STK{data1}, L1 ← L1w.PushOnly, pop,c2;
Rx ← rhRx ← MD, XDirtyDisp,c3;
WDw0:MAR ← [rhRx,Q + 0], L0 ← L0.WDw0, BRANCH[WDw0MapUD,$,1],c1, at[L0.WDw0,10,WMapFixCaller];
MDR ← STK{data0}, pop, L1 ← L1w.Push2Only,c2;
Noop,c3;
WDw1:MAR ← [rhRx,Q + 1],c1;
WDw1c2:MDR ← T{data0}, PC ← PC + PC16, IBDisp, BRANCH[$,WDw1PgCr,1],c2;
TOS ← STK{v}, pop, DISPNI[OpTable],c3;
WDw1PgCr:PC ← PC - PC16,c3;
Map ← Q ← [rhMDS,Q + 1],c1;
L0 ← L0.WriteGo, GOTO[WriteGo],c2;
WDw0MapUD:CALL[WMapFix] {will return to WDw0 },c2;
{——————————————————————————————————————————————————————
WDB
——————————————————————————————————————————————————————}
{@WDB, alpha}
{Timing:3 clicks, + 2 if fix map flags, + 2 if data on 2 pages}
{entry:exit:
TOS =| ptr|| v|
STK =| ~|| ~|
-->| data1|| data1|
| data0|| data0|
| v|| v|
| u| -->| u|}
@WDB:Q ← TOS + ib, L1 ← L1w.Push2Dec,c1, opcode[116’b];
T ← STK{data1}, pop,c2;
WDBx:PC ← PC + PC16,c3;
Map ← [rhMDS, Q],c1;
TT ← STK{data0}, pop,c2;
Rx ← rhRx ← MD, XDirtyDisp,c3;
WDBw0:MAR ← [rhRx,Q + 0], L0 ← L0.WDBw0, BRANCH[WDBw0MapUD,$,1],c1, at[L0.WDBw0,10,WMapFixCaller];
MDR ← TT,c2;
GOTO[WDw1],c3;
WDBw0MapUD:CALL[WMapFix] {will return to WDBw0 },c2;
{——————————————————————————————————————————————————————
WDS0
——————————————————————————————————————————————————————}
{@WDS0}
{Timing:4 clicks, + 2 if fix map flags, + 2 if data on 2 pages}
{entry:exit:
TOS =| data1|| v|
STK =| ~|| ~|
-->| data0|| data0|
| ptr|| ptr|
| v|| v|
| u| -->| u|}
{ UNUSED AT PRESENT
@WDS0:pop,c1, opcode[xxx];
T ← STK{ptr},c2;
Noop,c3;
Map ← Q ← [rhMDS,T + 1], L0 ← L0.WDSw0,c1;
T ← TOS{data1}, L1 ← L1w.PushOnly,c2;
Rx ← rhRx ← MD, XDirtyDisp,c3;
WDSw0:MAR ← [rhRx,Q + 0], BRANCH[WDSw0MapUD,$,1],c1, at[L0.WDSw0,10,WMapFixCaller];
MDR ← T{data1}, push, L1 ← L1.Push2Only,c2;
T ← STK{data0}, pop,c3;
MAR ← [rhRx,Q - 1], pop, GOTO[WDw1c2],c1;
WDSw0MapUD:
CALL[WMapFix] {will return to WDSw0 },c2;
}
{——————————————————————————————————————————————————————
WSDB
——————————————————————————————————————————————————————}
{@WSDB, alpha}
{Timing:4 clicks, + 2 if fix map flags, + 2 if data on 2 pages}
{entry:exit:
TOS =| data1|| v|
STK =| ~|| ~|
-->| data0|| data0|
| ptr|| ptr|
| v|| v|
| u| -->| u|}
@WSDB:PC ← PC + PC16, pop,c1, opcode[133’b];
T ← STK{ptr},c2;
T ← T + ib,c3;
Map ← Q ← [rhMDS,T], L0 ← L0.WDSBw0,c1;
T ← TOS{data1}, L1 ← L1w.DecOnly,c2;
Rx ← rhRx ← MD, XDirtyDisp, push,c3;
WSDBw0:MAR ← [rhRx,Q + 0], BRANCH[WSDBw0MapUD,$,1],c1, at[L0.WDSBw0,10,WMapFixCaller];
MDR ← STK{data0}, pop, L1 ← L1w.Push2Dec,c2;
Noop,c3;
MAR ← [rhRx,Q + 1], pop, GOTO[WDw1c2],c1;
WSDBw0MapUD:CALL[WMapFix] {will return to WSDBw0 },c2;
{——————————————————————————————————————————————————————
PS0 and PSB
——————————————————————————————————————————————————————}
{@PS0} {@PSB, alpha}
{Timing:3 clicks if no remap, + 2 if fix map flags}
{entry:exit:
TOS =| data|| ptr|
STK =| ~|| data|
-->| ptr|| ptr|
| v| -->| v|}
{ UNUSED AT PRESENT
@PS0:TT ← STK{ptr}, push, L1 ← L1w.NoFixes,c1, opcode[xxx];
T ← STK ← TOS{data}, pop,c2;
fXpop, fZpop,c3;
Map ← Q ← [rhMDS,TT], push, GOTO[WS0Mapx],c1;
@PSB:TT ← STK{ptr}, push, L1 ← L1w.DecOnly,c1, opcode[xxx];
T ← STK ← TOS{data}, pop,c2;
TT ← ib + TT, pop,c3;
Map ← Q ← [rhMDS,TT], pop,c1;
PC ← PC + PC16, push, L0 ← L0.WriteGo,c2;
Rx ← rhRx ← MD, XDirtyDisp, push, GOTO[WriteGo],c3;
}
{——————————————————————————————————————————————————————
PDS0
——————————————————————————————————————————————————————}
{@PDS0}
{Timing:4 clicks, + 2 if fix map flags, + 2 if data on 2 pages}
{entry:exit:
TOS =| data1|| ptr|
STK =| ~|| data1|
-->| data0|| data0|
| ptr|| ptr|
| v| -->| v|}
{ UNUSED AT PRESENT
@PDS0:pop ,c1, opcode[xxx];
T ← STK{ptr}, fXpop, fZpop, push,c2;
push,c3;
Map ← Q ← [rhMDS,T + 1], push, L0 ← L0.PDSw0,c1;
STK ← T ← TOS{data1}, pop, L1 ← L1w.NoFixes,c2;
Rx ← rhRx ← MD, XDirtyDisp,c3;
PDSw0:MAR ← [rhRx,Q + 0], BRANCH[PDSw0MapUD,$,1],c1, at[L0.PDSw0,10,WMapFixCaller];
MDR ← T{data1}, L1 ← L1w.PushOnly,c2;
T ← STK{data0}, pop, GOTO[WDw1],c3;
PDSw0MapUD:CALL[WMapFix] {will return to PDSw0 },c2;
}
{——————————————————————————————————————————————————————
PDSB
——————————————————————————————————————————————————————}
{@PDSB, alpha}
{Timing:4 clicks, + 2 if fix map flags, + 2 if data on 2 pages}
{entry:exit:
TOS =| data1|| ptr|
STK =| ~|| data1|
-->| data0|| data0|
| ptr|| ptr|
| v| -->| v|}
{ UNUSED AT PRESENT
@PDSB:PC ← PC + PC16, pop ,c1, opcode[xxx];
T ← STK{ptr}, fXpop, fZpop, push,c2;
push, L0 ← L0.PDSBw0,c3;
Map ← Q ← [rhMDS,T + ib + 1], push,c1;
STK ← T ← TOS{data1}, pop, L1 ← L1w.DecOnly,c2;
Rx ← rhRx ← MD, XDirtyDisp,c3;
PDSBw0:MAR ← [rhRx,Q + 0], BRANCH[PDSBw0MapUD,$,1],c1, at[L0.PDSBw0,10,WMapFixCaller];
MDR ← T{data1}, L1 ← L1w.PushDec,c2;
T ← STK{data0}, pop, GOTO[WDw1],c3;
PDSBw0MapUD:CALL[WMapFix] {will return to PDSBw0 },c2;
}
{——————————————————————————————————————————————————————
WILP
——————————————————————————————————————————————————————}
{@WILP, alpha{pair}}
{Timing:4 clicks, + 2 if L remap, + 2 if fix map flags}
{entry:exit:
TOS =| data|| v|
STK =| ~|| data|
-->| v|| v|
| u| -->| u|}
@WILP:push, T ← Lbias, L0 ← L0.WritePopGo,c1, opcode[126’b];
STK ← TOS{data}, L1 ← L1w.PopDec,c2;
T ← alpha.left + T, L2 ← L2.WIxPTail,c3;
MAR ← Q ← [rhL,T + L],c1;
PC ← PC + PC16, BRANCH[$,LRemapA,1],c2;
TT ← MD, GOTO[WIxPTail],c3;
WIxPTail:TT ← TT + alpha.right,c1, at[L2.WIxPTail,10,LGRemapCaller];
Noop,c2;
Noop,c3;
Map ← Q ← [rhMDS, TT],c1;
Xbus ← ib,c2;
Rx ← rhRx ← MD, XDirtyDisp, GOTO[WritePopGo],c3;
WritePopGo:MAR ← [rhRx,Q + 0], BRANCH[WPMapUD,$,1],c1, at[L0.WritePopGo,10,WMapFixCaller];
MDR ← TOS{data}, PC ← PC + PC16, IBDisp, pop, GOTO[SLTail],c2;
WPMapUD:CALL[WMapFix] {will return to WritePopGo },c2;
LRemapA:TT ← UvL, CALL[LGRemap] {will return to WIxPTail},c3;
{——————————————————————————————————————————————————————
WILPL
——————————————————————————————————————————————————————}
{@WILPL, alpha{pair}}
{Timing:6 clicks, + 2 if L remap, + 2 if fix map flags}
{entry:exit:
TOS =| data|| v|
STK =| ~|| data|
-->| v|| v|
| u| -->| u|}
@WILPL:push, T ← Lbias, L0 ← L0.WritePopGo,c1, opcode[150’b];
STK ← TOS, L1 ← L1.PopDec, GOTO[ILPLcom],c2;
Rx ← rhRx ← MD, XDirtyDisp,c3, at[L0.WritePopGo,10,ILPthings];
MAR ← [rhRx,Q + 0], BRANCH[WPLMapUD,$,1],c1;
MDR ← TOS{data}, PC ← PC + PC16, IBDisp, pop, GOTO[SLTail],c2;
WPLMapUD:CALL[WLMapFix] {will return to WritePopGo },c2;
{——————————————————————————————————————————————————————
WIGPL
——————————————————————————————————————————————————————}
{@WIGPL, alpha{pair}}
{Timing:6 clicks, + 2 if L remap, + 2 if fix map flags}
{entry:exit:
TOS =| data|| v|
STK =| ~|| data|
-->| v|| v|
| u| -->| u|}
@WIGPL:push, T ← Gbias, L0 ← L0.WritePopGo,c1, opcode[152’b];
STK ← TOS, L1 ← L1.PopDec, GOTO[IGPLcom],c2;
{——————————————————————————————————————————————————————
WXLP
——————————————————————————————————————————————————————}
{@WXLP, alpha{pair}}
{Timing:5 clicks, + 2 if L remap, + 2 if fix map flags}
{entry:exit:
TOS =| inx|| v|
STK =| ~|| inx|
-->| data|| data|
| v|| v|
| u| -->| u|}
@WXLP:T ← Lbias, push, L0 ← L0.WriteGo,c1, opcode[123’b];
STK ← TOS, pop, L1 ← L1w.NoFixes,c2;
T ← T + alpha.left, L2 ← L2.rxlp, GOTO[XLPcom],c3;
T ← STK, pop, L1 ← L1w.PushDec,c2, at[L0.WriteGo,10,XLPthings];
Rx ← rhRx ← MD, XDirtyDisp, GOTO[WriteGox],c3;
{——————————————————————————————————————————————————————
WXLPL
——————————————————————————————————————————————————————}
{@WXLPL, alpha{pair}}
{Timing:6 clicks, + 2 if L remap, + 2 if fix map flags}
{entry:exit:
TOS =| inx|| v|
STK =| ~|| inx|
-->| data|| data|
| v|| v|
| u| -->| u|}
@WXLPL:T ← Lbias, push, L0 ← L0.RedoLW,c1, opcode[144’b];
STK ← TOS, PC ← PC - PC16, L1 ← L1w.NoFixes,c2; {XLPLcom increments PC}
T ← T + alpha.left, pop, GOTO[XLPLcom],c3;
T ← STK, pop, L1 ← L1w.PushOnly,c2, at[L0.RedoLW,10,XLPthings];
Rx ← rhRx ← MD, XDirtyDisp, GOTO[RedoLW],c3;
{——————————————————————————————————————————————————————
WXGPL
——————————————————————————————————————————————————————}
{@WXGPL, alpha{pair}}
{Timing:6 clicks, + 2 if L remap, + 2 if fix map flags}
{entry:exit:
TOS =| inx|| v|
STK =| ~|| inx|
-->| data|| data|
| v|| v|
| u| -->| u|}
@WXGPL:T ← Gbias, push, L0 ← L0.RedoLW,c1, opcode[146’b];
STK ← TOS, PC ← PC - PC16, L1 ← L1w.NoFixes,c2; {XLPLcom increments PC}
T ← T + alpha.left, pop, GOTO[XGPLcom],c3;
{ E N D }