83Plus:BCALLs:4D65

From WikiTI
Jump to: navigation, search

Synopsis

Official Name: AppUpdateMouse

BCALL Address: 4D65

Update the mouse cursor on the screen based on previous key press, and wait for another key press.

Inputs

  • Memory as set up by AppStartMouse

Outputs

  • A: 0Ah if arrow key pressed, 0Ch if enter key pressed
  • 986D: Current mouse cursor coordinates
  • Mouse cursor updated on screen based on keypress during previous AppUpdateMouse or AppStartMouse

Destroys

  • BC, DE, HL

Comments

You must call AppStartMouse to initialize memory before calling AppUpdateMouse. AppUpdateMouse will wait for a keypress, but will only return when an arrow key, or the enter key, is pressed. If an arrow key is pressed, the mouse cursor coordinates will be automatically updated. The below example allows a user to move the mouse cursor around the screen, and returns once the enter key is pressed.

Example

 B_CALL AppStartMouse
MouseLoop:
 cp 0Ch
 jr z,MouseDone
 B_CALL AppUpdateMouse
 jr MouseLoop
MouseDone:
 B_CALL AppEraseMouse
 ret