home *** CD-ROM | disk | FTP | other *** search
/ QBasic & Borland Pascal & C / Delphi5.iso / C / Samples / C-ASM_VI.ARJ / PROGASM.ZIP / PROG005.ASM < prev    next >
Encoding:
Assembly Source File  |  1988-04-10  |  1.4 KB  |  30 lines

  1.  
  2. ;************************************************************************
  3. ; Example of register read                                              *
  4. ; Read content of CRTC register 0E and 0F, the cursor address           *
  5. ; Exit: AX - Address of the cursor in display buffer                    *
  6. ;************************************************************************
  7.  
  8.         PUBLIC  _Get_Cursor_Address
  9. _Get_Cursor_Address      PROC NEAR
  10.         PUSH    ES
  11.         XOR     AX,AX                   ;Set ES to point to BIOS data area
  12.         MOV     ES,AX
  13.         MOV     DX,ES:[BIOS_CRT_Addr]   ;Fetch CRTC address
  14.         MOV     AL,0EH                  ;Fetch index
  15.         OUT     DX,AL                   ;Select index
  16.         INC     DX                      ;Increment register address
  17.         IN      AL,DX                   ;Read the register value
  18.         JMP     $+2
  19.         MOV     BH,AL                   ;Save high half of the address
  20.         DEC     DX                      ;Fetch CRTC address
  21.         MOV     AL,0FH                  ;Fetch index
  22.         OUT     DX,AL                   ;Select index
  23.         INC     DX                      ;Increment register address
  24.         IN      AL,DX                   ;Read the register value
  25.         JMP     $+2
  26.         MOV     AH,BH                   ;Copy high half of the address
  27.         POP     ES
  28.         RET                             ;Return address in AX
  29. _Get_Cursor_Address     ENDP
  30.