Golan Shemi
Golan Shemi

Reputation: 11

Game in assembler program (in graphic mode) screen

I tried to do a game in assembler program (in graphic mode), in which I've got proc of some creature that moves around the screen. The thing is, I want to add a mouse on the screen, and a code that in which every time someone clicks on the right button of the mouse, the creature will disapear. I have a proc of disapearing the creature, I just need to call her. Someone can help me?

Upvotes: 1

Views: 130

Answers (1)

Sep Roland
Sep Roland

Reputation: 39166

  1. First make sure that your proc of disapearing the creature terminates with a RETF instruction.
  2. Then use the Set User-Defined Event Handler function of the int 33h mouse functions:

    mov ax, 000Ch            ;Function number
    mov cx, 0008h            ;Call mask: bit 3=ON means RightButtonPressed
    mov dx, Offset of your procedure
    mov es, Segment of your procedure
    int 33h
    

It would be best if your procedure preserved the flags and all registers it uses.
You can only rely on the CS segment register when you get invoked. The AX, BX, CX, DX, SI, and DI registers all have mouse-related values but they are of no importance for your present purpose.

Upvotes: 1

Related Questions