Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.sys.apple2.programmer > #4175

Re: Mouse Notes - From AppleX\SAMPLES\AMOUSE - for Anthony

From "Bill Buckels" <bbuckels@mts.net>
Newsgroups comp.sys.apple2.programmer
Subject Re: Mouse Notes - From AppleX\SAMPLES\AMOUSE - for Anthony
Date 2018-02-02 11:37 -0600
Organization Aioe.org NNTP Server
Message-ID <p527k3$a6$1@gioia.aioe.org> (permalink)
References <p525ss$1t3d$1@gioia.aioe.org>

Show all headers | View raw


"Bill Buckels" <bbuckels@mts.net> wrote:
>uses relocatable mouse calls

The following is from the AppleX\PROJECTS\METOO project (ME2.C) which 
combines the mouse and the keyboard... this is essentially the same as my 
initial post but probably a little easier to read if you don't want to read 
much... just download the AppleX distribution for working versions of all of 
this...

--- snip ---

/* 6502 assembly language mouse core functions */
#asm

*
* use the second line of the second page of the text screen
* as a dynamic dispatch vector set pointing to the mouse routines
*

SETMOUSE   EQU $880
SERVEMOUSE EQU SETMOUSE+3
READMOUSE  EQU SETMOUSE+6
CLEARMOUSE EQU SETMOUSE+9
POSMOUSE   EQU SETMOUSE+12
CLAMPMOUSE EQU SETMOUSE+15
HOMEMOUSE  EQU SETMOUSE+18
INITMOUSE  EQU SETMOUSE+21

          public setmouseon_
setmouseon_
          lda  #$01
          ldx  #$C4
          ldy  #$40
          cli
          jsr  SETMOUSE
          rts


          public homemouse_

homemouse_
          ldx  #$C4
          ldy  #$40
          jsr  HOMEMOUSE
          rts

          public readmouse_
readmouse_
          ldx  #$C4
          ldy  #$40
          php
          sei
          jsr  READMOUSE
          cli
          plp
          rts


          public mouseoff_
mouseoff_

          lda  #$00
          ldx  #$C4
          ldy  #$40
          cli
          jsr  SETMOUSE
          rts

#endasm

/* as above noted:
 * use text screen page two line two as an intermediate jump area
 * for access to the 8-mouse firmware subroutines.
 * we use a jsr to get there from our code.
 * our jmp vector instruction is placed there based on the rom
 * configuration of the current platform.
 * because we jsr'd from our code, we will return safely to our
 * code. this is why we use a jmp to loop from our vector
 * to the firmware.
 */

mouseinit()
{
    unsigned char *vptr,*tptr;
    unsigned char temp,i;

    vptr=(unsigned char *)0xc40b; /* firmware card signature */
    temp=vptr[0];
    if(temp!=1)return;       /* this must be set to 1   */
    temp=vptr[1];            /* X Y pointing device signature */
    if(temp!=32)return;      /* this must be set to $20 */

    vptr=(unsigned char *)0xc411; /* start of mouse vectors */
    mouseflag=vptr[0];            /* this must be set to 0  */
    if(mouseflag)return;

    tptr=(unsigned char *)0x880;  /* base address - page 2 line 2 */

    for(i=0;i<8;i++)
    {
      *vptr++;
      temp=*vptr;
      *tptr= '\x4c';   /* raw jmp instruction     */
      *tptr++;
      *tptr= temp  ;   /* mouse subroutine offset */
      *tptr++;
      *tptr= '\xc4';   /* base of mouse routines  */
      *tptr++;
    }

}

--- snip ---




Back to comp.sys.apple2.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Mouse Notes - From AppleX\SAMPLES\AMOUSE - for Anthony "Bill Buckels" <bbuckels@mts.net> - 2018-02-02 11:07 -0600
  Re: Mouse Notes - From AppleX\SAMPLES\AMOUSE - for Anthony "Bill Buckels" <bbuckels@mts.net> - 2018-02-02 11:37 -0600
    Re: Mouse Notes - From AppleX\SAMPLES\AMOUSE - for Anthony "Bill Buckels" <bbuckels@mts.net> - 2018-02-02 12:18 -0600
      Re: Mouse Notes - From AppleX\SAMPLES\AMOUSE - for Anthony gids.rs@sasktel.net - 2018-02-02 12:07 -0800
        Re: Mouse Notes - From AppleX\SAMPLES\AMOUSE - for Anthony "Bill Buckels" <bbuckels@mts.net> - 2018-02-03 04:46 -0600

csiph-web