;/*------------------------------------------------------------*/ ;/* filename - ttprvlns.asm */ ;/* */ ;/* function(s) */ ;/* TTerminal prevLines member function */ ;/*------------------------------------------------------------*/ ; ; Turbo Vision - Version 2.0 ; ; Copyright (c) 1994 by Borland International ; All Rights Reserved. ; PUBLIC @TTerminal@prevLines$quii INCLUDE TV.INC CODESEG DecDI PROC ifndef __FLAT__ CMP DI,WORD PTR [SI+TTerminalBuffer] JA short @@1 ADD DI,WORD PTR [SI+TTerminalBufSize] @@1: DEC DI else CMP EDI,[ESI+TTerminalBuffer] JA short @@1 ADD EDI,[ESI+TTerminalBufSize] @@1: DEC EDI endif RET ENDP IncDI PROC ifndef __FLAT__ INC DI MOV AX,WORD PTR [SI+TTerminalBuffer] ADD AX,[SI+TTerminalBufSize] CMP DI,AX JB short @@1 MOV DI,WORD PTR [SI+TTerminalBuffer] @@1: RET else INC EDI MOV EAX,[ESI+TTerminalBuffer] ADD EAX,[ESI+TTerminalBufSize] CMP EDI,EAX JB short @@1 MOV EDI,[ESI+TTerminalBuffer] @@1: RET endif ENDP @TTerminal@prevLines$quii PROC ARG thisPtr :PTR, Pos : WORD, Lines : WORD LineSeparator EQU 10 ifndef __FLAT__ USES DS,SI,DI LDS SI,[thisPtr] LES DI,[SI+TTerminalBuffer] ADD DI,[Pos] @@1: MOV CX,[Lines] JCXZ @@6 MOV AX,[SI+TTerminalQueBack] ADD AX,WORD PTR [SI+TTerminalBuffer] CMP DI,AX JE @@7 CALL DecDI @@2: MOV AX,[SI+TTerminalQueBack] ADD AX,WORD PTR [SI+TTerminalBuffer] CMP DI,AX JA @@3 MOV CX,DI SUB CX,WORD PTR [SI+TTerminalBuffer] JMP @@4 @@3: MOV CX,DI SUB CX,AX @@4: MOV AL,LineSeparator INC CX STD REPNE SCASB JE @@5 MOV AX,DI SUB AX,WORD PTR [SI+TTerminalBuffer] INC AX CMP AX,[SI+TTerminalQueBack] JE @@8 MOV DI,WORD PTR [SI+TTerminalBuffer] ADD DI,WORD PTR [SI+TTerminalBufSize] DEC DI JMP @@2 @@5: DEC [Lines] JNZ @@2 @@6: CALL IncDI CALL IncDI MOV AX,DI @@7: SUB AX,WORD PTR [SI+TTerminalBuffer] @@8: CLD RET else USES ESI,EDI MOV ESI, DWORD PTR [thisPtr] MOV EDI,[ESI+TTerminalBuffer] MOVZX EAX,[Pos] ADD EDI,EAX @@1: MOVZX ECX,[Lines] JECXZ short @@6 MOV EAX,[ESI+TTerminalQueBack] ADD EAX,[ESI+TTerminalBuffer] CMP EDI,EAX JE short @@7 CALL DecDI @@2: MOV EAX,[ESI+TTerminalQueBack] ADD EAX,[ESI+TTerminalBuffer] CMP EDI,EAX JA short @@3 MOV ECX,EDI SUB ECX,[ESI+TTerminalBuffer] JMP short @@4 @@3: MOV ECX,EDI SUB ECX,EAX @@4: MOV AL,LineSeparator INC ECX STD REPNE SCASB JE short @@5 MOV EAX,EDI SUB EAX,[ESI+TTerminalBuffer] INC EAX CMP EAX,[ESI+TTerminalQueBack] JE @@8 MOV EDI,[ESI+TTerminalBuffer] ADD EDI,[ESI+TTerminalBufSize] DEC EDI JMP @@2 @@5: DEC [Lines] JNZ @@2 @@6: CALL IncDI CALL IncDI MOV EAX,EDI @@7: SUB EAX,[ESI+TTerminalBuffer] @@8: CLD RET endif ENDP END