;Alto->8086 small-c compiler rev 2.0 C←CODE SEGMENT $INCLUDE(8086LIB.D) $INCLUDE(rpcagent.DEC) ASSUME CS:C←CODE, DS:C←DATA ; #include <Env.h> ; extern struct ZN *myZone; ; extern int CallFailed; ; extern int ImportFailed; ; extern AddType(); ; extern int CallFormatted(); ; extern CONT(); ; extern dBlock(); ; extern ENABLE(); ; extern struct ImportInstance *ImportInterface(); ; extern struct ShortSTRING *CStringToString(); ; static struct ImportInstance *agentInstance; ; static int args[10]; ; static struct ShortSTRING *specABN, *specAA, *specW; ; static int zip[2]; ; int /* really Authentication */ ; AgentAuthenticate(nonceId, caller, callee, lvAuthenticator) ←AgentAuthenticate: ; int nonceId, caller, callee, *lvAuthenticator; CALL StkChk PUSH BP MOV BP,SP PUSH CX PUSH BX ; { ; struct Seal sl; ; int authentication; ; if (ENABLE(CallFailed, &CONT, &sl) || (agentInstance==0 && AgentInitialize()==false)) return (0); ADD SP,0FFFAX MOV BX,←CallFailed PUSH BX ;&←sl LEA BX,[BP-8] MOV CX,OFFSET ←CONT CALL ←ENABLE POP DX OR BX,BX JNZ X3 MOV BX,←agentInstance OR BX,BX JNZ X4 CALL ←AgentInitialize OR BX,BX X4: JNZ X2 X3: MOV AL,1 JR X5 X2: XOR AL,AL X5: OR AL,AL JZ X1 XOR BX,BX MOV SP,BP POP BP RET; X1: ; args[0] = nonceId; ; BX ← ←nonceId MOV BX,[BP+6] MOV ←args,BX ; args[1] = caller; ; BX ← ←caller MOV BX,[BP+4] MOV ←args+2,BX ; args[2] = callee; ; BX ← ←callee MOV BX,[BP-2] MOV ←args+4,BX ; authentication = CallFormatted(agentInstance, doAuthenticate, specABN, specAA, args); MOV BX,←agentInstance PUSH BX MOV BX,4 PUSH BX MOV BX,←specABN PUSH BX LEA BX,←args MOV CX,←specAA CALL ←CallFormatted ADD SP,6 ; ←authentication ← BX POP DX PUSH BX ; *lvAuthenticator = args[4]; ; BX ← ←lvAuthenticator MOV BX,[BP-4] MOV CX,←args+8 MOV [BX],CX ; return (authentication); ; BX ← ←authentication POP BX PUSH BX MOV SP,BP POP BP RET; ; }; ; int /* really ShortSTRING */ ; AgentInstanceForInterface(range, type, instance) ←AgentInstanceForInterface: ; int range, type, instance; CALL StkChk PUSH BP MOV BP,SP PUSH CX PUSH BX ; { ; struct Seal sl; ; if (ENABLE(CallFailed, &CONT, &sl) || (agentInstance==0 && AgentInitialize()==false)) return (0); ADD SP,0FFFCX MOV BX,←CallFailed PUSH BX ;&←sl LEA BX,[BP-8] MOV CX,OFFSET ←CONT CALL ←ENABLE POP DX OR BX,BX JNZ X8 MOV BX,←agentInstance OR BX,BX JNZ X9 CALL ←AgentInitialize OR BX,BX X9: JNZ X7 X8: MOV AL,1 JR X10 X7: XOR AL,AL X10: OR AL,AL JZ X6 XOR BX,BX MOV SP,BP POP BP RET; X6: ; args[0] = range ? range: (int) zip; ; BX ← ←range MOV BX,[BP+4] OR BX,BX JZ X11 ; BX ← ←range MOV BX,[BP+4] JR X12 X11: LEA BX,←zip X12: MOV ←args,BX ; args[1] = type; ; BX ← ←type MOV BX,[BP-2] MOV ←args+2,BX ; args[2] = instance; ; BX ← ←instance MOV BX,[BP-4] MOV ←args+4,BX ; return (swab(CallFormatted(agentInstance, doInstanceForInterface, specABN, specW, args))); MOV BX,←agentInstance PUSH BX MOV BX,5 PUSH BX MOV BX,←specABN PUSH BX LEA BX,←args MOV CX,←specW CALL ←CallFormatted ADD SP,6 CALL ←swab MOV SP,BP POP BP RET; ; }; ; int /*BOOL*/ AgentInitialize() ←AgentInitialize: CALL StkChk PUSH BP MOV BP,SP ; { ; struct InterfaceName interface; ; struct Seal sl; ADD SP,0FFF4X ; Zero(&interface, lenInterfaceName); MOV BX,4 ;&←interface LEA CX,[BP-8] CALL ←Zero ; interface.type = CstringToString("Agent.Lark"); MOV BX,"Agent.Lark" CALL ←CstringToString ; ←interface ← BX MOV [BP-8],BX ; interface.instance = 0; MOV WORD PTR [BP-6],0 ; if (ENABLE(ImportFailed, &CONT, &sl)) return false; MOV BX,←ImportFailed PUSH BX ;&←sl LEA BX,[BP-12] MOV CX,OFFSET ←CONT CALL ←ENABLE POP DX OR BX,BX JZ X13 XOR BX,BX MOV SP,BP POP BP RET; X13: ; agentInstance = ImportInterface(&interface); ;&←interface LEA BX,[BP-8] CALL ←ImportInterface MOV ←agentInstance,BX ; specABN = CstringToString("DSS"); MOV BX,"DSS" CALL ←CstringToString MOV ←specABN,BX ; specAA = CstringToString("KK"); MOV BX,"KK" CALL ←CstringToString MOV ←specAA,BX ; specW = CstringToString("W"); MOV BX,"W" CALL ←CstringToString MOV ←specW,BX ; AddType('K', dBlock(16, 1, 0, true, false)); MOV BX,010X PUSH BX MOV BX,1 PUSH BX XOR BX,BX PUSH BX XOR BX,BX MOV CX,0FFFFX CALL ←dBlock ADD SP,6 MOV CX,04BX CALL ←AddType ; Block(); CALL ←Block ; return (true); MOV BX,0FFFFX MOV SP,BP POP BP RET; ; }; ; Externals Declared Here PUBLIC ←AgentAuthenticate PUBLIC ←AgentInitialize PUBLIC ←AgentInstanceForInterface C←CODE ENDS ; Number of Bytes of Code = 0179X, (377)