
 MC68020
Optimize68020 EQU 1

SegmentBeginn0:
  suba.w #$134,A7
  movem.l D2-D7/A2-A6,-(A7)
  movea.l $4.W,A5
  moveq.l #$14,D0
  move.l D0,$15C(A7)
  move.l A5,$2C(A7)
  lea dosname(PC),A1
  moveq.l #$25,D0
  movea.l A5,A6
OpenLibrary SET -$228
   jsr OpenLibrary(A6)
  movea.l D0,A4
  tst.l D0
   beq.w JL_0_1FE
  moveq.l #$00,D0
  lea $138(A7),A0
  moveq.l #4,D1
JL_0_32:
  move.l D0,(A0)+
   dbf D1,JL_0_32
  lea L_0_228(PC),A0
  move.l A0,D1
  lea $138(A7),A0
  move.l A0,D2
  moveq.l #$00,D3
  movea.l A4,A6
ReadArgs SET -$31E
   jsr ReadArgs(A6)
  move.l D0,$34(A7)
   bne.b JL_0_62
IoErr SET -$84
   jsr IoErr(A6)
  move.l D0,D1
  moveq.l #$00,D2
PrintFault SET -$1DA
   jsr PrintFault(A6)
 bra.w exit
 
JL_0_62:
  move.l $13C(A7),D1
   beq.b JL_0_72
  move.l D1,$144(A7)
  move.l D1,$140(A7)
 bra.b JL_0_7E
 
JL_0_72:
  tst.l $140(A7)
   bne.b JL_0_7E
  moveq.l #$01,D1
  move.l D1,$144(A7)
JL_0_7E:
  move.l $138(A7),D1
   beq.b JL_0_94
  movea.l D1,A0
  move.l (A0),D7
  move.l D7,D6
  move.l D7,$138(A7)
  lea L_0_274(PC),A3
 bra.b JL_0_9E
 
JL_0_94:
  moveq.l #$01,D6
MaxCli SET -$228
   jsr MaxCli(A6)
  move.l D0,D7
  suba.l A3,A3
JL_0_9E:
  move.l D7,$30(A7)
  tst.l $148(A7)
   beq.w JL_0_1D0
  moveq.l #$05,D1
  move.l D1,$15C(A7)
 bra.w JL_0_1D0
 
JL_0_B4:
  movea.l A5,A6
Forbid SET -$84
   jsr Forbid(A6)
  move.l D6,D1
  movea.l A4,A6
FindCliProc SET -$222
   jsr FindCliProc(A6)
  movea.l D0,A2
  tst.l D0
   beq.b JL_0_122
pr_CLI SET $AC
  move.l pr_CLI(A2),D0
  asl.l #2,D0
  movea.l D0,A5
   beq.b JL_0_120
  clr.b $38(A7)
cli_Module SET $3C
  tst.l cli_Module(A5)
   beq.b JL_0_10A
cli_CommandName SET $10
  tst.l cli_CommandName(A5)
   beq.b JL_0_10A
cli_CommandName SET $10
  move.l cli_CommandName(A5),D0
  asl.l #2,D0
  movea.l D0,A3
  move.b (A3)+,D0
  lea (a3),a0
  extb.l D0
  lea $38(A7),A1
  movea.l $2C(A7),A6   ;execbase
   jsr -$270(A6)       ;CopyMem(source,dest,size)(a0/a1,d0)
  move.b -(A3),D0
  ext.w D0
  clr.b $38(A7,D0.W)
cli_DefaultStack SET $34
JL_0_10A:
  move.l cli_DefaultStack(A5),D7
  asl.l #2,D7
pr_GlobVec SET $88
  movea.l pr_GlobVec(A2),A0
  move.l (A0),D5
ln_Pri SET $9
  move.b ln_Pri(A2),D4
  extb.l D4
   bra.b JL_0_122

JL_0_120:
  suba.l A2,A2
JL_0_122:
  movea.l $2C(A7),A5
  movea.l A5,A6
   jsr -$8A(A6)
  move.l A2,D0
   beq.w JL_0_1B2
  move.l D6,$14C(A7)
  move.l $148(A7),D0
   beq.b JL_0_15A
  movea.l D0,A0
  lea $38(A7),A1
   bsr.w JL_0_2FC
  tst.l D0
   bne.b JL_0_1B0
  lea L_0_290(PC),A0
  move.l A0,D1
  lea $14C(A7),A0
  move.l A0,D2
  movea.l A4,A6
 bra.b JL_0_1A8
 
JL_0_15A:
  lea L_0_296(PC),A0
  move.l A0,D1
  lea $14C(A7),A0
  move.l A0,D2
  movea.l A4,A6
VPrintf SET -$3BA
   jsr VPrintf(A6)
  tst.l $140(A7)
   beq.b JL_0_186
  lea $14C(A7),A3
  move.l D7,(A3)+
  move.l D5,(A3)+
  move.l D4,(A3)+
  lea L_0_2A6(PC),A0
  move.l A0,D1
VPrintf SET -$3BA
   jsr VPrintf(A6)
JL_0_186:
  lea L_0_2C4(PC),A2
  tst.l $144(A7)
   beq.b JL_0_19E
  lea L_0_2C6(PC),A2
  tst.b $38(A7)
   beq.b JL_0_19E
  lea L_0_2DA(PC),A2
JL_0_19E:
  lea $38(A7),A0
  move.l A0,$14C(A7)
  move.l A2,D1
VPrintf SET -$3BA
JL_0_1A8:
   jsr VPrintf(A6)
  clr.l $15C(A7)
JL_0_1B0:
  suba.l A3,A3
JL_0_1B2:
  moveq.l #$40,D1
  lsl.l #6,D1
  movea.l A4,A6
CheckSignal SET -$318
   jsr CheckSignal(A6)
  tst.l D0
   beq.b JL_0_1CE
  moveq.l #$4C,D1
  lsl.l #2,D1
  moveq.l #$00,D2
PrintFault SET -$1DA
   jsr PrintFault(A6)
  suba.l A3,A3
 bra.b JL_0_1D8
 
JL_0_1CE:
  addq.l #1,D6
JL_0_1D0:
  cmp.l $30(A7),D6
   ble.w JL_0_B4
JL_0_1D8:
  move.l A3,D0
   beq.b JL_0_1EA
  move.l A3,D1
  lea $138(A7),A0
  move.l A0,D2
  movea.l A4,A6
VPrintf SET -$3BA
   jsr VPrintf(A6)
JL_0_1EA:
  move.l $34(A7),D1
  movea.l A4,A6
FreeArgs SET -$35A
   jsr FreeArgs(A6)
exit:
  movea.l A4,A1
  movea.l A5,A6
   jsr -$19E(A6)
 bra.b JL_0_20E
 
JL_0_1FE:
  suba.l A1,A1
  movea.l A5,A6
   jsr -$126(A6)
  moveq.l #$7A,D1
  movea.l D0,A0
  move.l D1,$94(A0)
JL_0_20E:
  move.l $15C(A7),D0
  movem.l (A7)+,D2-D7/A2-A6
  adda.w #$134,A7
 rtS 
 
dosname:
  dc.b "dos.library",0
L_0_228:
  dc.b "PROCESS/N,FULL/S,TCB/S,CLI=ALL/S,COM=COMMAND/K",0
  dc.b "$VER: status 44.1 (7.1.2000)",0
L_0_274:
  dc.b "Process %ld does not exist",10,0
L_0_290:
  dc.b "%2ld",10,0
L_0_296:
  dc.b "Process %2ld: ",0,0
L_0_2A6:
  dc.b "stk %5ld, gv %3ld, pri %3ld ",0,0
L_0_2C4:
  dc.b 10,0
L_0_2C6:
  dc.b "No command loaded",10,0,0
L_0_2DA:
  dc.b "Loaded as command: %s",10,0,0

JL_0_2FC:
  moveq.l #$00,D0
  moveq.l #$00,D1
JL_0_300:
  move.b (A0)+,D0
  move.b (A1)+,D1
  cmpi.b #$61,D0
   blt.b JL_0_314
  cmpi.b #$7A,D0
   bgt.b JL_0_314
  subi.b #$20,D0
JL_0_314:
  cmpi.b #$61,D1
   blt.b JL_0_324
  cmpi.b #$7A,D1
   bgt.b JL_0_324
  subi.b #$20,D1
JL_0_324:
  sub.l D1,D0
   bne.b JL_0_32C
  tst.b D1
   bne.b JL_0_300
JL_0_32C:
 rtS 

