CODE SEGMENT BYT E PUBLIC ASSUME CS:CODE,DS:DATA PUBLIC FWrite, CAttr ; FWRITE = procedure (Fptr:pointer,FWAttr:byte;FWSt:string) ; Writes string to screen memory, using FWAttr, or no attr if FWAttr = 0 ; Turbo passed parameters FWSt EQU DWORD PTR [BP+6] FWAttr EQU BYTE PTR [BP+10] Fptr EQU DWORD PTR [BP+14] FWrite PROC FAR PUSH BP ;Save BP MOV BP,SP ;Set up stack frame PUSH DS ;Save DS LES DI,Fptr ;ES:DI points to first attribute LDS SI,FWSt ;DS:SI points to St[0] CLD ;Set direction to forward LODSB ;AX = Length(St); DS:SI -> St[1] XCHG AX,CX ;CX = Length; AL = WaitForRetrace JCXZ FWExit ;exit if string empty MOV AH,FWAttr ;AH = display attribute CMP AH,0 JZ Attr Noattr: MOVSB ;Move character to screen INC DI ;Skip attribute bytes LOOP Noattr ;Get next character JMP FWExit Attr: LODSB ;Load next character into AL STOSW ;Move video word into place LOOP Attr ;Get next character FWExit: POP DS ;clean up and go home MOV SP,BP ; POP BP ; RET 10 ; FWrite ENDP ; CAttr = procedure cattr(Cptr:pointer,cttr:byte;cols:word) Cols EQU WORD PTR [BP+6] Cttr EQU BYTE PTR [BP+8] Cptr EQU DWORD PTR [BP+12] CAttr PROC FAR PUSH BP ;Save BP MOV BP,SP ;Set up stack frame LES DI,Cptr INC DI ;Skip character CLD ;Set direction to forward MOV CX,Cols ;CX = Number to change JCXZ AExit ;If zero, exit MOV AL,Cttr ;AL = Attribute ANoWait: STOSB ;Change the attribute INC DI ;Skip characters LOOP ANoWait ;Get next character AExit: ; MOV SP,BP ;Clean up and go home POP BP ; RET 8 ; CAttr ENDP CODE ENDS END