home *** CD-ROM | disk | FTP | other *** search
-
- ;************************************************************************
- ; Display text at specified row and column *
- ; Entry: Row - Starting row of the text *
- ; Column-Starting column of the text *
- ; String-Pointer to Turbo Pascal string (with byte count) *
- ;************************************************************************
-
- Row EQU [BP+12]
- Column EQU [BP+10]
- string_seg EQU [BP+8]
- string_offset EQU [BP+6]
-
- PUBLIC Write_String
-
- Write_String PROC FAR
- PUSH BP
- MOV BP,SP
- PUSH DS
- PUSH DI ;Preserve registers
- PUSH SI
- PUSH ES
-
- ;--- Fetch number of rows and columns on the screen and
- ; compute absolute address in display buffer
-
- XOR AX,AX ;Point ES to segment zero
- MOV ES,AX
- MOV AX,Row ;Fetch row number
- MOV BX,ES:[BIOS_Columns] ;Fetch columns per screen
- MUL BX ;Compute absolute address
- ADD AX,Column ;in the display buffer as
- SHL AX,1 ;((Row*Col_per_row)+Column)*2
- MOV DI,AX ;Move address into register DI
-
- ;--- Determine and load segement of the display buffer
-
- MOV AX,0B000H ;Assume monochrome buffer address
- TEST BYTE PTR ES:[BIOS_Equipment],2 ;Is mono attached?
- JNZ Str_Address_Ok ;...Yes, go load segment
- MOV AX,0B800H ;...No, change address to color
- Str_Address_Ok:
- MOV ES,AX ;Set segment of display buffer
-
- ;--- Fetch address of the text
-
- mov DS,string_seg
- MOV SI,string_offset ;Get pointer to the string
- lodsb
- sub ah,ah
- mov cx,ax ;get byte count
- charloop:
- lodsb ;get char
- stosb ;save char
- inc di ;skip over attribute byte
- loop charloop
-
- String_Done:
- POP ES ;Restore registers
- POP DI
- POP SI
- POP DS
- POP BP
- RET 8
- Write_String ENDP