Would the C code in comments give the same functionality.
Given 20 bit address in ES:DI, calculate index into array of cursor positions in BDA and write row/col derived from offset in DI.
Abs2Vect: push ds push bx ; Preserve non-volatile push BDA ; Simplifies write into BDA pop ds ; word *Cursor = VideoSeg / 128 - 32 mov es, ax ; Get video segment B?00 where ? = (8-F) mov bh, al ; Make sure MSB is NULL shl ax, 1 mov bl, ah ; BX = VideoSeg / 128 xor bl, 32 ; High nibble will always be 7 is why this works ; word Coords = int (Addr/2) / 80 * 256 + (Addr/2) % 80 mov ax, di ; Get offset into video page ES shr ax, 1 ; Addr /= 2 mov cx, 80 ; Assume 80 columns / row. xor dx, dx div cx ; AL = int (Addr / 80), DL = Addr % 80 mov dh, al ; DX = Row/Col ; *Cursor = Coords mov [bx], dx ; Update new cursor positon in BDA pop bx pop ds ; Restore non-volatile. ret
I tried to find an online compiler that would give disassembly, but didn’t have much luck.