Hello ,
The code probably doesnt use system calls-i am not sure. But there are some asm units that could take some time if we try to rewrite them in pascal. I am attaching one such code.
Thanks and Regards, Anuradha
PAGE 58,132 TITLE Compare routine PAGE ;ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ ;³ Following EQU has to be set to 0 for NEAR call {$L compress.obj} ³ ;³ 1 for FAR call {INTERFACE in unit} ³ ;ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ ; @_NEAR_FAR EQU 1 ; ;ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ ;³ Return codes for compare ³ ;ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ ; @C_RC_1G2 EQU -1 ; Return code first parameter greater @C_RC_1S2 EQU 1 ; Return code first parameter smaller @C_RC_1E2 EQU 0 ; Return code parameters equal PAGE ;ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ ;³ Do not change following equates ³ ;³ Internals and parameter definitions ³ ;ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ ; ; ; Pascal parameter offsets on stack ; @P_RET_ADD EQU 2*(@_NEAR_FAR+1) ; Size of the return address @P_SOURCE1 EQU [BP+@P_RET_ADD+14] ; Address of structure1 @P_OFFSET1 EQU [BP+@P_RET_ADD+12] ; Offset in structure1 @P_SOURCE2 EQU [BP+@P_RET_ADD+8] ; Address of structure2 @P_OFFSET2 EQU [BP+@P_RET_ADD+6] ; Offset in structure2 @P_LENGTH EQU [BP+@P_RET_ADD+4] ; Length to compare PAGE ;ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ ;³ Compare routine : ³ ;³ Definition in Pascal : ³ ;³ FUNCTION COMPARE( VAR structure 1 ; ³ ;³ offset in structure 1 : INTEGER ; ³ ;³ VAR structure 2 ; ³ ;³ offset in structure 2 : INTEGER ; ³ ;³ length to compare : WORD ) : INTEGER ; ³ ;³ Return codes : ³ ;³ See equates above. ³ ;ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ ; CODE SEGMENT BYTE PUBLIC 'CODE' ASSUME CS:CODE ; COMPARE PROC NEAR ; PUSH DS ; Save Pascal environment and PUSH BP ; get parameter addressablitity MOV BP,SP PAGE ;ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ ;³ Set source and target address for compare. ³ ;³ Initialize compare counter. ³ ;³ Do the compare ³ ;ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ ; COMP_000: LDS SI,@P_SOURCE1 ; DS:SI to structure 1 ADD SI,@P_OFFSET1 LES DI,@P_SOURCE2 ; ES:DI to structure 2 ADD DI,@P_OFFSET2 MOV CX,@P_LENGTH ; Compare counter JCXZ COMP_001 ; If nothing to compare then equal CLD REPE CMPSB ; Do the compare JE COMP_001 JB COMP_002 MOV AX,@C_RC_1G2 ; Return 1 greater than 2 JMP SHORT COMP_EX COMP_001: MOV AX,@C_RC_1E2 ; Return 1 equal 2 JMP SHORT COMP_EX COMP_002: MOV AX,@C_RC_1S2 ; Return 1 smaller than 2 PAGE ;ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ ;³ Return point : restore Pascal environment and remove parameters. ³ ;ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ ; COMP_EX: MOV SP,BP ; Delete local scratch path POP BP ; Restore Pascal environment POP DS IF @_NEAR_FAR RETF 14 ; Kill parameters and return ELSE RETN 14 ; Kill parameters and return ENDIF ; COMPARE ENDP ; CODE ENDS ; PUBLIC COMPARE ; END