Search code examples
assemblyx86-16tasm

Mouse color in graphic mode


I'm working on my finale project in school and in my program the mouse is red (Graphic mode). Is there a way to change it to regular? I heard it was easy but I couldn't find it.

thanks!


Solution

  • This is my code to change the cursor shape :

    ;FROM http://lateblt.tripod.com/asm.htm
    .stack 100h
    .data
    
    my_cursor DB 11111111B, 11111001B
              DB 11111111B, 11110000B
              DB 11111111B, 11110000B
              DB 11111111B, 11110000B
              DB 11111111B, 11110000B
              DB 11111111B, 11110000B
              DB 00000111B, 11000000B
              DB 00000011B, 10000000B
              DB 00000011B, 10000000B
              DB 00000111B, 11000000B
              DB 00000111B, 11000000B
              DB 00001111B, 11100000B
              DB 00011111B, 11110000B
              DB 00011111B, 11111000B
              DB 00011111B, 11111000B
              DB 00011111B, 11111000B
    
              DB 00000000B, 00000110B
              DB 00000000B, 00001111B
              DB 00000000B, 00001111B
              DB 00000000B, 00001111B
              DB 00000000B, 00001111B
              DB 00000000B, 00001111B
              DB 11111000B, 00111111B
              DB 11111100B, 01111111B
              DB 11111100B, 01111111B
              DB 11111000B, 00111111B
              DB 11111000B, 00111111B
              DB 11110000B, 00011111B
              DB 11100000B, 00001111B
              DB 11100000B, 00000111B
              DB 11100000B, 00000111B
              DB 11100000B, 00000111B          
    
    .code
    
    mov ax, @data       ;INITIALIZE DATA SEGMENT.
    mov ds, ax
    mov es, ax          ;NECESSARY TO CHANGE CURSOR COLOR.
    
    mov ah, 0
    mov al, 13h         ;MODE 320x200.
    int 10h             ;START GRAPHICS MODE.
    
    mov ax, 1           ;TURN MOUSE
    int 33h             ;CURSOR ON.
    
    mov ax, 09h
    mov bx, 0ah 
    mov cx, 0
    mov dx, offset my_cursor ;SHAPE OF A HAND.
    int 33h            ;SET MOUSE CURSOR LOOK.
    
    repeat:            ;REPEAT UNTIL USER PRESS ANY KEY.
    mov ah, 0bh
    int 21h
    cmp al, 0
    je  repeat
    
    mov ax, 4c00h       ;TERMINATE PROGRAM.
    int 21h
    

    Tested on Windows XP and TASM :

    tasm /zi filename
    tlink /v filename
    filename
    

    It runs great, the cursor has the shape of a hand.