GennadyIS
Advanced Member | Редактировать | Профиль | Сообщение | Цитировать | Сообщить модератору /* REXX */ cls call ZocTimeout 3 call GET_LEVEL abst=_IN("?",0.6) i=pos("-",abst,1)+1 j=pos(" ",abst,i) DFB=substr(abst,i,j-i) CMD="B" ; DR="C:\_DUMPS" ; LOC="" MEM: ADDR=GET("CMD="||CMD||" ADDRESS?","0980",len_ADDR) if x2d(ADDR) >= x2d(DFB) then do say say ADDR "not in the INTERVAL 000000-"||DFB||" RETRY" signal MEM end DUMPLEN=d2x(x2d(DFB)-x2d(ADDR)) /* ADDR=GET("CMD="||CMD||" ADDRESS?",d2x(0,len_ADDR),len_ADDR) DUMPLEN=GET("CMD="||CMD||" ADDRESS="||ADDR||" LENGTH?","000E22",len_ADDR) if x2d(DUMPLEN)=0 then DUMPLEN=d2x(1,len_ADDR) FILE=F_CREATE(DR,CMD||"."||ADDR||"."||DUMPLEN||".BIN") ; t1=time(S) */ NXTADDR=GET_DATA("B",ADDR,DUMPLEN) call DONE "PWD NOT FOUND" ZSEND: parse arg R4,R5 if R5="" then do if len_ADDR=8 then call ZocSend R4 else do do m=1 to length(R4) TMP=substr(R4,m,1) call ZocSend TMP call ZocWait TMP end end call ZocSend "^M" call ZocWait LEVEL end else do call ZocSend R4 call ZocDelay R5 end RETURN _IN: parse arg R1,R2,R3 if arg(3)="" then R3=4096 call ZocReceiveBuf R3 call ZSend R1,R2 RETURN ZocReceiveBuf(0) GET_LEVEL: i=0 ; j=0 BEGIN: if i=0 then do j=j+1 if j=3 then do ERROR: say "COMMUNICATION PROBLEM.SCRIPT STOP" exit end abst=_IN("^Z",0.4) i=pos(">",abst,1) call ZocDelay 0.4 signal BEGIN end LEVEL=substr(abst,i-1,2) len_ADDR=6 if pos("F3",abst,1)\=0 then len_ADDR=8 call SET_LEVEL "T>" nASCII="" do j=0 to 127 if \datatype(d2c(j),x)=1 then do nASCII=nASCII||d2c(j) end end ZocSuppressOutput 1 RETURN SET_LEVEL: if LEVEL\=arg(1) & LEVEL\="F>" then do LEVEL=arg(1) TMP="/"||left(LEVEL,1) if LEVEL="T>" then TMP="/" call ZSend TMP end RETURN GET_DATA: parse arg _CMD,_ADDR,_COUNT,C_SECTOR,_DMP G1="1>" ; _WAIT=0 ; LEN_RESULT=1 if _CMD="B" then do G1="2>" _ADDR=d2x(x2d(_ADDR)*512,len_ADDR) end call SET_LEVEL G1 if _CMD="D"|_CMD="B" then LEN_RESULT=512 if _CMD="-"|_CMD="m" then do LEN_RESULT=2 G1=x2d(_ADDR)//2 _ADDR=d2x(x2d(_ADDR)-G1,len_ADDR) end do x2d(_COUNT) _ADDR=right(_ADDR,len_ADDR,"0") ADRLO=right(_ADDR,4) ADRHI=left(_ADDR,len_ADDR-4) NBUFF=d2x(x2d(_ADDR)%512,4) _MSG="ADDR: "||_ADDR _TASK=_CMD||ADRHI||","||ADRLO if _CMD="e2" then do _MSG="ADDR:"||ADRLO _TASK=_CMD||","||ADRLO end if _CMD="B" then do _MSG="BUFF: "||NBUFF _TASK=_CMD||NBUFF||","||NBUFF end if C_SECTOR\="" then do _MSG=D_MSG||C_SECTOR C_SECTOR=d2x(x2d(C_SECTOR)+1,03) end call RECEIVE _ADDR=d2x(x2d(_ADDR)+LEN_RESULT,len_ADDR) end RETURN _ADDR RECEIVE: RTR=0 PATTERN=LEVEL N_STR=16 if len_ADDR=8 then do PATTERN="F3 "||LEVEL N_STR=32 end if _CMD="S"|_CMD="U"|_CMD="m" then do _WAIT=1 LEVEL="-->" PATTERN="-->" end RETRY: call ZocNotify _MSG abst=_IN(_TASK) if _WAIT=1 then do LEVEL="1>" call ZocSend "^M" end if LEN_RESULT=512 then do abst=translate(abst," ",nASCII) PATTERN=_ADDR end i=pos(PATTERN,abst,1) if i=0 then do RTR=RTR+1 if RTR<3 then do say "RETRY "||MSG signal RETRY end say TASK||"ERROR" signal ERROR end if LEN_RESULT<512 then do abst=delstr(abst,i,) abst=translate(abst," ",nASCII) abst=space(abst,0) abst=x2c(right(abst,2*LEN_RESULT)) abst=reverse(abst) end else do abst=delstr(abst,1,i-1) abst=space(abst,0) i=1 j=(32/N_STR)*(x2d(10))*2 do N_STR abst=delstr(abst,i,len_ADDR) i=i+j end abst=delstr(abst,i,) i=pos("EDFE0D90",abst,1) if i\=0 then do TMP=substr(abst,i+100,64) abst=x2c(TMP) TMP=d2x(x2d(_ADDR)/512,len_ADDR-4) FILE=F_CREATE(DR,"_"||TMP||".BIN") ; t1=time(S) call charout FILE,abst call DONE end end if _DMP="" then call charout FILE,abst RETURN F_CREATE: parse arg D1,F1 if stream(D1,"C","QUERY EXISTS")="" then do call ZocShell MD D1,1 end F1=D1||"\"||F1 if stream(F1,"C","QUERY EXISTS")\="" then do call ZocShell DEL F1,1 end call stream F1,"C","OPEN WRITE" RETURN F1 GET: parse arg MSG,DEFAULT,TYPE L0: TMP=word(ZocAsk(MSG,DEFAULT),1) if TMP="" | TMP="##CANCEL##" then call CHK_NO(L0) if TYPE="" then RETURN TMP if datatype(TMP,X)=0 then do say "PARAM ["||TMP||"] not HEX.RETRY" signal L0 end RETURN right(TMP,TYPE,"0") CHK_NO: parse arg V1,V2 V2=LOC answer= ZocMsgBox(V2||" CONTINUE ?",2) if answer=##YES## then signal value V1 /* if V1\=EXITDOOR then signal value EXITDOOR */ say "BYE!" exit DONE: if arg(1)="" then do call stream FILE,"C","CLOSE" R1=FILE||" done in "||time(S)-t1||" sec." end else R1="PWD NOT FOUND" say say R1 exi |