70f TITLE Dir_Wr.ASM ; External Procedure ;Uses DOS's cursor coordinates when writing out the string ;================================================================== CSEG SEGMENT PUBLIC ASSUME CS:CSEG,DS:CSEG PUBLIC DIR_WR2 EXTRN attr:BYTE oldcol db 0 oldrow db 0 dir_wr2 PROC NEAR push ax ;Save registers push cx push dx push es push di push bp mov ax,0b800h mov es,ax mov bp,0 mov ah,03h ;Fetch old cursor position mov bh,0 int 10h mov oldcol,dl mov oldrow,dh sub ax,ax mov al,dh mov dh,160 ;Each row has 160 bytes... mul dh shl dl,1 add al,dl ;Take attribute bytes in account mov di,ax mov dl,attr sub cx,cx Next: movsb ;First the character... mov es:byte ptr[bp+di],dl ;then the attribute byte inc di inc cl cmp byte ptr[si],0 ;Byte = 0 ? (End of string) jne Next ;No, process next character mov dl,oldcol ;Put cursor at new position add dl,cl mov dh,oldrow mov bh,0 mov ah,02h int 10h inc si ;For next string if any pop bp ;Restore registers pop di pop es pop dx pop cx pop ax ret Dir_Wr2 ENDP CSEG ENDS END ;-------------------------------------------------------------------------- . 0