home *** CD-ROM | disk | FTP | other *** search
-
- ;************************************************************************
- ; Read attributes of character at Row, Column and return it in AX *
- ; Entry: The follwing parameters are passed on the stack as words *
- ; Row, Col *
- ; Exit: AX - Attribute *
- ;************************************************************************
-
- Row EQU [BP+8]
- Column EQU [BP+6]
-
- PUBLIC Read_Attribute
-
- Read_Attribute PROC FAR
- PUSH BP
- MOV BP,SP
- PUSH DI ;Preserve registers
- PUSH ES
-
- ;--- Convert row and column to absolute offset within 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 as
- ADD AX,Column ; Column + Row * Columns)
- SHL AX,1 ; Account for attributes
- MOV DI,AX ;Move address into register DI
- INC DI ;Skip character code byte
-
- ;--- 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 Attr_Read_Ok ;...Yes, go load segment
- MOV AX,0B800H ;...No, change address to color
- Attr_Read_Ok:
- MOV ES,AX ;Set segment of display buffer
-
- ;--- Fetch the attribute and split it into back and fore
-
- MOV AL,ES:[DI] ;Fetch the attribyte
- XOR AH,AH
-
- POP ES ;Restore registers
- POP DI
- MOV SP,BP
- POP BP
- RET 4
- Read_Attribute ENDP
-