;Alto->8086 small-c compiler rev 2.0 C←CODE SEGMENT $INCLUDE(8086LIB.D) $INCLUDE(larkmoneload.DEC) ASSUME CS:C←CODE, DS:C←DATA ; #include <Ec.h> ; struct Core { ; int advice, addrlo, addrhi, count; ; char data[1]; ; }; ; extern SingleStep(); ; extern GoNormal(); ; extern GoFromBreak(); ; extern int mState[1]; ; extern int advice; ; extern MoveBlock(); ; extern ByteBlt(); ; extern Swab(); ; extern DoubleEQ(); ; extern SLCReset(); ; extern SStartRx(); ; extern struct PBI *SCheckRx(); ; extern SStartTx(); ; extern int SCheckTx(); /* BOOL */ ; static int elBuf[130]; ; static struct PBI elPBI; ; static int tlID[2]; ; static int stateTimer; ; static int stateInterval; ; static int gotReply; ; extern int tlNet; ; extern int tlHost; ; extern int tlImHost; ; extern int localNet; ; StartEL() ←StartEL: PUSH BP MOV BP,SP ; { ; SLCReset(); CALL ←SLCReset ; elPBI.pup = (struct Pup *) &elBuf[2]; LEA BX,←elBuf+4 MOV WORD PTR ←elPBI+6,BX ; tlID[0] = tlID[1] = 0x6767; MOV ←tlID+2,06767X MOV ←tlID,06767X ; SStartRx(&elPBI, 256); MOV BX,0100X LEA CX,←elPBI CALL ←SStartRx ; }; MOV SP,BP POP BP RET; ; CheckEL() ←CheckEL: PUSH BP MOV BP,SP ; { ; if (SCheckRx() == 0) return; CALL ←SCheckRx OR BX,BX JNZ X1 MOV SP,BP POP BP RET; X1: ; ELoadProc(&elPBI); LEA BX,←elPBI CALL ←ELoadProc ; SStartRx(&elPBI, 256); MOV BX,0100X LEA CX,←elPBI CALL ←SStartRx ; }; MOV SP,BP POP BP RET; ; static ELoadProc(pbi) ←ELoadProc: ; struct PBI *pbi; PUSH BP MOV BP,SP PUSH BX ; { ; struct Pup *pup; ; char *caddr; ; char *cdata; ; int cAdvice; ; int ccount; ; int pupType; ; int maxLength; ; int dHost; ; struct Core *core; ADD SP,0FFEEX ; pup = pbi->pup; ; BX ← ←pbi MOV BX,[BP-2] MOV CX,[BX+6] ; ←pup ← CX MOV [BP-4],CX ; if (pup->dPort.socket.LS != 0) goto reject; ; BX ← ←pup MOV BX,[BP-4] MOV CX,[BX+10] OR CX,CX JZ X2 JMP ←reject X2: ; if (pup->dPort.socket.ms != 0x3000) goto reject; ; BX ← ←pup MOV BX,[BP-4] MOV CX,[BX+12] MOV BX,CX CMP BX,03000X JZ X3 JMP ←reject X3: ; dHost = pup->dPort.host; ; BX ← ←pup MOV BX,[BP-4] MOV AL,[BX+9] XOR AH,AH ; ←dHost ← AX MOV [BP-18],AX ; if ((dHost != EtherHost()) && (dHost != 0)) goto reject; CALL ←EtherHost ; CX ← ←dHost MOV CX,[BP-18] CMP CX,BX JZ X5 ; BX ← ←dHost MOV BX,[BP-18] OR BX,BX X5: JZ X4 JMP ←reject X4: ; if (!CheckCheckSum(pup)) goto reject; ; BX ← ←pup MOV BX,[BP-4] CALL ←CheckCheckSum OR BX,BX JNZ X6 JMP ←reject X6: ; core = (struct Core *) &pup->data; ; BX ← ←pup MOV BX,[BP-4] ADD BX,014X ; ←core ← BX POP DX PUSH BX ; if (core->addrhi) goto reject; ; BX ← ←core POP BX PUSH BX MOV CX,[BX+4] OR CX,CX JZ X7 JMP ←reject X7: ; ccount = Swab(core->count); ; BX ← ←core POP BX PUSH BX MOV CX,[BX+6] MOV BX,CX CALL ←Swab ; ←ccount ← BX MOV [BP-12],BX ; if (ccount < 0) goto reject; ; BX ← ←ccount MOV BX,[BP-12] CMP BX,0 JGE X8 JMP ←reject X8: ; maxLength = ((128 - pupOvWords) - 3) << 1; MOV WORD PTR [BP-16],0E4X ; if (ccount > maxLength) { ; BX ← ←maxLength MOV BX,[BP-16] ; CX ← ←ccount MOV CX,[BP-12] CMP CX,BX JLE X9 ; ccount = maxLength; ; BX ← ←maxLength MOV BX,[BP-16] ; ←ccount ← BX MOV [BP-12],BX ; core->count = Swab(maxLength); ; BX ← ←core POP BX PUSH BX PUSH BX ; BX ← ←maxLength MOV BX,[BP-16] CALL ←Swab MOV CX,BX POP BX MOV [BX+6],CX ; }; X9: ; caddr = Swab(core->addrlo); ; BX ← ←core POP BX PUSH BX MOV CX,[BX+2] MOV BX,CX CALL ←Swab ; ←caddr ← BX MOV [BP-6],BX ; cdata = &core->data[0]; ; BX ← ←core POP BX PUSH BX ADD BX,8 ; ←cdata ← BX MOV [BP-8],BX ; cAdvice = Swab(core->advice); ; DI ← ←core POP DI PUSH DI MOV BX,[DI] CALL ←Swab ; ←cAdvice ← BX MOV [BP-10],BX ; if (dHost == 0) cAdvice &= 0x3fff; ; BX ← ←dHost MOV BX,[BP-18] OR BX,BX JNZ X10 AND WORD PTR [BP-10],03FFFX X10: ; core->advice = Swab(advice); MOV BX,←advice CALL ←Swab MOV CX,BX ; BX ← ←core POP BX PUSH BX MOV [BX],CX ; pupType = pup->type; ; BX ← ←pup MOV BX,[BP-4] MOV AL,[BX+3] XOR AH,AH ; ←pupType ← AX MOV [BP-14],AX ; switch (pupType) { ; BX ← ←pupType MOV BX,[BP-14] JR X11 ; case ELStateWrite: X13: ; case ELSingleStep: X14: ; case ELGoFromBreak: X15: ; if (dHost == 0) goto reject; ; BX ← ←dHost MOV BX,[BP-18] OR BX,BX JNZ X16 JMP ←reject X16: ; if (((int) caddr != 1) || (ccount != 28)) goto reject; ; BX ← ←caddr MOV BX,[BP-6] CMP BX,1 JNZ X19 ; BX ← ←ccount MOV BX,[BP-12] CMP BX,01CX X19: X18: JZ X17 JMP ←reject X17: ; ByteBlt(mState, cdata, ccount); LEA BX,←mState PUSH BX ; BX ← ←ccount MOV BX,[BP-12] ; CX ← ←cdata MOV CX,[BP-8] CALL ←ByteBlt POP DX ; case ELStateRead: X20: ; if ((int) caddr != 1) goto reject; ; BX ← ←caddr MOV BX,[BP-6] CMP BX,1 JZ X21 JMP ←reject X21: ; ByteBlt(cdata, mState, ccount); ; BX ← ←cdata MOV BX,[BP-8] PUSH BX ; BX ← ←ccount MOV BX,[BP-12] LEA CX,←mState CALL ←ByteBlt POP DX ; pup->length = Swab((31 + ccount) & 0xfffe); ; BX ← ←ccount MOV BX,[BP-12] ADD BX,01FX AND BX,0FFFEX CALL ←Swab MOV CX,BX ; BX ← ←pup MOV BX,[BP-4] MOV [BX],CX ; pup->type = pup->type + 1; ; BX ← ←pup MOV BX,[BP-4] ; CX ← ←pup MOV CX,[BP-4] MOV DI,CX MOV AL,[DI+3] INC AL MOV [BX+3],AL ; ReplyTo(cAdvice, pbi); ; BX ← ←pbi MOV BX,[BP-2] ; CX ← ←cAdvice MOV CX,[BP-10] CALL ←ReplyTo ; if (pupType == ELStateWrite) GoNormal(); ; BX ← ←pupType MOV BX,[BP-14] JR $+5 X11: JMP X23 CMP BX,0C4X JNZ X22 CALL ←GoNormal X22: ; if (pupType == ELGoFromBreak) GoFromBreak(); ; BX ← ←pupType MOV BX,[BP-14] CMP BX,0CCX JNZ X24 CALL ←GoFromBreak X24: ; if (pupType == ELSingleStep) SingleStep(); ; BX ← ←pupType MOV BX,[BP-14] CMP BX,0CAX JNZ X25 CALL ←SingleStep X25: ; goto ok; JMP ←ok ; case ELWrite: X26: ; if (dHost == 0) goto reject; ; BX ← ←dHost MOV BX,[BP-18] OR BX,BX JNZ X27 JMP ←reject X27: ; ByteBlt(caddr, cdata, ccount); ; BX ← ←caddr MOV BX,[BP-6] PUSH BX ; BX ← ←ccount MOV BX,[BP-12] ; CX ← ←cdata MOV CX,[BP-8] CALL ←ByteBlt POP DX ; case ELRead: X28: ; if (Ugt(caddr, 0xffcf)) goto reject; MOV BX,0FFCFX ; CX ← ←caddr MOV CX,[BP-6] CALL ←Ugt OR BX,BX JZ X29 JMP ←reject X29: ; if (Ugt(ccount, 0xffd0 - ((int) caddr))) goto reject; ; BX ← ←caddr MOV BX,[BP-6] MOV CX,0FFD0X SUB CX,BX MOV BX,CX ; CX ← ←ccount MOV CX,[BP-12] CALL ←Ugt OR BX,BX JZ X30 JMP ←reject X30: ; ByteBlt(cdata, caddr, ccount); ; BX ← ←cdata MOV BX,[BP-8] PUSH BX ; BX ← ←ccount MOV BX,[BP-12] ; CX ← ←caddr MOV CX,[BP-6] CALL ←ByteBlt POP DX ; pup->length = Swab((31 + ccount) & 0xfffe); ; BX ← ←ccount MOV BX,[BP-12] ADD BX,01FX AND BX,0FFFEX CALL ←Swab MOV CX,BX ; BX ← ←pup MOV BX,[BP-4] MOV [BX],CX ; pup->type = pup->type + 1; ; BX ← ←pup MOV BX,[BP-4] ; CX ← ←pup MOV CX,[BP-4] MOV DI,CX MOV AL,[DI+3] INC AL MOV [BX+3],AL ; ReplyTo(cAdvice, pbi); ; BX ← ←pbi MOV BX,[BP-2] ; CX ← ←cAdvice MOV CX,[BP-10] CALL ←ReplyTo ; goto ok; JMP ←ok ; case ELDebug: { X31: ; if (dHost != 0) CallDebugger(0xfffa); ; BX ← ←dHost MOV BX,[BP-18] OR BX,BX JZ X32 MOV BX,0FFFAX CALL ←CallDebugger X32: ; goto reject; JMP ←reject ; }; ; case ELSWrite: X33: ; if (dHost == 0) goto reject; ; BX ← ←dHost MOV BX,[BP-18] OR BX,BX JNZ X34 JMP ←reject X34: ; SlaveBLT(caddr, cdata, ccount); /* how tell when it is done ? */ ; BX ← ←caddr MOV BX,[BP-6] PUSH BX ; BX ← ←ccount MOV BX,[BP-12] ; CX ← ←cdata MOV CX,[BP-8] CALL ←SlaveBLT POP DX ; case ELSRead: X35: ; SlaveBLT(cdata, caddr, ccount); ; BX ← ←cdata MOV BX,[BP-8] PUSH BX ; BX ← ←ccount MOV BX,[BP-12] ; CX ← ←caddr MOV CX,[BP-6] CALL ←SlaveBLT POP DX ; pup->length = Swab((31 + ccount) & 0xfffe); ; BX ← ←ccount MOV BX,[BP-12] ADD BX,01FX AND BX,0FFFEX CALL ←Swab MOV CX,BX ; BX ← ←pup MOV BX,[BP-4] MOV [BX],CX ; pup->type = pup->type + 1; ; BX ← ←pup MOV BX,[BP-4] ; CX ← ←pup MOV CX,[BP-4] MOV DI,CX MOV AL,[DI+3] INC AL MOV [BX+3],AL ; ReplyTo(cAdvice, pbi); ; BX ← ←pbi MOV BX,[BP-2] ; CX ← ←cAdvice MOV CX,[BP-10] CALL ←ReplyTo ; goto ok; JMP ←ok ; case ELCall: X36: ; CallPkt(cdata); ; BX ← ←cdata MOV BX,[BP-8] CALL ←CallPkt ; pup->type = pup->type + 1; ; BX ← ←pup MOV BX,[BP-4] ; CX ← ←pup MOV CX,[BP-4] MOV DI,CX MOV AL,[DI+3] INC AL MOV [BX+3],AL ; ReplyTo(cAdvice, pbi); ; BX ← ←pbi MOV BX,[BP-2] ; CX ← ←cAdvice MOV CX,[BP-10] CALL ←ReplyTo ; goto ok; JMP ←ok ; default: goto reject; X37: JMP ←reject ; }; JR X12 X23: MOV AL,BH OR AL,AL JNZ X37 MOV AL,BL CMP AL,0C4X JMPZ X13 CMP AL,0CAX JMPZ X14 CMP AL,0CCX JMPZ X15 CMP AL,0C6X JMPZ X20 CMP AL,0C0X JMPZ X26 CMP AL,0C2X JMPZ X28 CMP AL,0C8X JMPZ X31 CMP AL,0CEX JMPZ X33 CMP AL,0D0X JMPZ X35 CMP AL,0D2X JZ X36 JR X37 X12: ←ok: ; ok: ; gotReply = true; MOV ←gotReply,0FFFFX ←reject: ; reject: ; }; MOV SP,BP POP BP RET; ; static ReplyTo(cAdvice, pbi) ←ReplyTo: ; int cAdvice; ; struct PBI *pbi; PUSH BP MOV BP,SP PUSH CX PUSH BX ; { ; struct Pup *pup; ; struct EtherEncapsulation *ee; ; int temp; ; if (cAdvice & 0x4000) advice = cAdvice & 0x3fff; ADD SP,0FFFAX ; BX ← ←cAdvice MOV BX,[BP-2] AND BX,04000X OR BX,BX JZ X38 ; BX ← ←cAdvice MOV BX,[BP-2] AND BX,03FFFX MOV ←advice,BX X38: ; pup = pbi->pup; ; BX ← ←pbi MOV BX,[BP-4] MOV CX,[BX+6] ; ←pup ← CX MOV [BP-6],CX ; temp = (int) pup; ; BX ← ←pup MOV BX,[BP-6] ; ←temp ← BX POP DX PUSH BX ; temp -= 4; SUB WORD PTR [BP-10],4 ; ee = (struct EtherEncapsulation *) temp; ; BX ← ←temp POP BX PUSH BX ; ←ee ← BX MOV [BP-8],BX ; MoveBlock(tlID, &pup->id[0], 2); LEA BX,←tlID PUSH BX ; BX ← ←pup MOV BX,[BP-6] ADD BX,4 PUSH BX MOV BX,2 POP CX CALL ←MoveBlock POP DX ; if (cAdvice & 0x8000) { ; BX ← ←cAdvice MOV BX,[BP-2] AND BX,08000X OR BX,BX JZ X39 ; tlNet = pup->sPort.net; ; BX ← ←pup MOV BX,[BP-6] MOV AL,[BX+14] XOR AH,AH MOV ←tlNet,AX ; tlHost = pup->sPort.host; ; BX ← ←pup MOV BX,[BP-6] MOV AL,[BX+15] XOR AH,AH MOV ←tlHost,AX ; tlImHost = ee->src; ; BX ← ←ee MOV BX,[BP-8] MOV AL,[BX+1] XOR AH,AH MOV ←tlImHost,AX ; }; X39: ; if (pup->dPort.net != 0) localNet = pup->dPort.net; ; BX ← ←pup MOV BX,[BP-6] MOV AL,[BX+8] OR AL,AL JZ X40 ; BX ← ←pup MOV BX,[BP-6] MOV AL,[BX+8] XOR AH,AH MOV ←localNet,AX X40: ; ee->dst = ee->src; ; BX ← ←ee MOV BX,[BP-8] MOV AL,[BX+1] ; BX ← ←ee MOV BX,[BP-8] MOV [BX],AL ; ee->src = EtherHost(); ; BX ← ←ee MOV BX,[BP-8] PUSH BX CALL ←EtherHost MOV AL,BL POP BX MOV [BX+1],AL ; ee->type = 2; ; BX ← ←ee MOV BX,[BP-8] MOV WORD PTR [BX+2],2 ; SwapSourceAndDest(pup); ; BX ← ←pup MOV BX,[BP-6] CALL ←SwapSourceAndDest ; pup->transport = 0; ; BX ← ←pup MOV BX,[BP-6] MOV BYTE PTR [BX+2],0 ; ReallySetCheckSum(pup); ; BX ← ←pup MOV BX,[BP-6] CALL ←ReallySetCheckSum ; SStartTx(pbi); ; BX ← ←pbi MOV BX,[BP-4] CALL ←SStartTx ; while (!SCheckTx(pbi)) CheckWDT(); X41: ; BX ← ←pbi MOV BX,[BP-4] CALL ←SCheckTx OR BX,BX JNZ X42 CALL ←CheckWDT JR X41 X42: ; }; MOV SP,BP POP BP RET; ; SetCheckSum(pup) ←SetCheckSum: ; int *pup; PUSH BP MOV BP,SP PUSH BX ; { ; pup[((Swab(*pup) +1) >> 1) - 1] = -1; ; DI ← ←pup POP DI PUSH DI MOV BX,[DI] CALL ←Swab INC BX SHR BX DEC BX ; CX ← ←pup POP CX PUSH CX SAL BX ADD BX,CX MOV WORD PTR [BX],0FFFFX ; }; MOV SP,BP POP BP RET; ; CheckCheckSum(pup) ←CheckCheckSum: ; int *pup; PUSH BP MOV BP,SP PUSH BX ; { ; int ck; PUSH DX ; ck = pup[((Swab(*pup) +1) >> 1) - 1]; ; DI ← ←pup MOV DI,[BP-2] MOV BX,[DI] CALL ←Swab INC BX SHR BX DEC BX ; CX ← ←pup MOV CX,[BP-2] SAL BX ADD BX,CX MOV CX,[BX] ; ←ck ← CX POP DX PUSH CX ; if ((ck == -1) || (ck == CheckSum(pup))) return(true); ; BX ← ←ck POP BX PUSH BX CMP BX,0FFFFX JZ X45 ; BX ← ←pup MOV BX,[BP-2] CALL ←CheckSum ; CX ← ←ck POP CX PUSH CX CMP CX,BX X45: X44: JNZ X43 MOV BX,0FFFFX MOV SP,BP POP BP RET; X43: ; return(false); XOR BX,BX MOV SP,BP POP BP RET; ; }; ; ReallySetCheckSum(pup) ←ReallySetCheckSum: ; int *pup; PUSH BP MOV BP,SP PUSH BX ; { ; pup[((Swab(*pup) +1) >> 1) - 1] = CheckSum(pup); ; DI ← ←pup POP DI PUSH DI MOV BX,[DI] CALL ←Swab INC BX SHR BX DEC BX ; CX ← ←pup POP CX PUSH CX SAL BX ADD BX,CX PUSH BX ; BX ← ←pup MOV BX,[BP-2] CALL ←CheckSum MOV CX,BX POP BX MOV [BX],CX ; }; MOV SP,BP POP BP RET; ; SwapSourceAndDest(pup) ←SwapSourceAndDest: ; struct Pup *pup; PUSH BP MOV BP,SP PUSH BX ; { ; int temp[3]; ADD SP,0FFFAX ; MoveBlock(temp, &pup->dPort, 3); ;&←temp LEA BX,[BP-8] PUSH BX ; BX ← ←pup MOV BX,[BP-2] ADD BX,8 PUSH BX MOV BX,3 POP CX CALL ←MoveBlock POP DX ; MoveBlock(&pup->dPort, &pup->sPort, 3); ; BX ← ←pup MOV BX,[BP-2] ADD BX,8 PUSH BX ; BX ← ←pup MOV BX,[BP-2] ADD BX,0EX PUSH BX MOV BX,3 POP CX CALL ←MoveBlock POP DX ; MoveBlock(&pup->sPort, temp, 3); ; BX ← ←pup MOV BX,[BP-2] ADD BX,0EX PUSH BX MOV BX,3 ;&←temp LEA CX,[BP-8] CALL ←MoveBlock POP DX ; }; MOV SP,BP POP BP RET; ; FirstSendState() ←FirstSendState: PUSH BP MOV BP,SP ; { ; gotReply = false; MOV ←gotReply,0 ; stateInterval = 1000; MOV ←stateInterval,03E8X ; SendState(); CALL ←SendState ; }; MOV SP,BP POP BP RET; ; CheckState() ←CheckState: PUSH BP MOV BP,SP ; { ; if (gotReply) return; MOV BX,←gotReply OR BX,BX JZ X46 MOV SP,BP POP BP RET; X46: ; if (TmrExp(&stateTimer)) { LEA BX,←stateTimer CALL ←TmrExp OR BX,BX JZ X47 ; if (stateInterval < 0) stateInterval = 1000; MOV BX,←stateInterval CMP BX,0 JGE X48 MOV ←stateInterval,03E8X X48: ; if (stateInterval >= 5000) { MOV BX,←stateInterval CMP BX,01388X JL X49 ; tlNet = 0; MOV ←tlNet,0 ; tlHost = 0; MOV ←tlHost,0 ; localNet = 0; MOV ←localNet,0 ; tlImHost = 0; MOV ←tlImHost,0 ; }; X49: ; if (stateInterval < 30000) stateInterval += 1000; MOV BX,←stateInterval CMP BX,07530X JGE X50 ADD ←stateInterval,03E8X X50: ; SendState(); CALL ←SendState ; StartEL(); CALL ←StartEL ; }; X47: ; }; MOV SP,BP POP BP RET; ; static SendState() ←SendState: PUSH BP MOV BP,SP ; { ; struct Pup *pup; ; struct EtherEncapsulation *ee; ; int temp; ; struct Core *core; ADD SP,0FFF8X ; SLCReset(); CALL ←SLCReset ; elPBI.pup = (struct Pup *) &elBuf[2]; LEA BX,←elBuf+4 MOV WORD PTR ←elPBI+6,BX ; pup = elPBI.pup; MOV BX,WORD PTR ←elPBI+6 ; ←pup ← BX MOV [BP-2],BX ; temp = (int) pup; ; BX ← ←pup MOV BX,[BP-2] ; ←temp ← BX MOV [BP-6],BX ; temp -= 4; SUB WORD PTR [BP-6],4 ; ee = (struct EtherEncapsulation *) temp; ; BX ← ←temp MOV BX,[BP-6] ; ←ee ← BX MOV [BP-4],BX ; ee->src = tlImHost; ; BX ← ←ee MOV BX,[BP-4] MOV AX,←tlImHost MOV [BX+1],AL ; pup->sPort.net = tlNet; ; BX ← ←pup MOV BX,[BP-2] MOV AX,←tlNet MOV [BX+14],AL ; pup->sPort.host = tlHost; ; BX ← ←pup MOV BX,[BP-2] MOV AX,←tlHost MOV [BX+15],AL ; pup->dPort.net = localNet; ; BX ← ←pup MOV BX,[BP-2] MOV AX,←localNet MOV [BX+8],AL ; pup->dPort.host = EtherHost(); ; BX ← ←pup MOV BX,[BP-2] PUSH BX CALL ←EtherHost MOV AL,BL POP BX MOV [BX+9],AL ; pup->sPort.socket.LS = pup->dPort.socket.LS = 0; ; BX ← ←pup MOV BX,[BP-2] ; CX ← ←pup MOV CX,[BP-2] XCHG BX,CX MOV WORD PTR [BX+10],0 MOV BX,CX MOV WORD PTR [BX+16],0 ; pup->sPort.socket.ms = pup->dPort.socket.ms = 0x3000; ; BX ← ←pup MOV BX,[BP-2] ; CX ← ←pup MOV CX,[BP-2] XCHG BX,CX MOV WORD PTR [BX+12],03000X MOV BX,CX MOV WORD PTR [BX+18],03000X ; pup->type = ELBooted; ; BX ← ←pup MOV BX,[BP-2] MOV BYTE PTR [BX+3],0C9X ; DoubleIncrement(tlID, 1); MOV BX,1 LEA CX,←tlID CALL ←DoubleIncrement ; MoveBlock(&pup->id[0], tlID, 2); ; BX ← ←pup MOV BX,[BP-2] ADD BX,4 PUSH BX MOV BX,2 LEA CX,←tlID CALL ←MoveBlock POP DX ; core = (struct Core *) &pup->data; ; BX ← ←pup MOV BX,[BP-2] ADD BX,014X ; ←core ← BX POP DX PUSH BX ; core->count = Swab(38); ; BX ← ←core POP BX PUSH BX PUSH BX MOV BX,026X CALL ←Swab MOV CX,BX POP BX MOV [BX+6],CX ; core->addrhi = 0; ; BX ← ←core POP BX PUSH BX MOV WORD PTR [BX+4],0 ; core->addrlo = Swab(1); ; BX ← ←core POP BX PUSH BX PUSH BX MOV BX,1 CALL ←Swab MOV CX,BX POP BX MOV [BX+2],CX ; ByteBlt(&core->data[0], mState, 48); ; BX ← ←core POP BX PUSH BX ADD BX,8 PUSH BX MOV BX,030X LEA CX,←mState CALL ←ByteBlt POP DX ; pup->length = Swab((31 + 48) & 0xfffe); MOV BX,04EX CALL ←Swab MOV CX,BX ; BX ← ←pup MOV BX,[BP-2] MOV [BX],CX ; ReplyTo(false, &elPBI); LEA BX,←elPBI XOR CX,CX CALL ←ReplyTo ; SetTmr(stateInterval, &stateTimer); LEA BX,←stateTimer MOV CX,←stateInterval CALL ←SetTmr ; }; MOV SP,BP POP BP RET; ; int *GetELBuf() ←GetELBuf: PUSH BP MOV BP,SP ; { ; return(elBuf); LEA BX,←elBuf MOV SP,BP POP BP RET; ; }; ; int *GetDebugPtrs() ←GetDebugPtrs: PUSH BP MOV BP,SP ; { ; return(&tlNet); LEA BX,←tlNet MOV SP,BP POP BP RET; ; }; ; SlaveBLT(dest, src, count) ←SlaveBLT: ; int dest, src, count; PUSH BP MOV BP,SP PUSH CX PUSH BX ; { ; StoreW(src, BltFrom); MOV BX,0D9EAX ; CX ← ←src MOV CX,[BP-2] CALL ←StoreW ; StoreW(dest, BltTo); MOV BX,0D9ECX ; CX ← ←dest MOV CX,[BP+4] CALL ←StoreW ; StoreW(count >> 1, BltCount); ; BX ← ←count POP BX PUSH BX SHR BX PUSH BX MOV BX,0D9E8X POP CX CALL ←StoreW ; StartSlave(4, 0); XOR BX,BX MOV CX,4 CALL ←StartSlave ; SetTmr(count, &dest); ;&←dest LEA BX,[BP+4] ; CX ← ←count POP CX PUSH CX CALL ←SetTmr ; while (!TmrExp(&dest)) CheckWDT(); X51: ;&←dest LEA BX,[BP+4] CALL ←TmrExp OR BX,BX JNZ X52 CALL ←CheckWDT JR X51 X52: ; }; MOV SP,BP POP BP RET; ; struct CPArgs { ; int proc; ; int nargs; ; int returnSlot; ; int args[5]; ; }; ; extern int stackLimit; ; extern int monEnd; ; CallPkt(cp) ←CallPkt: ; struct CPArgs *cp; PUSH BP MOV BP,SP PUSH BX ; { ; int stklimit; PUSH DX ; BlockSwab(cp, 8); MOV BX,8 ; CX ← ←cp MOV CX,[BP-2] CALL ←BlockSwab ; if (cp->nargs > 5) return; ; BX ← ←cp MOV BX,[BP-2] MOV CX,[BX+2] MOV BX,CX CMP BX,5 JLE X53 MOV SP,BP POP BP RET; X53: ; stklimit = stackLimit; MOV BX,←stackLimit ; ←stklimit ← BX POP DX PUSH BX ; stackLimit = (int) &monEnd; LEA BX,←monEnd MOV ←stackLimit,BX ; stackLimit += 20; ADD ←stackLimit,014X ; cp->returnSlot = Apply(&cp->args[0], cp->proc, cp->nargs); ; BX ← ←cp MOV BX,[BP-2] PUSH BX ; BX ← ←cp MOV BX,[BP-2] ADD BX,6 PUSH BX ; DI ← ←cp MOV DI,[BP-2] MOV BX,[DI] ; CX ← ←cp MOV CX,[BP-2] MOV DI,CX MOV CX,[DI+2] XCHG BX,CX CALL ←Apply POP DX MOV CX,BX POP BX MOV [BX+4],CX ; BlockSwab(cp, 8); MOV BX,8 ; CX ← ←cp MOV CX,[BP-2] CALL ←BlockSwab ; stackLimit = stklimit; ; BX ← ←stklimit POP BX PUSH BX MOV ←stackLimit,BX ; }; MOV SP,BP POP BP RET; ; BlockSwab(ptr, count) ←BlockSwab: ; int *ptr, count; PUSH BP MOV BP,SP PUSH CX PUSH BX ; { ; int i; ; for (i = 0; i < count; i += 1) ptr[i] = Swab(ptr[i]); PUSH DX MOV WORD PTR [BP-6],0 X56: ; BX ← ←count MOV BX,[BP-4] ; CX ← ←i POP CX PUSH CX CMP CX,BX JGE X55 JR X54 X57: INC WORD PTR [BP-6] JR X56 X54: ; BX ← ←i POP BX PUSH BX ; CX ← ←ptr MOV CX,[BP-2] SAL BX ADD BX,CX PUSH BX ; BX ← ←i MOV BX,[BP-6] ; CX ← ←ptr MOV CX,[BP-2] SAL BX ADD BX,CX MOV CX,[BX] MOV BX,CX CALL ←Swab MOV CX,BX POP BX MOV [BX],CX JR X57 X55: ; }; MOV SP,BP POP BP RET; ; Externals Declared Here PUBLIC ←StartEL PUBLIC ←CheckEL PUBLIC ←CheckCheckSum PUBLIC ←SlaveBLT PUBLIC ←CallPkt PUBLIC ←SwapSourceAndDest PUBLIC ←ReallySetCheckSum PUBLIC ←SetCheckSum PUBLIC ←FirstSendState PUBLIC ←CheckState PUBLIC ←GetELBuf PUBLIC ←GetDebugPtrs PUBLIC ←BlockSwab C←CODE ENDS ; Number of Bytes of Code = 074CX, (1868)