INT 33h AX=0004h moves the pointer to a position the program chooses: to the default button of a dialog, back to the centre after a mode change, or under a menu item. The coordinates are in the same virtual-screen pixels INT 33h AX=0003h reports. If the pointer is visible, the driver redraws it at the new place.
The driver does not take the numbers blindly. A position outside the range (set by INT 33h AX=0007h and 0008h, the whole screen by default) is moved to the nearest edge, and in text mode the reported position is rounded down to the cell. The example sets two positions and reads each back:
XOR AX, AX ; reset: the range is the whole 640x200INT 33hMOV AX, 0004h ; move to 100, 50MOV CX, 100MOV DX, 50INT 33hCALL SHOWP1 ; 96 48: the cell at column 12, row 6MOV AX, 0004h ; far off the screenMOV CX, 5000MOV DX, 5000INT 33hCALL SHOWP1 ; 632 192: held at the last cellSHOWP1 PROC NEAR ; print the mouse position: x yMOV AX, 0003hINT 33h ; CX = x, DX = yMOV BX, DX ; keep y: printing uses DLMOV AX, CXCALL PDECMOV DL, " "MOV AH, 02hINT 21hMOV AX, BXCALL PDECMOV DL, " "MOV AH, 02hINT 21hRETSHOWP1 ENDPPDEC PROC NEAR ; print AX in decimal; keeps every registerPUSH AXPUSH BXPUSH CXPUSH DXMOV BX, 10XOR CX, CX ; digits on the stackDECD1:XOR DX, DXDIV BX ; AX = AX / 10, DX = the last digitPUSH DXINC CXTEST AX, AXJNZ DECD1DECD2:POP DX ; the digits come back first to lastADD DL, "0"MOV AH, 02hINT 21hLOOP DECD2POP DXPOP CXPOP BXPOP AXRETPDEC ENDP
Pitfalls
Moving the pointer does not generate a movement event for the handler installed with INT 33h AX=000Ch, and does not change the mickey counters: it is a jump, not a motion. Coordinates are signed words, so a negative value clips to the left or top edge. Set the range first and the position after, or the position may be clipped by the old range. In DOSBox-X with the host pointer integrated, moving the real mouse over the window right after this call moves the DOS pointer straight back.