qa.hlp (Table of Contents; Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
GetVidOffset
   Example  Back  Contents  Index
──────────────────────────────────────────────────────────────────────────────
 
;* GetVidOffset - Macro to determine offset in video segment that corresponds
;* to given screen coordinates.
;*
;* Params:  row - Screen row (top line = 0)
;*          col - Screen column (leftmost column = 0)
 
GetVidOffset MACRO row, col             ;; Macro definition
    mov ax, row
    mov bl, 80                          ;; Number of columns per row *
    mul bl                              ;;   current row + current column =
    add ax, col                         ;;   character byte #
    shl ax, 1                           ;; Double to account for cell size
ENDM                                    ;; Result in AX register
                                    -♦-